您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sample for GM_update
当前为
// ==UserScript== // @name GM_update Tester // @namespace TimidScript // @description Sample for GM_update // @include www.example.com // @version 1.2.2 // @require http://openuserjs.org/src/libs/TimidScript/TSL_-_GM_Update.js // @icon http://i.imgur.com/FD46Ak3.png?1 // @include *//www.example.com* // @include *//example.com* // @grant GM_xmlhttpRequest // @grant GM_info // @grant GM_getMetadata // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @grant GM_registerMenuCommand // @homeurl https://openuserjs.org/scripts/TimidScript/GM_update_Tester // ==/UserScript== // @gm_update manual var notice = document.createElement("div"); notice.setAttribute("style", "position: fixed; top: 10px; right: 10px; width: 400px; color: green; background-color: #E7E7F1; z-index: 999999999999; padding: 10px; border: 3px solid pink; margin: 0; text-align: center;"); notice.innerHTML = "Click the button below to do a manual check using <a href='https://greasyfork.org/scripts/4439'>" + "GM_update Tester's meta.js</a> file hosted on Greasy Fork. The result is printed in the console." + "Or you can select the GreaseMonkey menu command to do an update check from " + "<a href='https://openuserjs.org/scripts/TimidScript/GM_update_Tester'> OpenUserJS homepage."; document.body.appendChild(notice); var btn = document.createElement("div"); btn.setAttribute("style", "margin: 5px; padding:5px; text-align: center; border: 1px red solid; background-color: #FBF8C8; color: red; border-radius: 5px; width: 380px; cursor: pointer;"); btn.textContent = "Console Print Online Version"; btn.onclick = WhyClick; notice.appendChild(btn); function WhyClick() { try { console.log(GM_update) } catch (e) { console.warn(e); } var url = "https://greasyfork.org/scripts/4439/code/4439.meta.js"; GM_update.isThereANewVersion(url, updateCallback); } function updateCallback(success) { console.log("Has new version check succeeded: ", success); if (success) { console.info("Do Version Match: ", GM_update.online.version == GM_update.installed.version); console.log(GM_update.online); console.log(GM_update.installed); } }