Skip to content

Commit 420a068

Browse files
committed
Move CDN to a variable
1 parent 8329a79 commit 420a068

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Loader/gdmodext/js/injected.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
*/
1010
const debug = false;
1111

12+
/**
13+
* The CDN to fetch the GDAPI files from
14+
*/
15+
const CDN = "https://cdn.jsdelivr.net/gh/arthuro555/gdmod@8ec6b07e41cedc8c23b5708d8ed468bffbe6fb0c/API/";
16+
1217
/**
1318
* Flag telling if that page got patched already.
1419
*/
@@ -18,20 +23,20 @@ let isPatched = false;
1823
* Installs the modding API.
1924
*/
2025
function installGDModAPI() {
21-
return fetch("https://cdn.jsdelivr.net/gh/arthuro555/gdmod/API/includes.json")
26+
return fetch(CDN + "includes.json")
2227
.then(req => req.json())
2328
.then(includes => {
2429
return new Promise((resolve) => {
2530
let loaded = 0;
2631
for(let include of includes) {
2732
if(debug) console.log(`Loading ${include}`);
2833
const script = document.createElement("script");
29-
script.src = `https://cdn.jsdelivr.net/gh/arthuro555/gdmod/API/${include}`;
34+
script.src = CDN + include;
3035
script.onload = function() {
3136
if (++loaded === includes.length) {
3237
resolve();
3338
}
34-
document.body.removeChild(script); // Cleanup document after loading API.
39+
if(!debug) document.body.removeChild(script); // Cleanup document after loading API.
3540
}
3641
document.body.appendChild(script);
3742
}

0 commit comments

Comments
 (0)