Skip to content

Commit e68d06a

Browse files
committedJul 18, 2020
Fix bug in 'chain'
1 parent cf6531a commit e68d06a

File tree

3 files changed

+38
-33
lines changed

3 files changed

+38
-33
lines changed
 

‎dist/plugins/iwsy.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ const EasyCoder_IWSY = {
6464
return true;
6565
}
6666
return false;
67-
// case `path`:
68-
// const path = compiler.getNextValue();
69-
// compiler.addCommand({
70-
// domain: `iwsy`,
71-
// keyword: `iwsy`,
72-
// lino,
73-
// action,
74-
// path
75-
// });
76-
// return true;
67+
case `path`:
68+
const path = compiler.getNextValue();
69+
compiler.addCommand({
70+
domain: `iwsy`,
71+
keyword: `iwsy`,
72+
lino,
73+
action,
74+
path
75+
});
76+
return true;
7777
case `script`:
7878
const script = compiler.getNextValue();
7979
compiler.addCommand({
@@ -197,11 +197,11 @@ const EasyCoder_IWSY = {
197197
}
198198
program.iwsyFunctions = IWSY(player, script);
199199
break;
200-
// case `path`:
201-
// if (program.iwsyFunctions) {
202-
// program.iwsyFunctions.setPath(program.getValue(command.path));
203-
// }
204-
// break;
200+
case `path`:
201+
if (program.iwsyFunctions) {
202+
program.iwsyFunctions.setPath(program.getValue(command.path));
203+
}
204+
break;
205205
case `script`:
206206
script = program.getValue(command.script);
207207
try {
@@ -234,7 +234,6 @@ const EasyCoder_IWSY = {
234234
case `stop`:
235235
if (program.iwsyFunctions) {
236236
program.iwsyFunctions.stop();
237-
// delete program.iwsyFunctions;
238237
}
239238
break;
240239
case `removeStyles`:

‎iwsy/iwsy.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const IWSY = (playerElement, scriptObject) => {
44
let player = playerElement;
55
let script = scriptObject;
66
let homeScript = script;
7+
let thePath = ``;
78
let afterRun;
89
let plugins;
910
let timeouts = [];
@@ -991,7 +992,7 @@ const IWSY = (playerElement, scriptObject) => {
991992
script.runMode = runMode;
992993
doStep(script.steps[1]);
993994
} else {
994-
fetch(`${step.path}${step.script}?v=${Date.now()}`)
995+
fetch(`${thePath}/${step.script}?v=${Date.now()}`)
995996
.then(response => {
996997
if (response.status >= 400) {
997998
throw Error(`Unable to load ${step.script}: ${response.status}`);
@@ -1063,6 +1064,11 @@ const IWSY = (playerElement, scriptObject) => {
10631064
initScript();
10641065
};
10651066

1067+
// Set the path (for 'embed')
1068+
const setPath = path => {
1069+
thePath = path;
1070+
};
1071+
10661072
// Go to a specified step number
10671073
const gotoStep = target => {
10681074
script.scanTarget = target;
@@ -1270,6 +1276,7 @@ const IWSY = (playerElement, scriptObject) => {
12701276
return {
12711277
getScript,
12721278
setScript,
1279+
setPath,
12731280
gotoStep,
12741281
block,
12751282
run,

‎js/plugins/iwsy.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ const EasyCoder_IWSY = {
6464
return true;
6565
}
6666
return false;
67-
// case `path`:
68-
// const path = compiler.getNextValue();
69-
// compiler.addCommand({
70-
// domain: `iwsy`,
71-
// keyword: `iwsy`,
72-
// lino,
73-
// action,
74-
// path
75-
// });
76-
// return true;
67+
case `path`:
68+
const path = compiler.getNextValue();
69+
compiler.addCommand({
70+
domain: `iwsy`,
71+
keyword: `iwsy`,
72+
lino,
73+
action,
74+
path
75+
});
76+
return true;
7777
case `script`:
7878
const script = compiler.getNextValue();
7979
compiler.addCommand({
@@ -197,11 +197,11 @@ const EasyCoder_IWSY = {
197197
}
198198
program.iwsyFunctions = IWSY(player, script);
199199
break;
200-
// case `path`:
201-
// if (program.iwsyFunctions) {
202-
// program.iwsyFunctions.setPath(program.getValue(command.path));
203-
// }
204-
// break;
200+
case `path`:
201+
if (program.iwsyFunctions) {
202+
program.iwsyFunctions.setPath(program.getValue(command.path));
203+
}
204+
break;
205205
case `script`:
206206
script = program.getValue(command.script);
207207
try {
@@ -234,7 +234,6 @@ const EasyCoder_IWSY = {
234234
case `stop`:
235235
if (program.iwsyFunctions) {
236236
program.iwsyFunctions.stop();
237-
// delete program.iwsyFunctions;
238237
}
239238
break;
240239
case `removeStyles`:

0 commit comments

Comments
 (0)
Please sign in to comment.