百度 tower auto click

百度 tower 点击脚本

  1. // ==UserScript==
  2. // @name 百度 tower auto click
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description 百度 tower 点击脚本
  6. // @author 观主
  7. // @match http://tower.baidu.com/teams/*
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. function simulate(element) {
  13. var options = {
  14. pointerX: 0,
  15. pointerY: 0,
  16. button: 0,
  17. ctrlKey: false,
  18. altKey: false,
  19. shiftKey: false,
  20. metaKey: false,
  21. bubbles: true,
  22. cancelable: true
  23. }
  24. var oEvent = document.createEvent('MouseEvents');
  25. oEvent.initMouseEvent('click', options.bubbles, options.cancelable, document.defaultView,
  26. options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
  27. options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
  28. element.dispatchEvent(oEvent);
  29. }
  30. function start() {
  31. var a = document.querySelectorAll('button.btn.btn-primary.ng-binding.ng-scope');
  32. if(!a.length) return;
  33. var ele = a[a.length-1]
  34. // if(ele.innerText !== '开始下一阶段') return;
  35. simulate(ele, "click");
  36. setTimeout(function () {
  37. var btn = document.querySelector('.modal-footer.ng-scope .btn-default')
  38. btn && simulate(btn, "click");
  39. }, 1e3)
  40. }
  41. setInterval(start, 5e3)
  42. })();