GM_update Tester

GM_Update is a library that allows you to update your script from any site that support meta.js standard or the main USO alternatives: OpenUserJS, Greasy Fork镜像 and MonkeyGuts.

目前为 2014-08-23 提交的版本。查看 最新版本

// ==UserScript==
// @name                GM_update Tester
// @namespace           TimidScript
// @description         GM_Update is a library that allows you to update your script from any site that support meta.js standard or the main USO alternatives: OpenUserJS, Greasy Fork镜像 and MonkeyGuts.
// @include             www.example.com
// @version             3
// @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://gf.qytechs.cn/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://gf.qytechs.cn/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);
    }
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址