apactix抢票

一个在apactix上抢票的小助手

  1. // ==UserScript==
  2. // @name apactix抢票
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 一个在apactix上抢票的小助手
  6. // @author sfdye
  7. // @match https://booking.apactix.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // 设置抢票张数
  12. const ticAmount = 8;
  13.  
  14. // 设置抢票区域
  15. const section = "B";
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. var areaObj = getAreaBySec(section);
  21.  
  22. if (areaObj) {
  23. // 设置区域
  24. jQuery('div#section-sel').html('YOUR PREFERRED SECTION IS <big>'+ areaObj.description.replace(/ *\<[^)]*\> */g, "") + '</big>');
  25. assignPrice(areaObj);
  26. }
  27.  
  28. var ticQuantity = document.getElementById("qty_0");
  29. // 设置张数
  30. if (ticQuantity) ticQuantity.value = ticAmount;
  31.  
  32. var capKey = document.getElementById("capKey");
  33. if (capKey) capKey.focus();
  34.  
  35. var addtocart = document.getElementById("addtocart-btn");
  36. if (addtocart) {
  37. // 提交
  38. addtocart.click();
  39. }
  40.  
  41. })();