Skip to content

Commit 43e73b8

Browse files
committed
Add This Is Me
1 parent baafab8 commit 43e73b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+13032
-24
lines changed

easycoder/easycoder-min.js

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

easycoder/easycoder.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const EasyCoder_Compare = (program, value1, value2) => {
77
var v2 = val2.content;
88
if (v1 && val1.numeric) {
99
if (!val2.numeric) {
10-
v2 = (typeof v2 === `undefined`) ? 0 : parseInt(v2);
10+
v2 = (v2 === `` || typeof v2 === `undefined`) ? 0 : parseInt(v2);
1111
}
1212
} else {
1313
if (v2 && val2.numeric) {
@@ -2087,7 +2087,8 @@ const EasyCoder_Core = {
20872087
targetJSON[itemName] = itemValue.content;
20882088
} else if (itemValue.numeric) {
20892089
targetJSON[itemName] = itemValue.content;
2090-
} else if (itemValue.content.substr(0, 2) === `{"`) {
2090+
// } else if (itemValue.content.substr(0, 2) === `{"`) {
2091+
} else if ([`["`, `{"`].includes(itemValue.content.substr(0, 2))) {
20912092
targetJSON[itemName] = JSON.parse(itemValue.content);
20922093
} else {
20932094
targetJSON[itemName] = itemValue.content.split(`"`).join(`\\"`);

js/easycoder/Compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const EasyCoder_Compare = (program, value1, value2) => {
77
var v2 = val2.content;
88
if (v1 && val1.numeric) {
99
if (!val2.numeric) {
10-
v2 = (typeof v2 === `undefined`) ? 0 : parseInt(v2);
10+
v2 = (v2 === `` || typeof v2 === `undefined`) ? 0 : parseInt(v2);
1111
}
1212
} else {
1313
if (v2 && val2.numeric) {

js/easycoder/Core.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,8 @@ const EasyCoder_Core = {
17031703
targetJSON[itemName] = itemValue.content;
17041704
} else if (itemValue.numeric) {
17051705
targetJSON[itemName] = itemValue.content;
1706-
} else if (itemValue.content.substr(0, 2) === `{"`) {
1706+
// } else if (itemValue.content.substr(0, 2) === `{"`) {
1707+
} else if ([`["`, `{"`].includes(itemValue.content.substr(0, 2))) {
17071708
targetJSON[itemName] = JSON.parse(itemValue.content);
17081709
} else {
17091710
targetJSON[itemName] = itemValue.content.split(`"`).join(`\\"`);

js/plugins/browser.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,26 @@ const EasyCoder_Browser = {
17191719
}
17201720
throw new Error(`'${compiler.getToken()}' is not a symbol`);
17211721
}
1722+
} else if (token === `class`) {
1723+
if (compiler.nextTokenIs(`of`)) {
1724+
if (compiler.nextIsSymbol()) {
1725+
const symbol = compiler.getSymbolRecord();
1726+
if (symbol.extra === `dom`) {
1727+
if (compiler.nextTokenIs(`to`)) {
1728+
const value = compiler.getNextValue();
1729+
compiler.addCommand({
1730+
domain: `browser`,
1731+
keyword: `set`,
1732+
lino,
1733+
type: `setClass`,
1734+
symbolName: symbol.name,
1735+
value
1736+
});
1737+
return true;
1738+
}
1739+
}
1740+
}
1741+
}
17221742
} else if (token === `id`) {
17231743
if (compiler.nextTokenIs(`of`)) {
17241744
if (compiler.nextIsSymbol()) {
@@ -1980,6 +2000,15 @@ const EasyCoder_Browser = {
19802000
select.selectedIndex = -1;
19812001
}
19822002
break;
2003+
case `setClass`:
2004+
symbol = program.getSymbolRecord(command.symbolName);
2005+
target = symbol.element[symbol.index];
2006+
if (!target) {
2007+
targetId = program.getValue(symbol.value[symbol.index]);
2008+
target = document.getElementById(targetId);
2009+
}
2010+
target.classList.add(program.getValue(command.value));
2011+
break;
19832012
case `setId`:
19842013
symbol = program.getSymbolRecord(command.symbolName);
19852014
target = symbol.element[symbol.index];

resources/ecs/intro.ecs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
on message
2727
begin
2828
put the message into Message
29-
if Message is `restore` send Message to parent
30-
else if Message is `pause` begin end
31-
else go to Start
29+
if Message is `restore` send Message to parent
30+
else if Message is `pause` begin end
31+
else go to Start
3232
end
3333

3434
set ready
@@ -40,7 +40,7 @@ Start:
4040
on click RunCodex
4141
begin
4242
send `hide` to parent
43-
rest get Codex from `/resources/ecs/codex`
43+
rest get Codex from `/resources/ecs/codex.ecs`
4444
run Codex
4545
end
46-
stop
46+
stop

resources/ecs/main.ecs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
button AboutButton
1919
button PhilosophyButton
2020
button CodexButton
21+
button ThisIsMeButton
2122
hr Rule
2223
a ShowNotes
2324
module ShowdownModule
@@ -116,9 +117,9 @@ BuildPage:
116117
on click HomeButton
117118
begin
118119
gosub to DeselectAllButtons
119-
set style `background` of HomeButton to `darkgray`
120+
set style `background` of HomeButton to `darkgray`
120121
send `pause` to CurrentModule
121-
alias CurrentModule to HomeModule
122+
alias CurrentModule to HomeModule
122123
send to HomeModule
123124
end
124125

@@ -130,9 +131,9 @@ BuildPage:
130131
on click IntroButton
131132
begin
132133
gosub to DeselectAllButtons
133-
set style `background` of IntroButton to `darkgray`
134+
set style `background` of IntroButton to `darkgray`
134135
send `pause` to CurrentModule
135-
alias CurrentModule to IntroModule
136+
alias CurrentModule to IntroModule
136137
send to IntroModule
137138
end
138139

@@ -144,9 +145,9 @@ BuildPage:
144145
on click ExamplesButton
145146
begin
146147
gosub to DeselectAllButtons
147-
set style `background` of ExamplesButton to `darkgray`
148+
set style `background` of ExamplesButton to `darkgray`
148149
send `pause` to CurrentModule
149-
alias CurrentModule to ExamplesModule
150+
alias CurrentModule to ExamplesModule
150151
send to ExamplesModule
151152
end
152153

@@ -158,9 +159,9 @@ BuildPage:
158159
on click AboutButton
159160
begin
160161
gosub to DeselectAllButtons
161-
set style `background` of AboutButton to `darkgray`
162+
set style `background` of AboutButton to `darkgray`
162163
send `pause` to CurrentModule
163-
alias CurrentModule to AboutModule
164+
alias CurrentModule to AboutModule
164165
send to AboutModule
165166
end
166167

@@ -172,9 +173,9 @@ BuildPage:
172173
on click PhilosophyButton
173174
begin
174175
gosub to DeselectAllButtons
175-
set style `background` of PhilosophyButton to `darkgray`
176+
set style `background` of PhilosophyButton to `darkgray`
176177
send `pause` to CurrentModule
177-
alias CurrentModule to PhilosophyModule
178+
alias CurrentModule to PhilosophyModule
178179
send to PhilosophyModule
179180
end
180181

@@ -192,6 +193,16 @@ BuildPage:
192193
run Script
193194
end
194195

196+
create ButtonItem in ButtonList
197+
create ThisIsMeButton in ButtonItem
198+
set the style of ThisIsMeButton to ButtonStyle
199+
set style `margin-top` of ThisIsMeButton to `0.25em`
200+
set the text of ThisIsMeButton to `This is Me`
201+
on click ThisIsMeButton
202+
begin
203+
location `/thisisme/index.html`
204+
end
205+
195206
create Notes in Main
196207
create ShowNotes in Notes
197208
DoNotes:
@@ -216,4 +227,4 @@ DeselectAllButtons:
216227
set style `background` of ExamplesButton to ``
217228
set style `background` of AboutButton to ``
218229
set style `background` of PhilosophyButton to ``
219-
return
230+
return

resources/ecs/scripted.ecs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ SelectFile:
242242
put Content into Current
243243
set the content of Status to `Script '` cat File cat `' loaded`
244244
fork to ResetStatus
245-
set the title to `Script Editor - ` cat File
245+
set the title to File
246246

247247
CloseBrowser:
248248
set style `background-color` of Overlay to `rgba(0,0,0,0.0)`
@@ -255,4 +255,4 @@ CloseBrowser:
255255
ResetStatus:
256256
wait 2
257257
set the content of Status to ``
258-
stop
258+
stop

0 commit comments

Comments
 (0)