weiqi auto jump

按下方向键右,可直接跳到下一题

  1. // ==UserScript==
  2. // @name weiqi auto jump
  3. // @namespace https://www.101weiqi.com/qday/
  4. // @version 1.0
  5. // @description 按下方向键右,可直接跳到下一题
  6. // @author Lennon
  7. // @match https://*.101weiqi.com/*
  8. // @require http://code.jquery.com/jquery-2.1.1.min.js
  9. // @run-at document-end
  10. // @icon https://deepmind.com/static/v0.0.0/appIcons/favicon.png
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14.  
  15. var elementButton = $('a.btn-info');
  16. $(document).keyup(function(e) {
  17. switch (e.keyCode) {
  18. // arrow left
  19. case 37:
  20. elementButton[0].click();
  21. break;
  22. // arrow right
  23. case 39:
  24. if($('div[ng-click="startnext()"]').length) {
  25. $('div[ng-click="startnext()"]').click();
  26. } else if ($(elementButton[1]).length) {
  27. elementButton[1].click();
  28. } else if ($('div.huati_lei > span > a').attr('href').length) {
  29. location.href = $('div.huati_lei > span > a').attr('href');
  30. }
  31. break;
  32. }
  33.  
  34. return !0
  35. })
  36. })();