Skip to content

Commit 4cd0fa1

Browse files
committed
Updates, bug fixes; aded 'uuid'
1 parent 45414b2 commit 4cd0fa1

Some content is hidden

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

91 files changed

+17511
-1609
lines changed

codex/easycoder/easycoder-cordova.js

Lines changed: 10371 additions & 0 deletions
Large diffs are not rendered by default.

codex/easycoder/easycoder-min.js

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

codex/easycoder/easycoder.js

Lines changed: 1390 additions & 1219 deletions
Large diffs are not rendered by default.

codex/easycoder/easycoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: EasyCoder
44
* Plugin URI: https://easycoder.software
55
* Description: Control the appearance and behavior of your posts and pages by embedding simple English-like scripts, without the need to learn JavaScript.
6-
* Version: 2.5.1
6+
* Version: 2.5.4
77
* Author: EasyCoder Software
88
* Author URI: https://easycoder.software
99
*/
@@ -16,7 +16,7 @@
1616
add_action('wp_enqueue_scripts', 'easycoder_enqueue_script', 2);
1717
function easycoder_enqueue_script() {
1818
wp_enqueue_script('easycoder_script', plugin_dir_url( __FILE__ )
19-
. 'easycoder-min.js', array(), '2.5.1');
19+
. 'easycoder-min.js', array(), '2.5.4');
2020
}
2121

2222
// Set up default plugin and REST scripts

codex/easycoder/plugins/anagrams.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// eslint-disable-next-line no-unused-vars
22
const EasyCoder_Anagrams = {
33

4+
name: `EasyCoder_Anagrams`,
5+
46
value: {
57

68
compile: (compiler) => {

codex/easycoder/plugins/aws.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const EasyCoder_AWS = {
22

3+
name: `EasyCoder_AWS`,
4+
35
AWS: {
46

57
compile: (compiler) => {

codex/easycoder/plugins/browser.js

Lines changed: 99 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const EasyCoder_Browser = {
22

3+
name: `EasyCoder_Browser`,
4+
35
A: {
46

57
compile: (compiler) => {
@@ -354,14 +356,14 @@ const EasyCoder_Browser = {
354356
}
355357
} else {
356358
const imports = compiler.imports;
357-
if (imports.length > 0) {
358-
const parent = imports[0].name;
359+
if (imports && imports.length > 0) {
360+
// This section is used by Codex to force run in Run panel, which must be the first import
359361
compiler.addCommand({
360362
domain: `browser`,
361363
keyword: `create`,
362364
lino,
363365
name: symbolRecord.name,
364-
parent,
366+
parent: imports[0],
365367
imported: true
366368
});
367369
return true;
@@ -401,10 +403,11 @@ const EasyCoder_Browser = {
401403
parent = parentRecord.element[parentRecord.index];
402404
}
403405
targetRecord.element[targetRecord.index] = document.createElement(targetRecord.keyword);
404-
if (!this.elementId) {
405-
this.elementId = 0;
406+
if (!program.elementId) {
407+
program.elementId = 0;
406408
}
407-
targetRecord.element[targetRecord.index].id = `ec-${targetRecord.name}-${targetRecord.index}-${this.elementId++}`;
409+
targetRecord.element[targetRecord.index].id =
410+
`ec-${targetRecord.name}-${targetRecord.index}-${program.elementId++}`;
408411
if (targetRecord.keyword === `a`) {
409412
targetRecord.element[targetRecord.index].setAttribute(`href`, `#`);
410413
}
@@ -507,6 +510,34 @@ const EasyCoder_Browser = {
507510
}
508511
},
509512

513+
Focus: {
514+
515+
compile: (compiler) => {
516+
const lino = compiler.getLino();
517+
if (compiler.nextIsSymbol()) {
518+
const symbol = compiler.getToken();
519+
compiler.next();
520+
compiler.addCommand({
521+
domain: `browser`,
522+
keyword: `focus`,
523+
lino,
524+
symbol
525+
});
526+
return true;
527+
}
528+
compiler.addWarning(`Unrecognised syntax in 'focus'`);
529+
return false;
530+
},
531+
532+
run: (program) => {
533+
const command = program[program.pc];
534+
const symbol = program.getSymbolRecord(command.symbol);
535+
const element = symbol.element[symbol.index];
536+
element.focus();
537+
return command.pc + 1;
538+
}
539+
},
540+
510541
FORM: {
511542

512543
compile: (compiler) => {
@@ -1078,22 +1109,23 @@ const EasyCoder_Browser = {
10781109
switch (command.action) {
10791110
case `change`:
10801111
const changeItem = program.getSymbolRecord(command.symbol);
1081-
if (changeItem.keyword === `select`) {
1082-
const target = changeItem.element[changeItem.index];
1083-
target.targetPc = command.pc + 2;
1084-
target.addEventListener(`change`, function () {
1085-
try {
1086-
program.run(target.targetPc);
1087-
} catch (err) {
1088-
console.log(err.message);
1089-
alert(err.message);
1090-
}
1091-
return false;
1092-
});
1093-
}
1112+
// if (changeItem.keyword === `select`) {
1113+
const target = changeItem.element[changeItem.index];
1114+
target.targetPc = command.pc + 2;
1115+
target.addEventListener(`change`, function () {
1116+
try {
1117+
program.run(target.targetPc);
1118+
} catch (err) {
1119+
console.log(err.message);
1120+
alert(err.message);
1121+
}
1122+
return false;
1123+
});
1124+
// }
10941125
break;
10951126
case `click`:
10961127
const targetRecord = program.getSymbolRecord(command.symbol);
1128+
targetRecord.program = program.script;
10971129
targetRecord.element.forEach(function (target, index) {
10981130
target.targetRecord = targetRecord;
10991131
target.targetIndex = index;
@@ -1107,7 +1139,8 @@ const EasyCoder_Browser = {
11071139
eventTarget.targetRecord.index = eventTarget.targetIndex;
11081140
setTimeout(function () {
11091141
EasyCoder.timestamp = Date.now();
1110-
program.run(eventTarget.targetPc);
1142+
let p = EasyCoder.scripts[eventTarget.targetRecord.program];
1143+
p.run(eventTarget.targetPc);
11111144
}, 1);
11121145
}
11131146
}
@@ -1246,16 +1279,20 @@ const EasyCoder_Browser = {
12461279
e.stopPropagation();
12471280
document.dragX = e.clientX;
12481281
document.dragY = e.clientY;
1249-
setTimeout(function () {
1250-
program.run(document.mouseMovePc);
1251-
}, 1);
1282+
if (document.onmousemove) {
1283+
setTimeout(function () {
1284+
program.run(document.mouseMovePc);
1285+
}, 1);
1286+
}
12521287
return false;
12531288
};
12541289
window.onmouseup = function () {
1255-
window.onmousemove = null;
1256-
window.onmouseup = null;
1290+
document.onmousemove = null;
1291+
document.onmouseup = null;
12571292
setTimeout(function () {
1258-
program.run(document.mouseUpPc);
1293+
if (program && program.run) {
1294+
program.run(document.mouseUpPc);
1295+
}
12591296
}, 1);
12601297
return false;
12611298
};
@@ -1542,6 +1579,7 @@ const EasyCoder_Browser = {
15421579
Scroll: {
15431580

15441581
compile: (compiler) => {
1582+
const lino = compiler.getLino();
15451583
let name = null;
15461584
if (compiler.nextIsSymbol()) {
15471585
const symbolRecord = compiler.getSymbolRecord();
@@ -1553,6 +1591,7 @@ const EasyCoder_Browser = {
15531591
compiler.addCommand({
15541592
domain: `browser`,
15551593
keyword: `scroll`,
1594+
lino,
15561595
name,
15571596
to
15581597
});
@@ -1680,7 +1719,27 @@ const EasyCoder_Browser = {
16801719
return true;
16811720
}
16821721
}
1683-
throw new Error(`Expected a symbol at '{compiler.getToken()}'`);
1722+
throw new Error(`'${compiler.getToken()}' is not a symbol`);
1723+
}
1724+
} else if (token === `class`) {
1725+
if (compiler.nextTokenIs(`of`)) {
1726+
if (compiler.nextIsSymbol()) {
1727+
const symbol = compiler.getSymbolRecord();
1728+
if (symbol.extra === `dom`) {
1729+
if (compiler.nextTokenIs(`to`)) {
1730+
const value = compiler.getNextValue();
1731+
compiler.addCommand({
1732+
domain: `browser`,
1733+
keyword: `set`,
1734+
lino,
1735+
type: `setClass`,
1736+
symbolName: symbol.name,
1737+
value
1738+
});
1739+
return true;
1740+
}
1741+
}
1742+
}
16841743
}
16851744
} else if (token === `id`) {
16861745
if (compiler.nextTokenIs(`of`)) {
@@ -1943,6 +2002,15 @@ const EasyCoder_Browser = {
19432002
select.selectedIndex = -1;
19442003
}
19452004
break;
2005+
case `setClass`:
2006+
symbol = program.getSymbolRecord(command.symbolName);
2007+
target = symbol.element[symbol.index];
2008+
if (!target) {
2009+
targetId = program.getValue(symbol.value[symbol.index]);
2010+
target = document.getElementById(targetId);
2011+
}
2012+
target.classList.add(program.getValue(command.value));
2013+
break;
19462014
case `setId`:
19472015
symbol = program.getSymbolRecord(command.symbolName);
19482016
target = symbol.element[symbol.index];
@@ -2338,6 +2406,8 @@ const EasyCoder_Browser = {
23382406
return EasyCoder_Browser.FIELDSET;
23392407
case `file`:
23402408
return EasyCoder_Browser.FILE;
2409+
case `focus`:
2410+
return EasyCoder_Browser.Focus;
23412411
case `form`:
23422412
return EasyCoder_Browser.FORM;
23432413
case `fullscreen`:
@@ -2380,8 +2450,6 @@ const EasyCoder_Browser = {
23802450
return EasyCoder_Browser.Mail;
23812451
case `on`:
23822452
return EasyCoder_Browser.On;
2383-
case `option`:
2384-
return EasyCoder_Browser.Option;
23852453
case `p`:
23862454
return EasyCoder_Browser.P;
23872455
case `play`:
@@ -2501,7 +2569,7 @@ const EasyCoder_Browser = {
25012569
symbol: symbol.name
25022570
};
25032571
}
2504-
throw new Error(`Expected a symbol at '{compiler.getToken()}'`);
2572+
throw new Error(`'${compiler.getToken()}' is not a symbol`);
25052573
}
25062574
return null;
25072575
case `selected`:
@@ -3009,4 +3077,4 @@ window.onpopstate = function (event) {
30093077
console.log(`No script property in window state object`);
30103078
}
30113079
}
3012-
};
3080+
};

codex/easycoder/plugins/ckeditor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const EasyCoder_CKEditor = {
22

3+
name: `EasyCoder_CKEditor`,
4+
35
CKEditor: {
46

57
compile: (compiler) => {
@@ -167,4 +169,4 @@ const EasyCoder_CKEditor = {
167169
compile: () => {},
168170
test: () => {}
169171
}
170-
};
172+
};

codex/easycoder/plugins/codemirror.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const EasyCoder_CodeMirror = {
22

3+
name: `EasyCoder_CodeMirror`,
4+
35
CodeMirror: {
46

57
compile: (compiler) => {
@@ -108,14 +110,16 @@ const EasyCoder_CodeMirror = {
108110
}
109111
break;
110112
case `attach`:
111-
editor = program.getSymbolRecord(command.editor);
112-
const element = document.getElementById(editor.element[editor.index].id);
113-
editor.editor = CodeMirror.fromTextArea(element, {
114-
mode: command.mode,
115-
theme: `default`,
116-
lineNumbers: true
117-
});
118-
editor.editor.setSize(`100%`, `100%`);
113+
try {
114+
editor = program.getSymbolRecord(command.editor);
115+
const element = document.getElementById(editor.element[editor.index].id);
116+
editor.editor = CodeMirror.fromTextArea(element, {
117+
mode: command.mode,
118+
theme: `default`,
119+
lineNumbers: true
120+
});
121+
editor.editor.setSize(`100%`, `100%`);
122+
} catch (err) { alert(err); }
119123
break;
120124
case `setContent`:
121125
editor = program.getSymbolRecord(command.editor);
@@ -163,4 +167,4 @@ const EasyCoder_CodeMirror = {
163167
compile: () => {},
164168
test: () => {}
165169
}
166-
};
170+
};

codex/easycoder/plugins/dummy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const EasyCoder_Dummy = {
22

3+
name: `EasyCoder_Dummy`,
4+
35
Dummy: {
46

57
// Command keywords

0 commit comments

Comments
 (0)