mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Lint corrections.
This commit is contained in:
parent
d1f6bdb173
commit
d819db2acf
6 changed files with 16 additions and 8 deletions
|
@ -71,7 +71,7 @@ Blockly.inject = function(container, opt_options) {
|
|||
/**
|
||||
* Parse the provided toolbox tree into a consistent DOM format.
|
||||
* @param {Node|string} tree DOM tree of blocks, or text representation of same.
|
||||
* @return {Node} DOM tree of blocks or null.
|
||||
* @return {Node} DOM tree of blocks, or null.
|
||||
* @private
|
||||
*/
|
||||
Blockly.parseToolboxTree_ = function(tree) {
|
||||
|
|
|
@ -30,7 +30,10 @@
|
|||
*/
|
||||
goog.provide('Blockly.Msg');
|
||||
|
||||
// Back up original getMsg function.
|
||||
/**
|
||||
* Back up original getMsg function.
|
||||
* @type !Function
|
||||
*/
|
||||
goog.getMsgOrig = goog.getMsg;
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,7 +161,8 @@ Blockly.Toolbox.prototype.position = function() {
|
|||
var svgPosition = goog.style.getPageOffset(svg);
|
||||
var svgSize = Blockly.svgSize(svg);
|
||||
if (this.workspace_.RTL) {
|
||||
treeDiv.style.left = (svgPosition.x + svgSize.width - treeDiv.offsetWidth) + 'px';
|
||||
treeDiv.style.left =
|
||||
(svgPosition.x + svgSize.width - treeDiv.offsetWidth) + 'px';
|
||||
} else {
|
||||
treeDiv.style.left = svgPosition.x + 'px';
|
||||
}
|
||||
|
@ -177,6 +178,7 @@ Blockly.Toolbox.prototype.position = function() {
|
|||
|
||||
/**
|
||||
* Fill the toolbox with categories and blocks.
|
||||
* @param {Node} newTree DOM tree of blocks, or null.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Toolbox.prototype.populate_ = function(newTree) {
|
||||
|
|
|
@ -169,7 +169,8 @@ Blockly.PHP['lists_getIndex'] = function(block) {
|
|||
var code = 'array_slice(' + list + ', -' + at + ', 1)[0]';
|
||||
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
|
||||
} else if (mode == 'GET_REMOVE' || mode == 'REMOVE') {
|
||||
code = 'array_splice(' + list + ', count(' + list + ') - ' + at + ', 1)[0]';
|
||||
code = 'array_splice(' + list +
|
||||
', count(' + list + ') - ' + at + ', 1)[0]';
|
||||
if (mode == 'GET_REMOVE') {
|
||||
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
|
||||
} else if (mode == 'REMOVE') {
|
||||
|
@ -366,6 +367,6 @@ Blockly.PHP['lists_split'] = function(block) {
|
|||
} else {
|
||||
throw 'Unknown mode: ' + mode;
|
||||
}
|
||||
var code = functionName + '('+ value_delim + ', ' + value_input + ')';
|
||||
var code = functionName + '(' + value_delim + ', ' + value_input + ')';
|
||||
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
|
||||
};
|
||||
|
|
|
@ -153,7 +153,8 @@ Blockly.PHP['controls_forEach'] = function(block) {
|
|||
var branch = Blockly.PHP.statementToCode(block, 'DO');
|
||||
branch = Blockly.PHP.addLoopTrap(branch, block.id);
|
||||
var code = '';
|
||||
code += 'foreach (' + argument0 + ' as ' + variable0 + ') {\n' + branch + '}\n';
|
||||
code += 'foreach (' + argument0 + ' as ' + variable0 +
|
||||
') {\n' + branch + '}\n';
|
||||
return code;
|
||||
};
|
||||
|
||||
|
|
|
@ -97,9 +97,10 @@ Blockly.PHP['text_indexOf'] = function(block) {
|
|||
var code = operator + '(' + argument1 + ', ' + argument0 + ') + 1';
|
||||
|
||||
var functionName = Blockly.PHP.provideFunction_(
|
||||
block.getFieldValue('END') == 'FIRST'?'text_indexOf':'text_lastIndexOf',
|
||||
block.getFieldValue('END') == 'FIRST' ?
|
||||
'text_indexOf' : 'text_lastIndexOf',
|
||||
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'($text, $search) {',
|
||||
'($text, $search) {',
|
||||
' $pos = ' + operator + '($text, $search);',
|
||||
' return $pos === false ? 0 : $pos + 1;',
|
||||
'}']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue