diff options
Diffstat (limited to 'src/index.html')
-rw-r--r-- | src/index.html | 122 |
1 files changed, 73 insertions, 49 deletions
diff --git a/src/index.html b/src/index.html index 6b67cc248..929aec3ad 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -1,60 +1,84 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html lang="en"> | 2 | <html lang="en"> |
3 | <head> | 3 | <head> |
4 | <title>Ferdi</title> | 4 | <title>Ferdi</title> |
5 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | 5 | <meta charset="UTF-8" /> |
6 | <link rel="stylesheet" type="text/css" href="./styles/main.css" /> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
7 | <script type="text/javascript" src="./app.js"></script> | 7 | <link rel="stylesheet" type="text/css" href="./styles/main.css" /> |
8 | </head> | 8 | <link |
9 | <body> | 9 | rel="stylesheet" |
10 | <div class="window-draggable"></div> | 10 | type="text/css" |
11 | <div class="dev-warning">DEV MODE</div> | 11 | href="./styles/animations.css" |
12 | <div id="root"></div> | 12 | media="(prefers-reduced-motion: no-preference)" |
13 | <div id="portalContainer"></div> | 13 | /> |
14 | <script> | 14 | <script type="text/javascript" src="./app.js"></script> |
15 | document.querySelector('body').classList.add(process.env.OS_PLATFORM ? process.env.OS_PLATFORM : process.platform); | 15 | </head> |
16 | <body> | ||
17 | <div class="window-draggable"></div> | ||
18 | <div class="dev-warning">DEV MODE</div> | ||
19 | <div id="root"></div> | ||
20 | <div id="portalContainer"></div> | ||
21 | <script> | ||
22 | document | ||
23 | .querySelector('body') | ||
24 | .classList.add( | ||
25 | process.env.OS_PLATFORM ? process.env.OS_PLATFORM : process.platform, | ||
26 | ); | ||
16 | 27 | ||
17 | require('./sentry') | 28 | require('./sentry'); |
18 | const { isDevMode } = require('./environment'); | 29 | const { isDevMode } = require('./environment'); |
19 | if (isDevMode) { | 30 | if (isDevMode) { |
20 | const debugging = require('debug'); | 31 | const debugging = require('debug'); |
21 | debugging.enable(process.env.DEBUG); | 32 | debugging.enable(process.env.DEBUG); |
22 | 33 | ||
23 | const debug = debugging('Index'); | 34 | const debug = debugging('Index'); |
24 | 35 | ||
25 | document.querySelector('body').classList.add('isDevMode'); | 36 | document.querySelector('body').classList.add('isDevMode'); |
26 | 37 | ||
27 | (function() { | 38 | (function () { |
28 | const lrHost = 'http://localhost:35729'; | 39 | const lrHost = 'http://localhost:35729'; |
29 | const s = document.createElement('script'); | 40 | const s = document.createElement('script'); |
30 | s.async = true; | 41 | s.async = true; |
31 | s.setAttribute('src', lrHost + '/livereload.js'); | 42 | s.setAttribute('src', lrHost + '/livereload.js'); |
32 | document.body.appendChild(s); | 43 | document.body.appendChild(s); |
33 | 44 | ||
34 | s.onload = () => { | 45 | s.onload = () => { |
35 | debug('livereload loaded'); | 46 | debug('livereload loaded'); |
36 | const originalReloadBehaviour = window._onLiveReloadFileChanged; | 47 | const originalReloadBehaviour = window._onLiveReloadFileChanged; |
37 | 48 | ||
38 | window._onLiveReloadFileChanged = (file) => { | 49 | window._onLiveReloadFileChanged = file => { |
39 | const isTodoPreloadPath = file.path.includes('/build/features/todos/preload.js'); | 50 | const isTodoPreloadPath = file.path.includes( |
40 | if (!file.path.includes('/build/webview/') && !file.path.includes('/build/index.js') && !file.path.includes('/build/electron/') && !isTodoPreloadPath) { | 51 | '/build/features/todos/preload.js', |
41 | originalReloadBehaviour(file); | 52 | ); |
42 | } else { | 53 | if ( |
43 | if (isTodoPreloadPath) { | 54 | !file.path.includes('/build/webview/') && |
44 | debug('Livereload: Reloading all webviews'); | 55 | !file.path.includes('/build/index.js') && |
45 | const webview = document.querySelector('webview[partition="persist:todos"]'); | 56 | !file.path.includes('/build/electron/') && |
46 | if (webview) webview.reload(); | 57 | !isTodoPreloadPath |
47 | } else if (file.path.includes('/build/webview/')) { | 58 | ) { |
48 | debug('Livereload: Reloading all webviews'); | 59 | originalReloadBehaviour(file); |
49 | const webviews = document.querySelectorAll('webview').forEach(webview => webview.reload()); | ||
50 | } else { | 60 | } else { |
51 | debug('Livereload: skip reload as only main process files have changed'); | 61 | if (isTodoPreloadPath) { |
62 | debug('Livereload: Reloading all webviews'); | ||
63 | const webview = document.querySelector( | ||
64 | 'webview[partition="persist:todos"]', | ||
65 | ); | ||
66 | if (webview) webview.reload(); | ||
67 | } else if (file.path.includes('/build/webview/')) { | ||
68 | debug('Livereload: Reloading all webviews'); | ||
69 | const webviews = document | ||
70 | .querySelectorAll('webview') | ||
71 | .forEach(webview => webview.reload()); | ||
72 | } else { | ||
73 | debug( | ||
74 | 'Livereload: skip reload as only main process files have changed', | ||
75 | ); | ||
76 | } | ||
52 | } | 77 | } |
53 | } | 78 | }; |
54 | } | 79 | }; |
55 | } | 80 | })(); |
56 | })(); | 81 | } |
57 | } | 82 | </script> |
58 | </script> | 83 | </body> |
59 | </body> | ||
60 | </html> | 84 | </html> |