Fix url adapt param

master
Alexander Kondratyev 9 years ago
parent 74cd600ea6
commit 151e27fee6
  1. 6
      zsite/static/js/snippets.js

@ -157,14 +157,14 @@ $(function() {
paramValue = '' paramValue = ''
} }
var pattern = new RegExp('\\b('+paramName+'=).*?(&|$)'), var pattern = new RegExp('\\b(' + paramName + '=).*?(&|$)'),
url = window.location.href; url = window.location.href;
if (url.search(pattern) >= 0){ if (url.search(pattern) >= 0){
window.location = url.replace(pattern,'$1' + paramValue + '$2'); window.location = url.replace(pattern, '$1' + paramValue + '$2');
return window.location; return window.location;
} }
window.location = url + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue; window.location = url + '#' + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue;
return window.location; return window.location;
}; };
}); });
Loading…
Cancel
Save