Created
December 11, 2015 13:42
-
-
Save accelazh/67db723eb683b0b237bf to your computer and use it in GitHub Desktop.
When using "自动查询" + "自动提交" on 12306, frequently it pops out the auto commit window with zero ticket left. This is extremely distracting when trying to buy ticket for New Year Festival. Because You have to close the window, which waste your precious seconds, You cannot wait in peace for true tickets to come out, but have to be frequently disrupte…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function check_auto_buy() { | |
| if (!$('#content_autosubmitcheckticketinfo').is(':visible')) { | |
| // auto buy ticket window didn't show up | |
| return false; | |
| } | |
| var all_zero = true; | |
| $('#sy_ticket_num_id strong').each(function(i, val){ | |
| if (0 != $(val).text()) { | |
| all_zero = false; | |
| return false; | |
| } | |
| }); | |
| console.debug("[" + new Date() + "] " + "No tickets left?: " + all_zero); | |
| if (!all_zero) { | |
| // there is some tickets left, click buy button | |
| if (!$(".touclick[name=touclick-randCode_other]").is(':visible')) { | |
| $('#qr_submit').click(); | |
| } | |
| return true; | |
| } | |
| // no tickets left, cancel the window | |
| $('#back_edit').click(); | |
| setTimeout(function() { | |
| $("#query_ticket").click(); | |
| }, 500); | |
| return false; | |
| } | |
| setInterval(check_auto_buy, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment