From a93435f1004d2c5871504cf13d40279fe7db26da Mon Sep 17 00:00:00 2001 From: Ziga Date: Tue, 28 Jun 2022 14:41:12 +0200 Subject: [PATCH] Website Icons can now be toggled and optimized visual performance of toggling buttons --- website/css/settings.css | 4 ++++ website/js/default-functions.js | 11 +++++++++++ website/js/passwords.js | 7 ++++++- website/js/settings.js | 19 ++++++++++++++++++- website/passwords.html | 2 +- website/settings.html | 16 ++++++++++++++++ 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/website/css/settings.css b/website/css/settings.css index 77a4ec0..409e805 100644 --- a/website/css/settings.css +++ b/website/css/settings.css @@ -6,4 +6,8 @@ body{ min-width: 500px; min-height: 500px; overflow-x: hidden; +} + +select{ + -webkit-appearance: none; } \ No newline at end of file diff --git a/website/js/default-functions.js b/website/js/default-functions.js index 136d3fa..0aceb7a 100644 --- a/website/js/default-functions.js +++ b/website/js/default-functions.js @@ -34,6 +34,17 @@ function toggleMenu(){ } } +function toggleButton(id){ + let button = document.getElementById(id); + if(button.className.includes('successButton')){ + button.innerText = lang[readData('lang')]["disable"]; + button.className = "dangerButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; + }else{ + button.innerText = lang[readData('lang')]["enable"]; + button.className = "successButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; + } +} + function copyToClipboard(text){ let textArea = document.createElement("textarea"); textArea.value = text; diff --git a/website/js/passwords.js b/website/js/passwords.js index da38b3e..f597ae3 100644 --- a/website/js/passwords.js +++ b/website/js/passwords.js @@ -20,6 +20,7 @@ initStorageCache.then(() => { let start = new Date().getTime(); if (readData('passwords') !== null && typeof(readData('passwords')) !== 'undefined') { const passwords = JSON.parse(readData('passwords')); + const websiteIcons = readData('websiteIcons'); document.getElementById("stats-passwords").innerText = (passwords.length > 0) ? passwords.length : 0; let html_passwords = ""; for (let i = 0; i < passwords.length; i++) { @@ -28,7 +29,11 @@ initStorageCache.then(() => { html_passwords += "
"; //Icon - html_passwords += ""; + if(websiteIcons == "true"){ + html_passwords += ""; + }else{ + html_passwords += ""; + } html_passwords += "
"; //Url html_passwords += website; diff --git a/website/js/settings.js b/website/js/settings.js index da99cfc..0915e68 100644 --- a/website/js/settings.js +++ b/website/js/settings.js @@ -36,6 +36,14 @@ initStorageCache.then(() => { document.getElementById("toggle-2fa-btn").className = "successButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; } + if(readData('websiteIcons') == "true"){ + document.getElementById("toggle-website-icons").innerText = lang[readData('lang')]["disable"]; + document.getElementById("toggle-website-icons").className = "dangerButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; + }else{ + document.getElementById("toggle-website-icons").innerText = lang[readData('lang')]["enable"]; + document.getElementById("toggle-website-icons").className = "successButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; + } + if (readData('autoSearch') == "false") { document.getElementById("toggle-auto-search").innerText = lang[readData('lang')]["enable"]; document.getElementById("toggle-auto-search").className = "successButton font-bold inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md focus:outline-none sm:text-sm"; @@ -421,13 +429,22 @@ document.getElementById("dialog-button-cancel").addEventListener("click", () => hide('dialog'); }); +document.getElementById("toggle-website-icons").addEventListener("click", () => { + if(readData('websiteIcons') == "true") { + writeData('websiteIcons', "false"); + }else{ + writeData('websiteIcons', "true"); + } + toggleButton('toggle-website-icons'); +}); + document.getElementById("toggle-auto-search").addEventListener("click", () => { if (readData('autoSearch') == "false") { writeData('autoSearch', "true"); } else { writeData('autoSearch', "false"); } - location.reload(); + toggleButton('toggle-auto-search'); }); document.getElementById("toggle-2fa-btn").addEventListener("click", () => { diff --git a/website/passwords.html b/website/passwords.html index c43823b..65cf297 100644 --- a/website/passwords.html +++ b/website/passwords.html @@ -101,7 +101,7 @@
Client Version
-
6.2.0
+
6.3.0
diff --git a/website/settings.html b/website/settings.html index e999a1f..57199f6 100644 --- a/website/settings.html +++ b/website/settings.html @@ -154,6 +154,22 @@
+ +
  • +
    + +
    + +
    + +
    +