1 // ==UserScript== 2 // @name 12306 3 // @namespace 12306 4 // @version 0.1 5 // @description enter something useful 6 // @match https://dynamic.12306.cn/* 7 // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js 8 // @copyright 2012+, You 9 // ==/UserScript==10 11 //var dom = $(window.frames['main'].document); var btn = dom.find('#submitQuery'); var dt = dom.find(''); var interval = setInterval(function(){ btn.click(); if() },100);12 13 14 //验证码15 var code = $('input[name=randCode]'); 16 17 //查询按钮18 var btn = $('#submitQuery');19 20 if(btn.length == 0 && code == 0) 21 { 22 return;23 }24 25 //输入验证码后自动下单26 code.keyup(function(){ 27 if($(this).val().length == 4)28 {29 $('.long_button_u').last().focus();30 }31 }) 32 33 //自动查询34 $('').insertAfter(btn);35 36 $('#auto').click(function(){ this.disabled = true; auto()}); 37 38 function check()39 { 40 if($('.btn130_2').length > 0)41 {42 //自动预定43 $('.btn130_2').click();44 alert('有票了!');45 clearInterval(interval);46 }47 }48 var interval ;49 50 //自动查询并预定51 function auto()52 { 53 var interval = setInterval(function(){ 54 btn.click();55 check();56 },100);57 }58
随手写的,功能简单, 自动刷票,刷到了直接跳到订单页, 然后直接输入4位验证码自动提交订单.
祝愿春运能变的简单一点..