Merge branch 'develop' of https://github.com/google/blockly into develop

This commit is contained in:
Sean Lip
2016-07-15 16:40:38 -07:00
3 changed files with 14 additions and 10 deletions

View File

@@ -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;
});

View File

@@ -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.

View File

@@ -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).