dedup function

master
Aevann 2023-08-12 21:57:59 +03:00
parent ab83e2e65f
commit 6acb3a159a
2 changed files with 12 additions and 19 deletions

View File

@ -195,15 +195,7 @@ function bs_trigger(e) {
});
if (typeof update_speed_emoji_modal == 'function') {
let forms = e.querySelectorAll("textarea, .allow-emojis");
forms.forEach(i => {
let pseudo_div = document.createElement("div");
pseudo_div.className = "ghostdiv";
pseudo_div.style.display = "none";
i.after(pseudo_div);
i.addEventListener('input', update_speed_emoji_modal, false);
i.addEventListener('keydown', speed_carot_navigate, false);
});
insertGhostDivs(e)
}
}

View File

@ -511,16 +511,17 @@ function speed_carot_navigate(event)
}
}
// Let's get it running now
let forms = document.querySelectorAll("textarea, .allow-emojis");
forms.forEach(i => {
function insertGhostDivs(element) {
let forms = element.querySelectorAll("textarea, .allow-emojis");
forms.forEach(i => {
let pseudo_div = document.createElement("div");
pseudo_div.className = "ghostdiv";
pseudo_div.style.display = "none";
i.after(pseudo_div);
i.addEventListener('input', update_speed_emoji_modal, false);
i.addEventListener('keydown', speed_carot_navigate, false);
});
});
}
function loadEmojis(inputTargetIDName)
{