Greasy Fork

来自缓存

Greasy Fork is available in English.

shanbay单词快捷键

shanbay单词快捷键rcug

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name     shanbay单词快捷键
// @namespace  https://github/webhugo
// @version    4.2.4
// @description shanbay单词快捷键rcug
// @author     hugo
// require  https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js

// @noframes
// @match    *://*.shanbay.com/*   

// @grant    GM.getValue
// @grant    GM.setValue
// @grant    GM_getValue
// @grant    GM_setValue
// @grant    unsafeWindow
// @grant    GM_xmlhttpRequest
// @grant    GM.xmlHttpRequest
// @grant    GM_openInTab
// @grant    GM.openInTab
// ==/UserScript==
// 
(function () {
    'use strict';
    var jQuery = $ || window.$;
    var item;
    try {
        document.onkeydown = (event) => {
            let key = event.key;
            if (key == 'g') {
                item = jQuery(".known.span10")
                if (item) {
                    item.click();
                    console.log("know");
                    item = null;
                }
                item = jQuery(".continue.continue-button")
                if (item) {
                    item.click();
                    console.log("continue");
                    item = null;
                }
              event.preventDefault()

            }
            if (key == 'u') {
                item = jQuery(".unknown.span10");
                if (item) {
                    item.click();
                    console.log("unkown");
                    item = null;
                }
              event.preventDefault()
            }
            if (key == 'r') {
                item = jQuery(".speaker-icon");
                if (item) {
                    item.click();
                    console.log("read");
                    item = null;
                }
              event.preventDefault()
            }


            if(key == 'c'){
                let word = $(".span10.offset1>h1").text();
                $(".span10.offset1>h1").text()
                GM_xmlhttpRequest({
                    method: "GET",
                    url: `https://cn.bing.com/dict/search?q=${word}`,
                    onload: function (response) {
                       
                        //let html = jQuery(".lf_area",jQuery(response.responseText)).html();
                        //lf_area
                        jQuery("#answer").append(response.responseText);
                    }
                });
              event.preventDefault()
            }
            

        }

    } catch (e) {
        console.log(e);
    }
})();