mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-24 04:28:03 +01:00
add removeparam
This commit is contained in:
parent
440c99d850
commit
f31c80b1c7
1 changed files with 13 additions and 1 deletions
|
@ -1148,6 +1148,18 @@ Recommended Videos
|
|||
|
||||
<script>
|
||||
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later
|
||||
function removeParam(paramName) {
|
||||
|
||||
let searchParams = new URLSearchParams(window.location.search);
|
||||
searchParams.delete(paramName);
|
||||
|
||||
if (history.replaceState) {
|
||||
let searchString = searchParams.toString().length > 0 ? '?' + searchParams.toString() : '';
|
||||
let newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + searchString + window.location.hash;
|
||||
history.replaceState(null, '', newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
checkbox = document.getElementById("continue");
|
||||
|
||||
checkbox.addEventListener('change', function(e) {
|
||||
|
@ -1164,7 +1176,7 @@ checkbox.addEventListener('change', function(e) {
|
|||
|
||||
if (/[?&]autoplay=/.test(location.search)) {
|
||||
if(!checkbox.checked) {
|
||||
checkbox.checked = true;
|
||||
removeParam("autoplay")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue