Skip to content

Commit c3e69f1

Browse files
committed
Stuff for Storyteller
1 parent 7c7b7fb commit c3e69f1

File tree

7 files changed

+71
-30
lines changed

7 files changed

+71
-30
lines changed

build

Lines changed: 0 additions & 27 deletions
This file was deleted.

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.zip

42.4 KB
Binary file not shown.

js/EasyCoder-ST.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
EasyCoder.version = `2.6.0`;
2+
EasyCoder.timestamp = Date.now();
3+
4+
function EasyCoder_Startup() {
5+
EasyCoder.timestamp = Date.now();
6+
EasyCoder.scripts = {};
7+
window.EasyCoder = EasyCoder;
8+
const script = document.getElementById(`easycoder-script`);
9+
if (script) {
10+
script.style.display = `none`;
11+
try {
12+
EasyCoder.start(script.innerText);
13+
}
14+
catch (err) {
15+
EasyCoder.reportError(err);
16+
}
17+
}
18+
};
19+
20+
// For browsers
21+
window.onload = EasyCoder_Startup;

js/plugins-all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const EasyCoder_Plugins = {
1414
addPlugin(`showdown`, EasyCoder_Showdown);
1515
addPlugin(`svg`, EasyCoder_SVG);
1616
addPlugin(`ui`, EasyCoder_UI);
17+
addPlugin(`vfx`, EasyCoder_WOF);
1718
addPlugin(`wof`, EasyCoder_WOF);
1819
addPlugin(`anagrams`, EasyCoder_Anagrams);
1920
},

js/plugins-st.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Plugins for StoryTeller
2+
3+
// eslint-disable-next-line no-unused-vars
4+
const EasyCoder_Plugins = {
5+
6+
// eslint-disable-next-line no-unused-vars
7+
getGlobalPlugins: (timestamp, path, setPluginCount, getPlugin, addPlugin) => {
8+
setPluginCount(9); // *** IMPORTANT *** the number of plugins you will be adding
9+
10+
addPlugin(`browser`, EasyCoder_Browser);
11+
addPlugin(`json`, EasyCoder_Json);
12+
addPlugin(`rest`, EasyCoder_Rest);
13+
addPlugin(`gmap`, EasyCoder_GMap);
14+
addPlugin(`showdown`, EasyCoder_Showdown);
15+
addPlugin(`codemirror`, EasyCoder_CodeMirror);
16+
addPlugin(`svg`, EasyCoder_SVG);
17+
addPlugin(`ui`, EasyCoder_UI);
18+
addPlugin(`vfx`, EasyCoder_VFX);
19+
},
20+
21+
rest: () => {
22+
return ``;
23+
}
24+
};

js/plugins/browser.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,8 @@ const EasyCoder_Browser = {
19791979
const styleName = compiler.getValue();
19801980
let type = `setStyle`;
19811981
let symbolName = ``;
1982-
if (compiler.tokenIs(`of`)) {
1982+
token = compiler.getToken();
1983+
if (token === `of`) {
19831984
if (compiler.nextToken() === `body`) {
19841985
type = `setBodyStyle`;
19851986
} else if (compiler.isSymbol()) {
@@ -2007,6 +2008,20 @@ const EasyCoder_Browser = {
20072008
}
20082009
}
20092010
}
2011+
else if (token === `to`) {
2012+
const styleValue = compiler.getNextValue();
2013+
if (styleValue) {
2014+
compiler.addCommand({
2015+
domain: `browser`,
2016+
keyword: `set`,
2017+
lino,
2018+
type: `setHeadStyle`,
2019+
styleName,
2020+
styleValue
2021+
});
2022+
return true;
2023+
}
2024+
}
20102025
} else if (token === `default`) {
20112026
if (compiler.nextTokenIs(`of`)) {
20122027
if (compiler.nextIsSymbol()) {
@@ -2233,6 +2248,13 @@ const EasyCoder_Browser = {
22332248
break;
22342249
}
22352250
break;
2251+
case `setHeadStyle`:
2252+
const headStyleName = program.getValue(command.styleName);
2253+
const headStyleValue = program.getValue(command.styleValue);
2254+
var style = document.createElement('style');
2255+
style.innerHTML = `${headStyleName} ${headStyleValue}`;
2256+
document.head.appendChild(style);
2257+
break;
22362258
case `setBodyStyle`:
22372259
const bodyStyleValue = program.getValue(command.styleValue);
22382260
switch (command.styleName.content) {

0 commit comments

Comments
 (0)