diff --git a/blocks/lists.js b/blocks/lists.js index 0d23db05f..55dfac025 100644 --- a/blocks/lists.js +++ b/blocks/lists.js @@ -389,12 +389,9 @@ Blockly.Blocks['lists_getIndex'] = { tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM; break; } - if (where == 'FROM_START') { + if (where == 'FROM_START' || where == 'FROM_END') { tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP .replace('%1', Blockly.Blocks.ONE_BASED_INDEXING ? '#1' : '#0'); - } else if (where == 'FROM_END') { - tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP - .replace('%1', '#1'); // The end is always 1-indexed. } return tooltip; }); @@ -552,12 +549,9 @@ Blockly.Blocks['lists_setIndex'] = { tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM; break; } - if (where == 'FROM_START') { + if (where == 'FROM_START' || where == 'FROM_END') { tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP .replace('%1', Blockly.Blocks.ONE_BASED_INDEXING ? '#1' : '#0'); - } else if (where == 'FROM_END') { - tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP - .replace('%1', '#1'); // The end is always 1-indexed. } return tooltip; }); diff --git a/blocks/text.js b/blocks/text.js index 23ff52b32..c26bb578b 100644 --- a/blocks/text.js +++ b/blocks/text.js @@ -349,7 +349,17 @@ Blockly.Blocks['text_charAt'] = { this.appendDummyInput('AT'); this.setInputsInline(true); this.updateAt_(true); - this.setTooltip(Blockly.Msg.TEXT_CHARAT_TOOLTIP); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function() { + var where = thisBlock.getFieldValue('WHERE'); + var tooltip = Blockly.Msg.TEXT_CHARAT_TOOLTIP; + if (where == 'FROM_START' || where == 'FROM_END') { + tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP + .replace('%1', Blockly.Blocks.ONE_BASED_INDEXING ? '#1' : '#0'); + } + return tooltip; + }); }, /** * Create XML to represent whether there is an 'AT' input. diff --git a/core/workspace_svg.js b/core/workspace_svg.js index b61c43742..73bd6afe1 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -984,7 +984,7 @@ Blockly.WorkspaceSvg.prototype.preloadAudio_ = function() { }; /** - * Play an audio file at specified value. If volume is not specified, + * Play a named sound at specified volume. If volume is not specified, * use full volume (1). * @param {string} name Name of sound. * @param {number=} opt_volume Volume of sound (0-1).