Hello, you have come here looking for the meaning of the word
User:Mike Dillon/Scripts/params.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word
User:Mike Dillon/Scripts/params.js, but we will also tell you about its etymology, its characteristics and you will know how to say
User:Mike Dillon/Scripts/params.js in singular and plural. Everything you need to know about the word
User:Mike Dillon/Scripts/params.js you have here. The definition of the word
User:Mike Dillon/Scripts/params.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition of
User:Mike Dillon/Scripts/params.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
// function getParameterMap(url): Parses a URL and extracts the query string parameters;
// if no URL is provided, uses the current URL. Caches parsed parameters between invocations.
var getParameterMap = (function () {
// URL parameters cache: key=url, value=paramMap
var urlParamMaps = {};
return function (url) {
// If no URL is passed in, use the current page's URL
if (!url) {
url = location.href;
}
// Remove the anchor, if any
url = url.replace(/#.*/, '');
// If the parameters for this URL have already been parsed, return them
if (urlParamMaps) return urlParamMaps;
// Set up a new map for the parameters to be parsed
var paramMap = {};
// Split the URL from the query string
var search = url.split("?", 2);
if (search) {
// Split query string on "&"
var kvs = search.split("&");
for (var i in kvs) {
// Split each key-value pair on the equals sign
var kv = kvs.split("=", 2);
var key = kv;
var value = decodeURIComponent(kv);
// On the first occurence of a key, seed an empty array into paramMap
if (!paramMap) {
paramMap = ;
}
// Push the new value onto the value list for the key in paramMap
paramMap.push(value);
}
}
// Cache the paramMap to avoid parsing for all parameter requests
urlParamMaps = paramMap;
return paramMap;
};
})();
// function getParameterValues(key, url): Extracts the list of values for a particular key
// from the given URL; if no URL is provided, uses the current URL.
// Returns null if the parameter was not in the URL.
function getParameterValues(key, url) {
return getParameterMap(url);
}
// function getParameterValues(key, url): Extracts the values for a particular key
// from the given URL; if no URL is provided, uses the current URL.
// If there is more than one value for the given key, the first value is returned.
// Returns null if the parameter was not in the URL.
function getParameter(key, url) {
var values = getParameterValues(key, url);
return values ? values : null;
}
// function getParameterNames(url): Extracts the list of parameter names
// from the given URL; if no URL is provided, uses the current URL.
function getParameterNames(url) {
var names = ;
for (var n in getParameterMap(url)) {
names.push(n);
}
return names;
}