diff options
author | 2022-09-05 12:58:05 +0100 | |
---|---|---|
committer | 2022-09-05 12:58:05 +0100 | |
commit | de7112198e005e13c837eaf743b2ee9d32837c27 (patch) | |
tree | 3b157893af72cd6912cb20d754502d4341963762 /recipes/whatsapp/webview.js | |
parent | New recipe: Odysee (#165) (diff) | |
download | ferdium-recipes-de7112198e005e13c837eaf743b2ee9d32837c27.tar.gz ferdium-recipes-de7112198e005e13c837eaf743b2ee9d32837c27.tar.zst ferdium-recipes-de7112198e005e13c837eaf743b2ee9d32837c27.zip |
This reverts commit 6b2bc506c212e88359f06107097ac4446bd5216f.
Diffstat (limited to 'recipes/whatsapp/webview.js')
-rw-r--r-- | recipes/whatsapp/webview.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index d0b0cd8..77c4ebb 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js | |||
@@ -4,45 +4,6 @@ function _interopRequireDefault(obj) { | |||
4 | return obj && obj.__esModule ? obj : { default: obj }; | 4 | return obj && obj.__esModule ? obj : { default: obj }; |
5 | } | 5 | } |
6 | 6 | ||
7 | function createElement(messageBody, idString) { | ||
8 | const messageText = document.createTextNode(messageBody); | ||
9 | const message = document.createElement("p"); | ||
10 | message?.setAttribute("id", idString); | ||
11 | message?.setAttribute("class", idString); | ||
12 | message?.appendChild(messageText); | ||
13 | |||
14 | return message; | ||
15 | } | ||
16 | |||
17 | function addThemeMessage() { | ||
18 | const idString = 'ferdium-theme-message'; | ||
19 | const idStringTitle = 'ferdium-theme-title'; | ||
20 | const elementExists = document.querySelectorAll(`.${idString}`)[0] || document.querySelectorAll(`.${idStringTitle}`)[0] ? true : false; | ||
21 | |||
22 | if (!elementExists) { | ||
23 | const themePopupDiv = document.querySelectorAll("._2Nr6U")[0]; | ||
24 | |||
25 | // Create Ferdium Warning title element | ||
26 | const messageTitleString = 'FERDIUM WARNING!'; | ||
27 | const messageTitleElement = createElement(messageTitleString, idStringTitle); | ||
28 | |||
29 | // Create Ferdium Warning message element | ||
30 | const messageBody1 = 'To change your Whatsapp Theme, please use the native settings on Ferdium.'; | ||
31 | const messageBody2 = 'For that, right-click on the Whatsapp Service and click on Enable/Disable Dark mode.'; | ||
32 | const message1 = createElement(messageBody1, idString); | ||
33 | const message2 = createElement(messageBody2, idString); | ||
34 | |||
35 | // Add messages to Whatsapp Window | ||
36 | themePopupDiv?.prepend(message2) | ||
37 | themePopupDiv?.prepend(message1) | ||
38 | themePopupDiv?.prepend(messageTitleElement) | ||
39 | |||
40 | // Hide OK Button. | ||
41 | document.querySelectorAll("._20C5O")[1]?.setAttribute('style', 'display: none;'); | ||
42 | document.querySelectorAll("._2Nr6U > form")[0]?.setAttribute('style', 'display: none;'); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | module.exports = Ferdium => { | 7 | module.exports = Ferdium => { |
47 | const getMessages = () => { | 8 | const getMessages = () => { |
48 | let count = 0; | 9 | let count = 0; |
@@ -87,7 +48,6 @@ module.exports = Ferdium => { | |||
87 | const loopFunc = () => { | 48 | const loopFunc = () => { |
88 | getMessages(); | 49 | getMessages(); |
89 | getActiveDialogTitle(); | 50 | getActiveDialogTitle(); |
90 | addThemeMessage(); | ||
91 | }; | 51 | }; |
92 | 52 | ||
93 | window.addEventListener('beforeunload', async () => { | 53 | window.addEventListener('beforeunload', async () => { |