﻿new function (a) { var b = a.separator || "&"; var c = a.spaces === false ? false : true; var d = a.suffix === false ? "" : "[]"; var e = a.prefix === false ? false : true; var f = e ? a.hash === true ? "#" : "?" : ""; var g = a.numbers === false ? false : true; jQuery.query = new function () { var a = function (a, b) { for (i in b) { if (i.toLowerCase() == a.toLowerCase()) { return i } } return a }; var d = function (a, b) { return a != undefined && a !== null && (!!b ? a.constructor == b : true) }; var e = function (a) { var b, c = /\[([^[]*)\]/g, d = /^([^[]+)(\[.*\])?$/.exec(a), e = d[1], f = []; while (b = c.exec(d[2])) f.push(b[1]); return [e, f] }; var h = function (a, b, c) { var e, f = b.shift(); if (typeof a != "object") a = null; if (f === "") { if (!a) a = []; if (d(a, Array)) { a.push(b.length == 0 ? c : h(null, b.slice(0), c)) } else if (d(a, Object)) { var g = 0; while (a[g++] != null); a[--g] = b.length == 0 ? c : h(a[g], b.slice(0), c) } else { a = []; a.push(b.length == 0 ? c : h(null, b.slice(0), c)) } } else if (f && f.match(/^\s*[0-9]+\s*$/)) { var i = parseInt(f, 10); if (!a) a = []; a[i] = b.length == 0 ? c : h(a[i], b.slice(0), c) } else if (f) { var i = f.replace(/^\s*|\s*$/g, ""); if (!a) a = {}; if (d(a, Array)) { var j = {}; for (var g = 0; g < a.length; ++g) { j[g] = a[g] } a = j } a[i] = b.length == 0 ? c : h(a[i], b.slice(0), c) } else { return c } return a }; var j = function (a) { var b = this; b.keys = {}; if (a.queryObject) { jQuery.each(a.get(), function (a, c) { b.SET(a, c) }) } else { jQuery.each(arguments, function () { var a = "" + this; a = a.replace(/^[?#]/, ""); a = a.replace(/[;&]$/, ""); if (c) a = a.replace(/[+]/g, " "); jQuery.each(a.split(/[&;]/), function () { var a = decodeURIComponent(this.split("=")[0] || ""); var c = decodeURIComponent(this.split("=")[1] || ""); if (!a) return; if (g) { if (/^[+-]?[0-9]+\.[0-9]*$/.test(c)) c = parseFloat(c); else if (/^[+-]?[0-9]+$/.test(c)) c = parseInt(c, 10) } c = !c && c !== 0 ? true : c; if (c !== false && c !== true && typeof c != "number") c = c; b.SET(a, c) }) }) } return b }; j.prototype = { queryObject: true, has: function (a, b) { var c = this.get(a); return d(c, b) }, GET: function (b) { if (!d(b)) return this.keys; var c = e(b), f = c[0], g = c[1]; f = a(f, this.keys); var h = this.keys[f]; while (h != null && g.length != 0) { h = h[g.shift()] } return typeof h == "number" ? h : h || "" }, get: function (a) { var b = this.GET(a); if (d(b, Object)) return jQuery.extend(true, {}, b); else if (d(b, Array)) return b.slice(0); return b }, SET: function (b, c) { var f = !d(c) ? null : c; var g = e(b), i = g[0], j = g[1]; i = a(i, this.keys); var k = this.keys[i]; this.keys[i] = h(k, j.slice(0), f); return this }, set: function (a, b) { return this.copy().SET(a, b) }, REMOVE: function (a) { return this.SET(a, null).COMPACT() }, remove: function (a) { return this.copy().REMOVE(a) }, EMPTY: function () { var a = this; jQuery.each(a.keys, function (b, c) { delete a.keys[b] }); return a }, load: function (a) { var b = a.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); var c = a.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); return new j(a.length == c.length ? "" : c, a.length == b.length ? "" : b) }, empty: function () { return this.copy().EMPTY() }, copy: function () { return new j(this) }, COMPACT: function () { function a(b) { var c = typeof b == "object" ? d(b, Array) ? [] : {} : b; if (typeof b == "object") { function e(a, b, c) { if (d(a, Array)) a.push(c); else a[b] = c } jQuery.each(b, function (b, f) { if (!d(f)) return true; e(c, b, a(f)) }) } return c } this.keys = a(this.keys); return this }, compact: function () { return this.copy().COMPACT() }, toString: function () { var a = 0, e = [], g = [], h = this; var i = function (a) { a = a + ""; if (c) a = a.replace(/ /g, "+"); return encodeURIComponent(a) }; var j = function (a, b, c) { if (!d(c) || c === false) return; var e = [i(b)]; if (c !== true) { e.push("="); e.push(i(c)) } a.push(e.join("")) }; var k = function (a, b) { var c = function (a) { return !b || b == "" ? [a].join("") : [b, "[", a, "]"].join("") }; jQuery.each(a, function (a, b) { if (typeof b == "object") k(b, c(a)); else j(g, c(a), b) }) }; k(this.keys); if (g.length > 0) e.push(f); e.push(g.join(b)); return e.join("") } }; return new j(location.search, location.hash) } } (jQuery.query || {})
