Add alternative syntax using script tag for x-action and x-default-action
Add alternative syntax using script tag for x-action and x-default-action
diff --git a/js/game.js b/js/game.js
index 1901aba..eac738d 100644
--- a/js/game.js
+++ b/js/game.js
@@ -247,10 +247,19 @@ function makeGameObject(dom_object)
object_counter++;
}
for (const child of dom_object.children) {
- if (child.tagName.substring(0, 2) != "X-") {
+ let tag_name = child.tagName;
+ if (tag_name == 'SCRIPT') {
+ let type = child.getAttribute("type");
+ if (type == "text/action") {
+ tag_name = "X-ACTION";
+ } else if (type == "text/default-action") {
+ tag_name = "X-DEFAULT-ACTION";
+ }
+ }
+ if (tag_name.substring(0, 2) != "X-") {
continue;
}
- let attribute_name = child.tagName.slice(2);
+ let attribute_name = tag_name.slice(2);
if (attribute_name) {
attribute_name = attribute_name.toLowerCase()
if (attribute_name == 'present') {
@@ -1072,7 +1081,7 @@ class Game
if (this.history.length == 0) {
elt('previous-history').disabled = true;
} else {
- elt('previous-history').disabled = false;
+ elt('previous-history').disabled = true;
}
elt('next-history').disabled = false;
}