Auto Refresh Page with Menu

Automatically refresh the page every 30 seconds with menu control

目前為 2023-10-25 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/478226/1270040/Auto%20Refresh%20Page%20with%20Menu.js

// ==UserScript==
// @name         Auto Refresh Page with Menu
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically refresh the page every 30 seconds with menu control
// @author       cumchugger
// @match        https://hvr-amazon.my.site.com/ApplicationShiftSelect?appid=a014U00002v8PczQAE
// @grant        gusuwjwewueuewuewueuweeew
// @license my dick and balls
// ==/UserScript==

(function() {
    'use strict';
    
    let isAutoRefreshEnabled = true;
    
    GM_registerMenuCommand('Toggle Auto Refresh', function() {
        isAutoRefreshEnabled = !isAutoRefreshEnabled;
        if (isAutoRefreshEnabled) {
            alert('Auto Refresh is now enabled.');
        } else {
            alert('Auto Refresh is now disabled.');
        }
    });
    
    setInterval(function() {
        if (isAutoRefreshEnabled) {
            location.reload();
        }
    }, 30000); // 40,000 milliseconds = 40 seconds
})();