Merge pull request #1430 from longsleep/fixup-getURLParameter

Fixup getURLParameter 'null' return and encoding support
pull/1454/head
Lukas Reschke 2016-09-19 23:59:57 +07:00 committed by GitHub
commit d2887b76bc
1 changed files with 4 additions and 3 deletions

@ -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')
)||'';
}
/**