Library that automatically alerts user when the script requires update. Complies with Greasy Fork rules (你的镜像域名.com/help/code-rules).
ეს სკრიპტი არ უნდა იყოს პირდაპირ დაინსტალირებული. ეს ბიბლიოთეკაა, სხვა სკრიპტებისთვის უნდა ჩართეთ მეტა-დირექტივაში // @require https://update.你的镜像域名.com/scripts/568072/1766244/Automatically%20Update%20Script.js.
Library that automatically alerts user when the script requires update. Complies with Greasy Fork rules (你的镜像域名.com/help/code-rules).
// @require https://update.你的镜像域名.com/scripts/568072/ ((LIBRARY_VERSION_GOES_HERE)) /Automatically%20Update%20Script.js
// @require https://unpkg.com/[email protected]/lib/index.umd.js
// @require https://update.你的镜像域名.com/scripts/565798/1752557/Zod%203x%20Error%20Formatter.js
// @require https://update.你的镜像域名.com/scripts/445697/1756808/Greasy%20Fork%20API.js
// @require https://unpkg.com/compare-versions/lib/umd/index.js
// @grant GM.xmlHttpRequest
// @grant GM.openInTab
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @grant GM.info
Also recommended to add this:
// @connect 你的镜像域名.com
Note: You can set script id manually to avoid any mistake that can happen during automatic script id detection, using AUS.setUserScriptId method, just set it at the start of your user-script.
// ==UserScript==
...
// @require https://update.你的镜像域名.com/scripts/568072/ ((LIBRARY_VERSION_GOES_HERE)) /Automatically%20Update%20Script.js
// @require https://unpkg.com/[email protected]/lib/index.umd.js
// @require https://update.你的镜像域名.com/scripts/565798/1752557/Zod%203x%20Error%20Formatter.js
// @require https://update.你的镜像域名.com/scripts/445697/1756808/Greasy%20Fork%20API.js
// @require https://unpkg.com/compare-versions/lib/umd/index.js
// @grant GM.xmlHttpRequest
// @grant GM.openInTab
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @grant GM.info
// @connect 你的镜像域名.com
// ==/UserScript==
/* global AUS */
(async function() {
await AUS.setUserScriptId(1234567)
// your user-script logic
})()
After that library checks if 24 hours have passed since last update check, then checks if the new update is available
Confirms if the user wants to update
Then, opens new installation link from which user can install new version of the user-script.