-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinjectedPreload.js
More file actions
39 lines (32 loc) · 1016 Bytes
/
Copy pathinjectedPreload.js
File metadata and controls
39 lines (32 loc) · 1016 Bytes
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
/* eslint-disable */
// @ts-nocheck
console.log("foo'd!");
function reloadCss() {
const cssLink = document.querySelector('#palmodded');
const a = cssLink.getAttribute('href');
cssLink.setAttribute('href', '');
cssLink.setAttribute('href', a);
}
if (document.readyState !== 'loading') init();
else document.addEventListener('DOMContentLoaded', init);
function init() {
// TODO: find a better way to only add the elements after login page
setTimeout(() => {
const palmodded = document.createElement('link');
palmodded.id = 'palmodded';
palmodded.rel = 'stylesheet';
palmodded.setAttribute('href', cssPath);
document.body.append(palmodded);
if (jsPath !== undefined) {
const awa = document.createElement('script');
awa.setAttribute('src', jsPath);
document.body.append(awa);
}
}, 5000);
}
document.addEventListener('keydown', (e) => {
const evtobj = window.event ? event : e;
if (evtobj.keyCode === 82 && evtobj.ctrlKey) {
reloadCss();
}
});