Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions extensions/Comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Name: Comments
// ID: comments
// Description: Organize and label your code.
// License: MPL-2.0

// Version V.1.0.0

(function (Scratch) {
"use strict";

class NBComments {
getInfo() {
return {
id: "comments",
name: Scratch.translate("Comments"),
color1: "#E4DB8C",
color2: "#C6BE79",
color3: "#A8A167",
blocks: [
/* eslint-disable extension/should-translate */
{
opcode: "hat",
blockType: Scratch.BlockType.HAT,
isEdgeActivated: false,
text: "// [COMMENT]",
arguments: {
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "command",
blockType: Scratch.BlockType.COMMAND,
text: "// [COMMENT]",
arguments: {
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "loop",
blockType: Scratch.BlockType.CONDITIONAL,
text: "// [COMMENT]",
arguments: {
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "reporter",
blockType: Scratch.BlockType.REPORTER,
text: "[VALUE] // [COMMENT]",
arguments: {
VALUE: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "boolean",
blockType: Scratch.BlockType.BOOLEAN,
text: "[VALUE] // [COMMENT]",
arguments: {
VALUE: {
type: Scratch.ArgumentType.BOOLEAN,
},
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "object",
blockType: Scratch.BlockType.OBJECT,
text: "[VALUE] // [COMMENT]",
arguments: {
VALUE: {
type: Scratch.ArgumentType.OBJECT,
},
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
{
opcode: "array",
blockType: Scratch.BlockType.ARRAY,
text: "[VALUE] // [COMMENT]",
arguments: {
VALUE: {
type: Scratch.ArgumentType.ARRAY,
},
COMMENT: {
type: Scratch.ArgumentType.STRING,
defaultValue: "",
},
},
},
/* eslint-enable extension/should-translate */
],
};
}

hat() {
// no-op
}

command() {
// no-op
}

loop() {
return true;
}

reporter({ VALUE }) {
return VALUE;
}

boolean({ VALUE }) {
return VALUE || false;
}

object({ VALUE }) {
return VALUE || {};
}

array({ VALUE }) {
return VALUE || [];
}
}

Scratch.extensions.register(new NBComments());
})(Scratch);
1 change: 1 addition & 0 deletions extensions/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
// This file supports comments
"ddededodediamante/Vectors",
"Comments",
"CubesterYT/RichPresence"
]
1 change: 1 addition & 0 deletions images/Comments.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading