added Url as fallback

This commit is contained in:
Leon van Kammen 2023-03-09 22:32:28 +01:00
parent 2800c21121
commit 5b296c5d22
8 changed files with 110 additions and 24423 deletions

View File

@ -1,13 +1,14 @@
-dce no
-dce full
-cp src
xrfragment.Url
xrfragment.Query
-D shallow-expose
-js dist/xrfragment.js
--next
-dce no
-dce full
-cp src
Test
@ -17,7 +18,7 @@ Test
--next
-dce no
-dce full
-cp src
xrfragment.Query
@ -25,7 +26,7 @@ xrfragment.Query
--next
-dce no
-dce full
-cp src
xrfragment.Query
@ -33,7 +34,7 @@ xrfragment.Query
--next
-dce no
-dce full
-cp src
Test
@ -42,7 +43,7 @@ Test
#--next
#
#-dce no
#-dce full
#-cp src
#
#xrfragment.Query
@ -50,7 +51,7 @@ Test
#
#--next
#
#-dce no
#-dce full
#-cp src
#
#xrfragment.Query
@ -58,7 +59,7 @@ Test
#
#--next
#
#-dce no
#-dce full
#-cp src
#
#xrfragment.Query
@ -66,7 +67,7 @@ Test
#
#--next
#
#-dce no
#-dce full
#-cp src
#
#xrfragment.Query
@ -75,7 +76,7 @@ Test
#
#--next
#
#-dce no
#-dce full
#-cp src
#
#xrfragment.Query

1952
dist/xrfragment.js vendored

File diff suppressed because it is too large Load Diff

8391
dist/xrfragment.lua vendored

File diff suppressed because it is too large Load Diff

6072
dist/xrfragment.py vendored

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ package xrfragment;
@:expose // <- makes the class reachable from plain JavaScript
@:keep // <- avoids accidental removal by dead code elimination
//return untyped __js__("window.location.search");
#if js
var ok:Bool = js.Syntax.code('
@ -53,6 +54,7 @@ class Query {
return this.q;
}
@:keep
public function qualify( nodename:String ): Bool {
if( this.q.copy_all ) this.accept = true;
if( this.include.contains(nodename) ) this.accept = true;
@ -141,6 +143,7 @@ class Query {
return this.q;
}
@:keep
public function test( property:String, ?value:Dynamic ):Void{
if( this.preset == property ){
this.parse( value, true );

26
src/xrfragment/Url.hx Normal file
View File

@ -0,0 +1,26 @@
package xrfragment;
class Url {
private static var map:Map<String, String>;
private static function parseQueryMap(qs:String):Map<String, String> {
var splitArray:Array<String> = qs.split('&');
var regexPlus = ~/\+/g; // Regex for replacing addition symbol with a space
var resultMap = new Map<String,String>();
for (i in 0...splitArray.length) {
var splitByEqual = splitArray[i].split('=');
var key:String = splitByEqual[0];
if (splitByEqual.length == 1) {
// ..&a=&b.. (right side blank)
resultMap.set(key, "");
} else {
var value:String = StringTools.urlDecode(regexPlus.split(splitByEqual[1]).join(" "));
resultMap.set(key, value);
}
}
return resultMap;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff