Fast Linesplit (like fast split)

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Fast Linesplit (like fast split)
// @namespace    Put your cursor on top of on of the dots and press U
// @version      1.1
// @description  Put your cursor on top of on of the dots and press U
// @author       Net#1872
// @license      GPL-3.0-or-later
// @match        https://cellcraft.io/
// @match        https://agma.io/
// @grant        none
// ==/UserScript==

var split = "U"
window.addEventListener('keydown', keydown);
setTimeout(function() {
    split = split.charCodeAt(0)

}, 50)
function fsLine(){
    $("#canvas").trigger($.Event("keydown", { keyCode: 84}));
    $("#canvas").trigger($.Event("keyup", { keyCode: 84}));
}
function freezeKey() {
    $("#canvas").trigger($.Event("keydown", { keyCode: 70}));
    $("#canvas").trigger($.Event("keyup", { keyCode: 70}));
}

function keydown(event) {
    if(event.keyCode == split){
        fsLine()
        setTimeout(freezeKey, 115)
        setTimeout(freezeKey, 165)
    }
}



$("head").append(`<style>
.point {
  background-color:#333;
}

.point:hover {
  background-color: orange;
}
</style>`);

//Credit to wynell for the window.innerHeight and window.innerWidth

let [w, h] = [, window.innerHeight]
$('body').append(`
<div class="point" id="point-top" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  window.innerWidth / 2
}px; top: ${0}px; transform: translate(-50%, -50%);"></div>
<div class="point" id="point-right" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  window.innerWidth
}px; top: ${window.innerHeight / 2}px; transform: translate(-50%, -50%);"></div>
<div class="point" id="point-bottom" onclick="fsLine()" style="border: 2px solid white; border-radius: 100%; width: 15px; height: 15px; position: fixed; left: ${
  window.innerWidth / 2
}px; top: ${window.innerHeight}px; transform: translate(-50%, -50%);"></div>
<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: ${
  window.innerHeight / 2
}px; transform: translate(-50%, -50%);"></div>
</div>`)
$('#settingTab3,.rab-radius').click(function (e) {
  $('#roleSettings').css('display', 'block')
  $('#cLinesplitOverlay')
    .removeAttr('disabled')
    .parent()
    .parent()
    .css('display', 'block')
})

$(window).resize(function (e) {
  let [w, h] = [window.innerWidth, window.innerHeight]
  $('#point-top')
    .css('left', `${window.innerWidth / 2}px`)
    .css('top', `${0}px`)
  $('#point-right')
    .css('left', `${window.innerWidth}px`)
    .css('top', `${window.innerHeight / 2}px`)
  $('#point-bottom')
    .css('left', `${window.innerWidth / 2}px`)
    .css('top', `${window.innerHeight}px`)
  $('#point-left')
    .css('left', `${0}px`)
    .css('top', `${window.innerHeight / 2}px`)
})