Greasy Fork

/

目前为 2025-04-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         視
// @namespace    /
// @version      5.0
// @description  /
// @author       (c)2025 facaikotei
// @match        *://*/*
// @grant        GM_addElement
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @require      https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/jwerty/0.3.2/jwerty.min.js
// @require      https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/sentinel-js/0.0.5/sentinel.min.js
// @license      MIT
// @homepageURL  https://greasyfork.org/scripts/529908
// ==/UserScript==

(function () {
    'use strict';

    sentinel.on("#MyUpDown", function () {
        GM_addElement(document.querySelector(".MyBT"), "div", { id: "MyImage", class: "jianBian", textContent: "图片" });
        GM_addElement(document.querySelector("#MyImage"), "div", { style: "opacity: 0;", textContent: "图片" });
        GM_addStyle(".MyBT>div>div { width: 150px; }");
        document.querySelector("#MyImage").addEventListener("click", function () {
            jwerty.fire(GM_getValue("shortCutString", "alt+W"));
        });
        sentinel.off("#MyUpDown");
    });
    sentinel.on(".tyc-image-container", function () {
        GM_setValue("shortCutString", document.querySelector(".shortCutString").value);
        document.querySelector(".shortCutString").addEventListener("change", function () {
            GM_setValue("shortCutString", document.querySelector(".shortCutString").value);
        });
    });
})();