Factor out getArgs into Util class, since we use it in other places as well. Modify Permalink Control to fit.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@848 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-07-01 14:05:34 +00:00
parent 15a47c6513
commit 7f6ffe8164
2 changed files with 16 additions and 16 deletions
+15
View File
@@ -1008,3 +1008,18 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
var d = s.toFixed(3)/1000; // round to 1mm precision
return d;
};
OpenLayers.Util.getArgs = function() {
var args = new Object();
var query = location.search.substring(1); // Get query string.
var pairs = query.split("&"); // Break at ampersand. //+pjl
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('='); // Look for "name=value".
if (pos == -1) continue; // If not found, skip.
var argname = pairs[i].substring(0,pos); // Extract the name.
var value = pairs[i].substring(pos+1); // Extract the value.
args[argname] = unescape(value); // Store as a property.
}
return args; // Return the object.
};