File: D:/HostingSpaces/ZelfVerkopen/zelfverkopen.nl/resources/assets/js/site/helpers.js
/*
* Simple isset method for this does not exist in javascript
*/
var isset = function(obj)
{
return typeof obj !== 'undefined' && obj !== null;
};
//get url params by name
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
};
/* update url string */
function updateQueryString(key, value, urlString) {
if (!urlString) urlString = window.location.href;
if (urlString.indexOf(key + '=') > -1) {
$current = $.urlParam(key);
if ($current == 0) {
$split = urlString.split(key + '=');
$url = $split[0] + key + "=" + value + $split[1];
}
else {
$url = urlString.replace(key + "=" + $current, key + "=" + value);
}
} else {
if (urlString.indexOf('?') == -1) {
$split = urlString.split('?');
$url = $split[0] + '?' + key + '=' + value;
}
else {
$url = urlString + '&' + key + '=' + value;
}
}
return $url;
}