JS Brush Ticket Script

Source: Internet
Author: User

Now the script has the following features:
1. Prevent auto-brush ticket from crashing (automatically re-swipe the ticket after hanging off)
2. Custom Query time interval
3. Custom Auto Refresh Interval
4, Breakthrough 5 train limit
5, according to the time period, the type of car to brush all the satisfaction of the train
Don't say much nonsense, just go to the code:

//Record Wait TimevarWaittime=0; //Statistical Wait TimefunctionWaitforrestart () {if(!$ ("#autoSubmit"). Prop ("checked"))return ; if($ ("#query_ticket"). Text () = = "Stop Query") {waittime++; }      if(waittime>10){          $("#query_ticket"). Click (); SetTimeout (function() {waittime=0; if($ ("#query_ticket"). Text () = = "Query") {                  $("#query_ticket"). Click (); }          },1000); }  }    //Registering callback MethodsfunctionCallback (FUN1,FUN2) {fun1 ();  Fun2 (); }    //Add a ride personfunctionAddbuyer (name) {callback ($.showselectbuyer,function(){      $("#buyer-list li[p_value^=" +name+ "]"). Click ();    $.closeselectbuyer ();  }); }    //breaking limits, adding tripsfunctionAddtrain (Traincode) {$ ("#prior_train"). Append (' <span name= ' Prior_train-span "class=" Sel-box w80 "> ' +traincode+ ' <a class=" Close " href= "javascript:" onclick= "$.removesel (This," ' +traincode+ ' ", 4)" ></a></span> "); }    //Add priority seatsfunctionAddseat (seat) {callback ($.showselectseat,function(){      $("#seat-list li[name^=" +seat+ "]"). Click ();    $.closeselectseat ();  }); }    //Custom query IntervalfunctionAddtimes (starttime,endtime) {$ ("#cc_start_time"). Append (' <option value= ' +starttime.replace (":", "") +endtime.replace (":", "") + ' "> ' + Starttime+ '--' +endtime+ ' </option> '); $("#cc_start_time Option:last"). selected (); }    //query all the satisfied trains according to the time period and type of train. functionQuerybytimeandtraintype () {callback ($.showyxtrain,function(){      varYxtraintimer = SetInterval (function(){        if($ ("#filterTic"). length>0){          $("#filterTic"). Prop ("Checked",true); $("#yxtrain_close"). Click ();        Clearinterval (Yxtraintimer); }      },10);  }); }  

The above is to provide a way to modify the configuration, the following are self-configuring according to the requirements, we can select the trips to brush the ticket, or according to the time period + type of train to brush the time period of a certain type of train. Separately speaking:
1. Swipe the ticket according to the train
Specific operation:
Open 12306 website
Select the direction of the train and the departure date.
Filter out the trains to be refreshed, passengers, seats to do, etc., replace the following content

//==========================================  //The following are self-configuring as required://passengers, trains, Sibe//Show only the trips to be brushed, query interval, refresh time//==========================================    //Choose a person to rideAddbuyer ("Zhang San"); Addbuyer ("' John Doe (adult) '"); Addbuyer ("' Harry (student) '"); //Manually add trains, add them in order of precedence (easily break through the 5 train limit)Addtrain ("G100"); Addtrain ("G101"); Addtrain ("G102"); Addtrain ("G103"); Addtrain ("G104"); Addtrain ("G105"); Addtrain ("G106"); Addtrain ("G107"); //Add priority seats, add them in order of precedenceAddseat ("second-waiting Seat")); Addseat ("A Seat"); //auto refresh time 1sautosearchtime=1000; //pick up Booking assistant$ (". Up"). Click (); //Start detection anti-hangvarTimer =setinterval (waitforrestart,autosearchtime); //start to swipe ticketsif($ ("#query_ticket"). Text () = = "Query"){    varTimer2 = SetInterval (function(){      if($ ("#auto_query"). Prop ("checked") && $ ("#autoSubmit"). Prop ("checked") && $ ("#filterTic"). Prop (" Checked)){        $("#query_ticket"). Click ();      Clearinterval (TIMER2); }    },10); }  

2. Refresh the tickets for a specific type of train within a certain time period, such as refreshing all high-speed rail + tickets between 09:30-12:15
Specific operation:
Open 12306
Choose the direction of the train and the departure date.
Determine the time period, type of train, seat, and replace the following content

//==========================================  //The following are self-configuring as required://passengers, trains, Sibe//Show only the trips to be brushed, query interval, refresh time//==========================================    //Choose a person to rideAddbuyer ("Zhang San"); Addbuyer ("' John Doe (adult) '"); Addbuyer ("' Harry (student) '"); //Add priority seats, add them in order of precedenceAddseat ("second-waiting Seat")); //set the query interval manuallyAddtimes ("09:30", "12:15"); //Show only HSR + bullet train$ (". Check[value= ' G ']"). Prop ("Checked",true); $(". Check[value= ' D ']"). Prop ("Checked",true); //Show only the time period of the train, only show the ticket, two choose one//Note that if the item is selected, the checked trips are not valid. Querybytimeandtraintype (); //auto refresh time 1sautosearchtime=1000; //pick up Booking assistant$ (". Up"). Click (); //Start detection anti-hangvarTimer =setinterval (waitforrestart,autosearchtime); //start to swipe ticketsif($ ("#query_ticket"). Text () = = "Query"){    varTimer2 = SetInterval (function(){      if($ ("#auto_query"). Prop ("checked") && $ ("#autoSubmit"). Prop ("checked") && $ ("#filterTic"). Prop (" Checked)){        $("#query_ticket"). Click ();      Clearinterval (TIMER2); }    },10); }  

Paste the above modified content onto the browser console (F12,console tab) and press ENTER to execute. You can automatically start to swipe the ticket. If the refresh request is timed out, the timeout wait time is logged by waittime, and the refresh is automatically canceled when >10, and the auto-swipe ticket is restarted after 1 seconds.

JS Brush Ticket Script

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.