jquery uses Ajax to implement the micro-letter automatic reply plug-in _jquery

Source: Internet
Author: User
Tags stop script

Myscript.js

Copy Code code as follows:

var _autorun;
var str = new Array (' Forward what ', ' share what ', ' forwarded ', ' transferred ', ' forwarding ', ' continue to apply ', ' in no ', ' sent ', ' to forward ', ' to share ', ' shared ', ' yv ', ' bv ', ' gv ', ' PV ', ' RV ', ' Hello ', ' Beauty ', ' ask ', ' Code ', ' I want ', ' Want V ', ' want to add V ';
var isrun = false;
var i=0;
function Start () {
Console.log (' first ' + (++i) + ' secondary 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 ') {
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 (' You have added ')!=-1| | Disp.indexof (' Through your friend Authentication request ')!=-1| | Disp.indexof (' You add to Address Book ')!=-1) {
_this.click ();
var _input = $ ("#textInput");
var message = _ajax (' You have added ', attr);
_input.val (message);
var _click = document.getelementsbyclassname ("Chatsend");
_click[0].click ();
Isrun=false;
}
else if ((Disp.indexof (' Send buddy authentication request ')!=-1) &&disp!= ') {
Isrun=false;
}
else if ((Disp.indexof (' Read the above message ')!=-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 (' You add to Address Book ')!=-1) {
_this.click ();
var _input = $ ("#textInput");
var message = _ajax (' You add to Address Book ', attr);
_input.val (message);
var _click = document.getelementsbyclassname ("Chatsend");
_click[0].click ();
Isrun=false;
}
else if (Disp.indexof (' You have added ')!=-1| | Disp.indexof (' Through your friend Authentication request ')!=-1) {
_this.click ();
var _input = $ ("#textInput");
var message = _ajax (' You have added ', attr);
_input.val (message);
var _click = document.getelementsbyclassname ("Chatsend");
_click[0].click ();
Isrun=false;
}
else if ((Disp.indexof (' Send buddy authentication request ')!=-1) &&disp!= ') {
Isrun=false;
}
else if ((Disp.indexof (' Read the above message ') ==-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 ' > Note After the left session list is fully loaded, click the following button V1.4.4 only reply to the first version </p>";
button+= "<button id= ' Weixin_button ' > Execute script </button>";
button+= "<button id= ' stop ' > Stop script </button>"
button+= <span> Script Refresh time adjustment: </span><input type= ' number ' id= ' frequ ' value= ' 3.5 ' ><span> sec </ Span><button id= ' Sub ' > OK </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 (' Refresh time is too short to increase the number of people may have a script crash! ");
$ ("#frequ"). Val (' 3.5 ');
Time = 3500+ "";
}
else if (_second>6) {
var is_true = confirm (' Refresh time is too long, the user may not receive the message for a long time, do you want to set this? ');
if (is_true) {
Time = _second*1000+ "";
Alert (' After modifying the refresh time, stop the script and then click the Execute script to take effect. ');
}
else{
$ ("#frequ"). Val (' 3.5 ');
Time = 3500+ "";
}
}
else{
Time = _second*1000+ "";
Alert (' After modifying the refresh time, stop the script and then click the Execute script to take effect. ');
}
Console.log ("Time modified to:" +time+ "milliseconds");
})

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.