Merge pull request #1430 from longsleep/fixup-getURLParameter

Fixup getURLParameter 'null' return and encoding support
This commit is contained in:
Lukas Reschke 2016-09-19 23:59:57 +02:00 committed by GitHub
commit d2887b76bc

View file

@ -1722,9 +1722,10 @@ function formatDate(timestamp){
* @return {string}
*/
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1]
);
return decodeURIComponent(
(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(
location.search)||[,''])[1].replace(/\+/g, '%20')
)||'';
}
/**