opendatifsdf

// UserScript
// @name opendati
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://shanxi.ouchn.cn/mod/quiz/*
// @match 😕/.zhihuishu.com/*

// @connect *
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @grant GM_getValue
// @grant GM_setValue

// @require https://cdn.bootcdn.net/ajax/libs/jquery/2.0.0/jquery.js
// @require http://http😕/localhost/testopen.php?uid=111&callBack=doCallBack
// /UserScript

(function() {
'use strict';
//$.get("test.php", { name:"Donald", town:"Ducktown" });
var a=document.getElementsByClassName("qtext");
// a[0].innerText="一、判断题。(共2题)"; //"二、单项选择题。(共2题)" //2.在革命、建设、改革的实践中,我们党大力推进马克思主义中国化,产生了两次历史性飞跃,形成了思想和( )。
// a[0].innerText="2.新时代中国特色社会主义思想,是马克思主义中国化最新成果,是中国特色社会主义理论体系的重要组成部分。( )";

    document.onkeydown = function(event){        //在全局中绑定按下事件

    var e = event || window.e;
    var keyCode = e.keyCode || e.which;

    switch(keyCode){
    case 113://F2键
// $.get("test.php", { name:"Donald", town:"Ducktown" });
console.log(e.keyCode);

        $.post("http://localhost/testopen.php",
        {
            tm:"11",
            as:"22"
        },
               function(data,status){
            alert("数据: \n" + data + "\n状态: " + status);
        });

      break;
 case 115://F4键
aa();
console.log(e.keyCode);
//cc();
      break;
case 117://F6键
    sendAjax();
      break;
}
}

//r0 对,r1错
// Your code here...?uid=111&callBack=doCallBack


   function sendAjax(){
        $.getJSON("http://localhost/testopen.php?tm=11?callBack=?","tm=22",
        function (data) {
            var str = JSON.stringify(data);
            alert(str);
        });
    };

function doCallBack(data){
var str = JSON.stringify(data);
alert(str);
}

function aa(){
    GM_xmlhttpRequest({
        method: "post",
        url: 'http://localhost/testopen.php',
        data: 'tm=XXX&as=zzz&options=XXX',
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        onload: function(r) {
        // code
            alert(r.responseText);
        }
    });

}
function cc(){
    $.getJSON("http://localhost/testopen.php?callBack=?","tm=77",
        function (data) {
            var str = JSON.stringify(data);
            alert(str);
        alert("数据: \n" + str + "\n状态: " + status);
        });
}

})();

posted @ 2020-12-07 11:58  大白熊^_^  阅读(82)  评论(0编辑  收藏  举报