Skip to content

Commit 46c9a11

Browse files
committed
Bug fixes
1 parent 1671f88 commit 46c9a11

File tree

9 files changed

+218
-201
lines changed

9 files changed

+218
-201
lines changed

iwsy/iwsy.js

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ const IWSY = (playerElement, scriptObject) => {
180180
// Set the visibility of a block
181181
const setVisibility = (block, showHide) => {
182182
if (showHide) {
183-
block.element.style.opacity = `1.0`;
183+
// block.element.style.opacity = `1.0`;
184184
block.element.style.display = `block`;
185185
} else {
186-
block.element.style.opacity = `0.0`;
186+
// block.element.style.opacity = `0.0`;
187187
block.element.style.display = `none`;
188188
}
189189
};
@@ -202,11 +202,7 @@ const IWSY = (playerElement, scriptObject) => {
202202
}
203203
}
204204
}
205-
if (script.runMode === `manual`) {
206-
enterManualMode(step);
207-
} else {
208-
step.next();
209-
}
205+
step.next();
210206
};
211207

212208
const show = step => {
@@ -266,12 +262,17 @@ const IWSY = (playerElement, scriptObject) => {
266262
if (script.speed === `scan`) {
267263
for (const block of stepBlocks)
268264
{
269-
setVisibility(step, block, showHide);
265+
if (upDown) {
266+
block.element.style.opacity = `1.0`;
267+
block.element.style.display = `block`;
268+
} else {
269+
block.element.style.opacity = `0.0`;
270+
block.element.style.display = `none`;
271+
}
270272
}
271-
step.next();
272273
} else {
273274
const animSteps = Math.round(step.duration * 25);
274-
const continueFlag = step.continue;
275+
const continueFlag = step.continue === `yes`;
275276
for (const block of stepBlocks)
276277
{
277278
block.element.style.display = `block`;
@@ -590,7 +591,7 @@ const IWSY = (playerElement, scriptObject) => {
590591
} else {
591592
const animSteps = Math.round(step.duration * 25);
592593
let animStep = 0;
593-
const continueFlag = step.continue;
594+
const continueFlag = step.continue === `yes`;
594595
const interval = setInterval(() => {
595596
if (animStep < animSteps) {
596597
const ratio = 0.5 - Math.cos(Math.PI * animStep / animSteps) / 2;
@@ -694,10 +695,11 @@ const IWSY = (playerElement, scriptObject) => {
694695

695696
// Scan the script
696697
const scan = () => {
697-
script.speed = `scan`;
698698
removeBlocks();
699699
setupBlocks();
700700
player.innerHTML = ``;
701+
initScript();
702+
script.speed = `scan`;
701703
doStep(script.steps[0]);
702704
};
703705

@@ -900,6 +902,7 @@ const IWSY = (playerElement, scriptObject) => {
900902
script.labels = {};
901903
script.stop = false;
902904
script.vfxElements = [];
905+
script.scanFinished = false;
903906
removeStyles();
904907
for (const block of script.blocks) {
905908
const element = block.element;
@@ -917,17 +920,25 @@ const IWSY = (playerElement, scriptObject) => {
917920
if (index < script.steps.length - 1) {
918921
const nextStep = script.steps[step.index + 1];
919922
step.next = () => {
920-
if (script.runMode == `auto` || script.speed === `scan`) {
921-
setTimeout(() => {
922-
if (script.stop) {
923-
script.stop = false;
924-
restoreCursor();
925-
} else {
926-
doStep(nextStep);
927-
}
928-
}, 0);
923+
if (script.scanFinished) {
924+
script.scanFinished = false;
929925
} else {
930-
doStep(nextStep);
926+
if (script.speed === `scan` && nextStep.index === script.scanTarget) {
927+
script.speed = `normal`;
928+
script.scanFinished = true;
929+
}
930+
if (script.runMode == `auto` || script.speed === `scan`) {
931+
setTimeout(() => {
932+
if (script.stop) {
933+
script.stop = false;
934+
restoreCursor();
935+
} else {
936+
doStep(nextStep);
937+
}
938+
}, 0);
939+
} else {
940+
doStep(nextStep);
941+
}
931942
}
932943
};
933944
}
@@ -967,14 +978,6 @@ const IWSY = (playerElement, scriptObject) => {
967978
} else {
968979
console.log(`Step ${step.index}: ${step.action}`);
969980
}
970-
if (script.speed === `scan` && step.index === script.scanTarget) {
971-
script.speed = `normal`;
972-
for (const block of script.blocks) {
973-
if (block.element) {
974-
block.element.style.display = `block`;
975-
}
976-
}
977-
}
978981

979982
const onStepCB = script.onStepCB;
980983
if (step.action === `chain`) {

iwsy/resources/ecs/blocks.txt

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,16 @@
3636
variable N
3737
variable M
3838
variable NBlocks
39-
variable Args
40-
variable Protocol
41-
variable Domain
4239
variable IsHome
4340
variable CDN
4441

45-
json parse url the location as Args
46-
put property `protocol` of Args into Protocol
47-
put property `domain` of Args into Domain
48-
if Domain is `iwannashowyou.com`
49-
begin
50-
put `https://easycoder.github.io/iwsy/resources` into CDN
51-
set IsHome
52-
end
53-
else
54-
put Protocol cat Domain cat `/resources` into CDN
55-
clear IsHome
56-
end
42+
get IsHome from storage as `.ishome`
43+
get CDN from storage as `.cdn`
5744

5845
put -1 into SelectedBlock
5946

60-
rest get PropertyNames from CDN cat `/json/propertyNames.json`
61-
rest get PropertyDefaults from CDN cat `/json/propertyDefaults.json`
47+
rest get PropertyNames from CDN cat `/resources/json/propertyNames.json`
48+
rest get PropertyDefaults from CDN cat `/resources/json/propertyDefaults.json`
6249

6350
on message go to Start
6451
set ready

iwsy/resources/ecs/fileman.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@
4747
variable Item
4848
variable Post
4949

50-
json parse url the location as Args
51-
put property `domain` of Args into Domain
52-
if Domain is `iwannashowyou.com` set IsHome
53-
else clear IsHome
54-
! If the debug flag is set use admin storage
55-
get Item from storage as `debug`
56-
if Item is `true` clear IsHome
57-
get AdminPassword from storage as `.password`
50+
get IsHome from storage as `.ishome`
51+
get CDN from storage as `.cdn`
52+
get AdminPassword from storage as `.password`
5853

5954
if portrait
6055
begin

iwsy/resources/ecs/help.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,11 @@
2222
variable Item
2323
variable Len
2424
variable N
25-
variable Args
26-
variable Protocol
27-
variable Domain
2825
variable IsHome
2926
variable CDN
3027

31-
json parse url the location as Args
32-
put property `protocol` of Args into Protocol
33-
put property `domain` of Args into Domain
34-
if Domain is `iwannashowyou.com`
35-
begin
36-
put `https://easycoder.github.io/iwsy/resources` into CDN
37-
set IsHome
38-
end
39-
else
40-
put Protocol cat Domain cat `/resources` into CDN
41-
clear IsHome
42-
end
43-
! If the debug flag is set use admin storage
44-
get Item from storage as `debug`
45-
if Item clear IsHome
28+
get IsHome from storage as `.ishome`
29+
get CDN from storage as `.cdn`
4630

4731
if portrait
4832
begin
@@ -80,7 +64,7 @@ GetPage:
8064
put 0 into ImageCount
8165
put 0 into LinkCount
8266
iwsy remove styles
83-
rest get Content from CDN cat `/help/` cat Page cat `.md?v=` cat now
67+
rest get Content from CDN cat `/resources/help/` cat Page cat `.md?v=` cat now
8468
or begin
8569
put empty into Page
8670
go to GetPage
@@ -111,7 +95,7 @@ GetPage:
11195
add 1 to N
11296
put left N of Data into Data
11397
iwsy load Player Embed
114-
iwsy path Data
98+
! iwsy path Data
11599
iwsy run
116100
end
117101
stop
@@ -122,7 +106,7 @@ GetPage:
122106
! Decorate is called for every occurrence of ~...~ in the topic data
123107
Decorate:
124108
put the payload of DecoratorCallback into Payload
125-
if Payload is `iwsy` put `<img src="` cat CDN cat `/icon/iwsy.png?v=` cat now cat `" `
109+
if Payload is `iwsy` put `<img src="` cat CDN cat `/resources/icon/iwsy.png?v=` cat now cat `" `
126110
cat `style="height:0.8em;position:relative;top:0.1em" />` into Payload
127111
else if Payload is `clear` put `<div style="height:1px;clear:both"></div>` into Payload
128112
else

0 commit comments

Comments
 (0)