This commit is contained in:
haoouba 2021-02-03 22:10:09 +08:00
parent 9416e1af31
commit 2405648151

View File

@ -12,20 +12,20 @@
LAZY_LOAD: '<?php _getLazyload() ?>', LAZY_LOAD: '<?php _getLazyload() ?>',
encryption: str => window.btoa(unescape(encodeURIComponent(str))), encryption: str => window.btoa(unescape(encodeURIComponent(str))),
decrypt: str => decodeURIComponent(escape(window.atob(str))), decrypt: str => decodeURIComponent(escape(window.atob(str))),
changeURLArg: function(url, arg, arg_val) { changeURLArg: (url, arg, arg_val) => {
let pattern = arg + '=([^&]*)' let pattern = arg + '=([^&]*)';
let replaceText = arg + '=' + arg_val let replaceText = arg + '=' + arg_val;
if (url.match(pattern)) { if (url.match(pattern)) {
let tmp = '/(' + arg + '=)([^&]*)/gi' let tmp = '/(' + arg + '=)([^&]*)/gi';
return url.replace(eval(tmp), replaceText) return url.replace(eval(tmp), replaceText);
} else { } else {
if (url.match('[?]')) { if (url.match('[?]')) {
return url + '&' + replaceText return url + '&' + replaceText;
} else { } else {
return url + '?' + replaceText return url + '?' + replaceText;
} }
} }
return url + '\n' + arg + '\n' + arg_val return url + '\n' + arg + '\n' + arg_val;
} }
} }
</script> </script>