1/** -------------------------------------------------------------------------- 2 * jQuery URL Decoder 3 * Version 1.0 4 * Parses URL and return its components. Can also build URL from components 5 * 6 * --------------------------------------------------------------------------- 7 * HOW TO USE: 8 * 9 * $.url.decode('http://username:password@hostname/path?arg1=value%40+1&arg2=touch%C3%A9#anchor') 10 * // returns 11 * // http://username:password@hostname/path?arg1=value@ 1&arg2=touché#anchor 12 * // Note: "%40" is replaced with "@", "+" is replaced with " " and "%C3%A9" is replaced with "é" 13 * 14 * $.url.encode('file.htm?arg1=value1 @#456&arg2=value2 touché') 15 * // returns 16 * // file.htm%3Farg1%3Dvalue1%20%40%23456%26arg2%3Dvalue2%20touch%C3%A9 17 * // Note: "@" is replaced with "%40" and "é" is replaced with "%C3%A9" 18 * 19 * $.url.parse('http://username:password@hostname/path?arg1=value%40+1&arg2=touch%C3%A9#anchor') 20 * // returns 21 * { 22 * source: 'http://username:password@hostname/path?arg1=value%40+1&arg2=touch%C3%A9#anchor', 23 * protocol: 'http', 24 * authority: 'username:password@hostname', 25 * userInfo: 'username:password', 26 * user: 'username', 27 * password: 'password', 28 * host: 'hostname', 29 * port: '', 30 * path: '/path', 31 * directory: '/path', 32 * file: '', 33 * relative: '/path?arg1=value%40+1&arg2=touch%C3%A9#anchor', 34 * query: 'arg1=value%40+1&arg2=touch%C3%A9', 35 * anchor: 'anchor', 36 * params: { 37 * 'arg1': 'value@ 1', 38 * 'arg2': 'touché' 39 * } 40 * } 41 * 42 * $.url.build({ 43 * protocol: 'http', 44 * username: 'username', 45 * password: 'password', 46 * host: 'hostname', 47 * path: '/path', 48 * query: 'arg1=value%40+1&arg2=touch%C3%A9', 49 * // or 50 * //params: { 51 * // 'arg1': 'value@ 1', 52 * // 'arg2': 'touché' 53 * //} 54 * anchor: 'anchor', 55 * }) 56 * // returns 57 * // http://username:password@hostname/path?arg1=value%40+1&arg2=touch%C3%A9#anchor 58 * 59 * --------------------------------------------------------------------------- 60 * OTHER PARTIES' CODE: 61 * 62 * Parser based on the Regex-based URI parser by Steven Levithan. 63 * For more information visit http://blog.stevenlevithan.com/archives/parseuri 64 * 65 * Deparam taken from jQuery BBQ by Ben Alman. Dual licensed under the MIT and GPL licenses (http://benalman.com/about/license/) 66 * http://benalman.com/projects/jquery-bbq-plugin/ 67 * 68 * --------------------------------------------------------------------------- 69 70*/ 71jQuery.url = function() { function l(a) { for(var b = "", c = 0, f = 0, d = 0;c < a.length;) { f = a.charCodeAt(c); if(f < 128) { b += String.fromCharCode(f); c++ }else if(f > 191 && f < 224) { d = a.charCodeAt(c + 1); b += String.fromCharCode((f & 31) << 6 | d & 63); c += 2 }else { d = a.charCodeAt(c + 1); c3 = a.charCodeAt(c + 2); b += String.fromCharCode((f & 15) << 12 | (d & 63) << 6 | c3 & 63); c += 3 } }return b } function m(a, b) { var c = {}, f = {"true":true, "false":false, "null":null}; $.each(a.replace(/\+/g, " ").split("&"), function(d, j) { var e = j.split("="); d = k(e[0]); j = c; var i = 0, g = d.split("]["), h = g.length - 1; if(/\[/.test(g[0]) && /\]$/.test(g[h])) { g[h] = g[h].replace(/\]$/, ""); g = g.shift().split("[").concat(g); h = g.length - 1 }else h = 0; if(e.length === 2) { e = k(e[1]); if(b)e = e && !isNaN(e) ? +e : e === "undefined" ? undefined : f[e] !== undefined ? f[e] : e; if(h)for(;i <= h;i++) { d = g[i] === "" ? j.length : g[i]; j = j[d] = i < h ? j[d] || (g[i + 1] && isNaN(g[i + 1]) ? {} : []) : e }else if($.isArray(c[d]))c[d].push(e); else c[d] = c[d] !== undefined ? [c[d], e] : e }else if(d)c[d] = b ? undefined : "" }); return c } function n(a) { a = a || window.location; var b = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"]; a = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(a); for(var c = {}, f = b.length;f--;)c[b[f]] = a[f] || ""; if(c.query)c.params = m(c.query, true); return c } function o(a) { if(a.source)return encodeURI(a.source); var b = []; if(a.protocol)if(a.protocol == "file")b.push("file:///"); else a.protocol == "mailto" ? b.push("mailto:") : b.push(a.protocol + "://"); if(a.authority)b.push(a.authority); else { if(a.userInfo)b.push(a.userInfo + "@"); else if(a.user) { b.push(a.user); a.password && b.push(":" + a.password); b.push("@") }if(a.host) { b.push(a.host); a.port && b.push(":" + a.port) } }if(a.path)b.push(a.path); else { a.directory && b.push(a.directory); a.file && b.push(a.file) }
71if(a.query)b.push("?" + a.query); else a.params && b.push("?" + $.param(a.params)); a.anchor && b.push("#" + a.anchor); return b.join("") } function p(a) { return encodeURIComponent(a) } function k(a) { a = a || window.location.toString(); return l(unescape(a.replace(/\+/g, " "))) } return{encode:p, decode:k, parse:n, build:o} }();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.