Skip to content

Commit 80de766

Browse files
committed
Rever to current
1 parent b57f2de commit 80de766

File tree

4 files changed

+28
-52
lines changed

4 files changed

+28
-52
lines changed

easycoder/easycoder-min.js

Lines changed: 14 additions & 14 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 & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,21 +3921,11 @@ const EasyCoder = {
39213921
},
39223922

39233923
loadPluginJs: function(path) {
3924-
if (!path) {
3925-
path = document.scripts[0].src;
3926-
path = path.substring(0, path.indexOf(`/easycoder.js`));
3927-
}
3928-
this.path = path;
3929-
let src = `${path}/easycoder/plugins.js?ver=${this.version}`
3930-
console.log(`${Date.now() - this.timestamp} ms: Load ${src}`);
3924+
console.log(`${Date.now() - this.timestamp} ms: Load ${path}/easycoder/plugins.js`);
39313925
const script = document.createElement(`script`);
3932-
script.src = src;
3926+
script.src = `${window.location.origin}${path}/easycoder/plugins.js?ver=${this.version}`;
39333927
script.type = `text/javascript`;
39343928
script.onload = () => {
3935-
let path = this.path.substr(window.location.origin.length);
3936-
if (path.endsWith(`/`)) {
3937-
path = path.slice(0, -1);
3938-
}
39393929
EasyCoder_Plugins.getGlobalPlugins(
39403930
this.timestamp,
39413931
path,
@@ -3946,7 +3936,7 @@ const EasyCoder = {
39463936
};
39473937
script.onerror = () => {
39483938
if (path) {
3949-
this.loadPluginJs(null);
3939+
this.loadPluginJs(path.slice(0, path.lastIndexOf(`/`)));
39503940
} else {
39513941
this.reportError({
39523942
message: `Can't load plugins.js`
@@ -3960,14 +3950,12 @@ const EasyCoder = {
39603950
start: function(source) {
39613951
this.source = source;
39623952
this.scriptIndex = 0;
3963-
let pathname = window.location.href;
3964-
let q = pathname.indexOf('?');
3965-
if (q > 0) {
3966-
pathname = pathname.substr(0, q);
3967-
}
3953+
let pathname = window.location.pathname;
39683954
if (pathname.endsWith(`/`)) {
39693955
pathname = pathname.slice(0, -1);
3970-
}
3956+
} else {
3957+
pathname = ``;
3958+
}
39713959
if (typeof EasyCoder_Plugins === `undefined`) {
39723960
this.loadPluginJs(pathname);
39733961
} else {

easycoder/easycoder.zip

-207 Bytes
Binary file not shown.

js/easycoder/Main.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,11 @@ const EasyCoder = {
422422
},
423423

424424
loadPluginJs: function(path) {
425-
if (!path) {
426-
path = document.scripts[0].src;
427-
path = path.substring(0, path.indexOf(`/easycoder.js`));
428-
}
429-
this.path = path;
430-
let src = `${path}/easycoder/plugins.js?ver=${this.version}`
431-
console.log(`${Date.now() - this.timestamp} ms: Load ${src}`);
425+
console.log(`${Date.now() - this.timestamp} ms: Load ${path}/easycoder/plugins.js`);
432426
const script = document.createElement(`script`);
433-
script.src = src;
427+
script.src = `${window.location.origin}${path}/easycoder/plugins.js?ver=${this.version}`;
434428
script.type = `text/javascript`;
435429
script.onload = () => {
436-
let path = this.path.substr(window.location.origin.length);
437-
if (path.endsWith(`/`)) {
438-
path = path.slice(0, -1);
439-
}
440430
EasyCoder_Plugins.getGlobalPlugins(
441431
this.timestamp,
442432
path,
@@ -447,7 +437,7 @@ const EasyCoder = {
447437
};
448438
script.onerror = () => {
449439
if (path) {
450-
this.loadPluginJs(null);
440+
this.loadPluginJs(path.slice(0, path.lastIndexOf(`/`)));
451441
} else {
452442
this.reportError({
453443
message: `Can't load plugins.js`
@@ -461,14 +451,12 @@ const EasyCoder = {
461451
start: function(source) {
462452
this.source = source;
463453
this.scriptIndex = 0;
464-
let pathname = window.location.href;
465-
let q = pathname.indexOf('?');
466-
if (q > 0) {
467-
pathname = pathname.substr(0, q);
468-
}
454+
let pathname = window.location.pathname;
469455
if (pathname.endsWith(`/`)) {
470456
pathname = pathname.slice(0, -1);
471-
}
457+
} else {
458+
pathname = ``;
459+
}
472460
if (typeof EasyCoder_Plugins === `undefined`) {
473461
this.loadPluginJs(pathname);
474462
} else {

0 commit comments

Comments
 (0)