| 1 |
{%MainUnit castledownload.pas} |
| 2 |
{ |
| 3 |
Copyright 2013-2020 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{$ifdef read_interface} |
| 18 |
|
| 19 |
{$endif} |
| 20 |
|
| 21 |
{$ifdef read_implementation} |
| 22 |
|
| 23 |
{ Handle ecmascript / javascript protocols, to specify inline JS code. } |
| 24 |
|
| 25 |
{ TUrlEcmaScript ------------------------------------------------------------------- } |
| 26 |
|
| 27 |
type |
| 28 |
TUrlEcmaScript = class |
| 29 |
class function Read(const Url: String; out MimeType: string): TStream; |
| 30 |
class function MimeType(const URI: string; out Gzipped: Boolean): String; |
| 31 |
end; |
| 32 |
|
| 33 |
class function TUrlEcmaScript.Read(const Url: String; out MimeType: string): TStream; |
| 34 |
begin |
| 35 |
MimeType := 'application/javascript'; |
| 36 |
Result := MemoryStreamLoadFromString(InternalURIDeleteProtocol(URL)); |
| 37 |
end; |
| 38 |
|
| 39 |
class function TUrlEcmaScript.MimeType(const URI: string; out Gzipped: Boolean): String; |
| 40 |
begin |
| 41 |
Result := 'application/javascript'; |
| 42 |
Gzipped := false; |
| 43 |
end; |
| 44 |
|
| 45 |
{$endif} |