Last active
January 27, 2025 18:30
-
-
Save robfrawley/a157bc9b36d8e1e891e23cdf192f549f to your computer and use it in GitHub Desktop.
toggle-auto-refresh
This file contains hidden or 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
// ==UserScript== | |
// @name Auto Refresh Page | |
// @namespace http://tampermonkey.net/ | |
// @version 0.0.1 | |
// @description Browser script to continually auto-refresh a web page using a simple menu command. | |
// @author Rob Frawley 2nd | |
// @match *://www.newegg.com/* | |
// @grant GM_registerMenuCommand | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// @noframes | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const reloadIntervalSeconds = 20; | |
const reloadActionActivated = GM_getValue('reloadActionActivated', false); | |
const reloadToggleMenuEntry = GM_registerMenuCommand("Toggle Auto Refresh Page", function() { | |
GM_setValue('reloadActionActivated', !reloadActionActivated); | |
location.reload(); | |
}); | |
if (reloadActionActivated) { | |
setTimeout(function() { | |
location.reload(); | |
}, reloadIntervalSeconds * 1000) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment