From b79e7d092b3f761a2729d45be2640fa429e30206 Mon Sep 17 00:00:00 2001 From: "Leo G." <83966683+vLeov@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:30:39 +0200 Subject: [PATCH] add(errormsg): updated the js --- popup/popup.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/popup/popup.js b/popup/popup.js index c7c4619..810dc98 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -4,7 +4,9 @@ document.getElementById('changeColorBtn').addEventListener('click', () => { chrome.tabs.query({active: true, currentWindow: true}, (tabs) => { chrome.tabs.sendMessage(tabs[0].id, {changeColorBtn: true, color: color}, (response) => { if (response !== undefined && response.faieldColorValidation) { - alert("Color must be written as #RRGGBB"); + const errorMessage = document.getElementById('error-message-color'); + errorMessage.innerHTML = "Color must be written as #RRGGBB"; + errorMessage.style.display = 'block'; } }); }); @@ -26,7 +28,9 @@ document.getElementById('autologinBtn').addEventListener('click', () => { key: key }, (response) => { if (response !== undefined && response.failedInputValidation) { - alert("Input Validation Failed! Please Check Your Input and Try Again. View the GitHub Repo for more info."); + const errorMessage = document.getElementById('error-message-login'); + errorMessage.innerHTML = 'Input Validation Failed! Please Check Your Input and Try Again. View the GitHub Repo for more info.'; + errorMessage.style.display = 'block'; } }); }); @@ -54,8 +58,9 @@ document.getElementById('autologinEncryptionBtn').addEventListener('click', () = chrome.tabs.query({active: true, currentWindow: true}, (tabs) => { chrome.tabs.sendMessage(tabs[0].id, {autologinEncryptionBtn: true, key: key}, (response) => { if (response !== undefined && response.failedInputValidation) { - alert("Input Validation Failed! Please Check Your Input and Try Again. View the GitHub Repo for more info."); - } + const errorMessage = document.getElementById('error-message-login'); + errorMessage.textContent = "Input Validation Failed! Please Check Your Input and Try Again. View the GitHub Repo for more info."; + errorMessage.style.display = 'block'; } }); }); }); @@ -102,4 +107,4 @@ function getDarkMode() { } getAutologinState(); -getDarkMode(); \ No newline at end of file +getDarkMode();