Home > Web Front-end > JS Tutorial > body text

jquery uses ajax to implement WeChat automatic reply plug-in_jquery

WBOY
Release: 2016-05-16 16:51:03
Original
1501 people have browsed it

myscript.js

Copy code The code is as follows:

var _autorun;
var str = new Array('Forward what', 'Share what', 'Forwarded', 'Already forwarded', 'Already forwarded', 'Continue to apply', 'In Not','Sent','To forward','To share','Shared','yv','bv','gv','pv','rv','Hello','Beauty ','request','code','I want','want v','want to add v');
var isrun = false;
var i=0;
function start() {
console.log('th' (i) 'refresh');
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')){
                                                                                      '));
var disp = _me.find('p.desc').html();
disp = disp.toLowerCase();
disp = disp.trim();
for (var i = 0; i < str.length; i ){
                                                                                                                                                                                          
         }; ('You added to the address book')!=-1){
                                                                                                                                                                                                ',attr);
_input.val(message);
var _click = document.getElementsByClassName("chatSend");
_click[0].click();
                isrun=false;
                                                                                                                                                                   else if ((disp.indexOf('Read the above message carefully')!=-1)&&disp!=''){
                                                                                               🎜>                                                                                                   );
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 = "

Please wait until the session list on the left is completely loaded before clicking the following Button V1.4.4 only replies to the first version

";
button ="";
button ="< button id='stop'>Stop the script"
button ="The script refreshes once and adjusts the time:seconds
";
$("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('The refresh time is too short, the script may crash when the number of people increases! Please reset!');
$("# frequ").val('3.5');
time = 3500 "";
}
else if(_second>6){
var is_true = confirm('The refresh time is too long, the user You may not receive messages for a long time, are you sure you need to set this up?');
                                                                                                                                                                  Then click to execute the script to take effect.');
      }
        else{
                                                                                                                                                                                                                                                           ; }
}
else{
time = _second*1000 "";
alert('After modifying the refresh time, please stop the script and then click to execute the script to take effect.');
}
console.log("Time modified to:" time "milliseconds");
})




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template