-
Notifications
You must be signed in to change notification settings - Fork 5
/
preload.js
32 lines (26 loc) · 1.17 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
const { ipcRenderer } = require('electron')
const appConfig = require('./config')
window.addEventListener('DOMContentLoaded', () => {
// Hidden webpage elements uding ID tags
if(appConfig.hideElementsId.length > 0) {
for(let elementsId = 0; elementsId < appConfig.hideElementsId.length; elementsId++) {
let hiddenElementsId = document.getElementById(appConfig.hideElementsId[elementsId])
hiddenElementsId ? hiddenElementsId.style.display='none' : console.log
}
}
// Hidden webpage elements uding Class tags
if(appConfig.hideElementsClass.length > 0) {
for(let elementsClass = 0; elementsClass < appConfig.hideElementsClass.length; elementsClass++) {
let hiddenElementsClass = document.getElementsByClassName(appConfig.hideElementsClass[elementsClass])
hiddenElementsClass ? hiddenElementsClass[0].style.visibility='hidden' : console.log
}
}
//Change application tiitle
document.title = appConfig['appName']
//Error page reload again button press
let tryagainbtn = document.getElementById("tryagain")
tryagainbtn ? tryagainbtn.onclick = runc : false
function runc() {
ipcRenderer.send('online-status-changed', true)
}
})