Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions dist/plugins/iwsy.js
Original file line number Diff line number Diff line change
@@ -137,20 +137,20 @@ const EasyCoder_IWSY = {
script = program.getValue(command.script);
try {
script = JSON.parse(script);
EasyCoder.iwsyFunctions = IWSY(player, script);
} catch (err) {
alert(`Badly formatted script`);
alert(`iwsy load: Badly formatted script`);
}
EasyCoder.iwsyFunctions = IWSY(player, script);
break;
case `script`:
script = program.getValue(command.script);
try {
script = JSON.parse(script);
if (EasyCoder.iwsyFunctions) {
EasyCoder.iwsyFunctions.setScript(script);
}
} catch (err) {
alert(`Badly formatted script`);
alert(`iwsy script: Badly formatted script`);
}
if (EasyCoder.iwsyFunctions) {
EasyCoder.iwsyFunctions.setScript(script);
}
break;
case `goto`:
@@ -159,6 +159,9 @@ const EasyCoder_IWSY = {
}
break;
case `block`:
if (EasyCoder.iwsyFunctions) {
EasyCoder.iwsyFunctions.block(program.getValue(command.block));
}
break;
case `run`:
if (EasyCoder.iwsyFunctions) {
4 changes: 3 additions & 1 deletion iwsy/iwsy.js
Original file line number Diff line number Diff line change
@@ -744,7 +744,9 @@ const IWSY = (container, text) => {
initScript();
IWSY.plugins = {};
preloadImages();
doStep(script.steps[0]);
if (script.steps.length > 0) {
doStep(script.steps[0]);
}
return {
setScript,
gotoStep,
32 changes: 16 additions & 16 deletions iwsy/resources/ecs/iwsy.txt
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@
img Save
img RunStop
img Delete
img Cycle
a Link
module StepsModule
module BlocksModule
@@ -138,11 +137,6 @@ L2:
set the style of RunStop to `width:40px;margin-right:1.5em`
set attribute `src` of RunStop to `resources/icon/run.png`
set attribute `title` of RunStop to `Run`
create Link in Buttons
create Cycle in Link
set the style of Cycle to `width:40px`
set attribute `src` of Cycle to `resources/icon/cycle.png`
set attribute `title` of Cycle to `Cycle screens`

create Status in Buttons
if Mobile set the style of Status to `height:1em`
@@ -321,6 +315,7 @@ L2:
put 0 into N
gosub to SelectSection
clear Running
iwsy load Player Presentation

on message
begin
@@ -351,33 +346,32 @@ L2:

CreateNewPresentation:
set Presentation to object
set Item to object
set property `content` of Presentation to Item
set Item to array
set property `steps` of Presentation to Item
set property `blocks` of Presentation to Item
set property `content` of Presentation to Item
return

SetupSteps:
if StepsModule is not running
begin
rest get Script from `/resources/ecs/steps.txt`
rest get Script from `/resources/ecs/steps.txt?v=` cat now
run Script with StepsPanel and Presentation as StepsModule
end
return

SetupBlocks:
if BlocksModule is not running
begin
rest get Script from `/resources/ecs/blocks.txt`
rest get Script from `/resources/ecs/blocks.txt?v=` cat now
run Script with BlocksPanel and Presentation as BlocksModule
end
return

SetupContent:
if ContentModule is not running
begin
rest get Script from `/resources/ecs/content.txt`
rest get Script from `/resources/ecs/content.txt?v=` cat now
run Script with ContentPanel and Presentation as ContentModule
end
return
@@ -521,7 +515,7 @@ SelectFile:
index File to the index of FileName
set the content of NameEditor to File
put File into CurrentScriptName
if PasswordValid rest get Presentation from `/resources/json/` cat File
if PasswordValid rest get Presentation from `/resources/json/` cat File cat `?v=` cat now
else get Presentation from storage as File
put Presentation into LastSavedState
gosub to UpdateCurrentSection
@@ -559,10 +553,16 @@ DoRunStop:
end
else
begin
put property `steps` of Presentation into Item
if the json count of Item is 0 stop
put element 0 of Item into Item
if property `action` of Item is not `init`
begin
alert `The first step of a presentation must be an 'init' action.`
stop
end
set Running
gosub to ClearStepsButtons
put property `steps` of Presentation into Item
if the json count of Item is 0 stop
set attribute `src` of RunStop to `resources/icon/runstop.png`

put 0 into N
@@ -578,8 +578,8 @@ DoRunStop:
set property `action` of Message to `running`
send Message to StepsModule
end
iwsy run then

iwsy run then
begin
gosub to ClearStepsButtons
set attribute `src` of RunStop to `resources/icon/run.png`
10 changes: 6 additions & 4 deletions iwsy/resources/ecs/steps.txt
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@
variable Response
variable Message
variable Running
variable SavedIndex
variable N
variable B

@@ -170,9 +171,10 @@ Restart:
end
on click StepButton
begin
put the index of StepButton into SavedIndex
gosub to SaveCurrentStep
put SelectedStep into N
put the index of StepButton into SelectedStep
put SavedIndex into SelectedStep
if SelectedStep is N
begin
index Editor to N
@@ -246,7 +248,6 @@ Restart:
json add `goto` to ActionNames
json add `load` to ActionNames
set InitProperties to array
json add `title` to InitProperties
json add `aspect ratio` to InitProperties
json add `background` to InitProperties
json add `border` to InitProperties
@@ -380,7 +381,8 @@ ReloadStepEditor:
if Response
begin
index StepButton to SelectedStep
set property `title` of CurrentStep to TitleInput
index TitleInput to SelectedStep
set property `title` of CurrentStep to the text of TitleInput
put the selected item in ActionSelect into Action
gosub to CreateNewAction
clear Table
@@ -702,7 +704,7 @@ CreateNewAction:
while N is less than the json count of InitProperties
begin
put element N of InitProperties into InitProperty
set property InitProperty of CurrentStep to empty
set property InitProperty of CurrentStep to empty
add 1 to N
end
set property `aspect ratio` of CurrentStep to `WW:HH`
182 changes: 182 additions & 0 deletions iwsy/resources/json/demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"blocks": [
{
"name": "center title",
"background": "",
"border": "",
"borderRadius": "",
"fontColor": "#dddd88",
"fontFamily": "",
"fontSize": 80,
"fontStyle": "",
"fontWeight": "",
"height": 300,
"left": 0,
"textAlign": "center",
"textMarginLeft": "",
"textMarginTop": "",
"top": 300,
"width": "100%"
},
{
"name": "top title",
"background": "",
"border": "",
"borderRadius": "",
"fontColor": "#ffffff",
"fontFamily": "",
"fontSize": 50,
"fontStyle": "",
"fontWeight": "",
"height": 300,
"left": 0,
"textAlign": "center",
"textMarginLeft": "",
"textMarginTop": "",
"top": 30,
"width": "100%"
},
{
"name": "left",
"background": "rgba(80,80,80,0.5)",
"border": "1px solid gray",
"borderRadius": "",
"fontColor": "yellow",
"fontFamily": "",
"fontSize": 50,
"fontStyle": "",
"fontWeight": "",
"height": 700,
"left": 50,
"textAlign": "",
"textMarginLeft": 20,
"textMarginTop": 20,
"top": 250,
"width": 400
},
{
"name": "right",
"background": "rgba(80,80,80,0.5)",
"border": "1px solid gray",
"borderRadius": "",
"fontColor": "yellow",
"fontFamily": "",
"fontSize": 50,
"fontStyle": "",
"fontWeight": "",
"height": 700,
"left": 550,
"textAlign": "",
"textMarginLeft": 20,
"textMarginTop": 20,
"top": 250,
"width": 400
},
{
"name": "main content",
"background": "",
"border": "",
"borderRadius": "",
"fontColor": "yellow",
"fontFamily": "",
"fontSize": 50,
"fontStyle": "",
"fontWeight": "",
"height": 800,
"left": 50,
"textAlign": "",
"textMarginLeft": 10,
"textMarginTop": "",
"top": 300,
"width": "100%"
}
],
"content": [
{
"name": "iwannashowyou",
"content": "# I Wanna Show You%0a%0a### _knockout web-based presentations_"
},
{
"name": "page 1 left",
"content": "### PowerPoint%0a%0a - is slide-based%0a - is a PC application%0a - is hard to embed%0a%0aPowerPoint is organized mainly around static text blocks and tied to the desktop."
},
{
"name": "page 1 right",
"content": "### I Wanna Show You%0a - is step based%0a - runs in your browser%0a - is fully embeddable%0a%0aIWannaShowYou is built to handle color, movement and the online environment."
}
],
"steps": [
{
"title": "My demo presentation",
"action": "init",
"label": "",
"aspect ratio": "16:9",
"background": "url('resources/img/SemoigoDawn.jpg')",
"border": "1px solid gray"
},
{
"title": "Pause before starting",
"action": "pause",
"label": "",
"duration": 1
},
{
"title": "Setup main title and initial content",
"action": "set content",
"label": "",
"blocks": [
{
"block": "center title",
"content": "iwannashowyou"
},
{
"block": "left",
"content": "page 1 left"
},
{
"block": "right",
"content": "page 1 right"
}
]
},
{
"title": "Fade up title",
"action": "fade up",
"label": "",
"blocks": [
"center title"
],
"duration": 1
},
{
"title": "Wait 3 seconds",
"action": "hold",
"label": "",
"duration": 3
},
{
"title": "Move the title to the top",
"action": "transition",
"label": "",
"target": "top title",
"duration": 2,
"block": "center title"
},
{
"title": "Wait 1 second",
"action": "hold",
"label": "",
"duration": 1
},
{
"title": "Fade up first page",
"action": "fade up",
"label": "",
"blocks": [
"left",
"right"
],
"duration": 1
}
]
}
Loading
Oops, something went wrong.