From 95c979681787ecb056833c6fecf74d43c68718a6 Mon Sep 17 00:00:00 2001 From: SharkPool <139097378+SharkPool-SP@users.noreply.github.com> Date: Sun, 5 Nov 2023 21:45:33 -0800 Subject: [PATCH 01/13] Create Sty-Lists.js --- extensions/SharkPool/Sty-Lists.js | 950 ++++++++++++++++++++++++++++++ 1 file changed, 950 insertions(+) create mode 100644 extensions/SharkPool/Sty-Lists.js diff --git a/extensions/SharkPool/Sty-Lists.js b/extensions/SharkPool/Sty-Lists.js new file mode 100644 index 0000000000..fdc0086e92 --- /dev/null +++ b/extensions/SharkPool/Sty-Lists.js @@ -0,0 +1,950 @@ +// Name: Sty-Lists +// ID: SPlistMonitors +// Description: Customize and Organize Lists Monitors. +// By: SharkPool + +// Version 1.0 + +(function (Scratch) { + "use strict"; + + if (!Scratch.extensions.unsandboxed) { + throw new Error("Sty-Lists must run unsandboxed!"); + } + + const menuIconURI = +"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSI2Mi4xNDI4NiIgaGVpZ2h0PSI2Mi4xNDI4NiIgdmlld0JveD0iMCwwLDYyLjE0Mjg2LDYyLjE0Mjg2Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjA4LjkyODU3LC0xNDguOTI4NTcpIj48ZyBkYXRhLXBhcGVyLWRhdGE9InsmcXVvdDtpc1BhaW50aW5nTGF5ZXImcXVvdDs6dHJ1ZX0iIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlLWxpbmVjYXA9ImJ1dHQiIHN0cm9rZS1saW5lam9pbj0ibWl0ZXIiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWRhc2hhcnJheT0iIiBzdHJva2UtZGFzaG9mZnNldD0iMCIgc3R5bGU9Im1peC1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2ZmZmZmZiIgc3Ryb2tlPSIjZmY2NjFhIiBzdHJva2Utd2lkdGg9IjAiLz48L2c+PC9nPjwvc3ZnPg=="; + + const vm = Scratch.vm; + const runtime = vm.runtime; + const builtInFonts = [ + "Scratch", + "Sans Serif", + "Serif", + "Handwriting", + "Marker", + "Curly", + "Pixel" + ]; + + class SPlistMonitors { + getInfo() { + return { + id: "SPlistMonitors", + name: "Sty-Lists", + color1: "#FF661A", + color2: "#ba3e00", + color3: "#cc4602", + menuIconURI, + blocks: [ + { + opcode: "listExists", + blockType: Scratch.BlockType.BOOLEAN, + text: "does [LIST] exist?", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + defaultValue: "my list" + }, + }, + }, + { + opcode: "isShowing", + blockType: Scratch.BlockType.BOOLEAN, + text: "is [LIST] showing?", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + }, + }, + { + opcode: "makeList", + blockType: Scratch.BlockType.COMMAND, + text: "create list named [LIST] [TYPE]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + defaultValue: "my list", + }, + TYPE: { + type: Scratch.ArgumentType.STRING, + menu: "listTypes", + defaultValue: "globally", + } + }, + }, + "---", + { + opcode: "renderList", + blockType: Scratch.BlockType.COMMAND, + text: "render [LIST] with [NUM] columns", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + NUM: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 2, + }, + }, + }, + { + opcode: "getColumns", + blockType: Scratch.BlockType.REPORTER, + text: "# of columns in [LIST]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + }, + }, + "---", + { + opcode: "stretchList", + blockType: Scratch.BlockType.COMMAND, + text: "stretch [LIST] to width: [WIDTH] and height: [HEIGHT]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + WIDTH: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 200, + }, + HEIGHT: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 200, + }, + }, + }, + { + opcode: "getAtt", + blockType: Scratch.BlockType.REPORTER, + text: "get [THING] of [LIST]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + THING: { + type: Scratch.ArgumentType.STRING, + menu: "ATTS", + defaultValue: "width", + }, + }, + }, + "---", + { + opcode: "chooseOption", + blockType: Scratch.BlockType.COMMAND, + text: "turn [THING] in [LIST] [ON_OFF]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + THING: { + type: Scratch.ArgumentType.STRING, + menu: "listUtils", + defaultValue: "click events", + }, + ON_OFF: { + type: Scratch.ArgumentType.STRING, + menu: "ON_OFF", + defaultValue: "off", + }, + }, + }, + { + opcode: "formatItems", + blockType: Scratch.BlockType.COMMAND, + text: "align item text to [ALIGN] in [LIST]", + arguments: { + LIST: { + type: Scratch.ArgumentType.STRING, + menu: "lists" + }, + ALIGN: { + type: Scratch.ArgumentType.STRING, + menu: "ALIGN", + defaultValue: "left", + }, + }, + }, + { + blockType: Scratch.BlockType.XML, + xml: "