diff options
author | Francisco GuimarĂ£es | 2020-01-14 10:58:28 -0300 |
---|---|---|
committer | Francisco GuimarĂ£es | 2020-01-14 10:58:28 -0300 |
commit | cdacca177705db9ef597a7390c46ede305a60176 (patch) | |
tree | b140961deb383da05c7cff044253c3c0914f70e1 /whatsapp-nativefier-dark-inject.js | |
parent | bd900fd98a1563af93ae126a8995723fe7850273 (diff) | |
download | aur-cdacca177705db9ef597a7390c46ede305a60176.tar.gz |
Adds support for multi languages when there is the need to reload the service worker
Diffstat (limited to 'whatsapp-nativefier-dark-inject.js')
-rw-r--r-- | whatsapp-nativefier-dark-inject.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/whatsapp-nativefier-dark-inject.js b/whatsapp-nativefier-dark-inject.js index d5661c8898fc..fc07a128c74b 100644 --- a/whatsapp-nativefier-dark-inject.js +++ b/whatsapp-nativefier-dark-inject.js @@ -1490,7 +1490,19 @@ if (typeof GM_addStyle != "undefined") { document.documentElement.appendChild(node); } } -if (document.body.innerText.replace(/\n/g, ' ').search(/whatsapp works with.*to use whatsapp.*update/i) !== -1) - navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() }); + +const regexes = [ + // en + /whatsapp works with.*to use whatsapp.*update/i, + // pt + /o whatsapp funciona com.*para utilizar o whatsapp.*atualize/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; + } +} })(); |