-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-script.js
1 lines (1 loc) · 945 Bytes
/
main-script.js
1
let areMessageInputsValid = !0; document.querySelector("#start-campaign-button").addEventListener("click", (() => { if (areMessageInputsValid) { const e = parseInt(document.querySelector("#min-messages").value), s = parseInt(document.querySelector("#max-messages").value), a = document.querySelector("#campaigns-dropdown").value; chrome.runtime.sendMessage({ message: "start_campaign", campaignName: a, minMessages: e, maxMessages: s }) } })), document.addEventListener("DOMContentLoaded", (function () { const e = document.querySelectorAll(".message-input"); e.forEach((function (e) { e.addEventListener("input", (function () { const s = parseInt(document.querySelector("#min-messages").value, 10), a = parseInt(document.querySelector("#max-messages").value, 10); isNaN(s) || isNaN(a) || s < 0 || a > 70 || s > a ? (areMessageInputsValid = !1, e.style.outline = "2px solid red") : (areMessageInputsValid = !0, e.style.outline = "") })) })) }));