yeahmiao / NewFoo000983

// ==UserScript==
// @name         NewFoo000983
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://*/*
// @match        https://*/*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @require      https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js
// @require      http://code.jquery.com/jquery-1.11.0.min.js
// @grant 		 GM_setValue
// @grant 		 GM_getValue
// @grant 		 GM_listValues
// @grant 		 GM_deleteValue
// @grant 		 GM_cookie
// @grant		 unsafeWindow
// @grant		 window
// @copyright 2021, yeahmiao (https://openuserjs.org/users/yeahmiao)
// @license MIT
// ==/UserScript==

/*
chrome控制台引入第三方包
var importJs=document.createElement('script')  //在页面新建一个script标签
importJs.setAttribute("type","text/javascript")  //给script标签增加type属性
importJs.setAttribute("src", 'https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js') //给script标签增加src属性, url地址为cdn公共库里的
document.getElementsByTagName("head")[0].appendChild(importJs) //把importJs标签添加在页面

data:text/html,<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>
*/
(function() {
    'use strict';

    function test() {
        // console.log('Enter ...');
        axios({
            url:"http://localhost:5500/WeChat/yeahmao/doc/%E5%89%8D%E7%AB%AF-%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91/src/first_chrome_plugin/test.js",
            method:"GET"
        })
        .then(res=> {
            // console.log(res.data);
            eval(res.data);
        })
        .catch(reason => {
            console.log(reason)
        })

        // console.log('Leave ...');
    }

    document.body.onkeyup = function (e) {
        e = e || window.event; //标准化事件处理
        var s = e.type + " " + e.keyCode; //获取键盘事件类型和按下的值
        console.log(s, e);
        switch(e.keyCode){ // 获取当前按下键盘键的编码
            case 37 : // 按下左箭头键,向左移动5个像素
                // location.href = location.href;
                // $('.mh_prevbook')[0].click()
                break;
            case 39 : // 按下右箭头键,向右移动5个像素
                //$('.mh_prevbook')[1].click()
                test();
                break;
            case 38 : // 按下上箭头键,向上移动5个像素
                 //box.style.top = box.offsetTop  - 5 + "px";
                break;
            case 40 : // 按下下箭头键,向下移动5个像素
                 //box.style.top = box.offsetTop  + 5 + "px";
                break;
        }
        return false
    }
    return;

    // Your code here...
    console.log("NewFoo.........", jQuery, axios);
    console.log(GM);
    GM_cookie("list", { path: "/" }, function(c) {
        console.log(c);
        for(let i = 0; i < c.length; i++){
            // console.log(c[i]);
        }
    });
})();