diff options
author | vantezzen <hello@vantezzen.io> | 2020-02-12 11:20:25 +0100 |
---|---|---|
committer | vantezzen <hello@vantezzen.io> | 2020-02-12 11:20:25 +0100 |
commit | 20830e4f896526db66d9b3ace0ebc421620c4049 (patch) | |
tree | f88394b9e6c40701a0eb03aca7ea342f30df7f96 /src/features/todos/preload.js | |
parent | Fix lint (diff) | |
parent | Improve Bug report template (diff) | |
download | ferdium-app-20830e4f896526db66d9b3ace0ebc421620c4049.tar.gz ferdium-app-20830e4f896526db66d9b3ace0ebc421620c4049.tar.zst ferdium-app-20830e4f896526db66d9b3ace0ebc421620c4049.zip |
Merge branch 'develop' into publish-debug
Diffstat (limited to 'src/features/todos/preload.js')
-rw-r--r-- | src/features/todos/preload.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/features/todos/preload.js b/src/features/todos/preload.js index d1838e0d6..d834cf547 100644 --- a/src/features/todos/preload.js +++ b/src/features/todos/preload.js | |||
@@ -21,3 +21,30 @@ ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => { | |||
21 | debug('Received host message', event, message); | 21 | debug('Received host message', event, message); |
22 | hostMessageListener(message); | 22 | hostMessageListener(message); |
23 | }); | 23 | }); |
24 | |||
25 | if (window.location.href === 'https://app.franztodos.com/login/') { | ||
26 | // Insert info element informing about Franz accounts | ||
27 | const infoElement = document.createElement('p'); | ||
28 | infoElement.innerText = `You are using Franz's official Todo Service. | ||
29 | This service will only work with accounts registered with Franz - no Ferdi accounts will work here! | ||
30 | If you do not have a Franz account you can change the Todo service by going into Ferdi's settings and changing the "Todo server". | ||
31 | You can choose any service as this Todo server, e.g. Todoist or Apple Notes.`; | ||
32 | |||
33 | // Franz Todos uses React. Because of this we can't directly insert the element into the page | ||
34 | // but we have to wait for React to finish rendering the login page | ||
35 | let numChecks = 0; | ||
36 | const waitForReact = setInterval(() => { | ||
37 | const textElement = document.querySelector('p'); | ||
38 | if (textElement) { | ||
39 | clearInterval(waitForReact); | ||
40 | textElement.parentElement.insertBefore(infoElement, textElement); | ||
41 | } else { | ||
42 | numChecks += 1; | ||
43 | |||
44 | // Stop after ~10 seconds. We are probably not on the login page | ||
45 | if (numChecks > 1000) { | ||
46 | clearInterval(waitForReact); | ||
47 | } | ||
48 | } | ||
49 | }, 10); | ||
50 | } | ||