Raw Source
myway42 / Auto refresh

// ==UserScript==
// @name         Auto refresh
// @name:zh-CN   自动刷新
// @description  Automatically refresh current page with required number of times.
// @description:zh-CN  自动刷新当前页面所需的次数。
// @namespace    myway42.auto-refresh
// @version      0.0.4
// @author       myway42
// @homepage     https://github.com/myway42/Auto-refresh
// @license      MIT
// @match        *://*/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAjVBMVEX///8jIyMAAAAgICAdHR0YGBgbGxsXFxcTExMJCQkPDw8SEhIICAgNDQ34+Pjd3d02Njbl5eXs7OzLy8uKiorS0tJoaGhEREQqKirf399tbW3Pz8+pqanz8/OxsbFRUVFeXl67u7s+Pj6Xl5d9fX3CwsJKSko3Nzd5eXmfn59iYmIuLi6RkZGGhoZOTk4LnFE6AAAKPklEQVR4nO2daZeiOhCG20rYNwVBRTZFbdz6//+8q+3MbRVkSwX7zMnzYT5Me4CXLFQqVZWPD4FAIBAIBAKBQCAQCAQCgUAgEAgE7Yldx0v2+XQ6LYLi8m8eJd7Cjd/9WCjYCy8P07EFYFq6qqqKpFz+1S0TQB+n4XTruB2uFvury6vh9rCdsb08PaqgSzIZVUGoZIA12k237VQ6wejyokD9Sjg/eCtsP/+8NNMLbY86DYDxybObLlmAdLsahdlkCA01xNvNHHTaKO5OpgFqsaprSjvVfn4ujfzBxFSwLMagNrddSaQCo9B7edXAuv+xPO8yfFGJ817y/hd5PFV3wBU8/lTNhtX1Fz8Eq6+8PyJ1CKp6oPZ8WXhHP91mIDHJuyFBun2+tAfPv1LPw+vbgYyg74oMX08ap8bzb+hsYH3eDLrMnU1QWD9MOlnp5REy6FzjZKj6bhoPzs8N0nL30AYciPEUZfw9I8H5f8v1UFYIpcHKjdXcqng+DPTj6s89Nmr5j/lA+twDsH0f6iCQ3UZbopX+poTDCFxRhZu+bx3St5ld/lqMaDqEPrvg2IA3CIQXm3xSVkiOA6wv/aPOWd8VY36ZNcsKR8B/gZGgfyKqo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qqqilSC5/DOfv7vb+hkn5pp3EanpLoSnIOdvNL++rdC88SrFXvE7X1sNo+2/WseO1G/8OCOAlk8Hsjw+w5eEV/vzcuwOkIK5ayhqjwE/jxwevA307wFMhQQRUNdvdkLX3DFfCQJb7nqlb5vcmQp1gaaF6uF1T4vWk64FGrkPEOEKwI+CCjj3yggxDJACWb3ArLFC6LHmWI8SlbXOeYG3ZFveTr9qCb8m9Gk9l914oKv/fNyN+bfD8kdKiiYhV+b+v2AXbWPJtRmw+VeVBhe/9/CuheQlh6VCJZw1WFq/B7/4RaTEIuh6xTOGAGqTbglJvpvtS1t0PvqgQYTqjrQcWJVo/FvBOCOuUQy4gGznj4Kj3/82m80RitrxJtng+d0fFxKlmm5vN32I7WKBpphxNMESkHf1WFyK++OvvOniAKjJPB2++b7GmuMasncr+Q+5/vO5I1JXxbrqg7euiB0kvPc5ykltZHJNWsNHpn/uRSuZMo1Z4AOokyMLstHyWAdP/umqjO6O/2JYXGBambhABaK2c5kTSA4Hfk+OZjMHXdtNbtljN+FIxVsF4foU6oYoEyDqNflPbqR3neKatx4e2L7/L4mm4okkSvSJKi6tblv45puPc4nB4+PLG7WEX5tAiCdDabpWFQTPNo5bj/XC6vQCAQCAQCgUAgEAgEAoFAIBAIBDz5D/qwqFmPDTOnAAAAAElFTkSuQmCC
// @grant        GM_setValue
// @grant        GM_getValue
// @downloadURL https://update.greasyfork.org/scripts/489844/Auto%20refresh.user.js
// @updateURL https://update.greasyfork.org/scripts/489844/Auto%20refresh.meta.js
// ==/UserScript==
(function() {
    'use strict';
    const ORIGIN = window.location.href;
    let t = GM_getValue(ORIGIN);
    if (!t) t = +prompt("Enter refresh times", "refresh times");
    if (!(typeof t === 'number' && t > 0)) return;
    t--;
    GM_setValue(ORIGIN, t);
    window.location.reload();
})();