Created
December 17, 2021 02:11
-
-
Save z4none/f3e0882b29303fe8a06cef4e19abacaf to your computer and use it in GitHub Desktop.
auto refresh bookmarklet ( with progressbar )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
timeout=prompt("Set timeout [s]"); | |
countdown=0; | |
current=location.href; | |
if(timeout>0) | |
reload(); | |
else | |
location.replace(current); | |
function reload(){ | |
if(countdown <= 0) { | |
fr4me='<div style="position:fixed;width:100vw;z-index:9999;"><div id="_reload_countdown" style="height:4px;background:#09F;transform:translateX(-100%);transition:all 1s;"></div></div>'; | |
fr4me+='<iframe src="'+current+'" style="position:fixed;width:100vw;height:100vh;border:none;"/>'; | |
with(document){write(fr4me);void(close())}; | |
countdown = timeout; | |
document.body.style.margin='0' | |
} | |
else { | |
document.getElementById("_reload_countdown").style.transform="translateX(-" + countdown*100/timeout + "%)"; | |
} | |
countdown -= 1; | |
setTimeout('reload()',1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment