autolaocai

try to take over the world!

  1. // ==UserScript==
  2. // @name autolaocai
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author zhouqiang
  7. // @match https://www.laocaibao.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. "use strict";
  13.  
  14. // Your code here...
  15. console.log("Now, Let's GO! url = " + document.URL);
  16. if(document.URL.startsWith("https://www.laocaibao.com/products/")) {
  17. setTimeout(function() {
  18. console.log("reload pages...");
  19. window.location.reload();
  20. }, 20000);
  21. console.log("click buy button~");
  22. $('.nowBuy-btn').click();
  23. setTimeout(function() {
  24. console.log("click order buy button~");
  25. $('.buy-btn').click();
  26. }, 800);
  27. } else if(document.URL === "https://www.laocaibao.com/user/queryOrder") {
  28. console.log("click confirm button~");
  29. $('.confirm-btn').click();
  30. setTimeout(function() {
  31. $(".inputTradePwd-form-input").each(function(index){
  32. this.value = 3;
  33. this.onkeyup = function(e) {
  34. console.log(e);
  35. };
  36. let mockKeyEvent = {
  37. key: "3",
  38. code: "Digit3",
  39. keyCode: 51
  40. };
  41. let keyEvent = document.createEvent("KeyboardEvent");
  42. keyEvent.initKeyboardEvent("keyup", false, false, window, "Digit3", 2, false, false, false, false, false);
  43. Object.defineProperty(keyEvent, 'key', {
  44. value: "3",
  45. writable: true,
  46. enumerable: true,
  47. configurable: true
  48. });
  49. Object.defineProperty(keyEvent, 'code', {
  50. value: "Digit3",
  51. writable: true,
  52. enumerable: true,
  53. configurable: true
  54. });
  55. Object.defineProperty(keyEvent, 'keyCode', {
  56. value: 51,
  57. writable: true,
  58. enumerable: true,
  59. configurable: true
  60. });
  61. // keyEvent.key = "3";
  62. // keyEvent.code = "Digit3";
  63. // keyEvent.keyCode = 51;
  64. this.dispatchEvent(keyEvent);
  65. });
  66. setTimeout(function() {
  67. $(".charge-goon").click();
  68. }, 300);
  69. }, 300);
  70. }
  71. })();