You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

59 lines
1.3 KiB

const $ = require("../javascripts/jquery.min.js");
var keys = {};
var index;
$("input[type=text]").on("keyup", e => {
keys[e.key.toUpperCase()] = false;
setInput();
});
$("input[type=text]").on("keydown", e => {
Object.keys(keys).forEach(g => {
if (!keys[g])
delete keys[g];
});
keys[e.key.toUpperCase()] = true;
setInput();
});
function setInput() {
$(".keybind-input").val(Object.keys(keys).toString().replace(/,/gi, " + "));
}
$(".add-keybind").click(() => {
index = 0;
resetKeyAdder();
$(".dark-overlay").show().addClass("d-flex");
$(".keybind-input").focus();
});
$(".cancel-btn").click(() => {
$(".dark-overlay").hide().removeClass("d-flex");
resetKeyAdder()
})
$(".done-btn").click(() => {
switch (index) {
case 0:
$(".keybind-input").hide();
$(".select-function").show();
$(".done-btn").html("Done");
break;
case 1:
$(".dark-overlay").hide().removeClass("d-flex");
resetKeyAdder();
break;
default:
break;
4 years ago
}
index++;
})
function resetKeyAdder() {
$(".keybind-input").show().prop("value", "");
$(".select-function").hide();
$(".done-btn").html("Next");
}