From 651f44ebdfe3c6ff33f9135b23b971293a211dbc Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 12 Nov 2013 11:44:39 +0100 Subject: customizable drop-down menus for input slots --- store.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'store.js') 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( - '$', + '$%', myself.declarations[decl][0], - myself.declarations[decl][1] + myself.declarations[decl][1], + myself.declarations[decl][2] ? + '' + myself.declarations[decl][2] + + '' + : '' ); }, ''), this.body ? serializer.store(this.body.expression) : '', -- cgit v1.3.1