-
Notifications
You must be signed in to change notification settings - Fork 2
/
addon.js
21 lines (19 loc) · 861 Bytes
/
addon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
window.onload = async function () {
const scriptElement = document.head.getElementsByTagName('script')[0].src;
const settings = await require('electron').ipcRenderer.invoke('getSettings');
const refineScript = document.createElement('script');
refineScript.type = 'module';
refineScript.src = scriptElement.replace('addon.js', 'main.js');
const configScript = document.createElement('script');
configScript.src = scriptElement.replace('addon.js', 'config.js');
document.head.appendChild(configScript);
configScript.onload = function () {
window.theme = {
...window.theme,
location: decodeURIComponent(scriptElement.replace('addon.js', '').replace('file:///', '')),
theme: settings.theme,
localImageViewerByDefault: settings.localImageViewerByDefault,
};
document.head.appendChild(refineScript);
};
}