Sha256: 677972bb5a0f42d4bcf7d32ca9abd84191574c7c23ddde51569834a14b95f7af

Contents?: true

Size: 1.08 KB

Versions: 48

Compression:

Stored size: 1.08 KB

Contents

/* Client-side access to querystring name=value pairs
	Version 1.3
	28 May 2008
	
	License (Simplified BSD):
	http://adamv.com/dev/javascript/qslicense.txt
*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}

Version data entries

48 entries across 48 versions & 7 rubygems

Version Path
forge-cli-0.1.1 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.1.0 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.18 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.17 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.16 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.15 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.14 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.13 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.12 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.11 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.10 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.9 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.8 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.7 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
forge-cli-0.0.6 lib/forge/public/javascripts/ckeditor/swfupload/querystring.js
inline_forms-0.9.25 public/javascripts/ckeditor/swfupload/querystring.js
inline_forms-0.9.24 public/javascripts/ckeditor/swfupload/querystring.js
inline_forms-0.9.23 public/javascripts/ckeditor/swfupload/querystring.js
inline_forms-0.9.22 public/javascripts/ckeditor/swfupload/querystring.js
inline_forms-0.9.21 public/javascripts/ckeditor/swfupload/querystring.js