Normalize comments

This commit is contained in:
Neil Fraser
2021-05-19 09:23:37 -07:00
committed by Neil Fraser
parent 4436e2814d
commit dd0314bc0b
48 changed files with 185 additions and 186 deletions

View File

@@ -707,7 +707,7 @@ BlockDefinitionExtractor.typeOther_ = function(type) {
};
/**
* Creates a block Element for the color_hue block, with the given hue.
* Creates a block Element for the colour_hue block, with the given hue.
* @param hue {number} The hue value, from 0 to 360.
* @return {Element} The <block> Element representing a colour_hue block
* with the given hue.

View File

@@ -170,7 +170,7 @@ BlockExporterTools.prototype.generateCategoryFromBlockLib =
};
/**
* Generate selector dom from block library storage. For each block in the
* Generate selector DOM from block library storage. For each block in the
* library, it has a block option, which consists of a checkbox, a label,
* and a fixed size preview workspace.
* @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object.

View File

@@ -46,9 +46,9 @@ var BlockOption = function(blockSelector, blockType, previewBlockXml) {
};
/**
* Creates the dom for a single block option. Includes checkbox, label, and div
* Creates the DOM for a single block option. Includes checkbox, label, and div
* in which to inject the preview block.
* @return {!Element} Root node of the selector dom which consists of a
* @return {!Element} Root node of the selector DOM which consists of a
* checkbox, a label, and a fixed size preview workspace per block.
*/
BlockOption.prototype.createDom = function() {

View File

@@ -526,12 +526,12 @@ td.taboff:hover {
text-decoration: none;
}
/* Change color of dropdown links on hover. */
/* Change colour of dropdown links on hover. */
.dropdown-content a:hover, .dropdown-content label:hover {
background-color: #EEE;
}
/* Change color of dropdown links on selected. */
/* Change colour of dropdown links on selected. */
.dropdown-content-selected {
background-color: #DDD;
}

View File

@@ -490,8 +490,8 @@ WorkspaceFactoryController.prototype.changeSelectedCategory = function(name,
return;
}
// Change colour of selected category.
selected.changeColor(colour);
this.view.setBorderColor(this.model.getSelectedId(), colour);
selected.changeColour(colour);
this.view.setBorderColour(this.model.getSelectedId(), colour);
// Change category name.
selected.changeName(name);
this.view.updateCategoryName(name, this.model.getSelectedId());
@@ -588,9 +588,9 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) {
+ '. Rename your category and try again.');
return;
}
if (!standardCategory.color && standardCategory.hue !== undefined) {
if (!standardCategory.colour && standardCategory.hue !== undefined) {
// Calculate the hex colour based on the hue.
standardCategory.color = Blockly.hueToHex(standardCategory.hue);
standardCategory.colour = Blockly.hueToHex(standardCategory.hue);
}
// Transfers current flyout blocks to a category if it's the first category
// created.
@@ -607,8 +607,8 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) {
var tab = this.view.addCategoryRow(copy.name, copy.id);
this.addClickToSwitch(tab, copy.id);
// Color the category tab in the view.
if (copy.color) {
this.view.setBorderColor(copy.id, copy.color);
if (copy.colour) {
this.view.setBorderColour(copy.id, copy.colour);
}
// Switch to loaded category.
this.switchElement(copy.id);
@@ -805,10 +805,10 @@ WorkspaceFactoryController.prototype.importToolboxFromTree_ = function(tree) {
// Convert actual shadow blocks to user-generated shadow blocks.
this.convertShadowBlocks();
// Set category color.
// Set category colour.
if (item.getAttribute('colour')) {
category.changeColor(item.getAttribute('colour'));
this.view.setBorderColor(category.id, category.color);
category.changeColour(item.getAttribute('colour'));
this.view.setBorderColour(category.id, category.colour);
}
// Set any custom tags.
if (item.getAttribute('custom')) {
@@ -1222,8 +1222,8 @@ WorkspaceFactoryController.prototype.importBlocks = function(file, format) {
var blocks = controller.generator.getDefinedBlocks(blockTypes);
// Generate category XML and append to toolbox.
var categoryXml = FactoryUtils.generateCategoryXml(blocks, categoryName);
// Get random color for category between 0 and 360. Gives each imported
// category a different color.
// Get random colour for category between 0 and 360. Gives each imported
// category a different colour.
var randomColor = Math.floor(Math.random() * 360);
categoryXml.setAttribute('colour', randomColor);
controller.toolbox.appendChild(categoryXml);
@@ -1259,7 +1259,7 @@ WorkspaceFactoryController.prototype.setBlockLibCategory =
var blockLibCategory = document.getElementById('blockLibCategory');
// Set category ID so that it can be easily replaced, and set a standard,
// arbitrary block library color.
// arbitrary block library colour.
categoryXml.id = 'blockLibCategory';
categoryXml.setAttribute('colour', 260);

View File

@@ -77,8 +77,8 @@ WorkspaceFactoryGenerator.prototype.generateToolboxXml = function() {
var nextElement = Blockly.utils.xml.createElement('category');
nextElement.setAttribute('name', element.name);
// Add a colour attribute if one exists.
if (element.color != null) {
nextElement.setAttribute('colour', element.color);
if (element.colour != null) {
nextElement.setAttribute('colour', element.colour);
}
// Add a custom attribute if one exists.
if (element.custom != null) {

View File

@@ -239,8 +239,8 @@ WorkspaceFactoryInit.assignWorkspaceFactoryClickHandlers_ =
return;
}
document.getElementById('categoryName').value = selected.name;
document.getElementById('categoryColour').value = selected.color ?
selected.color.substring(1).toLowerCase() : '';
document.getElementById('categoryColour').value = selected.colour ?
selected.colour.substring(1).toLowerCase() : '';
console.log(document.getElementById('categoryColour').value);
// Link the colour picker to the field.
cp_init('categoryColour');

View File

@@ -7,7 +7,7 @@
/**
* @fileoverview Stores and updates information about state and categories
* in workspace factory. Each list element is either a separator or a category,
* and each category stores its name, XML to load that category, color,
* and each category stores its name, XML to load that category, colour,
* custom tags, and a unique ID making it possible to change category names and
* move categories easily. Keeps track of the currently selected list
* element. Also keeps track of all the user-created shadow blocks and
@@ -479,8 +479,8 @@ ListElement = function(type, opt_name) {
this.name = opt_name ? opt_name : null;
// Unique ID of element. Does not change.
this.id = Blockly.utils.genUid();
// Color of category. Default is no color. Null if separator.
this.color = null;
// Colour of category. Default is no colour. Null if separator.
this.colour = null;
// Stores a custom tag, if necessary. Null if no custom tag or separator.
this.custom = null;
};
@@ -510,7 +510,7 @@ ListElement.prototype.saveFromWorkspace = function(workspace) {
* not a category.
* @param {string} name New name of category.
*/
ListElement.prototype.changeName = function (name) {
ListElement.prototype.changeName = function(name) {
// Only update list elements that are categories.
if (this.type != ListElement.TYPE_CATEGORY) {
return;
@@ -519,16 +519,16 @@ ListElement.prototype.changeName = function (name) {
};
/**
* Sets the color of a category. If tries to set the color of something other
* Sets the colour of a category. If tries to set the colour of something other
* than a category, returns.
* @param {?string} color The color that should be used for that category,
* @param {?string} colour The colour that should be used for that category,
* or null if none.
*/
ListElement.prototype.changeColor = function (color) {
ListElement.prototype.changeColour = function(colour) {
if (this.type != ListElement.TYPE_CATEGORY) {
return;
}
this.color = color;
this.colour = colour;
};
/**
@@ -543,7 +543,7 @@ ListElement.prototype.copy = function() {
// Copy all attributes except ID.
copy.name = this.name;
copy.xml = this.xml;
copy.color = this.color;
copy.colour = this.colour;
copy.custom = this.custom;
// Return copy.
return copy;

View File

@@ -204,13 +204,13 @@ WorkspaceFactoryView.prototype.moveTabToIndex =
};
/**
* Given a category ID and color, use that color to color the left border of the
* tab for that category.
* @param {string} id The ID of the category to color.
* Given a category ID and colour, use that colour to colour the left border of
* the tab for that category.
* @param {string} id The ID of the category to colour.
* @param {?string} colour The colour for to be used for the border of the tab,
* or null if none. Must be a valid CSS string.
*/
WorkspaceFactoryView.prototype.setBorderColor = function(id, colour) {
WorkspaceFactoryView.prototype.setBorderColour = function(id, colour) {
var style = this.tabMap[id].style;
if (colour) {
style.borderLeftWidth = '8px';