Sha256: b33b91211fa548df3c8f570960c9d53eec91459e1168e5d411724a2e87ae559d

Contents?: true

Size: 1.06 KB

Versions: 71

Compression:

Stored size: 1.06 KB

Contents

/**
 * A simple querystring parser.
 * Example usage: var q = $.parseQuery(); q.fooreturns  "bar" if query contains "?foo=bar"; multiple values are added to an array. 
 * Values are unescaped by default and plus signs replaced with spaces, or an alternate processing function can be passed in the params object .
 * http://actingthemaggot.com/jquery
 *
 * Copyright (c) 2008 Michael Manning (http://actingthemaggot.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 **/
jQuery.parseQuery = function(qs,options) {
	var q = (typeof qs === 'string'?qs:window.location.search), o = {'f':function(v){return unescape(v).replace(/\+/g,' ');}}, options = (typeof qs === 'object' && typeof options === 'undefined')?qs:options, o = jQuery.extend({}, o, options), params = {};
	jQuery.each(q.match(/^\??(.*)$/)[1].split('&'),function(i,p){
		p = p.split('=');
		p[1] = o.f(p[1]);
		params[p[0]] = params[p[0]]?((params[p[0]] instanceof Array)?(params[p[0]].push(p[1]),params[p[0]]):[params[p[0]],p[1]]):p[1];
	});
	return params;
}

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
cpee-1.3.177 cockpit/lib/parsequery.js
cpee-1.3.176 cockpit/lib/parsequery.js
cpee-1.3.175 cockpit/lib/parsequery.js
cpee-1.3.174 cockpit/lib/parsequery.js
cpee-1.3.173 cockpit/lib/parsequery.js
cpee-1.3.172 cockpit/lib/parsequery.js
cpee-1.3.171 cockpit/lib/parsequery.js
cpee-1.3.170 cockpit/lib/parsequery.js
cpee-1.3.169 cockpit/lib/parsequery.js
cpee-1.3.167 cockpit/lib/parsequery.js
cpee-1.3.166 cockpit/lib/parsequery.js
cpee-1.3.164 cockpit/lib/parsequery.js
cpee-1.3.163 cockpit/lib/parsequery.js
cpee-1.3.162 cockpit/lib/parsequery.js
cpee-1.3.161 cockpit/lib/parsequery.js
cpee-1.3.160 cockpit/lib/parsequery.js
cpee-1.3.159 cockpit/lib/parsequery.js
cpee-1.3.158 cockpit/lib/parsequery.js
cpee-1.3.157 cockpit/lib/parsequery.js
cpee-1.3.156 cockpit/lib/parsequery.js