Skip to content

Commit f46db1e

Browse files
committed
Allow plugins to be local
1 parent 13f03e1 commit f46db1e

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

easycoder/easycoder-min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

easycoder/easycoder.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3912,8 +3912,11 @@ const EasyCoder = {
39123912
},
39133913

39143914
loadPluginJs: function(path) {
3915-
let location = document.scripts[0].src;
3916-
location = location.substring(0, location.indexOf(`/easycoder.js`));
3915+
let location = path;
3916+
if (!location) {
3917+
location = document.scripts[0].src;
3918+
location = location.substring(0, location.indexOf(`/easycoder.js`));
3919+
}
39173920
console.log(`${Date.now() - this.timestamp} ms: Load ${location}/plugins.js`);
39183921
const script = document.createElement(`script`);
39193922
script.src = `${location}/plugins.js?ver=${this.version}`;
@@ -3929,7 +3932,7 @@ const EasyCoder = {
39293932
};
39303933
script.onerror = () => {
39313934
if (path) {
3932-
this.loadPluginJs(path.slice(0, path.lastIndexOf(`/`)));
3935+
this.loadPluginJs(null);
39333936
} else {
39343937
this.reportError({
39353938
message: `Can't load plugins.js`
@@ -3950,7 +3953,7 @@ const EasyCoder = {
39503953
pathname = ``;
39513954
}
39523955
if (typeof EasyCoder_Plugins === `undefined`) {
3953-
this.loadPluginJs(pathname);
3956+
this.loadPluginJs(`${window.location.href}plugins.js`);
39543957
} else {
39553958
this.pluginsPath = pathname;
39563959
EasyCoder_Plugins.getGlobalPlugins(

easycoder/easycoder.zip

53 Bytes
Binary file not shown.

js/easycoder/Main.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,11 @@ const EasyCoder = {
421421
},
422422

423423
loadPluginJs: function(path) {
424-
let location = document.scripts[0].src;
425-
location = location.substring(0, location.indexOf(`/easycoder.js`));
424+
let location = path;
425+
if (!location) {
426+
location = document.scripts[0].src;
427+
location = location.substring(0, location.indexOf(`/easycoder.js`));
428+
}
426429
console.log(`${Date.now() - this.timestamp} ms: Load ${location}/plugins.js`);
427430
const script = document.createElement(`script`);
428431
script.src = `${location}/plugins.js?ver=${this.version}`;
@@ -438,7 +441,7 @@ const EasyCoder = {
438441
};
439442
script.onerror = () => {
440443
if (path) {
441-
this.loadPluginJs(path.slice(0, path.lastIndexOf(`/`)));
444+
this.loadPluginJs(null);
442445
} else {
443446
this.reportError({
444447
message: `Can't load plugins.js`
@@ -459,7 +462,7 @@ const EasyCoder = {
459462
pathname = ``;
460463
}
461464
if (typeof EasyCoder_Plugins === `undefined`) {
462-
this.loadPluginJs(pathname);
465+
this.loadPluginJs(`${window.location.href}plugins.js`);
463466
} else {
464467
this.pluginsPath = pathname;
465468
EasyCoder_Plugins.getGlobalPlugins(

0 commit comments

Comments
 (0)