Fast Linesplit (like fast split)

Put your cursor on top of on of the dots and press U

  1. // ==UserScript==
  2. // @name Fast Linesplit (like fast split)
  3. // @namespace Put your cursor on top of on of the dots and press U
  4. // @version 1.1
  5. // @description Put your cursor on top of on of the dots and press U
  6. // @author Net#1872
  7. // @license GPL-3.0-or-later
  8. // @match https://cellcraft.io/
  9. // @match https://agma.io/
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. var split = "U"
  14. window.addEventListener('keydown', keydown);
  15. setTimeout(function() {
  16. split = split.charCodeAt(0)
  17.  
  18. }, 50)
  19. function fsLine(){
  20. $("#canvas").trigger($.Event("keydown", { keyCode: 84}));
  21. $("#canvas").trigger($.Event("keyup", { keyCode: 84}));
  22. }
  23. function freezeKey() {
  24. $("#canvas").trigger($.Event("keydown", { keyCode: 70}));
  25. $("#canvas").trigger($.Event("keyup", { keyCode: 70}));
  26. }
  27.  
  28. function keydown(event) {
  29. if(event.keyCode == split){
  30. fsLine()
  31. setTimeout(freezeKey, 115)
  32. setTimeout(freezeKey, 165)
  33. }
  34. }
  35.  
  36.  
  37.  
  38. $("head").append(`<style>
  39. .point {
  40. background-color:#333;
  41. }
  42.  
  43. .point:hover {
  44. background-color: orange;
  45. }
  46. </style>`);
  47.  
  48. //Credit to wynell for the window.innerHeight and window.innerWidth
  49.  
  50. let [w, h] = [, window.innerHeight]
  51. $('body').append(`
  52. <div class="point" id="point-top" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  53. window.innerWidth / 2
  54. }px; top: ${0}px; transform: translate(-50%, -50%);"></div>
  55. <div class="point" id="point-right" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  56. window.innerWidth
  57. }px; top: ${window.innerHeight / 2}px; transform: translate(-50%, -50%);"></div>
  58. <div class="point" id="point-bottom" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  59. window.innerWidth / 2
  60. }px; top: ${window.innerHeight}px; transform: translate(-50%, -50%);"></div>
  61. <div class="point" id="point-left" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${0}px; top: ${
  62. window.innerHeight / 2
  63. }px; transform: translate(-50%, -50%);"></div>
  64. </div>`)
  65. $('#settingTab3,.rab-radius').click(function (e) {
  66. $('#roleSettings').css('display', 'block')
  67. $('#cLinesplitOverlay')
  68. .removeAttr('disabled')
  69. .parent()
  70. .parent()
  71. .css('display', 'block')
  72. })
  73.  
  74. $(window).resize(function (e) {
  75. let [w, h] = [window.innerWidth, window.innerHeight]
  76. $('#point-top')
  77. .css('left', `${window.innerWidth / 2}px`)
  78. .css('top', `${0}px`)
  79. $('#point-right')
  80. .css('left', `${window.innerWidth}px`)
  81. .css('top', `${window.innerHeight / 2}px`)
  82. $('#point-bottom')
  83. .css('left', `${window.innerWidth / 2}px`)
  84. .css('top', `${window.innerHeight}px`)
  85. $('#point-left')
  86. .css('left', `${0}px`)
  87. .css('top', `${window.innerHeight / 2}px`)
  88. })
  89.