POP弹窗模板

利用油猴进行弹出页面功能改造,辅助进行各项工作。

POP弹窗模板

  • 可以在此基础上进行功能改造。
  • 油猴代码:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    // ==UserScript==
    // @name POP弹窗模板
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs.main.js
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs_net.js
    // @author You
    // @match http://*/*
    // @match https://*/*
    // @grant none
    // ==/UserScript==
    'use strict';
    // Your code here...
    var popdivid='popdivid';
    mydoMF(popdivid);
    afun(popdivid,'百度','pinbaidu();');
    afun(popdivid,'正在加载....','getYiyan("yiyanid");','yiyanid','#F75000');
    setTimeout(function () {getYiyan('yiyanid');}, 500);
    // my dest

    var msg=document.getElementById("yiyanid");
    console.log(msg.innerText);
    afun(popdivid,'测试弹窗','test("'+msg.innerText+'");');

    function test(msgx){
    //alert(msgx);

    //console.log(clipboardData.getData("Text"));

    }
    document.addEventListener('copy', function(event){doPasteTxt();});
    function doPasteTxt(){
    navigator.clipboard.readText()
    .then((text) => {

    var src=window.location.href;
    var newsrc2='https://www.m3u8play.com/?play=' + text;
    //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    window.open(newsrc2);
    })
    .catch((err) => log('Async readText failed with error: "' + err + '"'));
    }

应用1:回答问题

  • 应用于某个网页答题
  • 实现自动寻找答案,自动点击答案
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    // ==UserScript==
    // @name POP---回答问题
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs.main.js
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs_net.js
    // @author You
    // @match http://*/*
    // @match https://*/*
    // @grant none
    // ==/UserScript==
    'use strict';
    // Your code here...
    var popdivid='popdivid';
    mydoMF(popdivid);
    afun(popdivid,'百度','pinbaidu();');
    afun(popdivid,'正在加载....','getYiyan("yiyanid");','yiyanid','#F75000');
    setTimeout(function () {getYiyan('yiyanid');}, 500);
    // my dest

    var msg=document.getElementById("yiyanid");
    console.log(msg.innerText);
    afun(popdivid,'测试弹窗','test("'+msg.innerText+'");');

    function test(msgx){

    var inp=$("input[name^='key_']");

    var keyvx='';

    $.each(inp,function (index,domEle){
    inn=index+1;
    inpid=inp[index].id;

    var idx=inpid.replace(/key_/, "");
    keyv=inp[index].value;
    keyvv=keyv.split('');
    console.log('keyvvv长度');
    keyl=keyvv.length;
    console.log(keyvv.length);

    $.each(keyvv,function (indexv,domElev){
    var keyvvv=keyvv[indexv].charCodeAt()-65;
    console.log(keyvvv);
    if (keyl==1){
    doClick(keyvvv,idx,0);
    }else{
    doClick(keyvvv,idx,1);
    };


    //setTimeout(function () {}, 100);
    });


    keyvx=keyvx+' '+inn+'-'+keyv;
    //doClick(1,
    console.log(+inn+'-'+keyv);
    console.log(idx);

    });

    //alert(inp[0].value;);
    document.getElementById("yiyanid").innerText=keyvx;



    //console.log(clipboardData.getData("Text"));

    }
    document.addEventListener('copy', function(event){doPasteTxt();});
    function doPasteTxt(){
    navigator.clipboard.readText()
    .then((text) => {

    var src=window.location.href;
    var newsrc2='https://www.m3u8play.com/?play=' + text;
    //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    window.open(newsrc2);
    })
    .catch((err) => log('Async readText failed with error: "' + err + '"'));
    }

应用2:POP-okzy弹出

  • 选中之后进行弹窗,播放
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    // ==UserScript==
    // @name POP-okzy弹出
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs.main.js
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs_net.js
    // @author You
    // @match http://*/*
    // @match https://*/*
    // @grant none
    // ==/UserScript==
    //https://www.okzyw.com/?m=vod-detail-id-*
    'use strict';
    // Your code here...
    var popdivid='popdivid';
    mydoMF(popdivid);
    afun(popdivid,'百度','pinbaidu();');
    //afun(popdivid,'正在加载....','getYiyan("yiyanid");','yiyanid','#F75000');
    //setTimeout(function () {getYiyan('yiyanid');}, 500);
    // my dest

    //var msg=document.getElementById("yiyanid");
    // console.log(msg.innerText);
    // afun(popdivid,'测试弹窗','test("'+msg.innerText+'");');
    afun(popdivid,'百度搜文','baiduso();');
    afun(popdivid,'播放m3u8','playm3u8();');

    function test(msgx){
    //alert(msgx);

    //console.log(clipboardData.getData("Text"));

    }
    //百度搜索选中文字
    function baiduso(){
    let copyMsg = window.getSelection().toString();
    var newsrc2='https://www.baidu.com/s?wd=' + copyMsg;
    //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    window.open(newsrc2);
    }

    //播放m3u8选中网址
    function playm3u8(){
    let copyMsg = window.getSelection().toString();
    var newsrc2='https://www.m3u8play.com/?play=' + copyMsg;
    //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    window.open(newsrc2);
    }



    // document.addEventListener('copy', function(event){doPasteTxt();});
    // function doPasteTxt(){
    // navigator.clipboard.readText()
    // .then((text) => {

    // var src=window.location.href;
    // var newsrc2='https://www.m3u8play.com/?play=' + text;
    // //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    // window.open(newsrc2);
    // })
    // .catch((err) => log('Async readText failed with error: "' + err + '"'));
    // }


    document.body.oncopy = e => {
    //console.log(window.getSelection().toString())
    let copyMsg = window.getSelection().toString();
    console.log(copyMsg);
    e.clipboardData.setData("Text", copyMsg);

    var src=window.location.href;
    var newsrc2='https://www.m3u8play.com/?play=' + copyMsg;
    //var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
    window.open(newsrc2);


    };

    // 监听键盘按下事件
    document.onkeydown = function() {
    // 判断 Ctrl+S
    if(event.ctrlKey == true && event.keyCode == 66) {
    console.log('Ctrl + s');
    // 或者 return false;
    document.getElementById(popdivid).style.display='inline-block';
    //event.preventDefault();//取消默认行为
    }
    };
    //弹出选中的文字
    $(document).ready(function () {
    $('body').mouseup(function (e) {
    var txt;
    var parentOffset = $(this).offset();
    var x = e.pageX - parentOffset.left;
    var y = e.pageY - parentOffset.top;
    txt = window.getSelection();
    txt1=txt.toString();
    if (txt1.length > 0) {
    console.log(txt1);
    // alert(txt1);

    }
    });
    });

应用4:给定成绩

  • 单个题目批改时给定成绩,良好优秀,中等及格
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    // ==UserScript==
    // @name POP-单个给定成绩
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs.main.js
    // @require https://gitee.com/aqtech/appset/raw/master/mfsq/popjs_net.js
    // @author You
    // @match http://mooc1.xx/work/review/question?courseId=*
    // @grant none
    // ==/UserScript==
    'use strict';
    // Your code here...
    var popdivid='popdivid';
    mydoMF(popdivid);
    // afun(popdivid,'百度','pinbaidu();');
    // afun(popdivid,'正在加载....','getYiyan("yiyanid");','yiyanid','#F75000');
    // setTimeout(function () {getYiyan('yiyanid');}, 500);
    // my dest

    // afun(popdivid,'正确','fuzhifs(100);');
    // afun(popdivid,'取中','fuzhifs(50);');
    // afun(popdivid,'错误','fuzhifs(0);');

    var x;
    x=parseInt(Math.random()*(100-92))+92;
    var y;
    y=parseInt(Math.random()*(90-82))+82;
    var z;
    z=parseInt(Math.random()*(80-72))+72;
    var t;
    t=parseInt(Math.random()*(70-62))+62;


    afun(popdivid,'优秀','fuzhifs('+x+');');
    afun(popdivid,'良好','fuzhifs('+y+');');
    afun(popdivid,'中等','fuzhifs('+z+');');
    afun(popdivid,'及格','fuzhifs('+t+');');

    //afun("tpsubmit",'zhengxxxxxxxx+++++++++++++++++++++++++++','fuzhifs(100);');

    function fuzhifs(fen){
    //var fen=0;
    //setTimeout(function () { console.log("waiting...."); },2000);
    //数字赋值

    // 获取分值,然后输入
    var rep = /<div class="makescore" data="(.*)?">/;
    var str = $('.makescore').prop('outerHTML');
    console.log(str);
    var res=rep.exec(str)[1];
    console.log(res);
    //$('.inpTxt markScore').val(res);

    //console.log(res2);
    // 首先赋值0,然后再根据有无jpg赋值满分

    //$("input[type=text]").val(0.01*fen*);

    // if (fen==100)
    // {
    // $("input[type=text]").val(res);
    // }
    $("input[type=text]").val(res*0.01*fen);
    //进行赋值后下一页
    setTimeout(function () { goNextRecord(this, 1); }, 50);
    setTimeout(function () {
    console.log('ressssssssssssssssssss');
    var popdivid='popdivid';
    mydoMF(popdivid);
    // afun(popdivid,'正确','fuzhifs(100);');
    // afun(popdivid,'取中','fuzhifs(50);');
    // afun(popdivid,'错误','fuzhifs(0);');

    var x;
    x=parseInt(Math.random()*(100-92))+92;
    var y;
    y=parseInt(Math.random()*(90-82))+82;
    var z;
    z=parseInt(Math.random()*(80-72))+72;
    var t;
    t=parseInt(Math.random()*(70-62))+62;


    afun(popdivid,'优秀','fuzhifs('+x+');');
    afun(popdivid,'良好','fuzhifs('+y+');');
    afun(popdivid,'中等','fuzhifs('+z+');');
    afun(popdivid,'及格','fuzhifs('+t+');');

    }, 300);




    // //查找下一份 连接,并点击
    // var nextb=$("a:contains('下一份')");
    // //console.log(nextb.prop('outerHTML'));
    // if (typeof(nextb.prop('outerHTML'))!="undefined"){

    // nextb[0].click()
    // }else{
    // //查找 保存 连接,并点击
    // var baocun=$("a:contains('保存')");

    // if (typeof(baocun.prop('outerHTML'))!="undefined"){
    // //保存
    // console.log("发现保存按钮");
    // console.log(baocun.prop('outerHTML'));
    // baocun.click();
    // }
    // }

    }


    document.addEventListener('DOMContentLoaded', function()
    {
    console.log("Modules Loaded!");
    console.log("如果您感觉效果不错,请您前往:https://github.com/yaowenxu 给个star 吧");
    });

    // 当节点dom 中内容发生变化的时候,重新进行删除,防止百度热搜异步加载!
    document.addEventListener('DOMSubtreeModified', function()
    {
    console.log("// 继续进行删除.....");

    });

功能js:popjs.main.js

  • 实现菜单,拖动等基础功能
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155

    //验证成功后弹出内容菜单,弹出菜单
    function PopIndex(popdivid,popdivtop,popdivright,acss,aoks,aerrs) {
    function d(a) {
    return a.indexOf('360ee') > -1 || a.indexOf('360se') > -1 || a.indexOf('se') > -1 || a.indexOf('aoyou') > -1 || a.indexOf('theworld') > -1 || a.indexOf('worldchrome') > -1 || a.indexOf('greenbrowser') > -1 || a.indexOf('qqbrowser') > -1 || a.indexOf('baidu') > -1
    }
    if(document.getElementById(popdivid)){
    document.getElementById(popdivid).style.display='';
    document.getElementById(popdivid).style.left='';
    document.getElementById(popdivid).style.top=popdivtop;
    document.getElementById(popdivid).style.right=popdivright;
    }else{
    var a = document.createElement('div');
    a.id = popdivid,
    a.style.cssText = acss,
    a.innerHTML = aoks;
    document.body.appendChild(a),
    a.onclick = function() {
    //a.style.display = 'none'
    },
    setTimeout(function() {
    a.click()
    },
    8e4)
    }
    }

    function dragFunc(id) {
    var Drag = document.getElementById(id);
    Drag.onmousedown = function(event) {
    var ev = event || window.event;
    event.stopPropagation();
    var disX = ev.clientX - Drag.offsetLeft;
    var disY = ev.clientY - Drag.offsetTop;
    document.onmousemove = function(event) {
    var ev = event || window.event;
    Drag.style.left = ev.clientX - disX + "px";
    Drag.style.top = ev.clientY - disY + "px";
    Drag.style.cursor = "move";
    };
    };
    Drag.onmouseup = function() {
    document.onmousemove = null;
    this.style.cursor = "default";
    };
    }
    //执行空
    function clickb(){
    console.log('clickb');
    }

    //创建菜单,可选颜色和id
    function afun(popdivid,atxt,afuntxt,aid,acolor){

    var aidx='aaa'+atxt.replace(/\s+/g,"bb")+Math.random();
    if(!aid){aid=aidx;}
    if(!acolor){acolor="#1d7fe2";}

    var ppa = '<a id=' + aid + ' style="color:'+acolor+';" href="javascript:void(0);" >' +atxt+ '</a>';
    var ppp = document.createElement("p");
    ppp.setAttribute("style","margin:0px;padding:0px;");//可行
    ppp.setAttribute("class","alink");
    ppp.innerHTML = ppa;
    document.getElementById(popdivid).appendChild(ppp.cloneNode(true));

    document.getElementById(aid).addEventListener("click", function(){eval(afuntxt);});
    }

    function mydoMF(popdivid){
    var host_popjs='https://gitee.com/aqtech/appset/raw/master/mfsq/popjs2.js';
    //p.popdivid,p.popdivtop,p.popdivright,p.acss,menuX(p),p.aerrs
    var msg=true;
    var user='user';
    var pwd='pwd';
    var src='src';
    var ver='1.0';
    var popdivid=popdivid;
    var popdivtop="10px";
    var popdivright="10px";
    var popdivwidth="200px";
    var acss='position: fixed; top: '+popdivtop+'; width:'+popdivwidth+';right: '+popdivright+'; padding: 10px; border: 1px solid rgb(92, 184, 229);border-radius: 5px; box-shadow: rgb(92, 184, 229) 0px 0px 20px; z-index: 999999;background-color: rgba(255, 255, 255, 0.8) !important;';
    //结果输出
    //var astyle='<style>';
    var aoks='<style type="text/css"> \n ';
    aoks=aoks+'.alink{text-align:left;display:block;line-height:30px;} \n ';
    aoks=aoks+'.alink a{display:block;border-style:none;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#ccc;} \n ';
    aoks=aoks+'.alink a:link,.alink a:visited{color:#ff0000;font-size:14px;text-decoration:none;} \n ';
    // aoks=aoks+'.alink a:link{color:#ff0000;height:14px;font-size:14px;text-decoration:none;} \n ';
    aoks=aoks+'.alink a:hover{background-color: #def0f9} \n ';
    // aoks=aoks+'.alink a:active{color:#ff0000;height:14px;font-size:14px;text-decoration:none;} \n ';
    // aoks=aoks+'.alink a:visited{color:#ff0000;height:14px;font-size:14px;text-decoration:none;} \n ';
    aoks=aoks+'</style> \n';
    aoks=aoks+'<p class="alink" style="padding:0px;margin:0px;text-align:right;"><a href="https://wqian.net/blog/2018/0517-mfsq-index.html" target="_blank" style="display:inline;">帮助</a>&nbsp;&nbsp;<a id="hidedivx" href="javascript:void(0);" style="display:inline;">关闭</a></p>';

    var aerrs='<p><a style="color:#1d7fe2" href="https://wqian.net/blog/2018/0517-mfsq-index.html" target="_blank">For More Help</a></p>';
    var popjs='popjs2.js?t=222';

    var p={
    msg:msg,
    user:user,
    pwd:pwd,
    src:src,
    popdivid:popdivid,
    popdivtop:popdivtop,
    popdivright:popdivright,
    acss:acss,
    aoks:aoks,
    aerrs:aerrs,
    popjs:popjs
    };
    //弹出装载菜单
    PopIndex(p.popdivid,p.popdivtop,p.popdivright,p.acss,menuX(p),p.aerrs);
    //可移动
    dragFunc(p.popdivid);
    document.getElementById("hidedivx").addEventListener("click", function(){hidediv(popdivid);});
    }


    function doMF(host_popjs,p){
    //弹出装载菜单
    PopIndex(p.popdivid,p.popdivtop,p.popdivright,p.acss,menuX(p),p.aerrs);
    //可移动
    dragFunc(p.popdivid);
    //运行其他函数
    RunFun();

    }
    function RunFun(){
    getYiyan('yiyanid');
    }

    function menuX(p){
    var exfun= p.aoks;
    //exfun=exfun+fmtEx('获取当前网址','pophref()');
    //exfun=exfun+fmtEx('vip','vipview()');
    //exfun=exfun+fmtEx('百度收录查询','pinbaidu()');
    //exfun=exfun+fmtEx('360收录查询','pin360()');
    //exfun=exfun+fmtEx('获取html','GetHtml(\''+p.src+'\')');
    //exfun=exfun+fmtExID('yiyanid','加载一言...','getYiyan(\'yiyanid\')');
    // exfun=exfun+fmtEx('查询网址通断','UrlOK(\''+p.src+'\')');

    return exfun;
    }

    function fmtEx(txt,fun){
    return '<p class="alink" style="margin:0px;padding:0px"><a style="color:#1d7fe2;" href="javascript:void(0);" onclick="' + fun + '">' +txt+ '</a></p>';
    }
    function fmtExID(id,txt,fun){
    //添加带id的菜单
    return '<p class="alink" style="margin:0px;padding:0px"><a id=' + id + ' style="color:#F75000;" href="javascript:void(0);" onclick="' + fun + '">' +txt+ '</a></p>';
    }
    //隐藏标签
    function hidediv(id){
    document.getElementById(id).style.display='none';
    }

功能js:popjs_net.js

  • 实现各项功能,在此进行功能函数的扩写。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function UrlOK(url){
// url="http://www.google.com";
$.ajax({
type: 'get',
cache: false,
url: url,
dataType: "jsonp", //跨域采用jsonp方式
processData: false,
timeout:5000, //超时时间,毫秒
complete: function (data) {
if (data.status==200) {
alert('ok');
} else {
alert("无效链接");
}
}
});

}
function GetHtml(url){
//$.getScript(url, function(html){
//alert(html);
//});
alert(document.getElementsByTagName("body")[0].innerHTML);
// document.getElementsByTagName("html")[0].innerHTML='oks';

}

//弹出窗口
function pophref(){
var src=window.location.href;
alert(src);
}
//vip解析
function vipview(){
var src=window.location.href;
var newsrc2='http://vip.wandhi.com/?v=' + src;
var newsrc='http://aqtech.gitee.io/appset/mfsq/vip.html?v=' + escape(encodeURI(newsrc2));
window.open(newsrc);
}
//百度收录查询
function pinbaidu(){
var newsrc='https://www.baidu.com/s?wd=site:'+ window.location.hostname;
//alert(newsrc);
window.open(newsrc);
}
//360收录查询
function pin360(){
var newsrc='https://www.so.com/s?q=site:'+ window.location.hostname;
//alert(newsrc);
window.open(newsrc);
}
function getYiyan(ElemtId){
fetch('https://v1.hitokoto.cn')
.then(function (res){
return res.json();
})
.then(function (data) {
var hitokoto = document.getElementById(ElemtId);
hitokoto.innerText = data.hitokoto;
})
.catch(function (err) {
console.error(err);
})
}