This repository was archived by the owner on Jan 29, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloader.js
More file actions
38 lines (34 loc) · 1.14 KB
/
Copy pathloader.js
File metadata and controls
38 lines (34 loc) · 1.14 KB
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
const fs = require('fs');
console.log('[Trophy] Injecting...');
// Themes
if (!fs.existsSync('./resources/app/trophy/themes')) {
console.log('[Trophy] Themes directory doesn\'t exist!');
} else {
fs.readdir('./resources/app/trophy/themes/', (err, files) => {
if (err) {
return console.log('[Trophy]' + err);
}
files.forEach(file => {
if (!file.endsWith('.css')) {
return;
}
document.head.insertAdjacentHTML('beforeend', `<link rel='stylesheet' href='./trophy/themes/${file.split('.')[0]}.css'/>`);
});
});
}
// Plugins
if (!fs.existsSync('./resources/app/trophy/themes')) {
console.log('[Trophy] Plugins directory doesn\'t exist!');
} else {
fs.readdir('./resources/app/trophy/plugins/', (err, files) => {
if (err) {
return console.log('[Trophy]' + err);
}
files.forEach(file => {
if (!file.endsWith('.js')) {
return;
}
document.body.insertAdjacentHTML('beforeend', `<script src='./trophy/plugins/${file.split('.')[0]}.js'></script>`);
});
});
}