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') { if (typeof update_speed_emoji_modal == 'function') {
let forms = e.querySelectorAll("textarea, .allow-emojis"); insertGhostDivs(e)
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);
});
} }
} }

View File

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