///
by speeduploop
///
//////////////////////////////
////KEYPAD HANDLER////////////
//////////////////////////////
let longpress = false;
const longpress_timespan = 1000;
let timeout;
function repeat_action(param) {
switch (param.key) {
case "0":
break;
}
}
//////////////
////LONGPRESS
/////////////
function longpress_action(param) {
switch (param.key) {
case "0":
break;
case "ArrowLeft":
if (status.view == "list-view") {
delete_event();
}
break;
}
}
///////////////
////SHORTPRESS
//////////////
function shortpress_action(param) {
switch (param.key) {
case "*":
break;
case "ArrowUp":
break;
case "ArrowDown":
break;
case "ArrowRight":
break;
case "ArrowLeft":
break;
case "1":
break;
case "3":
break;
case "2":
break;
case "#":
break;
case "7":
break;
case "SoftRight":
case "Alt":
break;
case "SoftLeft":
case "Control":
break;
case "Enter":
break;
case "Backspace":
break;
}
}
/////////////////////////////////
////shortpress / longpress logic
////////////////////////////////
function handleKeyDown(evt) {
if (evt.key === "Backspace") {
}
if (evt.key === "EndCall") {
evt.preventDefault();
window.close();
}
if (!evt.repeat) {
longpress = false;
timeout = setTimeout(() => {
longpress = true;
longpress_action(evt);
}, longpress_timespan);
}
if (evt.repeat) {
if (evt.key == "Backspace") longpress = false;
repeat_action(evt);
}
}
function handleKeyUp(evt) {
if (status.visible === false) return false;
if (evt.key == "Backspace" && document.activeElement.tagName == "INPUT") {
}
clearTimeout(timeout);
if (!longpress) {
shortpress_action(evt);
}
}
document.addEventListener("keydown", handleKeyDown);
document.addEventListener("keyup", handleKeyUp);