From 07be66a9eeeb3be7771575efc440461c62f4fc15 Mon Sep 17 00:00:00 2001 From: LukasLen <24789557+LukasLen@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:51:36 +0200 Subject: [PATCH 1/3] Fix settings structure change error * After changing the structure of the settings JSON it will now update to the correct structure --- src/background.js | 12 +++++++++--- src/manifest.json | 2 +- src/manifest_firefox.json | 2 +- src/popup/popup.js | 5 ++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/background.js b/src/background.js index fec3967..86cacee 100644 --- a/src/background.js +++ b/src/background.js @@ -8,7 +8,6 @@ if (typeof browser == "undefined") { globalThis.browser = chrome; } -const styleIdentifier = "pfwa"; const settingsIdentifier = "settings"; const defaultSettings = { settings: { @@ -57,7 +56,11 @@ browser.runtime.onInstalled.addListener(() => { // Set default settings upon install browser.storage.sync.get([settingsIdentifier]).then((result) => { - if (result.hasOwnProperty(settingsIdentifier)) return; + if (result.hasOwnProperty(settingsIdentifier)) { + var defaultKeys = Object.keys(defaultSettings.settings).sort(); + var currentKeys = Object.keys(result.settings).sort(); + if(JSON.stringify(defaultKeys) === JSON.stringify(currentKeys)) return; + } browser.storage.sync.set(defaultSettings); }); }); @@ -67,7 +70,10 @@ browser.commands.onCommand.addListener((command) => { if (command != "toggle") return; browser.storage.sync.get([settingsIdentifier]).then((result) => { - if (!result.hasOwnProperty(settingsIdentifier)) return; + if (!result.hasOwnProperty(settingsIdentifier)) { + browser.runtime.reload(); + return; + } result.settings.on = !result.settings.on; browser.storage.sync.set(result); diff --git a/src/manifest.json b/src/manifest.json index adc2a8d..da4b440 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -3,7 +3,7 @@ "default_locale": "en", "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "3.3.0", + "version": "3.3.1", "action": { "default_title": "__MSG_extensionName__", "default_popup": "popup/popup.html", diff --git a/src/manifest_firefox.json b/src/manifest_firefox.json index 303f37c..842f4e9 100644 --- a/src/manifest_firefox.json +++ b/src/manifest_firefox.json @@ -3,7 +3,7 @@ "default_locale": "en", "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "3.3.0", + "version": "3.3.1", "action": { "default_title": "__MSG_extensionName__", "default_popup": "popup/popup.html", diff --git a/src/popup/popup.js b/src/popup/popup.js index 974b5c3..5bfd236 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -32,7 +32,10 @@ function saveSettings() { let checked = this.checked; browser.storage.sync.get([settingsIdentifier]).then((result) => { - if (!result.hasOwnProperty(settingsIdentifier)) return; + if (!result.hasOwnProperty(settingsIdentifier)) { + browser.runtime.reload(); + return; + } if (id == "on") { result.settings.on = checked; } else if (id === "blurOnIdle") { From b5a59ae8d3c42ef46fdae0f2c1925a91d0a96f94 Mon Sep 17 00:00:00 2001 From: Thiago Gentil Date: Fri, 20 Sep 2024 10:07:28 -0300 Subject: [PATCH 2/3] Fix blur for message text input --- src/css/noDelay.css | 3 ++- src/css/textInput.css | 12 +++++++----- src/css/unblurActive.css | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/css/noDelay.css b/src/css/noDelay.css index 8b9c58b..3fc4b33 100644 --- a/src/css/noDelay.css +++ b/src/css/noDelay.css @@ -128,7 +128,8 @@ div.overlay ._am0k:hover /* user/group profile pic overlay view */, div.x1okw0bk.x1w0mnb:hover /* user profile pic in starred message list */, /* textInput */ -div._ak1l:hover /* message text input */ +div._ak1l:hover /* message text input */, +div._ak1r:hover /* message text input */ { transition-delay: 0.04s !important; -webkit-transition-duration: 0s !important; diff --git a/src/css/textInput.css b/src/css/textInput.css index 2f39e01..29aaa9c 100644 --- a/src/css/textInput.css +++ b/src/css/textInput.css @@ -3,20 +3,22 @@ /* Released under the MIT license, see LICENSE file for details */ /* former wa version (v2.2412.xx) */ -._3Uu1_ /*textarea*/, +._3Uu1_ /* textarea */, /* updated wa version (v2.3000.xx) */ -div._ak1l /* message text input */ +div._ak1l /* message text input */, +div._ak1r /* message text input */ { filter: grayscale(1) opacity(0.25); } /* former wa version (v2.2412.xx) */ -._3Uu1_:hover /*textarea*/, +._3Uu1_:hover /* textarea */, /* updated wa version (v2.3000.xx) */ -div._ak1l:hover /* message text input */ +div._ak1l:hover /* message text input */, +div._ak1r:hover /* message text input */ { filter: grayscale(0) opacity(1); transition-delay: 0.3s; -} \ No newline at end of file +} diff --git a/src/css/unblurActive.css b/src/css/unblurActive.css index 4b1c287..5a8f44f 100644 --- a/src/css/unblurActive.css +++ b/src/css/unblurActive.css @@ -134,7 +134,8 @@ body:hover ._3Uu1_ /*textarea*/, /* updated wa version (v2.3000.xx) */ /* textInput */ -div._ak1l:hover /* message text input */ +div._ak1l:hover /* message text input */, +div._ak1r:hover /* message text input */ { filter: grayscale(0) opacity(1); } From cccabe33374d97b9bf23ee18f9e420fcd9516148 Mon Sep 17 00:00:00 2001 From: LukasLen <24789557+LukasLen@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:33:23 +0100 Subject: [PATCH 3/3] Fix text input blur --- docs/index.html | 2 +- src/manifest.json | 2 +- src/manifest_firefox.json | 2 +- src/popup/popup.js | 45 ++++++++------------------------------- 4 files changed, 12 insertions(+), 39 deletions(-) diff --git a/docs/index.html b/docs/index.html index 8c95479..76f6c1b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,7 +18,7 @@

Privacy Extension For WhatsApp™ Web

-

900,000 Users. Available for Chrome and Firefox.

+

1,200,000 Users. Available for Chrome and Firefox.

Screenshot: Reveal messages on hover. Screenshot: Customize what you want to blur. diff --git a/src/manifest.json b/src/manifest.json index da4b440..a5f8d10 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -3,7 +3,7 @@ "default_locale": "en", "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "3.3.1", + "version": "3.3.2", "action": { "default_title": "__MSG_extensionName__", "default_popup": "popup/popup.html", diff --git a/src/manifest_firefox.json b/src/manifest_firefox.json index 842f4e9..30730db 100644 --- a/src/manifest_firefox.json +++ b/src/manifest_firefox.json @@ -3,7 +3,7 @@ "default_locale": "en", "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "3.3.1", + "version": "3.3.2", "action": { "default_title": "__MSG_extensionName__", "default_popup": "popup/popup.html", diff --git a/src/popup/popup.js b/src/popup/popup.js index 5bfd236..bbff95b 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -68,7 +68,10 @@ function saveFormSettings(ev) { const [key, val] = Object.entries(Object.fromEntries(new FormData(ev.target)))[0]; browser.storage.sync.get([settingsIdentifier]).then((result) => { - if (!result.hasOwnProperty(settingsIdentifier)) return; + if (!result.hasOwnProperty(settingsIdentifier)) { + browser.runtime.reload(); + return; + } if (key === "itBlur") { result.settings.blurOnIdle.idleTimeout = val; } else { @@ -80,7 +83,10 @@ function saveFormSettings(ev) { // Load settings and update switches browser.storage.sync.get([settingsIdentifier]).then((result) => { - if (!result.hasOwnProperty(settingsIdentifier)) return; + if (!result.hasOwnProperty(settingsIdentifier)) { + browser.runtime.reload(); + return; + } switches.forEach((checkbox) => { let id = checkbox.dataset.style; @@ -104,37 +110,4 @@ browser.storage.sync.get([settingsIdentifier]).then((result) => { } }) -}); - - -/* -// legacy code, keeping it for future reference -// message loading not implemented currently - -//load message -xmlhttp=new XMLHttpRequest(); -xmlhttp.onreadystatechange=function(){ - if (xmlhttp.readyState==4 && xmlhttp.status==200){ - let response = JSON.parse(xmlhttp.responseText); - if(response["*"] && response["*"]["min"] <= version && response["*"]["max"] >= version) - response = response["*"]["msg"]; - else - response = response[version] ? response[version] : ''; - - if(response != "" && data.currentPopupMessage != response){ - mainContent.style.display = "none"; - popupMessage.innerText = response; - popupMessage.innerHTML += "
Close message"; - - let popupMessageButton = document.getElementById('popupMessageButton'); - popupMessageButton.addEventListener('click', function() { - chrome.storage.sync.set({currentPopupMessage: response}); - popupMessage.innerHTML = ""; - mainContent.style.display = "initial"; - }); - } - } -} -xmlhttp.open("GET", "https://lukaslen.com/message/pfwa.json", true); -xmlhttp.send(); -*/ \ No newline at end of file +}); \ No newline at end of file