jquery ajaxによる微信自動返信プラグイン

7009 ワード

myscript.js
 
  
var _autorun;
var str = new Array(' ',' ',' ',' �D�l',' ',' ',' ',' ',' ',' ',' ','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 = "

V1.4.4

";
    button+="";
    button+=""
    button+=" :
";
$("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+" ");
})