Skip to content

Instantly share code, notes, and snippets.

@robfrawley
Last active January 27, 2025 18:30
Show Gist options
  • Save robfrawley/a157bc9b36d8e1e891e23cdf192f549f to your computer and use it in GitHub Desktop.
Save robfrawley/a157bc9b36d8e1e891e23cdf192f549f to your computer and use it in GitHub Desktop.
toggle-auto-refresh
// ==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