MyKirito Reincarnation PlugIn

霸權轉生點:不要再按到手軟

  1. // ==UserScript==
  2. // @name MyKirito Reincarnation PlugIn
  3. // @namespace https://github.com/JCxYIS/mykirito-reincarination-plugin
  4. // @version 1.0
  5. // @description 霸權轉生點:不要再按到手軟
  6. // @author JCxYIS
  7. // @match https://mykirito.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function()
  12. {
  13. 'use strict';
  14.  
  15.  
  16. // 參數
  17. const FUNC_NAME_LIST = ["+", "-"];
  18. const TIMES_LIST = [10, 100]
  19. let lastPath = ""
  20.  
  21. // 進入點
  22. setInterval ( function ()
  23. {
  24. if ( lastPath != location.pathname )
  25. {
  26. lastPath = location.pathname;
  27. main ();
  28. }
  29. }
  30. , 1000
  31. );
  32.  
  33.  
  34.  
  35. // 主函式
  36. function main()
  37. {
  38. if(location.pathname != "/reincarnation")
  39. {
  40. return;
  41. }
  42.  
  43. console.log("insert reincar")
  44.  
  45. // 綁按紐
  46. let allbuttons = Array.from( document.getElementsByTagName('button') );
  47. for(let i = 0; i < allbuttons.length && i < 50; i++)
  48. {
  49. for(let j = 0; j < FUNC_NAME_LIST.length; j++)
  50. {
  51. if(allbuttons[i].innerText === FUNC_NAME_LIST[j] && allbuttons[i].offsetParent !== null) /*.parentElement.style.display != "none"*/
  52. {
  53.  
  54. // 綁次數
  55. for(let k = 0; k < TIMES_LIST.length; k++)
  56. {
  57. let newButt = allbuttons[i].cloneNode(true);
  58. newButt.innerHTML += TIMES_LIST[k];
  59.  
  60. // func
  61. newButt.onclick = ()=>
  62. {
  63. let t = TIMES_LIST[k];
  64. function doclick()
  65. {
  66. // console.log(t);
  67. t--;
  68. allbuttons[i].click();
  69. if(t > 0)
  70. setTimeout(() => {doclick()}, 0);
  71. }
  72. doclick();
  73. };
  74.  
  75. // insert
  76. let p = allbuttons[i].parentNode
  77. if(allbuttons[i].innerHTML === "-")
  78. p.insertBefore(newButt, allbuttons[i].parentNode.firstChild);
  79. else
  80. p.appendChild(newButt);
  81. // console.log(k+" Binded "+newButt.innerHTML);
  82. }
  83. }
  84. }
  85. }
  86. }
  87.  
  88. })();