summaryrefslogtreecommitdiff
path: root/store.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-11-12 11:44:39 +0100
committerjmoenig <jens@moenig.org>2013-11-12 11:44:39 +0100
commit651f44ebdfe3c6ff33f9135b23b971293a211dbc (patch)
treefc809de66ca1b78aa8d3bee9566f4760b9b5ceb8 /store.js
parentcc7a1558f1aeb3fa0e75378f8688cdfa40c8fb8e (diff)
downloadsnap-byow-651f44ebdfe3c6ff33f9135b23b971293a211dbc.tar.gz
snap-byow-651f44ebdfe3c6ff33f9135b23b971293a211dbc.zip
customizable drop-down menus for input slots
Diffstat (limited to 'store.js')
-rw-r--r--store.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/store.js b/store.js
index e51c8da..0032919 100644
--- a/store.js
+++ b/store.js
@@ -49,7 +49,7 @@
*/
-/*global modules, XML_Element, XML_Serializer, VariableFrame, StageMorph,
+/*global modules, XML_Element, VariableFrame, StageMorph,
SpriteMorph, WatcherMorph, Point, CustomBlockDefinition, Context,
ReporterBlockMorph, CommandBlockMorph, HatBlockMorph, RingMorph, contains,
detect, CustomCommandBlockMorph, CustomReporterBlockMorph, Color, List,
@@ -61,7 +61,7 @@ SyntaxElementMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.store = '2013-September-17';
+modules.store = '2013-November-12';
// XML_Serializer ///////////////////////////////////////////////////////
@@ -741,12 +741,16 @@ SnapSerializer.prototype.loadCustomBlocks = function (
if (inputs) {
i = -1;
inputs.children.forEach(function (child) {
+ var options = child.childNamed('options');
if (child.tag !== 'input') {
return;
}
i += 1;
- definition.declarations[names[i]]
- = [child.attributes.type, child.contents];
+ definition.declarations[names[i]] = [
+ child.attributes.type,
+ child.contents,
+ options ? options.contents : undefined
+ ];
});
}
@@ -1479,8 +1483,6 @@ VariableFrame.prototype.toXML = function (serializer) {
}, '');
};
-
-
// Watchers
WatcherMorph.prototype.toXML = function (serializer) {
@@ -1661,9 +1663,13 @@ CustomBlockDefinition.prototype.toXML = function (serializer) {
this.codeMapping || '',
Object.keys(this.declarations).reduce(function (xml, decl) {
return xml + serializer.format(
- '<input type="@">$</input>',
+ '<input type="@">$%</input>',
myself.declarations[decl][0],
- myself.declarations[decl][1]
+ myself.declarations[decl][1],
+ myself.declarations[decl][2] ?
+ '<options>' + myself.declarations[decl][2] +
+ '</options>'
+ : ''
);
}, ''),
this.body ? serializer.store(this.body.expression) : '',