diff --git a/files/assets/js/core.js b/files/assets/js/core.js index fe71ee244..303db35d1 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -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) } } diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index b5eebb7d3..4399f40b4 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -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 => { - 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 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) {