You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// License: http://unlicense.org/ (i.e. do what you want with it!)
1
+
;(function($){
2
+
3
+
vartag2attr={
4
+
a : 'href',
5
+
img : 'src',
6
+
form : 'action',
7
+
base : 'href',
8
+
script : 'src',
9
+
iframe : 'src',
10
+
link : 'href'
11
+
},
12
+
13
+
key=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],// keys available to query
4
14
5
-
jQuery.url=function()
6
-
{
7
-
varsegments={};
15
+
parser={
16
+
strict : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,//less intuitive, more accurate to the specs
17
+
loose : /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/// more intuitive, fails on relative paths and deviates from specs
18
+
},
8
19
9
-
varparsed={};
10
-
11
-
/**
12
-
* Options object. Only the URI and strictMode values can be changed via the setters below.
13
-
*/
14
-
varoptions={
15
-
16
-
url : window.location,// default URI is the page in which the script is running
17
-
18
-
strictMode: false,// 'loose' parsing by default
19
-
20
-
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],// keys available to query
21
-
22
-
q: {
23
-
name: "queryKey",
24
-
parser: /(?:^|&|;)([^&=;]*)=?([^&;]*)/g
25
-
},
26
-
27
-
parser: {
28
-
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,//less intuitive, more accurate to the specs
29
-
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/// more intuitive, fails on relative paths and deviates from specs
30
-
}
20
+
qs_parser=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g;// supports both ampersand and semicolon-delimted query string key/value pairs
31
21
32
-
};
33
-
34
-
/**
35
-
* Deals with the parsing of the URI according to the regex above.
36
-
* Written by Steven Levithan - see credits at top.
0 commit comments