summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco GuimarĂ£es2020-06-06 03:17:07 -0300
committerFrancisco GuimarĂ£es2020-06-06 03:17:07 -0300
commit523a9bc0c10edf972ce537b74241e5c3d21b313e (patch)
treed819298747dad5256044ef851716f4b335f73144
parent94e625981d002cdeb3e3fa6dc104c13844e3d0e3 (diff)
downloadaur-523a9bc0c10edf972ce537b74241e5c3d21b313e.tar.gz
Improve serviceWorkerHack
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--whatsapp-nativefier-dark-inject.js30
3 files changed, 13 insertions, 25 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d375b348c13..bd4d884b846 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = whatsapp-nativefier-dark
pkgdesc = WhatsApp desktop built with nativefier (electron) using dark theme
- pkgver = 1.0.0
+ pkgver = 1.1.0
pkgrel = 1
url = https://web.whatsapp.com
arch = armv7l
@@ -20,7 +20,7 @@ pkgbase = whatsapp-nativefier-dark
source = yarn.lock
sha256sums = f79228902c35740ba202fc74494b3fa851911e466955298b231d7fcfebc63b37
sha256sums = 12b72fd82fff48dc8c5a08f7bc070259b9929cf408bf6738133a08508e4d3d09
- sha256sums = c7c201732ce2c2b55fc496280b23a493feb2d7c8fd7b008d7d416d3906529829
+ sha256sums = 57fef7d701d3cf68d7d8b96392a2d53541fcd25ed4bd79cdd5cedfc3efb40926
sha256sums = 6b214b951ff556fe2b87bb66bf8d3eb7b8ae7ed1dd0ceef0fa9d2c4ca86e0fff
sha256sums = 77c85afca5dcea2a041a9461ead9700067556f95dc3702602c074260c4d3f047
diff --git a/PKGBUILD b/PKGBUILD
index 3d8702306f1..24665fea744 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Francisco Guimaraes <francisco at gmail dot com>
pkgname=whatsapp-nativefier-dark
-pkgver=1.0.0
+pkgver=1.1.0
pkgrel=1
pkgdesc="WhatsApp desktop built with nativefier (electron) using dark theme"
arch=("armv7l" "i686" "x86_64")
@@ -19,7 +19,7 @@ source=(
sha256sums=(
"f79228902c35740ba202fc74494b3fa851911e466955298b231d7fcfebc63b37"
"12b72fd82fff48dc8c5a08f7bc070259b9929cf408bf6738133a08508e4d3d09"
- "c7c201732ce2c2b55fc496280b23a493feb2d7c8fd7b008d7d416d3906529829"
+ "57fef7d701d3cf68d7d8b96392a2d53541fcd25ed4bd79cdd5cedfc3efb40926"
"6b214b951ff556fe2b87bb66bf8d3eb7b8ae7ed1dd0ceef0fa9d2c4ca86e0fff"
"77c85afca5dcea2a041a9461ead9700067556f95dc3702602c074260c4d3f047"
)
diff --git a/whatsapp-nativefier-dark-inject.js b/whatsapp-nativefier-dark-inject.js
index 18d4ebb10a6..bde8470c42b 100644
--- a/whatsapp-nativefier-dark-inject.js
+++ b/whatsapp-nativefier-dark-inject.js
@@ -41,27 +41,15 @@
}
function serviceWorkerHack() {
- const regexes = [
- // en (enlish)
- /whatsapp works with.*to use whatsapp.*update/i,
- // pt (portuguese)
- /o whatsapp funciona com.*para utilizar o whatsapp.*atualize/i,
- // ge (german)
- /whatsapp funktioniert mit.*um whatsapp zu benutzen.*aktualisiere/i,
- // es (spanish)
- /whatsapp funciona con.*para usar whatsapp.*actualiza/i,
- // ca (catalan)
- /whatsapp funciona amb.*per utilitzar whatsapp.*actualitza/i,
- ];
-
- for (const regex of regexes) {
- if (document.body.innerText.replace(/\n/g, " ").search(regex) !== -1) {
- navigator.serviceWorker.getRegistration().then(function (r) {
- r.unregister();
- document.location.reload();
- });
- return;
- }
+ if (
+ document.querySelector(
+ "a[href='https://support.google.com/chrome/answer/95414']"
+ )
+ ) {
+ navigator.serviceWorker.getRegistration().then((registration) => {
+ registration.unregister();
+ document.location.reload();
+ });
}
}