This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreload.js
92 lines (79 loc) · 2.53 KB
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const {isMacintosh} = require('@treverix/custom-electron-titlebar')
const customTitlebar = require('@treverix/custom-electron-titlebar');
const {Menu} = require('@treverix/remote')
var {ipcRenderer} = require('electron')
const fs = require('fs')
var loadWindow = true
document.addEventListener('DOMContentLoaded', (event) => {
// It does not make sense to use the custom titlebar on macOS where
// it only tries to simulate what we get with the normal behavior anyway.
if (process.platform != 'darwin') {
// add a menu
const menu = new Menu();
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex('#000F42'),
icon: `./build/icon.png`,
menu
});
var head = document.getElementsByTagName('head')[0];
var sty = document.createElement('style');
sty.type = 'text/css';
var css = `
.titlebar{
z-index: 999999;
}
.oneall_social_login{
visibility: hidden;
}
div.edit-post-layout.is-mode-visual.is-sidebar-opened.has-metaboxes.interface-interface-skeleton{
top : 30px !important;
}
#wpadminbar{
top: 30px !important;
}
/* There two selectors below is for the backsite (admin dashboard) */
#adminmenuwrap{
position: relative !important;
}
#adminmenu{
top: 30px !important;
margin : 40px 0 !important;
}
#wpbody{
margin-top: 30px !important;
}
${window.location.href.startsWith('https://arendelleodyssey.com') ?'':`
body{
margin-top: 30px !important;
}
nav{
margin-top: 30px !important;
}`}
/* Elementor */
#elementor-panel-header-wrapper{
top : 30px;
position: relative;
}
#elementor-panel-content-wrapper{
position: relative !important;
top: 30px !important;
}
` // You can compress all css files you need and put here
if (sty.styleSheet){
sty.styleSheet.cssText = css;
} else {
sty.appendChild(document.createTextNode(css));
}
head.appendChild(sty);
var socialLogin = document.querySelector('.oneall_social_login');
socialLogin.parentNode.removeChild(socialLogin);
}
})
document.addEventListener('readystatechange', (event) => {
if (document.readyState == 'complete' && loadWindow) {
ipcRenderer.send('closeLoad');
loadWindow = false
}
});