jquery使用ajax實現微信自動回複外掛程式_jquery

來源:互聯網
上載者:User

myscript.js

複製代碼 代碼如下:

var _autorun;
var str = new Array('轉寄什麼','分享什麼','已轉寄','已轉發','己轉寄','繼續申請','在不','已發送','以轉寄','以分享','已分享','yv','bv','gv','pv','rv','你好','美女','索要','代碼','我要','要v','要加v');
var isrun = false;
var i=0;
function start(){
    console.log('第'+(++i)+'次重新整理');
    var chatListColumn =$(".chatListColumn");
    chatListColumn.each(function(){
        var _this = this;
        var _me = $(this);
        var attr = $(this).attr('un');
        if((attr!='')&&(attr!='filehelper')&&(attr!='weixin')&&(attr!='newsapp')&&(attr!='fmessage')){
            //console.log($(this).attr('un'));
            var disp =  _me.find('p.desc').html();
            disp = disp.toLowerCase();
            disp = disp.trim();
            for (var i = 0; i < str.length; i++){
                if(disp.indexOf(str[i])!=-1){
                    isrun=true;break;
                }
            };
           if(disp.indexOf('你已添加了')!=-1||disp.indexOf('通過了你的好友驗證請求')!=-1||disp.indexOf('你添加到通訊錄')!=-1){
                _this.click();
                var _input = $("#textInput");
                var  message = _ajax('你已添加了',attr);
                _input.val(message);
                var _click = document.getElementsByClassName("chatSend");
                _click[0].click();
                isrun=false;
            }
            else if((disp.indexOf('發送好友驗證請求')!=-1)&&disp!=''){
                isrun=false;
            }
            else if((disp.indexOf('仔細閱讀上述訊息')!=-1)&&disp!=''){
                isrun=false;
            }
            else if(disp!=''){
               isrun=false;
           }
            //console.log(disp);
            /*if(isrun){
                _this.click();
                var _input = $("#textInput");
                var  message = _ajax(disp,attr);
                _input.val(message);
                var _click = document.getElementsByClassName("chatSend");
                _click[0].click();
                isrun=false;
            }
            else if(disp.indexOf('你添加到通訊錄')!=-1){
                _this.click();
                var _input = $("#textInput");
                var  message = _ajax('你添加到通訊錄',attr);
                _input.val(message);
                var _click = document.getElementsByClassName("chatSend");
                _click[0].click();
                isrun=false;
            }
            else if(disp.indexOf('你已添加了')!=-1||disp.indexOf('通過了你的好友驗證請求')!=-1){
                _this.click();
                var _input = $("#textInput");
                var  message = _ajax('你已添加了',attr);
                _input.val(message);
                var _click = document.getElementsByClassName("chatSend");
                _click[0].click();
                isrun=false;
            }
            else if((disp.indexOf('發送好友驗證請求')!=-1)&&disp!=''){
                isrun=false;
            }
            else if((disp.indexOf('仔細閱讀上述訊息')==-1)&&disp!=''){
                _this.click();
                var _input = $("#textInput");
                var  message = _ajax('other',attr);
                _input.val(message);
                var _click = document.getElementsByClassName("chatSend");
                _click[0].click();
                isrun=false;
            }*/

        }
    })
}
function _ajax(disp,attr){
    var message='';
    $.ajax({
        url:'http://112.124.97.72/Auto_Server/autoserver.php',
        async:false,
        type:'GET',
        data:"message="+disp+"&id="+attr,
        success:function(e){
            if(e){
                message = e;
            }
            else{

            }
        }
    })
    return message;
}
var time='3500';
 function run(){
    _autorun = setInterval('start()',time);
}

//alert(1);
var button = "<div id='plugin'><p id='message'>注意待左側會話列表完全載入完畢之後再點擊以下按鈕 V1.4.4 只回複第一條版本</p>";
    button+="<button id='weixin_button'>執行指令碼</button>";
    button+="<button id='stop'>停止指令碼</button>"
    button+="<span>指令碼重新整理一次時間調整:</span><input type='number' id='frequ' value='3.5'><span>秒</span><button id='sub'>確定</button></div>";
$("body").prepend(button);
$("#weixin_button").click(function(){
    $(this).css({'background':'#30DA59','color':'rgb(253, 248, 248)'});
    $("#stop").css({'background':'#BEC7C0','color':'rgb(14, 9, 9)'})
    run();
})
$("#stop").click(function(){
    $(this).css({'background':'#30DA59','color':'rgb(253, 248, 248)'});
    $("#weixin_button").css({'background':'#BEC7C0','color':'rgb(14, 9, 9)'})
    window.clearInterval(_autorun);
})
$("#sub").click(function(){
    var _second = parseFloat($("#frequ").val());
    if(_second<2){
        alert('重新整理時間過短,人數增加較多時可能出現指令碼崩潰!請重新設定!');
        $("#frequ").val('3.5');
        time = 3500+"";
    }
    else if(_second>6){
        var is_true = confirm('重新整理時間過長,使用者可能很長時間接收不到訊息,確定需要這樣設定嗎?');
        if(is_true){
            time = _second*1000+"";
            alert('修改重新整理時間後請停止指令碼之後再點擊執行指令碼才會生效.');
        }
        else{
            $("#frequ").val('3.5');
            time = 3500+"";
        }
    }
    else{
        time = _second*1000+"";
        alert('修改重新整理時間後請停止指令碼之後再點擊執行指令碼才會生效.');
    }
    console.log("時間修改為:"+time+"毫秒");
})

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.