From 950a9dee4c4d89a8c1e0f7074899c0d0c5ce2c31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 13:13:38 +0300
Subject: [PATCH 01/63] Create 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 933 +++++++++++++++++++++
1 file changed, 933 insertions(+)
create mode 100644 extensions/RIHART/Window Settings/1.0.0.js
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
new file mode 100644
index 0000000000..94a65c1a69
--- /dev/null
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -0,0 +1,933 @@
+// Name: Window Settings
+// ID: RIHART
+// Description: Thanks to this extension, you can customize the project window (this works if you package the project in the ".exe" format).
+// By: RIHART
+// Version: 1.0.0
+
+
+(function (Scratch) {
+ "use strict";
+
+ Scratch.translate.setup({
+ ru /*_РусскийЯзык_*/: {
+ ExtensionName: "Настройки Окна",
+ LabelA: "Window Settings:",
+ MoveWHXY: " | | | | окно [SC] [WHXY]: [WHXYA], [WHXYB] | | | | ",
+ // [SC]:
+ SCA: "задать",
+ SCB: "изменить",
+ // [WHXY]:
+ WHXYA: "ширину, высоту",
+ WHXYB: "позицию x, позицию y",
+ WindowSCWH: " | | | | окно [MenuSC] [MenuWH]: [WH] | | | | ",
+ // [MenuSC]:
+ MenuSCA: "задать",
+ MenuSCB: "изменить",
+ // [MenuWH]:
+ MenuWHA: "ширину",
+ MenuWHB: "высоту",
+ MenuWHC: "позицию x",
+ MenuWHD: "позицию y",
+ moveToPresets: " | | | | переместить окно [PRESETS] | | | | ",
+ // [PRESETS]:
+ PRESETSA: "по центру",
+ PRESETSB: "справа",
+ PRESETSC: "слева",
+ PRESETSD: "сверху",
+ PRESETSE: "снизу",
+ PRESETSF: "в верхнем правом углу",
+ PRESETSG: "в верхнем левом углу",
+ PRESETSH: "в нижнем правом углу",
+ PRESETSI: "в нижнем левом углу",
+ changeTitleTo: " | | | | задать окну имя [TITLE] | | | | ",
+ WindowWHXY: " | | | | окно [MenuWindowWHXY] | | | | ",
+ innerStageSize: " | | | | размер внутренней сцены [innerMenuSetChange] ширину: [innerWidth] высоту: [innerHeight] | | | | ",
+ // [innerMenuSetChange]:
+ innerMenuSetChangeA: "задать",
+ innerMenuSetChangeB: "изменить",
+ innerStageSizeWidthHeight: " | | | | размер внутренней сцены [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
+ // [innerMenuSetChangeWH]:
+ innerMenuSetChangeWHA: "задать",
+ innerMenuSetChangeWHB: "изменить",
+ // [innerMenuWidthHeight]:
+ innerMenuWidthHeightA: "ширину",
+ innerMenuWidthHeightB: "высоту",
+ setDimensions: " | | | | задать сцену по ширине: [width] по высоте: [height] | | | | ",
+ getDimension: " | | | | сцена [dimension] | | | | ",
+ greenFlag: " | | | | нажать на флаг [flag] | | | | ",
+ FullscreenEnterExit: " | | | | полноэкранный режим [MenuFEE] | | | | ",
+ // [MenuFEE]:
+ FullscreenEnter: "включить",
+ FullscreenExit: "выключить",
+ closeWindow: " | | | | закрыть окно | | | | ",
+ QuestionsWS: " | | | | [MenuQuestions] | | | | ",
+ // [MenuQuestions]:
+ MenuQuestionsA: "касается ли окно края экрана?",
+ MenuQuestionsB: "сфокусировано ли окно?",
+ MenuQuestionsC: "является ли окно полноэкранным?",
+ ScreenWHXY: " | | | | экран [MenuScreenWHXY] | | | | ",
+ setEnabled: " | | | | задать [thing] [enabled] | | | | ",
+ // [thing]:
+ thingA: "🗲 турбо режим",
+ thingB: "интерполяция",
+ thingC: "убрать рамку сцены",
+ thingD: "убрать разные ограничения",
+ thingE: "перо в высоком качестве",
+ // [enabled]:
+ setFramerate: " | | | | задать ограничение частоты кадров на: [fps] | | | | ",
+ showHideOption: " | | | | [SHOWHIDE] [OPTIONSH] | | | | ",
+ // [SHOWHIDE]:
+ show: "показать",
+ hide: "скрыть",
+ // [OPTIONSH]:
+ flag: "иконка флага",
+ pause: "иконка паузы",
+ stop: "иконка остановки",
+ fullscreen: "иконка полноэкранного режима",
+ optionShown: " | | | | [OPTION] показан? | | | | ",
+ },
+ });
+
+ if (!Scratch.extensions.unsandboxed) {throw new Error("Error");}
+
+
+ // иконка меню:
+ const menuIconURI = "data:image/svg+xml,%3Csvg%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%2294%22%20height%3D%2294%22%20rx%3D%2217%22%20fill%3D%22%234B6095%22%20stroke%3D%22%232D3548%22%20stroke-width%3D%226%22%2F%3E%3Crect%20x%3D%2226%22%20y%3D%2226%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%225%22%20stroke%3D%22white%22%20stroke-width%3D%226%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M23%2031C23%2026.5817%2026.5817%2023%2031%2023H69C73.4183%2023%2077%2026.5817%2077%2031V35C77%2039.4183%2073.4183%2043%2069%2043H31C26.5817%2043%2023%2039.4183%2023%2035V31ZM43%2037C45.2091%2037%2047%2035.2091%2047%2033C47%2030.7909%2045.2091%2029%2043%2029C40.7909%2029%2039%2030.7909%2039%2033C39%2035.2091%2040.7909%2037%2043%2037ZM57%2033C57%2035.2091%2055.2091%2037%2053%2037C50.7909%2037%2049%2035.2091%2049%2033C49%2030.7909%2050.7909%2029%2053%2029C55.2091%2029%2057%2030.7909%2057%2033ZM33%2037C35.2091%2037%2037%2035.2091%2037%2033C37%2030.7909%2035.2091%2029%2033%2029C30.7909%2029%2029%2030.7909%2029%2033C29%2035.2091%2030.7909%2037%2033%2037Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";
+
+ // иконки блоков:
+ const MoveWHXY = "data:image/gif;base64,";
+ const greenFlagURI="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAxNiAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zIDAuNUMzIDAuMjIzODU4IDIuNzc2MTQgMCAyLjUgMEgxLjVDMC42NzE1NzMgMCAwIDAuNjcxNTczIDAgMS41VjE4LjVDMCAxOS4zMjg0IDAuNjcxNTczIDIwIDEuNSAyMFYyMEMyLjMyODQzIDIwIDMgMTkuMzI4NCAzIDE4LjVWMTVDMyAxMy44OTU0IDMuODk1NDMgMTMgNSAxM0gxNEMxNS4xMDQ2IDEzIDE2IDEyLjEwNDYgMTYgMTFWM0MxNiAxLjg5NTQzIDE1LjEwNDYgMSAxNCAxSDMuNUMzLjIyMzg2IDEgMyAwLjc3NjE0MiAzIDAuNVYwLjVaIiBmaWxsPSIjMTgxRDBEIi8+Cjwvc3ZnPgo=";
+
+
+ const TURBO_MODE = "turbo mode";
+ const INTERPOLATION = "interpolation";
+ const REMOVE_FENCING = "remove fencing";
+ const REMOVE_MISC_LIMITS = "remove misc limits";
+ const HIGH_QUALITY_PEN = "high quality pen";
+
+
+ var fullScreen;
+ var greenFlag;
+ var pauseButton;
+ var stopButton;
+
+ const getButtons = () => {
+ fullScreen = undefined;
+ greenFlag = undefined;
+ pauseButton = undefined;
+ stopButton = undefined;
+
+ const rightButtons = document.querySelectorAll(
+ '[class*="stage-header_stage-button_"]'
+ );
+ fullScreen = rightButtons[rightButtons.length - 1];
+ if (!fullScreen) {
+ fullScreen =
+ document.querySelector(".fullscreen-button") ||
+ document.querySelector(".standalone-fullscreen-button");
+ }
+
+ greenFlag =
+ document.querySelector('[class*="green-flag_green-flag_"]') ||
+ document.querySelector(".green-flag-button");
+ pauseButton =
+ document.querySelector(".pause-btn") ||
+ document.querySelector(".pause-button");
+ stopButton =
+ document.querySelector('[class*="stop-all_stop-all_"]') ||
+ document.querySelector(".stop-all-button");
+ };
+
+ class controlcontrols {
+ constructor() {
+ Scratch.vm.runtime.on("RUNTIME_DISPOSED", () => {
+ getButtons();
+ for (const button of [fullScreen, greenFlag, pauseButton, stopButton]) {
+ if (button) {
+ button.style.display = "block";
+ }
+ }
+ });
+ }
+ }
+ class lmsmcutils {
+ getInfo() {
+ return {
+ id: "WindowSettings",
+ name: Scratch.translate({ id: "ExtensionName", default: "Window Settings" }),
+ color1: "#5671B7",
+ color2: "#4B6095",
+ color3: "#2D3548",
+ menuIconURI: menuIconURI,
+
+ blocks: [
+
+ {
+ opcode: "MoveWHXY",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "MoveWHXY",
+ default: " | | | | window [SC] [WHXY]: [WHXYA], [WHXYB] | | | | "
+ }),
+ arguments: {
+ SC: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "SC",
+ },
+ WHXY: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "WHXY",
+ },
+ WHXYA: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "480",
+ },
+ WHXYB: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "360",
+ },
+ },
+ },
+
+ {
+ opcode: "WindowSCWH",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "WindowSCWH",
+ default: " | | | | window [MenuSC] [MenuWH]: [WH] | | | | "
+ }),
+ arguments: {
+ MenuSC: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuSC",
+ },
+ MenuWH: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuWH",
+ },
+ WH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "480",
+ },
+ },
+ },
+
+ {
+ opcode: "moveToPresets",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "moveToPresets",
+ default: " | | | | move window to the [PRESETS] | | | | "
+ }),
+ arguments: {
+ PRESETS: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MOVE",
+ },
+ },
+ },
+
+ {
+ opcode: "changeTitleTo",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "changeTitleTo",
+ default: " | | | | set window title to [TITLE] | | | | "
+ }),
+ arguments: {
+ TITLE: {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: "WAYLIVES",
+ },
+ },
+ },
+
+ {
+ opcode: "WindowWHXY",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate({
+ id: "WindowWHXY",
+ default: " | | | | window [MenuWindowWHXY] | | | | "
+ }),
+ arguments: {
+ MenuWindowWHXY: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuWindowWHXY",
+ },
+ },
+ },
+
+ "---",
+
+ {
+ opcode: "innerStageSize",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "innerStageSize",
+ default: " | | | | inner stage size [innerMenuSetChange] width: [innerWidth] height: [innerHeight] | | | | "
+ }),
+ arguments: {
+ innerMenuSetChange: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "innerMenuSetChange",
+ },
+ innerWidth: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "480",
+ },
+ innerHeight: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "360",
+ },
+ },
+ },
+
+ {
+ opcode: "innerStageSizeWidthHeight",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "innerStageSizeWidthHeight",
+ default: " | | | | inner stage size [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | "
+ }),
+ arguments: {
+ innerMenuSetChangeWH: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "innerMenuSetChangeWH",
+ },
+ innerMenuWidthHeight: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "innerMenuWidthHeight",
+ },
+ innerWidthHeight: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "480",
+ },
+ },
+ },
+
+ {
+ opcode: "setDimensions",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "setDimensions",
+ default: " | | | | set stage size width: [width] height: [height] | | | | "
+ }),
+ arguments: {
+ width: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "480",
+ },
+ height: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "360",
+ },
+ },
+ },
+
+ {
+ opcode: "getDimension",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate({
+ id: "getDimension",
+ default: " | | | | stage [dimension] | | | | "
+ }),
+ arguments: {
+ dimension: {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: "width",
+ menu: "dimension",
+ },
+ },
+ },
+
+ "---",
+
+ {
+ opcode: "greenFlag",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "greenFlag",
+ default: " | | | | run flag [flag] | | | | "
+ }),
+ arguments: {
+ flag: {
+ type: Scratch.ArgumentType.IMAGE,
+ dataURI: greenFlagURI,
+ },
+ },
+ },
+
+ {
+ opcode: "FullscreenEnterExit",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "FullscreenEnterExit",
+ default: " | | | | fullscreen [MenuFEE] | | | | "
+ }),
+ arguments: {
+ MenuFEE: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuFEE",
+ },
+ },
+ },
+
+ {
+ opcode: "closeWindow",
+ blockType: Scratch.BlockType.COMMAND,
+ isTerminal: true,
+ text: Scratch.translate({
+ id: "closeWindow",
+ default: " | | | | close window | | | | "
+ }),
+ },
+
+ {
+ opcode: "QuestionsWS",
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: Scratch.translate({
+ id: "QuestionsWS",
+ default: " | | | | [MenuQuestions] | | | | "
+ }),
+ disableMonitor: true,
+ arguments: {
+ MenuQuestions: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuQuestions",
+ },
+ },
+ },
+
+ {
+ opcode: "ScreenWHXY",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate({
+ id: "ScreenWHXY",
+ default: " | | | | screen [MenuScreenWHXY] | | | | "
+ }),
+ arguments: {
+ MenuScreenWHXY: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "MenuScreenWHXY",
+ },
+ },
+ },
+
+ "---",
+/*
+ {
+ opcode: "setEnabled",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "setEnabled",
+ default: " | | | | set [thing] to [enabled] | | | | "
+ }),
+ arguments: {
+ thing: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "thing",
+ defaultValue: "TURBO_MODE",
+ },
+ enabled: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "enabled",
+ defaultValue: "true",
+ },
+ },
+ },
+*/
+ {
+ opcode: "setFramerate",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "setFramerate",
+ default: " | | | | set framerate limit to [fps] | | | | "
+ }),
+ arguments: {
+ fps: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "30",
+ },
+ },
+ },
+
+
+ "---",
+
+
+ {
+ opcode: "showHideOption",
+ blockType: Scratch.BlockType.COMMAND,
+ text: Scratch.translate({
+ id: "showHideOption",
+ default: " | | | | [SHOWHIDE] [OPTIONSH] | | | | "
+ }),
+ arguments: {
+ SHOWHIDE: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "SHOWHIDE",
+ },
+ OPTIONSH: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "OPTIONSH",
+ },
+ },
+ },
+ {
+ opcode: "optionShown",
+ blockType: Scratch.BlockType.BOOLEAN,
+ text: Scratch.translate({
+ id: "optionShown",
+ default: " | | | | [OPTION] shown? | | | | "
+ }),
+ arguments: {
+ OPTION: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "OPTION",
+ },
+ },
+ },
+ "---",
+
+ ],
+
+
+ menus: {
+
+ SC: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "SCA", default: "set" }), value: "Set" },
+ { text: Scratch.translate({ id: "SCB", default: "change" }), value: "Change" },
+ ],
+ },
+ WHXY: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "WHXYA", default: "width, height" }), value: "WidthHeight" },
+ { text: Scratch.translate({ id: "WHXYB", default: "x position, y position" }), value: "PositionXY" },
+ ],
+ },
+ MenuSC: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "MenuSCA", default: "set" }), value: "Set" },
+ { text: Scratch.translate({ id: "MenuSCB", default: "change" }), value: "Change" },
+ ],
+ },
+ MenuWH: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "MenuWHA", default: "width" }), value: "Width" },
+ { text: Scratch.translate({ id: "MenuWHB", default: "height" }), value: "Height" },
+ { text: Scratch.translate({ id: "MenuWHC", default: "x position" }), value: "PositionX" },
+ { text: Scratch.translate({ id: "MenuWHD", default: "y position" }), value: "PositionY" },
+ ],
+ },
+ MOVE: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "PRESETSA", default: "center" }), value: "center" },
+ { text: Scratch.translate({ id: "PRESETSB", default: "right" }), value: "right" },
+ { text: Scratch.translate({ id: "PRESETSC", default: "left" }), value: "left" },
+ { text: Scratch.translate({ id: "PRESETSD", default: "top" }), value: "top" },
+ { text: Scratch.translate({ id: "PRESETSE", default: "bottom" }), value: "bottom" },
+ { text: Scratch.translate({ id: "PRESETSF", default: "top right" }), value: "top right" },
+ { text: Scratch.translate({ id: "PRESETSG", default: "top left" }), value: "top left" },
+ { text: Scratch.translate({ id: "PRESETSH", default: "bottom right" }), value: "bottom right" },
+ { text: Scratch.translate({ id: "PRESETSI", default: "bottom left" }), value: "bottom left" },
+ ],
+ },
+ MenuWindowWHXY: {
+ acceptReporters: true,
+ items: [
+ { text: "width", value: "Width" },
+ { text: "height", value: "Height" },
+ { text: "x position", value: "PositionX" },
+ { text: "y position", value: "PositionY" },
+ { text: "title", value: "Title" },
+ ],
+ },
+ innerMenuSetChange: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "innerMenuSetChangeA", default: "set" }), value: "set" },
+ { text: Scratch.translate({ id: "innerMenuSetChangeB", default: "change" }), value: "change" },
+ ],
+ },
+ innerMenuSetChangeWH: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "innerMenuSetChangeWHA", default: "set" }), value: "set" },
+ { text: Scratch.translate({ id: "innerMenuSetChangeWHB", default: "change" }), value: "change" },
+ ],
+ },
+ innerMenuWidthHeight: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "innerMenuWidthHeightA", default: "width" }), value: "width" },
+ { text: Scratch.translate({ id: "innerMenuWidthHeightB", default: "height" }), value: "height" },
+ ],
+ },
+ dimension: {
+ acceptReporters: true,
+ items: [
+ {
+ text: Scratch.translate("width"),
+ value: "width",
+ },
+ {
+ text: Scratch.translate("height"),
+ value: "height",
+ },
+ ],
+ },
+ MenuFEE: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "FullscreenEnter", default: "width" }), value: "Enter" },
+ { text: Scratch.translate({ id: "FullscreenExit", default: "height" }), value: "Exit" },
+ ],
+ },
+ MenuQuestions: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "MenuQuestionsA", default: "is window touching screen edge" }), value: "A" },
+ { text: Scratch.translate({ id: "MenuQuestionsB", default: "is window focused?" }), value: "B" },
+ { text: Scratch.translate({ id: "MenuQuestionsC", default: "is window fullscreen?" }), value: "C" },
+ ],
+ },
+ MenuScreenWHXY: {
+ acceptReporters: true,
+ items: [
+ { text: "width", value: "Width" },
+ { text: "height", value: "Height" },
+ ],
+ },
+
+ thing: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "thingA", default: "🗲 turbo mode" }), value: "TURBO_MODE" },
+ { text: Scratch.translate({ id: "thingB", default: "interpolation" }), value: "INTERPOLATION" },
+ { text: Scratch.translate({ id: "thingC", default: "remove fencing" }), value: "REMOVE_FENCING" },
+ { text: Scratch.translate({ id: "thingD", default: "remove misc limits" }), value: "REMOVE_MISC_LIMITS" },
+ { text: Scratch.translate({ id: "thingE", default: "high quality pen" }), value: "HIGH_QUALITY_PEN" },
+ ],
+ },
+
+ enabled: {
+ acceptReporters: false,
+ items: [
+ {
+ text: Scratch.translate("enabled"),
+ value: "true",
+ },
+ {
+ text: Scratch.translate("disabled"),
+ value: "false",
+ },
+ ],
+ },
+
+ OPTION: {
+ acceptReporters: true,
+ items: [
+ {
+ text: Scratch.translate("flag"),
+ value: "flag",
+ },
+ {
+ text: Scratch.translate("pause"),
+ value: "pause",
+ },
+ {
+ text: Scratch.translate("stop"),
+ value: "stop",
+ },
+ {
+ text: Scratch.translate("fullscreen"),
+ value: "fullscreen",
+ },
+ ],
+ },
+ SHOWHIDE: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "show", default: "show" }), value: "show" },
+ { text: Scratch.translate({ id: "hide", default: "hide" }), value: "hide" },
+ ],
+ },
+ OPTIONSH: {
+ acceptReporters: false,
+ items: [
+ { text: Scratch.translate({ id: "flag", default: "flag" }), value: "flag" },
+ { text: Scratch.translate({ id: "pause", default: "pause" }), value: "pause" },
+ { text: Scratch.translate({ id: "stop", default: "stop" }), value: "stop" },
+ { text: Scratch.translate({ id: "fullscreen", default: "fullscreen" }), value: "fullscreen" },
+ ],
+ },
+
+ },
+ };
+ }
+
+ getDimension({ dimension }) {
+ if (dimension === "width") {
+ return Scratch.vm.runtime.stageWidth;
+ } else if (dimension === "height") {
+ return Scratch.vm.runtime.stageHeight;
+ }
+ return 0;
+ }
+
+ setDimensions({ width, height }) {
+ width = Scratch.Cast.toNumber(width);
+ height = Scratch.Cast.toNumber(height);
+ Scratch.vm.setStageSize(width, height);
+ }
+
+
+
+ MoveWHXY(args) {
+ if (args.SC == "Set") {
+ if (args.WHXY == "WidthHeight") {
+ window.resizeTo(args.WHXYA, args.WHXYB);
+ } else if (args.WHXY == "PositionXY") {
+ window.moveTo(args.WHXYA, args.WHXYB);
+ }
+ } else if (args.SC == "Change") {
+ if (args.WHXY == "WidthHeight") {
+ window.resizeBy(args.WHXYA, args.WHXYB);
+ } else if (args.WHXY == "PositionXY") {
+ window.moveBy(args.WHXYA, args.WHXYB);
+ }
+ }
+ Scratch.vm.runtime.requestRedraw();
+ }
+
+ innerStageSize(args) {
+ if (args.innerMenuSetChange == "set") {
+ window.resizeTo(args.innerWidth + (window.outerWidth - window.innerWidth), args.innerHeight + (window.outerHeight - window.innerHeight));
+ } else if (args.innerMenuSetChange == "change") {
+ window.resizeBy(args.innerWidth, args.innerHeight);
+ }
+ Scratch.vm.runtime.requestRedraw();
+ }
+
+ innerStageSizeWidthHeight(args) {
+ if (args.innerMenuSetChangeWH == "set") {
+ if (args.innerMenuWidthHeight == "width") {
+ const innerHeight = window.outerHeight;
+ window.resizeTo(args.innerWidthHeight + (window.outerWidth - window.innerWidth), innerHeight);
+ } else if (args.innerMenuWidthHeight == "height") {
+ const innerWidth = window.outerWidth;
+ window.resizeTo(innerWidth, args.innerWidthHeight + (window.outerHeight - window.innerHeight));
+ }
+ } else if (args.innerMenuSetChangeWH == "change") {
+ if (args.innerMenuWidthHeight == "width") {
+ window.resizeBy(args.innerWidthHeight, 0);
+ } else if (args.innerMenuWidthHeight == "height") {
+ window.resizeBy(0, args.innerWidthHeight);
+ }
+ }
+ Scratch.vm.runtime.requestRedraw();
+ }
+
+ moveToPresets(args) {
+ if (args.PRESETS == "center") {
+ const left = (screen.width - window.outerWidth) / 2;
+ const top = (screen.height - window.outerHeight) / 2;
+ window.moveTo(left, top);
+ } else if (args.PRESETS == "right") {
+ const right = screen.width - window.outerWidth;
+ const top = (screen.height - window.outerHeight) / 2;
+ window.moveTo(right, top);
+ } else if (args.PRESETS == "left") {
+ const top = (screen.height - window.outerHeight) / 2;
+ window.moveTo(0, top);
+ } else if (args.PRESETS == "top") {
+ const left = (screen.width - window.outerWidth) / 2;
+ window.moveTo(left, 0);
+ } else if (args.PRESETS == "bottom") {
+ const left = (screen.width - window.outerWidth) / 2;
+ const bottom = screen.height - window.outerHeight;
+ window.moveTo(left, bottom);
+ } else if (args.PRESETS == "top right") {
+ const right = screen.width - window.outerWidth;
+ window.moveTo(right, 0);
+ } else if (args.PRESETS == "top left") {
+ window.moveTo(0, 0);
+ } else if (args.PRESETS == "bottom right") {
+ const right = screen.width - window.outerWidth;
+ const bottom = screen.height - window.outerHeight;
+ window.moveTo(right, bottom);
+ } else if (args.PRESETS == "bottom left") {
+ const bottom = screen.height - window.outerHeight;
+ window.moveTo(0, bottom);
+ }
+ Scratch.vm.runtime.requestRedraw();
+ }
+
+ WindowWHXY(args) {
+ if (args.MenuWindowWHXY == "Width") {
+ return window.outerWidth;
+ } else if (args.MenuWindowWHXY == "Height") {
+ return window.outerHeight;
+ } else if (args.MenuWindowWHXY == "PositionX") {
+ return window.screenLeft;
+ } else if (args.MenuWindowWHXY == "PositionY") {
+ return window.screenTop;
+ } else if (args.MenuWindowWHXY == "Title") {
+ return document.title;
+ }
+ }
+ ScreenWHXY(args) {
+ if (args.MenuScreenWHXY == "Width") {
+ return screen.width;
+ } else if (args.MenuScreenWHXY == "Height") {
+ return screen.height;
+ }
+ }
+ QuestionsWS(args) {
+ if (args.MenuQuestions == "A") {
+ const edgeX = screen.width - window.outerWidth;
+ const edgeY = screen.height - window.outerHeight;
+ return (
+ window.screenLeft <= 0 ||
+ window.screenTop <= 0 ||
+ window.screenLeft >= edgeX ||
+ window.screenTop >= edgeY
+ );
+ } else if (args.MenuQuestions == "B") {
+ return document.hasFocus();
+ } else if (args.MenuQuestions == "C") {
+ return document.fullscreenElement !== null;
+ }
+ }
+ FullscreenEnterExit(args) {
+ if (args.MenuFEE == "Enter") {
+ if (document.fullscreenElement == null) {
+ document.documentElement.requestFullscreen();
+ }
+ } else if (args.MenuFEE == "Exit") {
+ if (document.fullscreenElement !== null) {
+ document.exitFullscreen();
+ }
+ }
+ }
+
+ WindowSCWH(args) {
+ if (args.MenuSC == "Set") {
+ if (args.MenuWH == "Width") {
+ const currentH = window.outerHeight;
+ window.resizeTo(args.WH, currentH);
+ } else if (args.MenuWH == "Height") {
+ const currentW = window.outerWidth;
+ window.resizeTo(currentW, args.WH);
+ } else if (args.MenuWH == "PositionX") {
+ const currentY = window.screenY;
+ window.moveTo(args.WH, currentY);
+ } else if (args.MenuWH == "PositionY") {
+ const currentX = window.screenX;
+ window.moveTo(currentX, args.WH);
+ }
+ } else if (args.MenuSC == "Change") {
+ if (args.MenuWH == "Width") {
+ window.resizeBy(args.WH, 0);
+ } else if (args.MenuWH == "Height") {
+ window.resizeBy(0, args.WH);
+ } else if (args.MenuWH == "PositionX") {
+ window.moveBy(args.WH, 0);
+ } else if (args.MenuWH == "PositionY") {
+ window.moveBy(0, args.WH);
+ }
+ }
+ Scratch.vm.runtime.requestRedraw();
+ }
+
+ changeTitleTo(args) {
+ document.title = args.TITLE;
+ }
+ closeWindow() {
+ const editorConfirmation = Scratch.translate({
+ id: "editorConfirmation",
+ default:
+ "Are you sure you want to close this window?\n\n(This message will not appear when the project is packaged)",
+ });
+ // @ts-expect-error
+ if (typeof ScratchBlocks === "undefined" || confirm(editorConfirmation)) {
+ window.close();
+ }
+ }
+
+ greenFlag() {
+ Scratch.vm.runtime.greenFlag();
+ }
+
+ setEnabled({ thing, enabled }) {
+ enabled = Scratch.Cast.toBoolean(enabled);
+
+ if (thing === TURBO_MODE) {
+ Scratch.vm.setTurboMode(enabled);
+ } else if (thing === INTERPOLATION) {
+ Scratch.vm.setInterpolation(enabled);
+ } else if (thing === REMOVE_FENCING) {
+ Scratch.vm.setRuntimeOptions({
+ fencing: !enabled,
+ });
+ } else if (thing === REMOVE_MISC_LIMITS) {
+ Scratch.vm.setRuntimeOptions({
+ miscLimits: !enabled,
+ });
+ } else if (thing === HIGH_QUALITY_PEN) {
+ Scratch.renderer.setUseHighQualityRender(enabled);
+ }
+ }
+
+ setFramerate({ fps }) {
+ fps = Scratch.Cast.toNumber(fps);
+ Scratch.vm.setFramerate(fps);
+ }
+
+ showHideOption(args) {
+ getButtons();
+ if (args.SHOWHIDE === "show") {
+ if (args.OPTIONSH === "flag" && greenFlag) {
+ greenFlag.style.display = "block";
+ } else if (args.OPTIONSH === "pause" && pauseButton) {
+ pauseButton.style.display = "block";
+ } else if (args.OPTIONSH === "stop" && stopButton) {
+ stopButton.style.display = "block";
+ } else if (args.OPTIONSH === "fullscreen" && fullScreen) {
+ fullScreen.style.display = "block";
+ }
+ } else if (args.SHOWHIDE === "hide") {
+ if (args.OPTIONSH === "flag" && greenFlag) {
+ greenFlag.style.display = "none";
+ } else if (args.OPTIONSH === "pause" && pauseButton) {
+ pauseButton.style.display = "none";
+ } else if (args.OPTIONSH === "stop" && stopButton) {
+ stopButton.style.display = "none";
+ } else if (args.OPTIONSH === "fullscreen" && fullScreen) {
+ fullScreen.style.display = "none";
+ }
+ }
+ }
+
+ optionShown(args) {
+ getButtons();
+ if (args.OPTION === "flag" && greenFlag) {
+ return greenFlag.style.display !== "none";
+ } else if (args.OPTION === "pause" && pauseButton) {
+ return pauseButton.style.display !== "none";
+ } else if (args.OPTION === "stop" && stopButton) {
+ return stopButton.style.display !== "none";
+ } else if (args.OPTION === "fullscreen" && fullScreen) {
+ return fullScreen.style.display !== "none";
+ }
+ return false;
+ }
+ }
+ Scratch.extensions.register(new lmsmcutils());
+})(Scratch);
From 3d09c9090c03bbe4908b7c0384db43dd2bbaf3e5 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Fri, 28 Feb 2025 10:21:45 +0000
Subject: [PATCH 02/63] [Automated] Format code
---
extensions/RIHART/Window Settings/1.0.0.js | 625 ++++++++++++++-------
1 file changed, 417 insertions(+), 208 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index 94a65c1a69..2618802026 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -4,108 +4,112 @@
// By: RIHART
// Version: 1.0.0
-
(function (Scratch) {
- "use strict";
+ "use strict";
- Scratch.translate.setup({
+ Scratch.translate.setup({
ru /*_РусскийЯзык_*/: {
ExtensionName: "Настройки Окна",
LabelA: "Window Settings:",
MoveWHXY: " | | | | окно [SC] [WHXY]: [WHXYA], [WHXYB] | | | | ",
- // [SC]:
- SCA: "задать",
- SCB: "изменить",
- // [WHXY]:
- WHXYA: "ширину, высоту",
- WHXYB: "позицию x, позицию y",
+ // [SC]:
+ SCA: "задать",
+ SCB: "изменить",
+ // [WHXY]:
+ WHXYA: "ширину, высоту",
+ WHXYB: "позицию x, позицию y",
WindowSCWH: " | | | | окно [MenuSC] [MenuWH]: [WH] | | | | ",
- // [MenuSC]:
- MenuSCA: "задать",
- MenuSCB: "изменить",
- // [MenuWH]:
- MenuWHA: "ширину",
- MenuWHB: "высоту",
- MenuWHC: "позицию x",
- MenuWHD: "позицию y",
+ // [MenuSC]:
+ MenuSCA: "задать",
+ MenuSCB: "изменить",
+ // [MenuWH]:
+ MenuWHA: "ширину",
+ MenuWHB: "высоту",
+ MenuWHC: "позицию x",
+ MenuWHD: "позицию y",
moveToPresets: " | | | | переместить окно [PRESETS] | | | | ",
- // [PRESETS]:
- PRESETSA: "по центру",
- PRESETSB: "справа",
- PRESETSC: "слева",
- PRESETSD: "сверху",
- PRESETSE: "снизу",
- PRESETSF: "в верхнем правом углу",
- PRESETSG: "в верхнем левом углу",
- PRESETSH: "в нижнем правом углу",
- PRESETSI: "в нижнем левом углу",
+ // [PRESETS]:
+ PRESETSA: "по центру",
+ PRESETSB: "справа",
+ PRESETSC: "слева",
+ PRESETSD: "сверху",
+ PRESETSE: "снизу",
+ PRESETSF: "в верхнем правом углу",
+ PRESETSG: "в верхнем левом углу",
+ PRESETSH: "в нижнем правом углу",
+ PRESETSI: "в нижнем левом углу",
changeTitleTo: " | | | | задать окну имя [TITLE] | | | | ",
WindowWHXY: " | | | | окно [MenuWindowWHXY] | | | | ",
- innerStageSize: " | | | | размер внутренней сцены [innerMenuSetChange] ширину: [innerWidth] высоту: [innerHeight] | | | | ",
- // [innerMenuSetChange]:
- innerMenuSetChangeA: "задать",
- innerMenuSetChangeB: "изменить",
- innerStageSizeWidthHeight: " | | | | размер внутренней сцены [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
- // [innerMenuSetChangeWH]:
- innerMenuSetChangeWHA: "задать",
- innerMenuSetChangeWHB: "изменить",
- // [innerMenuWidthHeight]:
- innerMenuWidthHeightA: "ширину",
- innerMenuWidthHeightB: "высоту",
- setDimensions: " | | | | задать сцену по ширине: [width] по высоте: [height] | | | | ",
+ innerStageSize:
+ " | | | | размер внутренней сцены [innerMenuSetChange] ширину: [innerWidth] высоту: [innerHeight] | | | | ",
+ // [innerMenuSetChange]:
+ innerMenuSetChangeA: "задать",
+ innerMenuSetChangeB: "изменить",
+ innerStageSizeWidthHeight:
+ " | | | | размер внутренней сцены [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
+ // [innerMenuSetChangeWH]:
+ innerMenuSetChangeWHA: "задать",
+ innerMenuSetChangeWHB: "изменить",
+ // [innerMenuWidthHeight]:
+ innerMenuWidthHeightA: "ширину",
+ innerMenuWidthHeightB: "высоту",
+ setDimensions:
+ " | | | | задать сцену по ширине: [width] по высоте: [height] | | | | ",
getDimension: " | | | | сцена [dimension] | | | | ",
greenFlag: " | | | | нажать на флаг [flag] | | | | ",
FullscreenEnterExit: " | | | | полноэкранный режим [MenuFEE] | | | | ",
- // [MenuFEE]:
- FullscreenEnter: "включить",
- FullscreenExit: "выключить",
+ // [MenuFEE]:
+ FullscreenEnter: "включить",
+ FullscreenExit: "выключить",
closeWindow: " | | | | закрыть окно | | | | ",
QuestionsWS: " | | | | [MenuQuestions] | | | | ",
- // [MenuQuestions]:
- MenuQuestionsA: "касается ли окно края экрана?",
- MenuQuestionsB: "сфокусировано ли окно?",
- MenuQuestionsC: "является ли окно полноэкранным?",
+ // [MenuQuestions]:
+ MenuQuestionsA: "касается ли окно края экрана?",
+ MenuQuestionsB: "сфокусировано ли окно?",
+ MenuQuestionsC: "является ли окно полноэкранным?",
ScreenWHXY: " | | | | экран [MenuScreenWHXY] | | | | ",
setEnabled: " | | | | задать [thing] [enabled] | | | | ",
- // [thing]:
- thingA: "🗲 турбо режим",
- thingB: "интерполяция",
- thingC: "убрать рамку сцены",
- thingD: "убрать разные ограничения",
- thingE: "перо в высоком качестве",
- // [enabled]:
- setFramerate: " | | | | задать ограничение частоты кадров на: [fps] | | | | ",
+ // [thing]:
+ thingA: "🗲 турбо режим",
+ thingB: "интерполяция",
+ thingC: "убрать рамку сцены",
+ thingD: "убрать разные ограничения",
+ thingE: "перо в высоком качестве",
+ // [enabled]:
+ setFramerate:
+ " | | | | задать ограничение частоты кадров на: [fps] | | | | ",
showHideOption: " | | | | [SHOWHIDE] [OPTIONSH] | | | | ",
- // [SHOWHIDE]:
- show: "показать",
- hide: "скрыть",
- // [OPTIONSH]:
- flag: "иконка флага",
- pause: "иконка паузы",
- stop: "иконка остановки",
- fullscreen: "иконка полноэкранного режима",
+ // [SHOWHIDE]:
+ show: "показать",
+ hide: "скрыть",
+ // [OPTIONSH]:
+ flag: "иконка флага",
+ pause: "иконка паузы",
+ stop: "иконка остановки",
+ fullscreen: "иконка полноэкранного режима",
optionShown: " | | | | [OPTION] показан? | | | | ",
},
- });
-
- if (!Scratch.extensions.unsandboxed) {throw new Error("Error");}
-
+ });
+
+ if (!Scratch.extensions.unsandboxed) {
+ throw new Error("Error");
+ }
// иконка меню:
- const menuIconURI = "data:image/svg+xml,%3Csvg%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%2294%22%20height%3D%2294%22%20rx%3D%2217%22%20fill%3D%22%234B6095%22%20stroke%3D%22%232D3548%22%20stroke-width%3D%226%22%2F%3E%3Crect%20x%3D%2226%22%20y%3D%2226%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%225%22%20stroke%3D%22white%22%20stroke-width%3D%226%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M23%2031C23%2026.5817%2026.5817%2023%2031%2023H69C73.4183%2023%2077%2026.5817%2077%2031V35C77%2039.4183%2073.4183%2043%2069%2043H31C26.5817%2043%2023%2039.4183%2023%2035V31ZM43%2037C45.2091%2037%2047%2035.2091%2047%2033C47%2030.7909%2045.2091%2029%2043%2029C40.7909%2029%2039%2030.7909%2039%2033C39%2035.2091%2040.7909%2037%2043%2037ZM57%2033C57%2035.2091%2055.2091%2037%2053%2037C50.7909%2037%2049%2035.2091%2049%2033C49%2030.7909%2050.7909%2029%2053%2029C55.2091%2029%2057%2030.7909%2057%2033ZM33%2037C35.2091%2037%2037%2035.2091%2037%2033C37%2030.7909%2035.2091%2029%2033%2029C30.7909%2029%2029%2030.7909%2029%2033C29%2035.2091%2030.7909%2037%2033%2037Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";
-
+ const menuIconURI =
+ "data:image/svg+xml,%3Csvg%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%2294%22%20height%3D%2294%22%20rx%3D%2217%22%20fill%3D%22%234B6095%22%20stroke%3D%22%232D3548%22%20stroke-width%3D%226%22%2F%3E%3Crect%20x%3D%2226%22%20y%3D%2226%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%225%22%20stroke%3D%22white%22%20stroke-width%3D%226%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M23%2031C23%2026.5817%2026.5817%2023%2031%2023H69C73.4183%2023%2077%2026.5817%2077%2031V35C77%2039.4183%2073.4183%2043%2069%2043H31C26.5817%2043%2023%2039.4183%2023%2035V31ZM43%2037C45.2091%2037%2047%2035.2091%2047%2033C47%2030.7909%2045.2091%2029%2043%2029C40.7909%2029%2039%2030.7909%2039%2033C39%2035.2091%2040.7909%2037%2043%2037ZM57%2033C57%2035.2091%2055.2091%2037%2053%2037C50.7909%2037%2049%2035.2091%2049%2033C49%2030.7909%2050.7909%2029%2053%2029C55.2091%2029%2057%2030.7909%2057%2033ZM33%2037C35.2091%2037%2037%2035.2091%2037%2033C37%2030.7909%2035.2091%2029%2033%2029C30.7909%2029%2029%2030.7909%2029%2033C29%2035.2091%2030.7909%2037%2033%2037Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";
+
// иконки блоков:
const MoveWHXY = "data:image/gif;base64,";
- const greenFlagURI="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAxNiAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zIDAuNUMzIDAuMjIzODU4IDIuNzc2MTQgMCAyLjUgMEgxLjVDMC42NzE1NzMgMCAwIDAuNjcxNTczIDAgMS41VjE4LjVDMCAxOS4zMjg0IDAuNjcxNTczIDIwIDEuNSAyMFYyMEMyLjMyODQzIDIwIDMgMTkuMzI4NCAzIDE4LjVWMTVDMyAxMy44OTU0IDMuODk1NDMgMTMgNSAxM0gxNEMxNS4xMDQ2IDEzIDE2IDEyLjEwNDYgMTYgMTFWM0MxNiAxLjg5NTQzIDE1LjEwNDYgMSAxNCAxSDMuNUMzLjIyMzg2IDEgMyAwLjc3NjE0MiAzIDAuNVYwLjVaIiBmaWxsPSIjMTgxRDBEIi8+Cjwvc3ZnPgo=";
+ const greenFlagURI =
+ "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAxNiAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zIDAuNUMzIDAuMjIzODU4IDIuNzc2MTQgMCAyLjUgMEgxLjVDMC42NzE1NzMgMCAwIDAuNjcxNTczIDAgMS41VjE4LjVDMCAxOS4zMjg0IDAuNjcxNTczIDIwIDEuNSAyMFYyMEMyLjMyODQzIDIwIDMgMTkuMzI4NCAzIDE4LjVWMTVDMyAxMy44OTU0IDMuODk1NDMgMTMgNSAxM0gxNEMxNS4xMDQ2IDEzIDE2IDEyLjEwNDYgMTYgMTFWM0MxNiAxLjg5NTQzIDE1LjEwNDYgMSAxNCAxSDMuNUMzLjIyMzg2IDEgMyAwLjc3NjE0MiAzIDAuNVYwLjVaIiBmaWxsPSIjMTgxRDBEIi8+Cjwvc3ZnPgo=";
-
const TURBO_MODE = "turbo mode";
const INTERPOLATION = "interpolation";
const REMOVE_FENCING = "remove fencing";
const REMOVE_MISC_LIMITS = "remove misc limits";
const HIGH_QUALITY_PEN = "high quality pen";
-
var fullScreen;
var greenFlag;
var pauseButton;
@@ -149,25 +153,28 @@
}
});
}
- }
+ }
class lmsmcutils {
getInfo() {
- return {
+ return {
id: "WindowSettings",
- name: Scratch.translate({ id: "ExtensionName", default: "Window Settings" }),
+ name: Scratch.translate({
+ id: "ExtensionName",
+ default: "Window Settings",
+ }),
color1: "#5671B7",
color2: "#4B6095",
color3: "#2D3548",
menuIconURI: menuIconURI,
-
- blocks: [
+ blocks: [
{
opcode: "MoveWHXY",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "MoveWHXY",
- default: " | | | | window [SC] [WHXY]: [WHXYA], [WHXYB] | | | | "
+ text: Scratch.translate({
+ id: "MoveWHXY",
+ default:
+ " | | | | window [SC] [WHXY]: [WHXYA], [WHXYB] | | | | ",
}),
arguments: {
SC: {
@@ -188,13 +195,13 @@
},
},
},
-
+
{
opcode: "WindowSCWH",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "WindowSCWH",
- default: " | | | | window [MenuSC] [MenuWH]: [WH] | | | | "
+ text: Scratch.translate({
+ id: "WindowSCWH",
+ default: " | | | | window [MenuSC] [MenuWH]: [WH] | | | | ",
}),
arguments: {
MenuSC: {
@@ -211,13 +218,13 @@
},
},
},
-
+
{
opcode: "moveToPresets",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "moveToPresets",
- default: " | | | | move window to the [PRESETS] | | | | "
+ text: Scratch.translate({
+ id: "moveToPresets",
+ default: " | | | | move window to the [PRESETS] | | | | ",
}),
arguments: {
PRESETS: {
@@ -226,13 +233,13 @@
},
},
},
-
+
{
opcode: "changeTitleTo",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "changeTitleTo",
- default: " | | | | set window title to [TITLE] | | | | "
+ text: Scratch.translate({
+ id: "changeTitleTo",
+ default: " | | | | set window title to [TITLE] | | | | ",
}),
arguments: {
TITLE: {
@@ -240,14 +247,14 @@
defaultValue: "WAYLIVES",
},
},
- },
-
+ },
+
{
opcode: "WindowWHXY",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate({
- id: "WindowWHXY",
- default: " | | | | window [MenuWindowWHXY] | | | | "
+ text: Scratch.translate({
+ id: "WindowWHXY",
+ default: " | | | | window [MenuWindowWHXY] | | | | ",
}),
arguments: {
MenuWindowWHXY: {
@@ -255,16 +262,17 @@
menu: "MenuWindowWHXY",
},
},
- },
+ },
- "---",
+ "---",
{
opcode: "innerStageSize",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "innerStageSize",
- default: " | | | | inner stage size [innerMenuSetChange] width: [innerWidth] height: [innerHeight] | | | | "
+ text: Scratch.translate({
+ id: "innerStageSize",
+ default:
+ " | | | | inner stage size [innerMenuSetChange] width: [innerWidth] height: [innerHeight] | | | | ",
}),
arguments: {
innerMenuSetChange: {
@@ -281,13 +289,14 @@
},
},
},
-
+
{
opcode: "innerStageSizeWidthHeight",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "innerStageSizeWidthHeight",
- default: " | | | | inner stage size [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | "
+ text: Scratch.translate({
+ id: "innerStageSizeWidthHeight",
+ default:
+ " | | | | inner stage size [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
}),
arguments: {
innerMenuSetChangeWH: {
@@ -308,9 +317,10 @@
{
opcode: "setDimensions",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "setDimensions",
- default: " | | | | set stage size width: [width] height: [height] | | | | "
+ text: Scratch.translate({
+ id: "setDimensions",
+ default:
+ " | | | | set stage size width: [width] height: [height] | | | | ",
}),
arguments: {
width: {
@@ -323,13 +333,13 @@
},
},
},
-
+
{
opcode: "getDimension",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate({
- id: "getDimension",
- default: " | | | | stage [dimension] | | | | "
+ text: Scratch.translate({
+ id: "getDimension",
+ default: " | | | | stage [dimension] | | | | ",
}),
arguments: {
dimension: {
@@ -338,16 +348,16 @@
menu: "dimension",
},
},
- },
+ },
"---",
-
+
{
opcode: "greenFlag",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "greenFlag",
- default: " | | | | run flag [flag] | | | | "
+ text: Scratch.translate({
+ id: "greenFlag",
+ default: " | | | | run flag [flag] | | | | ",
}),
arguments: {
flag: {
@@ -360,9 +370,9 @@
{
opcode: "FullscreenEnterExit",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "FullscreenEnterExit",
- default: " | | | | fullscreen [MenuFEE] | | | | "
+ text: Scratch.translate({
+ id: "FullscreenEnterExit",
+ default: " | | | | fullscreen [MenuFEE] | | | | ",
}),
arguments: {
MenuFEE: {
@@ -371,23 +381,23 @@
},
},
},
-
+
{
opcode: "closeWindow",
blockType: Scratch.BlockType.COMMAND,
isTerminal: true,
- text: Scratch.translate({
- id: "closeWindow",
- default: " | | | | close window | | | | "
+ text: Scratch.translate({
+ id: "closeWindow",
+ default: " | | | | close window | | | | ",
}),
- },
-
+ },
+
{
opcode: "QuestionsWS",
blockType: Scratch.BlockType.BOOLEAN,
- text: Scratch.translate({
- id: "QuestionsWS",
- default: " | | | | [MenuQuestions] | | | | "
+ text: Scratch.translate({
+ id: "QuestionsWS",
+ default: " | | | | [MenuQuestions] | | | | ",
}),
disableMonitor: true,
arguments: {
@@ -397,13 +407,13 @@
},
},
},
-
+
{
opcode: "ScreenWHXY",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate({
- id: "ScreenWHXY",
- default: " | | | | screen [MenuScreenWHXY] | | | | "
+ text: Scratch.translate({
+ id: "ScreenWHXY",
+ default: " | | | | screen [MenuScreenWHXY] | | | | ",
}),
arguments: {
MenuScreenWHXY: {
@@ -414,7 +424,7 @@
},
"---",
-/*
+ /*
{
opcode: "setEnabled",
blockType: Scratch.BlockType.COMMAND,
@@ -439,9 +449,9 @@
{
opcode: "setFramerate",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "setFramerate",
- default: " | | | | set framerate limit to [fps] | | | | "
+ text: Scratch.translate({
+ id: "setFramerate",
+ default: " | | | | set framerate limit to [fps] | | | | ",
}),
arguments: {
fps: {
@@ -450,17 +460,15 @@
},
},
},
-
- "---",
+ "---",
-
{
opcode: "showHideOption",
blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "showHideOption",
- default: " | | | | [SHOWHIDE] [OPTIONSH] | | | | "
+ text: Scratch.translate({
+ id: "showHideOption",
+ default: " | | | | [SHOWHIDE] [OPTIONSH] | | | | ",
}),
arguments: {
SHOWHIDE: {
@@ -476,9 +484,9 @@
{
opcode: "optionShown",
blockType: Scratch.BlockType.BOOLEAN,
- text: Scratch.translate({
- id: "optionShown",
- default: " | | | | [OPTION] shown? | | | | "
+ text: Scratch.translate({
+ id: "optionShown",
+ default: " | | | | [OPTION] shown? | | | | ",
}),
arguments: {
OPTION: {
@@ -487,57 +495,135 @@
},
},
},
- "---",
-
+ "---",
],
-
menus: {
-
SC: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "SCA", default: "set" }), value: "Set" },
- { text: Scratch.translate({ id: "SCB", default: "change" }), value: "Change" },
+ {
+ text: Scratch.translate({ id: "SCA", default: "set" }),
+ value: "Set",
+ },
+ {
+ text: Scratch.translate({ id: "SCB", default: "change" }),
+ value: "Change",
+ },
],
},
WHXY: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "WHXYA", default: "width, height" }), value: "WidthHeight" },
- { text: Scratch.translate({ id: "WHXYB", default: "x position, y position" }), value: "PositionXY" },
+ {
+ text: Scratch.translate({
+ id: "WHXYA",
+ default: "width, height",
+ }),
+ value: "WidthHeight",
+ },
+ {
+ text: Scratch.translate({
+ id: "WHXYB",
+ default: "x position, y position",
+ }),
+ value: "PositionXY",
+ },
],
- },
+ },
MenuSC: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "MenuSCA", default: "set" }), value: "Set" },
- { text: Scratch.translate({ id: "MenuSCB", default: "change" }), value: "Change" },
+ {
+ text: Scratch.translate({ id: "MenuSCA", default: "set" }),
+ value: "Set",
+ },
+ {
+ text: Scratch.translate({ id: "MenuSCB", default: "change" }),
+ value: "Change",
+ },
],
},
MenuWH: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "MenuWHA", default: "width" }), value: "Width" },
- { text: Scratch.translate({ id: "MenuWHB", default: "height" }), value: "Height" },
- { text: Scratch.translate({ id: "MenuWHC", default: "x position" }), value: "PositionX" },
- { text: Scratch.translate({ id: "MenuWHD", default: "y position" }), value: "PositionY" },
+ {
+ text: Scratch.translate({ id: "MenuWHA", default: "width" }),
+ value: "Width",
+ },
+ {
+ text: Scratch.translate({ id: "MenuWHB", default: "height" }),
+ value: "Height",
+ },
+ {
+ text: Scratch.translate({
+ id: "MenuWHC",
+ default: "x position",
+ }),
+ value: "PositionX",
+ },
+ {
+ text: Scratch.translate({
+ id: "MenuWHD",
+ default: "y position",
+ }),
+ value: "PositionY",
+ },
],
},
MOVE: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "PRESETSA", default: "center" }), value: "center" },
- { text: Scratch.translate({ id: "PRESETSB", default: "right" }), value: "right" },
- { text: Scratch.translate({ id: "PRESETSC", default: "left" }), value: "left" },
- { text: Scratch.translate({ id: "PRESETSD", default: "top" }), value: "top" },
- { text: Scratch.translate({ id: "PRESETSE", default: "bottom" }), value: "bottom" },
- { text: Scratch.translate({ id: "PRESETSF", default: "top right" }), value: "top right" },
- { text: Scratch.translate({ id: "PRESETSG", default: "top left" }), value: "top left" },
- { text: Scratch.translate({ id: "PRESETSH", default: "bottom right" }), value: "bottom right" },
- { text: Scratch.translate({ id: "PRESETSI", default: "bottom left" }), value: "bottom left" },
+ {
+ text: Scratch.translate({ id: "PRESETSA", default: "center" }),
+ value: "center",
+ },
+ {
+ text: Scratch.translate({ id: "PRESETSB", default: "right" }),
+ value: "right",
+ },
+ {
+ text: Scratch.translate({ id: "PRESETSC", default: "left" }),
+ value: "left",
+ },
+ {
+ text: Scratch.translate({ id: "PRESETSD", default: "top" }),
+ value: "top",
+ },
+ {
+ text: Scratch.translate({ id: "PRESETSE", default: "bottom" }),
+ value: "bottom",
+ },
+ {
+ text: Scratch.translate({
+ id: "PRESETSF",
+ default: "top right",
+ }),
+ value: "top right",
+ },
+ {
+ text: Scratch.translate({
+ id: "PRESETSG",
+ default: "top left",
+ }),
+ value: "top left",
+ },
+ {
+ text: Scratch.translate({
+ id: "PRESETSH",
+ default: "bottom right",
+ }),
+ value: "bottom right",
+ },
+ {
+ text: Scratch.translate({
+ id: "PRESETSI",
+ default: "bottom left",
+ }),
+ value: "bottom left",
+ },
],
- },
+ },
MenuWindowWHXY: {
acceptReporters: true,
items: [
@@ -551,22 +637,58 @@
innerMenuSetChange: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "innerMenuSetChangeA", default: "set" }), value: "set" },
- { text: Scratch.translate({ id: "innerMenuSetChangeB", default: "change" }), value: "change" },
+ {
+ text: Scratch.translate({
+ id: "innerMenuSetChangeA",
+ default: "set",
+ }),
+ value: "set",
+ },
+ {
+ text: Scratch.translate({
+ id: "innerMenuSetChangeB",
+ default: "change",
+ }),
+ value: "change",
+ },
],
},
innerMenuSetChangeWH: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "innerMenuSetChangeWHA", default: "set" }), value: "set" },
- { text: Scratch.translate({ id: "innerMenuSetChangeWHB", default: "change" }), value: "change" },
+ {
+ text: Scratch.translate({
+ id: "innerMenuSetChangeWHA",
+ default: "set",
+ }),
+ value: "set",
+ },
+ {
+ text: Scratch.translate({
+ id: "innerMenuSetChangeWHB",
+ default: "change",
+ }),
+ value: "change",
+ },
],
},
innerMenuWidthHeight: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "innerMenuWidthHeightA", default: "width" }), value: "width" },
- { text: Scratch.translate({ id: "innerMenuWidthHeightB", default: "height" }), value: "height" },
+ {
+ text: Scratch.translate({
+ id: "innerMenuWidthHeightA",
+ default: "width",
+ }),
+ value: "width",
+ },
+ {
+ text: Scratch.translate({
+ id: "innerMenuWidthHeightB",
+ default: "height",
+ }),
+ value: "height",
+ },
],
},
dimension: {
@@ -585,16 +707,46 @@
MenuFEE: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "FullscreenEnter", default: "width" }), value: "Enter" },
- { text: Scratch.translate({ id: "FullscreenExit", default: "height" }), value: "Exit" },
+ {
+ text: Scratch.translate({
+ id: "FullscreenEnter",
+ default: "width",
+ }),
+ value: "Enter",
+ },
+ {
+ text: Scratch.translate({
+ id: "FullscreenExit",
+ default: "height",
+ }),
+ value: "Exit",
+ },
],
},
MenuQuestions: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "MenuQuestionsA", default: "is window touching screen edge" }), value: "A" },
- { text: Scratch.translate({ id: "MenuQuestionsB", default: "is window focused?" }), value: "B" },
- { text: Scratch.translate({ id: "MenuQuestionsC", default: "is window fullscreen?" }), value: "C" },
+ {
+ text: Scratch.translate({
+ id: "MenuQuestionsA",
+ default: "is window touching screen edge",
+ }),
+ value: "A",
+ },
+ {
+ text: Scratch.translate({
+ id: "MenuQuestionsB",
+ default: "is window focused?",
+ }),
+ value: "B",
+ },
+ {
+ text: Scratch.translate({
+ id: "MenuQuestionsC",
+ default: "is window fullscreen?",
+ }),
+ value: "C",
+ },
],
},
MenuScreenWHXY: {
@@ -608,11 +760,41 @@
thing: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "thingA", default: "🗲 turbo mode" }), value: "TURBO_MODE" },
- { text: Scratch.translate({ id: "thingB", default: "interpolation" }), value: "INTERPOLATION" },
- { text: Scratch.translate({ id: "thingC", default: "remove fencing" }), value: "REMOVE_FENCING" },
- { text: Scratch.translate({ id: "thingD", default: "remove misc limits" }), value: "REMOVE_MISC_LIMITS" },
- { text: Scratch.translate({ id: "thingE", default: "high quality pen" }), value: "HIGH_QUALITY_PEN" },
+ {
+ text: Scratch.translate({
+ id: "thingA",
+ default: "🗲 turbo mode",
+ }),
+ value: "TURBO_MODE",
+ },
+ {
+ text: Scratch.translate({
+ id: "thingB",
+ default: "interpolation",
+ }),
+ value: "INTERPOLATION",
+ },
+ {
+ text: Scratch.translate({
+ id: "thingC",
+ default: "remove fencing",
+ }),
+ value: "REMOVE_FENCING",
+ },
+ {
+ text: Scratch.translate({
+ id: "thingD",
+ default: "remove misc limits",
+ }),
+ value: "REMOVE_MISC_LIMITS",
+ },
+ {
+ text: Scratch.translate({
+ id: "thingE",
+ default: "high quality pen",
+ }),
+ value: "HIGH_QUALITY_PEN",
+ },
],
},
@@ -654,24 +836,44 @@
SHOWHIDE: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "show", default: "show" }), value: "show" },
- { text: Scratch.translate({ id: "hide", default: "hide" }), value: "hide" },
+ {
+ text: Scratch.translate({ id: "show", default: "show" }),
+ value: "show",
+ },
+ {
+ text: Scratch.translate({ id: "hide", default: "hide" }),
+ value: "hide",
+ },
],
},
OPTIONSH: {
acceptReporters: false,
items: [
- { text: Scratch.translate({ id: "flag", default: "flag" }), value: "flag" },
- { text: Scratch.translate({ id: "pause", default: "pause" }), value: "pause" },
- { text: Scratch.translate({ id: "stop", default: "stop" }), value: "stop" },
- { text: Scratch.translate({ id: "fullscreen", default: "fullscreen" }), value: "fullscreen" },
+ {
+ text: Scratch.translate({ id: "flag", default: "flag" }),
+ value: "flag",
+ },
+ {
+ text: Scratch.translate({ id: "pause", default: "pause" }),
+ value: "pause",
+ },
+ {
+ text: Scratch.translate({ id: "stop", default: "stop" }),
+ value: "stop",
+ },
+ {
+ text: Scratch.translate({
+ id: "fullscreen",
+ default: "fullscreen",
+ }),
+ value: "fullscreen",
+ },
],
},
-
},
};
}
-
+
getDimension({ dimension }) {
if (dimension === "width") {
return Scratch.vm.runtime.stageWidth;
@@ -687,8 +889,6 @@
Scratch.vm.setStageSize(width, height);
}
-
-
MoveWHXY(args) {
if (args.SC == "Set") {
if (args.WHXY == "WidthHeight") {
@@ -708,23 +908,32 @@
innerStageSize(args) {
if (args.innerMenuSetChange == "set") {
- window.resizeTo(args.innerWidth + (window.outerWidth - window.innerWidth), args.innerHeight + (window.outerHeight - window.innerHeight));
+ window.resizeTo(
+ args.innerWidth + (window.outerWidth - window.innerWidth),
+ args.innerHeight + (window.outerHeight - window.innerHeight)
+ );
} else if (args.innerMenuSetChange == "change") {
window.resizeBy(args.innerWidth, args.innerHeight);
}
Scratch.vm.runtime.requestRedraw();
}
-
+
innerStageSizeWidthHeight(args) {
if (args.innerMenuSetChangeWH == "set") {
if (args.innerMenuWidthHeight == "width") {
const innerHeight = window.outerHeight;
- window.resizeTo(args.innerWidthHeight + (window.outerWidth - window.innerWidth), innerHeight);
+ window.resizeTo(
+ args.innerWidthHeight + (window.outerWidth - window.innerWidth),
+ innerHeight
+ );
} else if (args.innerMenuWidthHeight == "height") {
const innerWidth = window.outerWidth;
- window.resizeTo(innerWidth, args.innerWidthHeight + (window.outerHeight - window.innerHeight));
+ window.resizeTo(
+ innerWidth,
+ args.innerWidthHeight + (window.outerHeight - window.innerHeight)
+ );
}
- } else if (args.innerMenuSetChangeWH == "change") {
+ } else if (args.innerMenuSetChangeWH == "change") {
if (args.innerMenuWidthHeight == "width") {
window.resizeBy(args.innerWidthHeight, 0);
} else if (args.innerMenuWidthHeight == "height") {
@@ -733,7 +942,7 @@
}
Scratch.vm.runtime.requestRedraw();
}
-
+
moveToPresets(args) {
if (args.PRESETS == "center") {
const left = (screen.width - window.outerWidth) / 2;
@@ -882,14 +1091,14 @@
});
} else if (thing === HIGH_QUALITY_PEN) {
Scratch.renderer.setUseHighQualityRender(enabled);
- }
+ }
}
setFramerate({ fps }) {
fps = Scratch.Cast.toNumber(fps);
Scratch.vm.setFramerate(fps);
- }
-
+ }
+
showHideOption(args) {
getButtons();
if (args.SHOWHIDE === "show") {
@@ -913,7 +1122,7 @@
fullScreen.style.display = "none";
}
}
- }
+ }
optionShown(args) {
getButtons();
@@ -927,7 +1136,7 @@
return fullScreen.style.display !== "none";
}
return false;
- }
+ }
}
Scratch.extensions.register(new lmsmcutils());
})(Scratch);
From a1a73590424aabaaa931508a732c626a4caa29db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 13:44:59 +0300
Subject: [PATCH 03/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index 2618802026..d8315f20df 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -2,6 +2,8 @@
// ID: RIHART
// Description: Thanks to this extension, you can customize the project window (this works if you package the project in the ".exe" format).
// By: RIHART
+// License: MIT
+
// Version: 1.0.0
(function (Scratch) {
From e7b08679134fbeee79a2b8b4a0c0994033f37b90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 13:53:51 +0300
Subject: [PATCH 04/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 93 +++++++++-------------
1 file changed, 36 insertions(+), 57 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index d8315f20df..c87696c62e 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -13,14 +13,14 @@
ru /*_РусскийЯзык_*/: {
ExtensionName: "Настройки Окна",
LabelA: "Window Settings:",
- MoveWHXY: " | | | | окно [SC] [WHXY]: [WHXYA], [WHXYB] | | | | ",
+ MoveWHXY: "окно [SC] [WHXY]: [WHXYA], [WHXYB]",
// [SC]:
SCA: "задать",
SCB: "изменить",
// [WHXY]:
WHXYA: "ширину, высоту",
WHXYB: "позицию x, позицию y",
- WindowSCWH: " | | | | окно [MenuSC] [MenuWH]: [WH] | | | | ",
+ WindowSCWH: "окно [MenuSC] [MenuWH]: [WH]",
// [MenuSC]:
MenuSCA: "задать",
MenuSCB: "изменить",
@@ -29,7 +29,7 @@
MenuWHB: "высоту",
MenuWHC: "позицию x",
MenuWHD: "позицию y",
- moveToPresets: " | | | | переместить окно [PRESETS] | | | | ",
+ moveToPresets: "переместить окно [PRESETS]",
// [PRESETS]:
PRESETSA: "по центру",
PRESETSB: "справа",
@@ -40,15 +40,15 @@
PRESETSG: "в верхнем левом углу",
PRESETSH: "в нижнем правом углу",
PRESETSI: "в нижнем левом углу",
- changeTitleTo: " | | | | задать окну имя [TITLE] | | | | ",
- WindowWHXY: " | | | | окно [MenuWindowWHXY] | | | | ",
+ changeTitleTo: "задать окну имя [TITLE]",
+ WindowWHXY: "окно [MenuWindowWHXY]",
innerStageSize:
- " | | | | размер внутренней сцены [innerMenuSetChange] ширину: [innerWidth] высоту: [innerHeight] | | | | ",
+ "размер внутренней сцены [innerMenuSetChange] ширину: [innerWidth] высоту: [innerHeight]",
// [innerMenuSetChange]:
innerMenuSetChangeA: "задать",
innerMenuSetChangeB: "изменить",
innerStageSizeWidthHeight:
- " | | | | размер внутренней сцены [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
+ "размер внутренней сцены [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight]",
// [innerMenuSetChangeWH]:
innerMenuSetChangeWHA: "задать",
innerMenuSetChangeWHB: "изменить",
@@ -56,21 +56,21 @@
innerMenuWidthHeightA: "ширину",
innerMenuWidthHeightB: "высоту",
setDimensions:
- " | | | | задать сцену по ширине: [width] по высоте: [height] | | | | ",
- getDimension: " | | | | сцена [dimension] | | | | ",
- greenFlag: " | | | | нажать на флаг [flag] | | | | ",
- FullscreenEnterExit: " | | | | полноэкранный режим [MenuFEE] | | | | ",
+ "задать сцену по ширине: [width] по высоте: [height]",
+ getDimension: "сцена [dimension]",
+ greenFlag: "нажать на флаг [flag]",
+ FullscreenEnterExit: "полноэкранный режим [MenuFEE]",
// [MenuFEE]:
FullscreenEnter: "включить",
FullscreenExit: "выключить",
- closeWindow: " | | | | закрыть окно | | | | ",
- QuestionsWS: " | | | | [MenuQuestions] | | | | ",
+ closeWindow: "закрыть окно",
+ QuestionsWS: "[MenuQuestions]",
// [MenuQuestions]:
MenuQuestionsA: "касается ли окно края экрана?",
MenuQuestionsB: "сфокусировано ли окно?",
MenuQuestionsC: "является ли окно полноэкранным?",
- ScreenWHXY: " | | | | экран [MenuScreenWHXY] | | | | ",
- setEnabled: " | | | | задать [thing] [enabled] | | | | ",
+ ScreenWHXY: "экран [MenuScreenWHXY]",
+ setEnabled: "задать [thing] [enabled]",
// [thing]:
thingA: "🗲 турбо режим",
thingB: "интерполяция",
@@ -79,8 +79,8 @@
thingE: "перо в высоком качестве",
// [enabled]:
setFramerate:
- " | | | | задать ограничение частоты кадров на: [fps] | | | | ",
- showHideOption: " | | | | [SHOWHIDE] [OPTIONSH] | | | | ",
+ "задать ограничение частоты кадров на: [fps]",
+ showHideOption: "[SHOWHIDE] [OPTIONSH]",
// [SHOWHIDE]:
show: "показать",
hide: "скрыть",
@@ -89,7 +89,7 @@
pause: "иконка паузы",
stop: "иконка остановки",
fullscreen: "иконка полноэкранного режима",
- optionShown: " | | | | [OPTION] показан? | | | | ",
+ optionShown: "[OPTION] показан?",
},
});
@@ -176,7 +176,7 @@
text: Scratch.translate({
id: "MoveWHXY",
default:
- " | | | | window [SC] [WHXY]: [WHXYA], [WHXYB] | | | | ",
+ "window [SC] [WHXY]: [WHXYA], [WHXYB]",
}),
arguments: {
SC: {
@@ -203,7 +203,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "WindowSCWH",
- default: " | | | | window [MenuSC] [MenuWH]: [WH] | | | | ",
+ default: "window [MenuSC] [MenuWH]: [WH]",
}),
arguments: {
MenuSC: {
@@ -226,7 +226,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "moveToPresets",
- default: " | | | | move window to the [PRESETS] | | | | ",
+ default: "move window to the [PRESETS]",
}),
arguments: {
PRESETS: {
@@ -241,7 +241,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "changeTitleTo",
- default: " | | | | set window title to [TITLE] | | | | ",
+ default: "set window title to [TITLE]",
}),
arguments: {
TITLE: {
@@ -256,7 +256,7 @@
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({
id: "WindowWHXY",
- default: " | | | | window [MenuWindowWHXY] | | | | ",
+ default: "window [MenuWindowWHXY]",
}),
arguments: {
MenuWindowWHXY: {
@@ -274,7 +274,7 @@
text: Scratch.translate({
id: "innerStageSize",
default:
- " | | | | inner stage size [innerMenuSetChange] width: [innerWidth] height: [innerHeight] | | | | ",
+ "inner stage size [innerMenuSetChange] width: [innerWidth] height: [innerHeight]",
}),
arguments: {
innerMenuSetChange: {
@@ -298,7 +298,7 @@
text: Scratch.translate({
id: "innerStageSizeWidthHeight",
default:
- " | | | | inner stage size [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight] | | | | ",
+ "inner stage size [innerMenuSetChangeWH] [innerMenuWidthHeight]: [innerWidthHeight]",
}),
arguments: {
innerMenuSetChangeWH: {
@@ -322,7 +322,7 @@
text: Scratch.translate({
id: "setDimensions",
default:
- " | | | | set stage size width: [width] height: [height] | | | | ",
+ "set stage size width: [width] height: [height]",
}),
arguments: {
width: {
@@ -341,7 +341,7 @@
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({
id: "getDimension",
- default: " | | | | stage [dimension] | | | | ",
+ default: "stage [dimension]",
}),
arguments: {
dimension: {
@@ -359,7 +359,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "greenFlag",
- default: " | | | | run flag [flag] | | | | ",
+ default: "run flag [flag]",
}),
arguments: {
flag: {
@@ -374,7 +374,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "FullscreenEnterExit",
- default: " | | | | fullscreen [MenuFEE] | | | | ",
+ default: "fullscreen [MenuFEE]",
}),
arguments: {
MenuFEE: {
@@ -390,7 +390,7 @@
isTerminal: true,
text: Scratch.translate({
id: "closeWindow",
- default: " | | | | close window | | | | ",
+ default: "close window",
}),
},
@@ -399,7 +399,7 @@
blockType: Scratch.BlockType.BOOLEAN,
text: Scratch.translate({
id: "QuestionsWS",
- default: " | | | | [MenuQuestions] | | | | ",
+ default: "[MenuQuestions]",
}),
disableMonitor: true,
arguments: {
@@ -415,7 +415,7 @@
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({
id: "ScreenWHXY",
- default: " | | | | screen [MenuScreenWHXY] | | | | ",
+ default: "screen [MenuScreenWHXY]",
}),
arguments: {
MenuScreenWHXY: {
@@ -426,34 +426,13 @@
},
"---",
- /*
- {
- opcode: "setEnabled",
- blockType: Scratch.BlockType.COMMAND,
- text: Scratch.translate({
- id: "setEnabled",
- default: " | | | | set [thing] to [enabled] | | | | "
- }),
- arguments: {
- thing: {
- type: Scratch.ArgumentType.STRING,
- menu: "thing",
- defaultValue: "TURBO_MODE",
- },
- enabled: {
- type: Scratch.ArgumentType.STRING,
- menu: "enabled",
- defaultValue: "true",
- },
- },
- },
-*/
+
{
opcode: "setFramerate",
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "setFramerate",
- default: " | | | | set framerate limit to [fps] | | | | ",
+ default: "set framerate limit to [fps]",
}),
arguments: {
fps: {
@@ -470,7 +449,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "showHideOption",
- default: " | | | | [SHOWHIDE] [OPTIONSH] | | | | ",
+ default: "[SHOWHIDE] [OPTIONSH]",
}),
arguments: {
SHOWHIDE: {
@@ -488,7 +467,7 @@
blockType: Scratch.BlockType.BOOLEAN,
text: Scratch.translate({
id: "optionShown",
- default: " | | | | [OPTION] shown? | | | | ",
+ default: "[OPTION] shown?",
}),
arguments: {
OPTION: {
From a33d0b2d0770e0565c41fa2293d5fc2b4a6c6c72 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Fri, 28 Feb 2025 10:56:02 +0000
Subject: [PATCH 05/63] [Automated] Format code
---
extensions/RIHART/Window Settings/1.0.0.js | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index c87696c62e..cf7be36f4b 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -55,8 +55,7 @@
// [innerMenuWidthHeight]:
innerMenuWidthHeightA: "ширину",
innerMenuWidthHeightB: "высоту",
- setDimensions:
- "задать сцену по ширине: [width] по высоте: [height]",
+ setDimensions: "задать сцену по ширине: [width] по высоте: [height]",
getDimension: "сцена [dimension]",
greenFlag: "нажать на флаг [flag]",
FullscreenEnterExit: "полноэкранный режим [MenuFEE]",
@@ -78,8 +77,7 @@
thingD: "убрать разные ограничения",
thingE: "перо в высоком качестве",
// [enabled]:
- setFramerate:
- "задать ограничение частоты кадров на: [fps]",
+ setFramerate: "задать ограничение частоты кадров на: [fps]",
showHideOption: "[SHOWHIDE] [OPTIONSH]",
// [SHOWHIDE]:
show: "показать",
@@ -175,8 +173,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "MoveWHXY",
- default:
- "window [SC] [WHXY]: [WHXYA], [WHXYB]",
+ default: "window [SC] [WHXY]: [WHXYA], [WHXYB]",
}),
arguments: {
SC: {
@@ -321,8 +318,7 @@
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({
id: "setDimensions",
- default:
- "set stage size width: [width] height: [height]",
+ default: "set stage size width: [width] height: [height]",
}),
arguments: {
width: {
@@ -426,7 +422,7 @@
},
"---",
-
+
{
opcode: "setFramerate",
blockType: Scratch.BlockType.COMMAND,
From ea8e1e53bd1e6d4f7c0bff19a5cd1f0554c12c1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:03:34 +0300
Subject: [PATCH 06/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index cf7be36f4b..967e21af8e 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -9,7 +9,6 @@
(function (Scratch) {
"use strict";
- Scratch.translate.setup({
ru /*_РусскийЯзык_*/: {
ExtensionName: "Настройки Окна",
LabelA: "Window Settings:",
@@ -88,8 +87,7 @@
stop: "иконка остановки",
fullscreen: "иконка полноэкранного режима",
optionShown: "[OPTION] показан?",
- },
- });
+ },);
if (!Scratch.extensions.unsandboxed) {
throw new Error("Error");
From e01604f2386170997c763b70750e90538b6350db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:11:26 +0300
Subject: [PATCH 07/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index 967e21af8e..3fe1ed2c4f 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -87,7 +87,7 @@
stop: "иконка остановки",
fullscreen: "иконка полноэкранного режима",
optionShown: "[OPTION] показан?",
- },);
+ },
if (!Scratch.extensions.unsandboxed) {
throw new Error("Error");
From 1188bb528be7d86787b26a77e4b95125b4534e78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:15:20 +0300
Subject: [PATCH 08/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index 3fe1ed2c4f..cf7be36f4b 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -9,6 +9,7 @@
(function (Scratch) {
"use strict";
+ Scratch.translate.setup({
ru /*_РусскийЯзык_*/: {
ExtensionName: "Настройки Окна",
LabelA: "Window Settings:",
@@ -88,6 +89,7 @@
fullscreen: "иконка полноэкранного режима",
optionShown: "[OPTION] показан?",
},
+ });
if (!Scratch.extensions.unsandboxed) {
throw new Error("Error");
From a2c43fb73d19fa52b9d106cf0ec2c53326e31d70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:17:09 +0300
Subject: [PATCH 09/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index cf7be36f4b..af9ffd1306 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -9,7 +9,7 @@
(function (Scratch) {
"use strict";
- Scratch.translate.setup({
+ Scratch.translate({
ru /*_РусскийЯзык_*/: {
ExtensionName: "Настройки Окна",
LabelA: "Window Settings:",
From 537c8c76ab5b00458aeb1e1a7c0aa8da84dcff02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:21:50 +0300
Subject: [PATCH 10/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index af9ffd1306..c512897c10 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -142,18 +142,6 @@
document.querySelector(".stop-all-button");
};
- class controlcontrols {
- constructor() {
- Scratch.vm.runtime.on("RUNTIME_DISPOSED", () => {
- getButtons();
- for (const button of [fullScreen, greenFlag, pauseButton, stopButton]) {
- if (button) {
- button.style.display = "block";
- }
- }
- });
- }
- }
class lmsmcutils {
getInfo() {
return {
From 5f6b77d6632c302511630c8bf2390108e355e8f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:25:58 +0300
Subject: [PATCH 11/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index c512897c10..b2bcedca28 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -100,7 +100,6 @@
"data:image/svg+xml,%3Csvg%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%2294%22%20height%3D%2294%22%20rx%3D%2217%22%20fill%3D%22%234B6095%22%20stroke%3D%22%232D3548%22%20stroke-width%3D%226%22%2F%3E%3Crect%20x%3D%2226%22%20y%3D%2226%22%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%225%22%20stroke%3D%22white%22%20stroke-width%3D%226%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M23%2031C23%2026.5817%2026.5817%2023%2031%2023H69C73.4183%2023%2077%2026.5817%2077%2031V35C77%2039.4183%2073.4183%2043%2069%2043H31C26.5817%2043%2023%2039.4183%2023%2035V31ZM43%2037C45.2091%2037%2047%2035.2091%2047%2033C47%2030.7909%2045.2091%2029%2043%2029C40.7909%2029%2039%2030.7909%2039%2033C39%2035.2091%2040.7909%2037%2043%2037ZM57%2033C57%2035.2091%2055.2091%2037%2053%2037C50.7909%2037%2049%2035.2091%2049%2033C49%2030.7909%2050.7909%2029%2053%2029C55.2091%2029%2057%2030.7909%2057%2033ZM33%2037C35.2091%2037%2037%2035.2091%2037%2033C37%2030.7909%2035.2091%2029%2033%2029C30.7909%2029%2029%2030.7909%2029%2033C29%2035.2091%2030.7909%2037%2033%2037Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";
// иконки блоков:
- const MoveWHXY = "data:image/gif;base64,";
const greenFlagURI =
"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAxNiAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zIDAuNUMzIDAuMjIzODU4IDIuNzc2MTQgMCAyLjUgMEgxLjVDMC42NzE1NzMgMCAwIDAuNjcxNTczIDAgMS41VjE4LjVDMCAxOS4zMjg0IDAuNjcxNTczIDIwIDEuNSAyMFYyMEMyLjMyODQzIDIwIDMgMTkuMzI4NCAzIDE4LjVWMTVDMyAxMy44OTU0IDMuODk1NDMgMTMgNSAxM0gxNEMxNS4xMDQ2IDEzIDE2IDEyLjEwNDYgMTYgMTFWM0MxNiAxLjg5NTQzIDE1LjEwNDYgMSAxNCAxSDMuNUMzLjIyMzg2IDEgMyAwLjc3NjE0MiAzIDAuNVYwLjVaIiBmaWxsPSIjMTgxRDBEIi8+Cjwvc3ZnPgo=";
From 77c34217c4dd8d915420590710e49e544fb62c84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:32:25 +0300
Subject: [PATCH 12/63] Create Window Settings.svg
---
images/RIHART/Window Settings.svg | 194 ++++++++++++++++++++++++++++++
1 file changed, 194 insertions(+)
create mode 100644 images/RIHART/Window Settings.svg
diff --git a/images/RIHART/Window Settings.svg b/images/RIHART/Window Settings.svg
new file mode 100644
index 0000000000..f83fe092d7
--- /dev/null
+++ b/images/RIHART/Window Settings.svg
@@ -0,0 +1,194 @@
+
From 4e77dc8bf31929edfdc7558e9ab49999574597dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:44:02 +0300
Subject: [PATCH 13/63] Update 1.0.0.js
---
extensions/RIHART/Window Settings/1.0.0.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/RIHART/Window Settings/1.0.0.js
index b2bcedca28..556709944b 100644
--- a/extensions/RIHART/Window Settings/1.0.0.js
+++ b/extensions/RIHART/Window Settings/1.0.0.js
@@ -674,14 +674,14 @@
{
text: Scratch.translate({
id: "FullscreenEnter",
- default: "width",
+ default: "on",
}),
value: "Enter",
},
{
text: Scratch.translate({
id: "FullscreenExit",
- default: "height",
+ default: "off",
}),
value: "Exit",
},
From 02ebdfdd1760b38a757103d26b7cce7021f011f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:57:04 +0300
Subject: [PATCH 14/63] Rename 1.0.0.js to 1.0.0.js
---
extensions/{RIHART => WAYLIVES}/Window Settings/1.0.0.js | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename extensions/{RIHART => WAYLIVES}/Window Settings/1.0.0.js (100%)
diff --git a/extensions/RIHART/Window Settings/1.0.0.js b/extensions/WAYLIVES/Window Settings/1.0.0.js
similarity index 100%
rename from extensions/RIHART/Window Settings/1.0.0.js
rename to extensions/WAYLIVES/Window Settings/1.0.0.js
From e4e2c9fbf41f7679f5fd4e50980ec897e8b8a2f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:57:47 +0300
Subject: [PATCH 15/63] Rename Window Settings.svg to Window Settings.svg
---
images/{RIHART => WAYLIVES}/Window Settings.svg | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename images/{RIHART => WAYLIVES}/Window Settings.svg (100%)
diff --git a/images/RIHART/Window Settings.svg b/images/WAYLIVES/Window Settings.svg
similarity index 100%
rename from images/RIHART/Window Settings.svg
rename to images/WAYLIVES/Window Settings.svg
From db656c4fbdc9405bda3c8cd574b1adff8a77538f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sat, 1 Mar 2025 15:24:27 +0300
Subject: [PATCH 16/63] Update and rename 1.0.0.js to 2.0.0.js
---
extensions/WAYLIVES/Window Settings/{1.0.0.js => 2.0.0.js} | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
rename extensions/WAYLIVES/Window Settings/{1.0.0.js => 2.0.0.js} (99%)
diff --git a/extensions/WAYLIVES/Window Settings/1.0.0.js b/extensions/WAYLIVES/Window Settings/2.0.0.js
similarity index 99%
rename from extensions/WAYLIVES/Window Settings/1.0.0.js
rename to extensions/WAYLIVES/Window Settings/2.0.0.js
index 556709944b..a641205de5 100644
--- a/extensions/WAYLIVES/Window Settings/1.0.0.js
+++ b/extensions/WAYLIVES/Window Settings/2.0.0.js
@@ -1,10 +1,10 @@
-// Name: Window Settings
+// Name: Window Settings V2
// ID: RIHART
// Description: Thanks to this extension, you can customize the project window (this works if you package the project in the ".exe" format).
// By: RIHART
// License: MIT
-// Version: 1.0.0
+// Version: 2.0.0
(function (Scratch) {
"use strict";
From 2411fe311d805e943fca77317bec4d9ac40f4275 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sat, 1 Mar 2025 15:27:29 +0300
Subject: [PATCH 17/63] Update 2.0.0.js
---
extensions/WAYLIVES/Window Settings/2.0.0.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/WAYLIVES/Window Settings/2.0.0.js b/extensions/WAYLIVES/Window Settings/2.0.0.js
index a641205de5..e6b52f6aa3 100644
--- a/extensions/WAYLIVES/Window Settings/2.0.0.js
+++ b/extensions/WAYLIVES/Window Settings/2.0.0.js
@@ -1,5 +1,5 @@
// Name: Window Settings V2
-// ID: RIHART
+// ID: WRWindowSettings
// Description: Thanks to this extension, you can customize the project window (this works if you package the project in the ".exe" format).
// By: RIHART
// License: MIT
From 46abee791792865ba4240a257f81689975545db6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sun, 2 Mar 2025 16:39:06 +0300
Subject: [PATCH 18/63] Create 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 391 +++++++++++++++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 extensions/WAYLIVES/SVG/1.0.1.js
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
new file mode 100644
index 0000000000..223600a86d
--- /dev/null
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -0,0 +1,391 @@
+// Name: SVG
+// ID: WRsvg
+// Description: Create SVG elements.
+// By: WAYLIVES
+// License: MIT
+
+// Version: 1.0.1
+
+(async function(Scratch) {
+ const variables = {};
+ const blocks = [];
+ const menus = {};
+
+
+ if (!Scratch.extensions.unsandboxed) {
+ alert("This extension needs to be unsandboxed to run!")
+ return
+ }
+
+ function doSound(ab, cd, runtime) {
+ const audioEngine = runtime.audioEngine;
+
+ const fetchAsArrayBufferWithTimeout = (url) =>
+ new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ let timeout = setTimeout(() => {
+ xhr.abort();
+ reject(new Error("Timed out"));
+ }, 5000);
+ xhr.onload = () => {
+ clearTimeout(timeout);
+ if (xhr.status === 200) {
+ resolve(xhr.response);
+ } else {
+ reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
+ }
+ };
+ xhr.onerror = () => {
+ clearTimeout(timeout);
+ reject(new Error(`Failed to request ${url}`));
+ };
+ xhr.responseType = "arraybuffer";
+ xhr.open("GET", url);
+ xhr.send();
+ });
+
+ const soundPlayerCache = new Map();
+
+ const decodeSoundPlayer = async (url) => {
+ const cached = soundPlayerCache.get(url);
+ if (cached) {
+ if (cached.sound) {
+ return cached.sound;
+ }
+ throw cached.error;
+ }
+
+ try {
+ const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
+ const soundPlayer = await audioEngine.decodeSoundPlayer({
+ data: {
+ buffer: arrayBuffer,
+ },
+ });
+ soundPlayerCache.set(url, {
+ sound: soundPlayer,
+ error: null,
+ });
+ return soundPlayer;
+ } catch (e) {
+ soundPlayerCache.set(url, {
+ sound: null,
+ error: e,
+ });
+ throw e;
+ }
+ };
+
+ const playWithAudioEngine = async (url, target) => {
+ const soundBank = target.sprite.soundBank;
+
+ let soundPlayer;
+ try {
+ const originalSoundPlayer = await decodeSoundPlayer(url);
+ soundPlayer = originalSoundPlayer.take();
+ } catch (e) {
+ console.warn(
+ "Could not fetch audio; falling back to primitive approach",
+ e
+ );
+ return false;
+ }
+
+ soundBank.addSoundPlayer(soundPlayer);
+ await soundBank.playSound(target, soundPlayer.id);
+
+ delete soundBank.soundPlayers[soundPlayer.id];
+ soundBank.playerTargets.delete(soundPlayer.id);
+ soundBank.soundEffects.delete(soundPlayer.id);
+
+ return true;
+ };
+
+ const playWithAudioElement = (url, target) =>
+ new Promise((resolve, reject) => {
+ const mediaElement = new Audio(url);
+
+ mediaElement.volume = target.volume / 100;
+
+ mediaElement.onended = () => {
+ resolve();
+ };
+ mediaElement
+ .play()
+ .then(() => {
+ // Wait for onended
+ })
+ .catch((err) => {
+ reject(err);
+ });
+ });
+
+ const playSound = async (url, target) => {
+ try {
+ if (!(await Scratch.canFetch(url))) {
+ throw new Error(`Permission to fetch ${url} denied`);
+ }
+
+ const success = await playWithAudioEngine(url, target);
+ if (!success) {
+ return await playWithAudioElement(url, target);
+ }
+ } catch (e) {
+ console.warn(`All attempts to play ${url} failed`, e);
+ }
+ };
+
+ playSound(ab, cd)
+ }
+ class Extension {
+ getInfo() {
+ return {
+ "id": "extensionID",
+ "name": "SVG",
+ "color1": "#9823FF",
+ "color2": "#7C2DC1",
+ "tbShow": true,
+ "blocks": blocks,
+ "menus": menus
+ }
+ }
+ }
+ blocks.push({
+ opcode: "svg",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
+ arguments: {
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "ELEMENTS": {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: '',
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svg"] = async (args, util) => {
+ variables['svgWidth'] = args["WIDTH"]
+ variables['svgHeight'] = args["HEIGHT"]
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "line",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
+ arguments: {
+ "XA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "YA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "XB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "YB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "COLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "OPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["line"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "rect",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "X": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "Y": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "RADIUS": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '20',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["rect"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "ellipse",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "CX": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "CY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["ellipse"] = async (args, util) => {
+ return (('')
+ };
+
+ (0 + 0);
+
+ blocks.push({
+ opcode: "svgWidth",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg width"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgWidth"] = async (args, util) => {
+ return variables['svgWidth']
+ };
+
+ blocks.push({
+ opcode: "svgHeight",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg height"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgHeight"] = async (args, util) => {
+ return variables['svgHeight']
+ };
+
+ menus["LINECAPmenu"] = {
+ acceptReporters: true,
+ items: ["round", "butt", "square"]
+ }
+
+ Scratch.extensions.register(new Extension());
+})(Scratch);
From 1ff413f28dbf47c4091926b1810460615113c724 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sun, 2 Mar 2025 16:43:50 +0300
Subject: [PATCH 19/63] Delete extensions/WAYLIVES/SVG directory
---
extensions/WAYLIVES/SVG/1.0.1.js | 391 -------------------------------
1 file changed, 391 deletions(-)
delete mode 100644 extensions/WAYLIVES/SVG/1.0.1.js
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
deleted file mode 100644
index 223600a86d..0000000000
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ /dev/null
@@ -1,391 +0,0 @@
-// Name: SVG
-// ID: WRsvg
-// Description: Create SVG elements.
-// By: WAYLIVES
-// License: MIT
-
-// Version: 1.0.1
-
-(async function(Scratch) {
- const variables = {};
- const blocks = [];
- const menus = {};
-
-
- if (!Scratch.extensions.unsandboxed) {
- alert("This extension needs to be unsandboxed to run!")
- return
- }
-
- function doSound(ab, cd, runtime) {
- const audioEngine = runtime.audioEngine;
-
- const fetchAsArrayBufferWithTimeout = (url) =>
- new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- let timeout = setTimeout(() => {
- xhr.abort();
- reject(new Error("Timed out"));
- }, 5000);
- xhr.onload = () => {
- clearTimeout(timeout);
- if (xhr.status === 200) {
- resolve(xhr.response);
- } else {
- reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
- }
- };
- xhr.onerror = () => {
- clearTimeout(timeout);
- reject(new Error(`Failed to request ${url}`));
- };
- xhr.responseType = "arraybuffer";
- xhr.open("GET", url);
- xhr.send();
- });
-
- const soundPlayerCache = new Map();
-
- const decodeSoundPlayer = async (url) => {
- const cached = soundPlayerCache.get(url);
- if (cached) {
- if (cached.sound) {
- return cached.sound;
- }
- throw cached.error;
- }
-
- try {
- const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
- const soundPlayer = await audioEngine.decodeSoundPlayer({
- data: {
- buffer: arrayBuffer,
- },
- });
- soundPlayerCache.set(url, {
- sound: soundPlayer,
- error: null,
- });
- return soundPlayer;
- } catch (e) {
- soundPlayerCache.set(url, {
- sound: null,
- error: e,
- });
- throw e;
- }
- };
-
- const playWithAudioEngine = async (url, target) => {
- const soundBank = target.sprite.soundBank;
-
- let soundPlayer;
- try {
- const originalSoundPlayer = await decodeSoundPlayer(url);
- soundPlayer = originalSoundPlayer.take();
- } catch (e) {
- console.warn(
- "Could not fetch audio; falling back to primitive approach",
- e
- );
- return false;
- }
-
- soundBank.addSoundPlayer(soundPlayer);
- await soundBank.playSound(target, soundPlayer.id);
-
- delete soundBank.soundPlayers[soundPlayer.id];
- soundBank.playerTargets.delete(soundPlayer.id);
- soundBank.soundEffects.delete(soundPlayer.id);
-
- return true;
- };
-
- const playWithAudioElement = (url, target) =>
- new Promise((resolve, reject) => {
- const mediaElement = new Audio(url);
-
- mediaElement.volume = target.volume / 100;
-
- mediaElement.onended = () => {
- resolve();
- };
- mediaElement
- .play()
- .then(() => {
- // Wait for onended
- })
- .catch((err) => {
- reject(err);
- });
- });
-
- const playSound = async (url, target) => {
- try {
- if (!(await Scratch.canFetch(url))) {
- throw new Error(`Permission to fetch ${url} denied`);
- }
-
- const success = await playWithAudioEngine(url, target);
- if (!success) {
- return await playWithAudioElement(url, target);
- }
- } catch (e) {
- console.warn(`All attempts to play ${url} failed`, e);
- }
- };
-
- playSound(ab, cd)
- }
- class Extension {
- getInfo() {
- return {
- "id": "extensionID",
- "name": "SVG",
- "color1": "#9823FF",
- "color2": "#7C2DC1",
- "tbShow": true,
- "blocks": blocks,
- "menus": menus
- }
- }
- }
- blocks.push({
- opcode: "svg",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
- arguments: {
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "ELEMENTS": {
- type: Scratch.ArgumentType.STRING,
- defaultValue: '',
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svg"] = async (args, util) => {
- variables['svgWidth'] = args["WIDTH"]
- variables['svgHeight'] = args["HEIGHT"]
- return (('')
- };
-
- blocks.push({
- opcode: "line",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
- arguments: {
- "XA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "YA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "XB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "YB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "COLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "OPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["line"] = async (args, util) => {
- return (('')
- };
-
- blocks.push({
- opcode: "rect",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "X": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "Y": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "RADIUS": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '20',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["rect"] = async (args, util) => {
- return (('')
- };
-
- blocks.push({
- opcode: "ellipse",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "CX": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "CY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["ellipse"] = async (args, util) => {
- return (('')
- };
-
- (0 + 0);
-
- blocks.push({
- opcode: "svgWidth",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg width"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgWidth"] = async (args, util) => {
- return variables['svgWidth']
- };
-
- blocks.push({
- opcode: "svgHeight",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg height"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgHeight"] = async (args, util) => {
- return variables['svgHeight']
- };
-
- menus["LINECAPmenu"] = {
- acceptReporters: true,
- items: ["round", "butt", "square"]
- }
-
- Scratch.extensions.register(new Extension());
-})(Scratch);
From 568253c80f766f55bdfbfb7fbe99c75c40d7ca19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sun, 2 Mar 2025 18:09:21 +0300
Subject: [PATCH 20/63] Create 1.0.1.js
---
.../WAYLIVES/Window Settings/SVG/1.0.1.js | 391 ++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
diff --git a/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js b/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
new file mode 100644
index 0000000000..223600a86d
--- /dev/null
+++ b/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
@@ -0,0 +1,391 @@
+// Name: SVG
+// ID: WRsvg
+// Description: Create SVG elements.
+// By: WAYLIVES
+// License: MIT
+
+// Version: 1.0.1
+
+(async function(Scratch) {
+ const variables = {};
+ const blocks = [];
+ const menus = {};
+
+
+ if (!Scratch.extensions.unsandboxed) {
+ alert("This extension needs to be unsandboxed to run!")
+ return
+ }
+
+ function doSound(ab, cd, runtime) {
+ const audioEngine = runtime.audioEngine;
+
+ const fetchAsArrayBufferWithTimeout = (url) =>
+ new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ let timeout = setTimeout(() => {
+ xhr.abort();
+ reject(new Error("Timed out"));
+ }, 5000);
+ xhr.onload = () => {
+ clearTimeout(timeout);
+ if (xhr.status === 200) {
+ resolve(xhr.response);
+ } else {
+ reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
+ }
+ };
+ xhr.onerror = () => {
+ clearTimeout(timeout);
+ reject(new Error(`Failed to request ${url}`));
+ };
+ xhr.responseType = "arraybuffer";
+ xhr.open("GET", url);
+ xhr.send();
+ });
+
+ const soundPlayerCache = new Map();
+
+ const decodeSoundPlayer = async (url) => {
+ const cached = soundPlayerCache.get(url);
+ if (cached) {
+ if (cached.sound) {
+ return cached.sound;
+ }
+ throw cached.error;
+ }
+
+ try {
+ const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
+ const soundPlayer = await audioEngine.decodeSoundPlayer({
+ data: {
+ buffer: arrayBuffer,
+ },
+ });
+ soundPlayerCache.set(url, {
+ sound: soundPlayer,
+ error: null,
+ });
+ return soundPlayer;
+ } catch (e) {
+ soundPlayerCache.set(url, {
+ sound: null,
+ error: e,
+ });
+ throw e;
+ }
+ };
+
+ const playWithAudioEngine = async (url, target) => {
+ const soundBank = target.sprite.soundBank;
+
+ let soundPlayer;
+ try {
+ const originalSoundPlayer = await decodeSoundPlayer(url);
+ soundPlayer = originalSoundPlayer.take();
+ } catch (e) {
+ console.warn(
+ "Could not fetch audio; falling back to primitive approach",
+ e
+ );
+ return false;
+ }
+
+ soundBank.addSoundPlayer(soundPlayer);
+ await soundBank.playSound(target, soundPlayer.id);
+
+ delete soundBank.soundPlayers[soundPlayer.id];
+ soundBank.playerTargets.delete(soundPlayer.id);
+ soundBank.soundEffects.delete(soundPlayer.id);
+
+ return true;
+ };
+
+ const playWithAudioElement = (url, target) =>
+ new Promise((resolve, reject) => {
+ const mediaElement = new Audio(url);
+
+ mediaElement.volume = target.volume / 100;
+
+ mediaElement.onended = () => {
+ resolve();
+ };
+ mediaElement
+ .play()
+ .then(() => {
+ // Wait for onended
+ })
+ .catch((err) => {
+ reject(err);
+ });
+ });
+
+ const playSound = async (url, target) => {
+ try {
+ if (!(await Scratch.canFetch(url))) {
+ throw new Error(`Permission to fetch ${url} denied`);
+ }
+
+ const success = await playWithAudioEngine(url, target);
+ if (!success) {
+ return await playWithAudioElement(url, target);
+ }
+ } catch (e) {
+ console.warn(`All attempts to play ${url} failed`, e);
+ }
+ };
+
+ playSound(ab, cd)
+ }
+ class Extension {
+ getInfo() {
+ return {
+ "id": "extensionID",
+ "name": "SVG",
+ "color1": "#9823FF",
+ "color2": "#7C2DC1",
+ "tbShow": true,
+ "blocks": blocks,
+ "menus": menus
+ }
+ }
+ }
+ blocks.push({
+ opcode: "svg",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
+ arguments: {
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "ELEMENTS": {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: '',
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svg"] = async (args, util) => {
+ variables['svgWidth'] = args["WIDTH"]
+ variables['svgHeight'] = args["HEIGHT"]
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "line",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
+ arguments: {
+ "XA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "YA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "XB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "YB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "COLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "OPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["line"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "rect",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "X": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "Y": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "RADIUS": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '20',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["rect"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "ellipse",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "CX": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "CY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["ellipse"] = async (args, util) => {
+ return (('')
+ };
+
+ (0 + 0);
+
+ blocks.push({
+ opcode: "svgWidth",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg width"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgWidth"] = async (args, util) => {
+ return variables['svgWidth']
+ };
+
+ blocks.push({
+ opcode: "svgHeight",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg height"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgHeight"] = async (args, util) => {
+ return variables['svgHeight']
+ };
+
+ menus["LINECAPmenu"] = {
+ acceptReporters: true,
+ items: ["round", "butt", "square"]
+ }
+
+ Scratch.extensions.register(new Extension());
+})(Scratch);
From 8331ebdc3ebcf12610e2308587b0f2329b658f02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sun, 2 Mar 2025 18:10:57 +0300
Subject: [PATCH 21/63] Delete extensions/WAYLIVES/Window Settings/SVG
directory
---
.../WAYLIVES/Window Settings/SVG/1.0.1.js | 391 ------------------
1 file changed, 391 deletions(-)
delete mode 100644 extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
diff --git a/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js b/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
deleted file mode 100644
index 223600a86d..0000000000
--- a/extensions/WAYLIVES/Window Settings/SVG/1.0.1.js
+++ /dev/null
@@ -1,391 +0,0 @@
-// Name: SVG
-// ID: WRsvg
-// Description: Create SVG elements.
-// By: WAYLIVES
-// License: MIT
-
-// Version: 1.0.1
-
-(async function(Scratch) {
- const variables = {};
- const blocks = [];
- const menus = {};
-
-
- if (!Scratch.extensions.unsandboxed) {
- alert("This extension needs to be unsandboxed to run!")
- return
- }
-
- function doSound(ab, cd, runtime) {
- const audioEngine = runtime.audioEngine;
-
- const fetchAsArrayBufferWithTimeout = (url) =>
- new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- let timeout = setTimeout(() => {
- xhr.abort();
- reject(new Error("Timed out"));
- }, 5000);
- xhr.onload = () => {
- clearTimeout(timeout);
- if (xhr.status === 200) {
- resolve(xhr.response);
- } else {
- reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
- }
- };
- xhr.onerror = () => {
- clearTimeout(timeout);
- reject(new Error(`Failed to request ${url}`));
- };
- xhr.responseType = "arraybuffer";
- xhr.open("GET", url);
- xhr.send();
- });
-
- const soundPlayerCache = new Map();
-
- const decodeSoundPlayer = async (url) => {
- const cached = soundPlayerCache.get(url);
- if (cached) {
- if (cached.sound) {
- return cached.sound;
- }
- throw cached.error;
- }
-
- try {
- const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
- const soundPlayer = await audioEngine.decodeSoundPlayer({
- data: {
- buffer: arrayBuffer,
- },
- });
- soundPlayerCache.set(url, {
- sound: soundPlayer,
- error: null,
- });
- return soundPlayer;
- } catch (e) {
- soundPlayerCache.set(url, {
- sound: null,
- error: e,
- });
- throw e;
- }
- };
-
- const playWithAudioEngine = async (url, target) => {
- const soundBank = target.sprite.soundBank;
-
- let soundPlayer;
- try {
- const originalSoundPlayer = await decodeSoundPlayer(url);
- soundPlayer = originalSoundPlayer.take();
- } catch (e) {
- console.warn(
- "Could not fetch audio; falling back to primitive approach",
- e
- );
- return false;
- }
-
- soundBank.addSoundPlayer(soundPlayer);
- await soundBank.playSound(target, soundPlayer.id);
-
- delete soundBank.soundPlayers[soundPlayer.id];
- soundBank.playerTargets.delete(soundPlayer.id);
- soundBank.soundEffects.delete(soundPlayer.id);
-
- return true;
- };
-
- const playWithAudioElement = (url, target) =>
- new Promise((resolve, reject) => {
- const mediaElement = new Audio(url);
-
- mediaElement.volume = target.volume / 100;
-
- mediaElement.onended = () => {
- resolve();
- };
- mediaElement
- .play()
- .then(() => {
- // Wait for onended
- })
- .catch((err) => {
- reject(err);
- });
- });
-
- const playSound = async (url, target) => {
- try {
- if (!(await Scratch.canFetch(url))) {
- throw new Error(`Permission to fetch ${url} denied`);
- }
-
- const success = await playWithAudioEngine(url, target);
- if (!success) {
- return await playWithAudioElement(url, target);
- }
- } catch (e) {
- console.warn(`All attempts to play ${url} failed`, e);
- }
- };
-
- playSound(ab, cd)
- }
- class Extension {
- getInfo() {
- return {
- "id": "extensionID",
- "name": "SVG",
- "color1": "#9823FF",
- "color2": "#7C2DC1",
- "tbShow": true,
- "blocks": blocks,
- "menus": menus
- }
- }
- }
- blocks.push({
- opcode: "svg",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
- arguments: {
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "ELEMENTS": {
- type: Scratch.ArgumentType.STRING,
- defaultValue: '',
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svg"] = async (args, util) => {
- variables['svgWidth'] = args["WIDTH"]
- variables['svgHeight'] = args["HEIGHT"]
- return (('')
- };
-
- blocks.push({
- opcode: "line",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
- arguments: {
- "XA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "YA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "XB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "YB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "COLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "OPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["line"] = async (args, util) => {
- return (('')
- };
-
- blocks.push({
- opcode: "rect",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "X": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "Y": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "RADIUS": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '20',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["rect"] = async (args, util) => {
- return (('')
- };
-
- blocks.push({
- opcode: "ellipse",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "CX": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "CY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["ellipse"] = async (args, util) => {
- return (('')
- };
-
- (0 + 0);
-
- blocks.push({
- opcode: "svgWidth",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg width"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgWidth"] = async (args, util) => {
- return variables['svgWidth']
- };
-
- blocks.push({
- opcode: "svgHeight",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg height"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgHeight"] = async (args, util) => {
- return variables['svgHeight']
- };
-
- menus["LINECAPmenu"] = {
- acceptReporters: true,
- items: ["round", "butt", "square"]
- }
-
- Scratch.extensions.register(new Extension());
-})(Scratch);
From bf6a38fdd09d6201c60428ff6a0b14f3892f4cd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Sun, 2 Mar 2025 18:11:23 +0300
Subject: [PATCH 22/63] Create 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 391 +++++++++++++++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 extensions/WAYLIVES/SVG/1.0.1.js
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
new file mode 100644
index 0000000000..223600a86d
--- /dev/null
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -0,0 +1,391 @@
+// Name: SVG
+// ID: WRsvg
+// Description: Create SVG elements.
+// By: WAYLIVES
+// License: MIT
+
+// Version: 1.0.1
+
+(async function(Scratch) {
+ const variables = {};
+ const blocks = [];
+ const menus = {};
+
+
+ if (!Scratch.extensions.unsandboxed) {
+ alert("This extension needs to be unsandboxed to run!")
+ return
+ }
+
+ function doSound(ab, cd, runtime) {
+ const audioEngine = runtime.audioEngine;
+
+ const fetchAsArrayBufferWithTimeout = (url) =>
+ new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ let timeout = setTimeout(() => {
+ xhr.abort();
+ reject(new Error("Timed out"));
+ }, 5000);
+ xhr.onload = () => {
+ clearTimeout(timeout);
+ if (xhr.status === 200) {
+ resolve(xhr.response);
+ } else {
+ reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
+ }
+ };
+ xhr.onerror = () => {
+ clearTimeout(timeout);
+ reject(new Error(`Failed to request ${url}`));
+ };
+ xhr.responseType = "arraybuffer";
+ xhr.open("GET", url);
+ xhr.send();
+ });
+
+ const soundPlayerCache = new Map();
+
+ const decodeSoundPlayer = async (url) => {
+ const cached = soundPlayerCache.get(url);
+ if (cached) {
+ if (cached.sound) {
+ return cached.sound;
+ }
+ throw cached.error;
+ }
+
+ try {
+ const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
+ const soundPlayer = await audioEngine.decodeSoundPlayer({
+ data: {
+ buffer: arrayBuffer,
+ },
+ });
+ soundPlayerCache.set(url, {
+ sound: soundPlayer,
+ error: null,
+ });
+ return soundPlayer;
+ } catch (e) {
+ soundPlayerCache.set(url, {
+ sound: null,
+ error: e,
+ });
+ throw e;
+ }
+ };
+
+ const playWithAudioEngine = async (url, target) => {
+ const soundBank = target.sprite.soundBank;
+
+ let soundPlayer;
+ try {
+ const originalSoundPlayer = await decodeSoundPlayer(url);
+ soundPlayer = originalSoundPlayer.take();
+ } catch (e) {
+ console.warn(
+ "Could not fetch audio; falling back to primitive approach",
+ e
+ );
+ return false;
+ }
+
+ soundBank.addSoundPlayer(soundPlayer);
+ await soundBank.playSound(target, soundPlayer.id);
+
+ delete soundBank.soundPlayers[soundPlayer.id];
+ soundBank.playerTargets.delete(soundPlayer.id);
+ soundBank.soundEffects.delete(soundPlayer.id);
+
+ return true;
+ };
+
+ const playWithAudioElement = (url, target) =>
+ new Promise((resolve, reject) => {
+ const mediaElement = new Audio(url);
+
+ mediaElement.volume = target.volume / 100;
+
+ mediaElement.onended = () => {
+ resolve();
+ };
+ mediaElement
+ .play()
+ .then(() => {
+ // Wait for onended
+ })
+ .catch((err) => {
+ reject(err);
+ });
+ });
+
+ const playSound = async (url, target) => {
+ try {
+ if (!(await Scratch.canFetch(url))) {
+ throw new Error(`Permission to fetch ${url} denied`);
+ }
+
+ const success = await playWithAudioEngine(url, target);
+ if (!success) {
+ return await playWithAudioElement(url, target);
+ }
+ } catch (e) {
+ console.warn(`All attempts to play ${url} failed`, e);
+ }
+ };
+
+ playSound(ab, cd)
+ }
+ class Extension {
+ getInfo() {
+ return {
+ "id": "extensionID",
+ "name": "SVG",
+ "color1": "#9823FF",
+ "color2": "#7C2DC1",
+ "tbShow": true,
+ "blocks": blocks,
+ "menus": menus
+ }
+ }
+ }
+ blocks.push({
+ opcode: "svg",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
+ arguments: {
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "ELEMENTS": {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: '',
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svg"] = async (args, util) => {
+ variables['svgWidth'] = args["WIDTH"]
+ variables['svgHeight'] = args["HEIGHT"]
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "line",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
+ arguments: {
+ "XA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "YA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "XB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "YB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "COLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "OPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["line"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "rect",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "X": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "Y": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "RADIUS": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '20',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["rect"] = async (args, util) => {
+ return (('')
+ };
+
+ blocks.push({
+ opcode: "ellipse",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "CX": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "CY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["ellipse"] = async (args, util) => {
+ return (('')
+ };
+
+ (0 + 0);
+
+ blocks.push({
+ opcode: "svgWidth",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg width"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgWidth"] = async (args, util) => {
+ return variables['svgWidth']
+ };
+
+ blocks.push({
+ opcode: "svgHeight",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg height"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false
+ });
+ Extension.prototype["svgHeight"] = async (args, util) => {
+ return variables['svgHeight']
+ };
+
+ menus["LINECAPmenu"] = {
+ acceptReporters: true,
+ items: ["round", "butt", "square"]
+ }
+
+ Scratch.extensions.register(new Extension());
+})(Scratch);
From e19854544bf334375c56ccd7e989ea600a42cc00 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Sun, 2 Mar 2025 15:18:36 +0000
Subject: [PATCH 23/63] [Automated] Format code
---
extensions/WAYLIVES/SVG/1.0.1.js | 812 +++++++++++++++++--------------
1 file changed, 456 insertions(+), 356 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 223600a86d..7e82b972d2 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -6,386 +6,486 @@
// Version: 1.0.1
-(async function(Scratch) {
- const variables = {};
- const blocks = [];
- const menus = {};
+(async function (Scratch) {
+ const variables = {};
+ const blocks = [];
+ const menus = {};
+ if (!Scratch.extensions.unsandboxed) {
+ alert("This extension needs to be unsandboxed to run!");
+ return;
+ }
- if (!Scratch.extensions.unsandboxed) {
- alert("This extension needs to be unsandboxed to run!")
- return
- }
-
- function doSound(ab, cd, runtime) {
- const audioEngine = runtime.audioEngine;
-
- const fetchAsArrayBufferWithTimeout = (url) =>
- new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- let timeout = setTimeout(() => {
- xhr.abort();
- reject(new Error("Timed out"));
- }, 5000);
- xhr.onload = () => {
- clearTimeout(timeout);
- if (xhr.status === 200) {
- resolve(xhr.response);
- } else {
- reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
- }
- };
- xhr.onerror = () => {
- clearTimeout(timeout);
- reject(new Error(`Failed to request ${url}`));
- };
- xhr.responseType = "arraybuffer";
- xhr.open("GET", url);
- xhr.send();
- });
+ function doSound(ab, cd, runtime) {
+ const audioEngine = runtime.audioEngine;
- const soundPlayerCache = new Map();
-
- const decodeSoundPlayer = async (url) => {
- const cached = soundPlayerCache.get(url);
- if (cached) {
- if (cached.sound) {
- return cached.sound;
- }
- throw cached.error;
- }
-
- try {
- const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
- const soundPlayer = await audioEngine.decodeSoundPlayer({
- data: {
- buffer: arrayBuffer,
- },
- });
- soundPlayerCache.set(url, {
- sound: soundPlayer,
- error: null,
- });
- return soundPlayer;
- } catch (e) {
- soundPlayerCache.set(url, {
- sound: null,
- error: e,
- });
- throw e;
- }
+ const fetchAsArrayBufferWithTimeout = (url) =>
+ new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ let timeout = setTimeout(() => {
+ xhr.abort();
+ reject(new Error("Timed out"));
+ }, 5000);
+ xhr.onload = () => {
+ clearTimeout(timeout);
+ if (xhr.status === 200) {
+ resolve(xhr.response);
+ } else {
+ reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
+ }
+ };
+ xhr.onerror = () => {
+ clearTimeout(timeout);
+ reject(new Error(`Failed to request ${url}`));
};
+ xhr.responseType = "arraybuffer";
+ xhr.open("GET", url);
+ xhr.send();
+ });
- const playWithAudioEngine = async (url, target) => {
- const soundBank = target.sprite.soundBank;
+ const soundPlayerCache = new Map();
- let soundPlayer;
- try {
- const originalSoundPlayer = await decodeSoundPlayer(url);
- soundPlayer = originalSoundPlayer.take();
- } catch (e) {
- console.warn(
- "Could not fetch audio; falling back to primitive approach",
- e
- );
- return false;
- }
+ const decodeSoundPlayer = async (url) => {
+ const cached = soundPlayerCache.get(url);
+ if (cached) {
+ if (cached.sound) {
+ return cached.sound;
+ }
+ throw cached.error;
+ }
- soundBank.addSoundPlayer(soundPlayer);
- await soundBank.playSound(target, soundPlayer.id);
+ try {
+ const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
+ const soundPlayer = await audioEngine.decodeSoundPlayer({
+ data: {
+ buffer: arrayBuffer,
+ },
+ });
+ soundPlayerCache.set(url, {
+ sound: soundPlayer,
+ error: null,
+ });
+ return soundPlayer;
+ } catch (e) {
+ soundPlayerCache.set(url, {
+ sound: null,
+ error: e,
+ });
+ throw e;
+ }
+ };
- delete soundBank.soundPlayers[soundPlayer.id];
- soundBank.playerTargets.delete(soundPlayer.id);
- soundBank.soundEffects.delete(soundPlayer.id);
+ const playWithAudioEngine = async (url, target) => {
+ const soundBank = target.sprite.soundBank;
- return true;
- };
+ let soundPlayer;
+ try {
+ const originalSoundPlayer = await decodeSoundPlayer(url);
+ soundPlayer = originalSoundPlayer.take();
+ } catch (e) {
+ console.warn(
+ "Could not fetch audio; falling back to primitive approach",
+ e
+ );
+ return false;
+ }
- const playWithAudioElement = (url, target) =>
- new Promise((resolve, reject) => {
- const mediaElement = new Audio(url);
+ soundBank.addSoundPlayer(soundPlayer);
+ await soundBank.playSound(target, soundPlayer.id);
- mediaElement.volume = target.volume / 100;
+ delete soundBank.soundPlayers[soundPlayer.id];
+ soundBank.playerTargets.delete(soundPlayer.id);
+ soundBank.soundEffects.delete(soundPlayer.id);
- mediaElement.onended = () => {
- resolve();
- };
- mediaElement
- .play()
- .then(() => {
- // Wait for onended
- })
- .catch((err) => {
- reject(err);
- });
- });
+ return true;
+ };
+
+ const playWithAudioElement = (url, target) =>
+ new Promise((resolve, reject) => {
+ const mediaElement = new Audio(url);
- const playSound = async (url, target) => {
- try {
- if (!(await Scratch.canFetch(url))) {
- throw new Error(`Permission to fetch ${url} denied`);
- }
+ mediaElement.volume = target.volume / 100;
- const success = await playWithAudioEngine(url, target);
- if (!success) {
- return await playWithAudioElement(url, target);
- }
- } catch (e) {
- console.warn(`All attempts to play ${url} failed`, e);
- }
+ mediaElement.onended = () => {
+ resolve();
};
+ mediaElement
+ .play()
+ .then(() => {
+ // Wait for onended
+ })
+ .catch((err) => {
+ reject(err);
+ });
+ });
- playSound(ab, cd)
- }
- class Extension {
- getInfo() {
- return {
- "id": "extensionID",
- "name": "SVG",
- "color1": "#9823FF",
- "color2": "#7C2DC1",
- "tbShow": true,
- "blocks": blocks,
- "menus": menus
- }
+ const playSound = async (url, target) => {
+ try {
+ if (!(await Scratch.canFetch(url))) {
+ throw new Error(`Permission to fetch ${url} denied`);
}
- }
- blocks.push({
- opcode: "svg",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
- arguments: {
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "ELEMENTS": {
- type: Scratch.ArgumentType.STRING,
- defaultValue: '',
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svg"] = async (args, util) => {
- variables['svgWidth'] = args["WIDTH"]
- variables['svgHeight'] = args["HEIGHT"]
- return (('')
- };
- blocks.push({
- opcode: "line",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
- arguments: {
- "XA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "YA": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "XB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "YB": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "COLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "OPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["line"] = async (args, util) => {
- return (('')
+ const success = await playWithAudioEngine(url, target);
+ if (!success) {
+ return await playWithAudioElement(url, target);
+ }
+ } catch (e) {
+ console.warn(`All attempts to play ${url} failed`, e);
+ }
};
- blocks.push({
- opcode: "rect",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "X": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "Y": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "RADIUS": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '20',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["rect"] = async (args, util) => {
- return (('')
- };
+ playSound(ab, cd);
+ }
+ class Extension {
+ getInfo() {
+ return {
+ id: "extensionID",
+ name: "SVG",
+ color1: "#9823FF",
+ color2: "#7C2DC1",
+ tbShow: true,
+ blocks: blocks,
+ menus: menus,
+ };
+ }
+ }
+ blocks.push({
+ opcode: "svg",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate(
+ "SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"
+ ),
+ arguments: {
+ WIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ HEIGHT: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ ELEMENTS: {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: "",
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["svg"] = async (args, util) => {
+ variables["svgWidth"] = args["WIDTH"];
+ variables["svgHeight"] = args["HEIGHT"];
+ return (
+ '"
+ );
+ };
- blocks.push({
- opcode: "ellipse",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
- arguments: {
- "CX": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "CY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
- },
- "WIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "HEIGHT": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
- },
- "FILLCOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
- },
- "FILLOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "STROKEWIDTH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
- },
- "STROKECOLOR": {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
- },
- "STROKEOPACITY": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
- },
- "DASH": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "GAP": {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
- },
- "LINECAP": {
- type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- },
- },
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["ellipse"] = async (args, util) => {
- return (('')
- };
+ blocks.push({
+ opcode: "line",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate(
+ "LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"
+ ),
+ arguments: {
+ XA: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "4",
+ },
+ YA: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "4",
+ },
+ XB: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "96",
+ },
+ YB: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "96",
+ },
+ WIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "8",
+ },
+ COLOR: {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: "#ff0000",
+ },
+ OPACITY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ DASH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ GAP: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ LINECAP: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "LINECAPmenu",
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["line"] = async (args, util) => {
+ return (
+ '"
+ );
+ };
- (0 + 0);
+ blocks.push({
+ opcode: "rect",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate(
+ "RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
+ ),
+ arguments: {
+ X: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "4",
+ },
+ Y: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "4",
+ },
+ WIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "92",
+ },
+ HEIGHT: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "92",
+ },
+ RADIUS: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "20",
+ },
+ FILLCOLOR: {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: "#ff0000",
+ },
+ FILLOPACITY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ STROKEWIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "8",
+ },
+ STROKECOLOR: {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: "#000000",
+ },
+ STROKEOPACITY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ DASH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ GAP: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ LINECAP: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "LINECAPmenu",
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["rect"] = async (args, util) => {
+ return (
+ '"
+ );
+ };
- blocks.push({
- opcode: "svgWidth",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg width"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgWidth"] = async (args, util) => {
- return variables['svgWidth']
- };
+ blocks.push({
+ opcode: "ellipse",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate(
+ "ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
+ ),
+ arguments: {
+ CX: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "50",
+ },
+ CY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "50",
+ },
+ WIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "92",
+ },
+ HEIGHT: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "92",
+ },
+ FILLCOLOR: {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: "#ff0000",
+ },
+ FILLOPACITY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ STROKEWIDTH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "8",
+ },
+ STROKECOLOR: {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: "#000000",
+ },
+ STROKEOPACITY: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "100",
+ },
+ DASH: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ GAP: {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: "0",
+ },
+ LINECAP: {
+ type: Scratch.ArgumentType.STRING,
+ menu: "LINECAPmenu",
+ },
+ },
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["ellipse"] = async (args, util) => {
+ return (
+ '"
+ );
+ };
- blocks.push({
- opcode: "svgHeight",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg height"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false
- });
- Extension.prototype["svgHeight"] = async (args, util) => {
- return variables['svgHeight']
- };
+ 0 + 0;
- menus["LINECAPmenu"] = {
- acceptReporters: true,
- items: ["round", "butt", "square"]
- }
+ blocks.push({
+ opcode: "svgWidth",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg width"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["svgWidth"] = async (args, util) => {
+ return variables["svgWidth"];
+ };
+
+ blocks.push({
+ opcode: "svgHeight",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg height"),
+ arguments: {},
+ disableMonitor: true,
+ isEdgeActivated: false,
+ });
+ Extension.prototype["svgHeight"] = async (args, util) => {
+ return variables["svgHeight"];
+ };
+
+ menus["LINECAPmenu"] = {
+ acceptReporters: true,
+ items: ["round", "butt", "square"],
+ };
- Scratch.extensions.register(new Extension());
+ Scratch.extensions.register(new Extension());
})(Scratch);
From 90d23ab2fbd923286550e7fe470bf43620cdf004 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 11:44:03 +0300
Subject: [PATCH 24/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 717 +++++++++++--------------------
1 file changed, 244 insertions(+), 473 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 7e82b972d2..c6843ddc70 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -6,486 +6,257 @@
// Version: 1.0.1
-(async function (Scratch) {
- const variables = {};
- const blocks = [];
- const menus = {};
+(function(Scratch) {
+ 'use strict';
if (!Scratch.extensions.unsandboxed) {
- alert("This extension needs to be unsandboxed to run!");
- return;
+ throw new Error('This example must run unsandboxed');
}
- function doSound(ab, cd, runtime) {
- const audioEngine = runtime.audioEngine;
-
- const fetchAsArrayBufferWithTimeout = (url) =>
- new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- let timeout = setTimeout(() => {
- xhr.abort();
- reject(new Error("Timed out"));
- }, 5000);
- xhr.onload = () => {
- clearTimeout(timeout);
- if (xhr.status === 200) {
- resolve(xhr.response);
- } else {
- reject(new Error(`HTTP error ${xhr.status} while fetching ${url}`));
- }
- };
- xhr.onerror = () => {
- clearTimeout(timeout);
- reject(new Error(`Failed to request ${url}`));
- };
- xhr.responseType = "arraybuffer";
- xhr.open("GET", url);
- xhr.send();
- });
-
- const soundPlayerCache = new Map();
-
- const decodeSoundPlayer = async (url) => {
- const cached = soundPlayerCache.get(url);
- if (cached) {
- if (cached.sound) {
- return cached.sound;
- }
- throw cached.error;
- }
-
- try {
- const arrayBuffer = await fetchAsArrayBufferWithTimeout(url);
- const soundPlayer = await audioEngine.decodeSoundPlayer({
- data: {
- buffer: arrayBuffer,
- },
- });
- soundPlayerCache.set(url, {
- sound: soundPlayer,
- error: null,
- });
- return soundPlayer;
- } catch (e) {
- soundPlayerCache.set(url, {
- sound: null,
- error: e,
- });
- throw e;
- }
- };
-
- const playWithAudioEngine = async (url, target) => {
- const soundBank = target.sprite.soundBank;
-
- let soundPlayer;
- try {
- const originalSoundPlayer = await decodeSoundPlayer(url);
- soundPlayer = originalSoundPlayer.take();
- } catch (e) {
- console.warn(
- "Could not fetch audio; falling back to primitive approach",
- e
- );
- return false;
- }
-
- soundBank.addSoundPlayer(soundPlayer);
- await soundBank.playSound(target, soundPlayer.id);
-
- delete soundBank.soundPlayers[soundPlayer.id];
- soundBank.playerTargets.delete(soundPlayer.id);
- soundBank.soundEffects.delete(soundPlayer.id);
-
- return true;
- };
-
- const playWithAudioElement = (url, target) =>
- new Promise((resolve, reject) => {
- const mediaElement = new Audio(url);
-
- mediaElement.volume = target.volume / 100;
-
- mediaElement.onended = () => {
- resolve();
- };
- mediaElement
- .play()
- .then(() => {
- // Wait for onended
- })
- .catch((err) => {
- reject(err);
- });
- });
-
- const playSound = async (url, target) => {
- try {
- if (!(await Scratch.canFetch(url))) {
- throw new Error(`Permission to fetch ${url} denied`);
- }
-
- const success = await playWithAudioEngine(url, target);
- if (!success) {
- return await playWithAudioElement(url, target);
- }
- } catch (e) {
- console.warn(`All attempts to play ${url} failed`, e);
- }
- };
-
- playSound(ab, cd);
- }
- class Extension {
+ class svg {
getInfo() {
return {
- id: "extensionID",
- name: "SVG",
- color1: "#9823FF",
- color2: "#7C2DC1",
- tbShow: true,
- blocks: blocks,
- menus: menus,
+ id: 'svg',
+ name: 'SVG',
+ color1: '#9823FF',
+ color2: '#7C2DC1',
+ color3: '#2D3548',
+ blocks: [
+ {
+ opcode: "svg",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
+ arguments: {
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "ELEMENTS": {
+ type: Scratch.ArgumentType.STRING,
+ defaultValue: '',
+ }
+ }
+ },
+
+ "---",
+
+ {
+ opcode: "line",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
+ arguments: {
+ "XA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "YA": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "XB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "YB": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '96',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "COLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "OPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ },
+ },
+ },
+
+ {
+ opcode: "rect",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "X": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "Y": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '4',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "RADIUS": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '20',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ }
+ }
+ },
+
+ {
+ opcode: "ellipse",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ arguments: {
+ "CX": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "CY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '50',
+ },
+ "WIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "HEIGHT": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '92',
+ },
+ "FILLCOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#ff0000',
+ },
+ "FILLOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "STROKEWIDTH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '8',
+ },
+ "STROKECOLOR": {
+ type: Scratch.ArgumentType.COLOR,
+ defaultValue: '#000000',
+ },
+ "STROKEOPACITY": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '100',
+ },
+ "DASH": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "GAP": {
+ type: Scratch.ArgumentType.NUMBER,
+ defaultValue: '0',
+ },
+ "LINECAP": {
+ type: Scratch.ArgumentType.STRING,
+ menu: 'LINECAPmenu'
+ }
+ }
+ },
+
+ "---",
+
+ /*{
+ opcode: "svgWidth",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg width"),
+ },
+
+ {
+ opcode: "svgHeight",
+ blockType: Scratch.BlockType.REPORTER,
+ text: Scratch.translate("svg height"),
+ },*/
+
+ ],
+ menus: {
+ LINECAPmenu: {
+ acceptReporters: true,
+ items: ['round', 'butt', 'square']
+ },
+ }
};
}
+
+ svg(args) {
+ return (('')
+ }
+
+ line(args) {
+ return (('')
+ }
+
+ rect(args){
+ return (('')
+ }
+
+ ellipse(args) {
+ return (('')
+ }
+
+ svgWidth(args) {
+ return variables['svgWidth']
+ }
+
+ svgHeight(args) {
+ return variables['svgHeight']
+ }
+
}
- blocks.push({
- opcode: "svg",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate(
- "SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"
- ),
- arguments: {
- WIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- HEIGHT: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- ELEMENTS: {
- type: Scratch.ArgumentType.STRING,
- defaultValue: "",
- },
- },
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["svg"] = async (args, util) => {
- variables["svgWidth"] = args["WIDTH"];
- variables["svgHeight"] = args["HEIGHT"];
- return (
- '"
- );
- };
-
- blocks.push({
- opcode: "line",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate(
- "LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"
- ),
- arguments: {
- XA: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "4",
- },
- YA: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "4",
- },
- XB: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "96",
- },
- YB: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "96",
- },
- WIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "8",
- },
- COLOR: {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: "#ff0000",
- },
- OPACITY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- DASH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- GAP: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- LINECAP: {
- type: Scratch.ArgumentType.STRING,
- menu: "LINECAPmenu",
- },
- },
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["line"] = async (args, util) => {
- return (
- '"
- );
- };
-
- blocks.push({
- opcode: "rect",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate(
- "RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
- ),
- arguments: {
- X: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "4",
- },
- Y: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "4",
- },
- WIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "92",
- },
- HEIGHT: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "92",
- },
- RADIUS: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "20",
- },
- FILLCOLOR: {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: "#ff0000",
- },
- FILLOPACITY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- STROKEWIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "8",
- },
- STROKECOLOR: {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: "#000000",
- },
- STROKEOPACITY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- DASH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- GAP: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- LINECAP: {
- type: Scratch.ArgumentType.STRING,
- menu: "LINECAPmenu",
- },
- },
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["rect"] = async (args, util) => {
- return (
- '"
- );
- };
-
- blocks.push({
- opcode: "ellipse",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate(
- "ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
- ),
- arguments: {
- CX: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "50",
- },
- CY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "50",
- },
- WIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "92",
- },
- HEIGHT: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "92",
- },
- FILLCOLOR: {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: "#ff0000",
- },
- FILLOPACITY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- STROKEWIDTH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "8",
- },
- STROKECOLOR: {
- type: Scratch.ArgumentType.COLOR,
- defaultValue: "#000000",
- },
- STROKEOPACITY: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "100",
- },
- DASH: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- GAP: {
- type: Scratch.ArgumentType.NUMBER,
- defaultValue: "0",
- },
- LINECAP: {
- type: Scratch.ArgumentType.STRING,
- menu: "LINECAPmenu",
- },
- },
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["ellipse"] = async (args, util) => {
- return (
- '"
- );
- };
-
- 0 + 0;
-
- blocks.push({
- opcode: "svgWidth",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg width"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["svgWidth"] = async (args, util) => {
- return variables["svgWidth"];
- };
-
- blocks.push({
- opcode: "svgHeight",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg height"),
- arguments: {},
- disableMonitor: true,
- isEdgeActivated: false,
- });
- Extension.prototype["svgHeight"] = async (args, util) => {
- return variables["svgHeight"];
- };
-
- menus["LINECAPmenu"] = {
- acceptReporters: true,
- items: ["round", "butt", "square"],
- };
-
- Scratch.extensions.register(new Extension());
+
+ Scratch.extensions.register(new svg());
})(Scratch);
From 36f60c665529460f6c3757edc16578b6e5652d49 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Mon, 3 Mar 2025 08:54:04 +0000
Subject: [PATCH 25/63] [Automated] Format code
---
extensions/WAYLIVES/SVG/1.0.1.js | 337 ++++++++++++++++++++-----------
1 file changed, 218 insertions(+), 119 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index c6843ddc70..2938a38793 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -6,210 +6,218 @@
// Version: 1.0.1
-(function(Scratch) {
- 'use strict';
+(function (Scratch) {
+ "use strict";
if (!Scratch.extensions.unsandboxed) {
- throw new Error('This example must run unsandboxed');
+ throw new Error("This example must run unsandboxed");
}
class svg {
getInfo() {
return {
- id: 'svg',
- name: 'SVG',
- color1: '#9823FF',
- color2: '#7C2DC1',
- color3: '#2D3548',
+ id: "svg",
+ name: "SVG",
+ color1: "#9823FF",
+ color2: "#7C2DC1",
+ color3: "#2D3548",
blocks: [
{
opcode: "svg",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"),
+ text: Scratch.translate(
+ "SVG-frame // width: [WIDTH] height: [HEIGHT] elements in svg: [ELEMENTS]"
+ ),
arguments: {
- "WIDTH": {
+ WIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "HEIGHT": {
+ HEIGHT: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "ELEMENTS": {
+ ELEMENTS: {
type: Scratch.ArgumentType.STRING,
- defaultValue: '',
- }
- }
+ defaultValue: "",
+ },
+ },
},
-
+
"---",
-
+
{
opcode: "line",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"),
+ text: Scratch.translate(
+ "LINE // x1, y1: [XA][YA] x2, y2: [XB][YB] width: [WIDTH] color: [COLOR] opacity: [OPACITY]% dash, gap: [DASH][GAP] linecap: [LINECAP]"
+ ),
arguments: {
- "XA": {
+ XA: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
+ defaultValue: "4",
},
- "YA": {
+ YA: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
+ defaultValue: "4",
},
- "XB": {
+ XB: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
+ defaultValue: "96",
},
- "YB": {
+ YB: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '96',
+ defaultValue: "96",
},
- "WIDTH": {
+ WIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
+ defaultValue: "8",
},
- "COLOR": {
+ COLOR: {
type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
+ defaultValue: "#ff0000",
},
- "OPACITY": {
+ OPACITY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "DASH": {
+ DASH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "GAP": {
+ GAP: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "LINECAP": {
+ LINECAP: {
type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
+ menu: "LINECAPmenu",
},
},
},
-
+
{
opcode: "rect",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ text: Scratch.translate(
+ "RECT // x, y: [X][Y] width: [WIDTH] height: [HEIGHT] radius: [RADIUS] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
+ ),
arguments: {
- "X": {
+ X: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
+ defaultValue: "4",
},
- "Y": {
+ Y: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '4',
+ defaultValue: "4",
},
- "WIDTH": {
+ WIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
+ defaultValue: "92",
},
- "HEIGHT": {
+ HEIGHT: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
+ defaultValue: "92",
},
- "RADIUS": {
+ RADIUS: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '20',
+ defaultValue: "20",
},
- "FILLCOLOR": {
+ FILLCOLOR: {
type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
+ defaultValue: "#ff0000",
},
- "FILLOPACITY": {
+ FILLOPACITY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "STROKEWIDTH": {
+ STROKEWIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
+ defaultValue: "8",
},
- "STROKECOLOR": {
+ STROKECOLOR: {
type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
+ defaultValue: "#000000",
},
- "STROKEOPACITY": {
+ STROKEOPACITY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "DASH": {
+ DASH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "GAP": {
+ GAP: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "LINECAP": {
+ LINECAP: {
type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- }
- }
+ menu: "LINECAPmenu",
+ },
+ },
},
-
+
{
opcode: "ellipse",
blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"),
+ text: Scratch.translate(
+ "ELLIPSE // cx, cy: [CX][CY] width: [WIDTH] height: [HEIGHT] fill color: [FILLCOLOR] fill opacity: [FILLOPACITY]% stroke width: [STROKEWIDTH] stroke color: [STROKECOLOR] stroke opacity: [STROKEOPACITY]% dash, gap: [DASH][GAP] stroke linecap: [LINECAP]"
+ ),
arguments: {
- "CX": {
+ CX: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
+ defaultValue: "50",
},
- "CY": {
+ CY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '50',
+ defaultValue: "50",
},
- "WIDTH": {
+ WIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
+ defaultValue: "92",
},
- "HEIGHT": {
+ HEIGHT: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '92',
+ defaultValue: "92",
},
- "FILLCOLOR": {
+ FILLCOLOR: {
type: Scratch.ArgumentType.COLOR,
- defaultValue: '#ff0000',
+ defaultValue: "#ff0000",
},
- "FILLOPACITY": {
+ FILLOPACITY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "STROKEWIDTH": {
+ STROKEWIDTH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '8',
+ defaultValue: "8",
},
- "STROKECOLOR": {
+ STROKECOLOR: {
type: Scratch.ArgumentType.COLOR,
- defaultValue: '#000000',
+ defaultValue: "#000000",
},
- "STROKEOPACITY": {
+ STROKEOPACITY: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '100',
+ defaultValue: "100",
},
- "DASH": {
+ DASH: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "GAP": {
+ GAP: {
type: Scratch.ArgumentType.NUMBER,
- defaultValue: '0',
+ defaultValue: "0",
},
- "LINECAP": {
+ LINECAP: {
type: Scratch.ArgumentType.STRING,
- menu: 'LINECAPmenu'
- }
- }
+ menu: "LINECAPmenu",
+ },
+ },
},
-
+
"---",
-
+
/*{
opcode: "svgWidth",
blockType: Scratch.BlockType.REPORTER,
@@ -221,42 +229,133 @@
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate("svg height"),
},*/
-
],
menus: {
LINECAPmenu: {
acceptReporters: true,
- items: ['round', 'butt', 'square']
+ items: ["round", "butt", "square"],
},
- }
+ },
};
}
-
+
svg(args) {
- return (('')
+ return (
+ '"
+ );
}
-
+
line(args) {
- return (('')
+ return (
+ '"
+ );
}
-
- rect(args){
- return (('')
+
+ rect(args) {
+ return (
+ '"
+ );
}
-
+
ellipse(args) {
- return (('')
+ return (
+ '"
+ );
}
-
+
svgWidth(args) {
- return variables['svgWidth']
+ return variables["svgWidth"];
}
-
+
svgHeight(args) {
- return variables['svgHeight']
+ return variables["svgHeight"];
}
-
}
-
- Scratch.extensions.register(new svg());
+
+ Scratch.extensions.register(new svg());
})(Scratch);
From 0831d51df7f45bb6e6191aa5e3a97f4ca7dd23fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 11:57:04 +0300
Subject: [PATCH 26/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 2938a38793..2974396007 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -215,20 +215,7 @@
},
},
},
-
- "---",
-
- /*{
- opcode: "svgWidth",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg width"),
- },
-
- {
- opcode: "svgHeight",
- blockType: Scratch.BlockType.REPORTER,
- text: Scratch.translate("svg height"),
- },*/
+
],
menus: {
LINECAPmenu: {
@@ -347,14 +334,6 @@
"/>"
);
}
-
- svgWidth(args) {
- return variables["svgWidth"];
- }
-
- svgHeight(args) {
- return variables["svgHeight"];
- }
}
Scratch.extensions.register(new svg());
From 4bfba541fc531a0bd57c690d335d2ccb30dbf753 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 12:04:09 +0300
Subject: [PATCH 27/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 2974396007..cfe130b33b 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -228,27 +228,27 @@
svg(args) {
return (
- '"
);
}
line(args) {
return (
- '
Date: Mon, 3 Mar 2025 12:24:03 +0300
Subject: [PATCH 28/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 39 ++------------------------------
1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index cfe130b33b..088304c3d5 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -228,48 +228,13 @@
svg(args) {
return (
- '"
+ '"
);
}
line(args) {
return (
- '"
+ '"
);
}
From c66d90c4b819b2bf3b6e56a6ae56a12e85dfeb22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 12:31:07 +0300
Subject: [PATCH 29/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 55 ++------------------------------
1 file changed, 3 insertions(+), 52 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 088304c3d5..d679078f6b 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -240,65 +240,16 @@
rect(args) {
return (
- '"
+ '"
);
}
ellipse(args) {
return (
- '"
+ '"
);
}
+
}
Scratch.extensions.register(new svg());
From 926a0b31336f77c2d68847b3a9304ed859b376eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 12:33:52 +0300
Subject: [PATCH 30/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index d679078f6b..7df46cbf78 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -17,7 +17,7 @@
getInfo() {
return {
id: "svg",
- name: "SVG",
+ name: Scratch.translate("SVG"),
color1: "#9823FF",
color2: "#7C2DC1",
color3: "#2D3548",
From 70d66d4ad0afb4ee2d3bb9aa7589eb3002807f36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 12:36:26 +0300
Subject: [PATCH 31/63] Update 1.0.1.js
From 487e7adfa9da4886eb45b7ac7bef69b7cc510c98 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Mon, 3 Mar 2025 09:37:49 +0000
Subject: [PATCH 32/63] [Automated] Format code
---
extensions/WAYLIVES/SVG/1.0.1.js | 95 ++++++++++++++++++++++++++++++--
1 file changed, 89 insertions(+), 6 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 7df46cbf78..a688258e6a 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -215,7 +215,6 @@
},
},
},
-
],
menus: {
LINECAPmenu: {
@@ -228,28 +227,112 @@
svg(args) {
return (
- '"
+ '"
);
}
line(args) {
return (
- '"
+ '"
);
}
rect(args) {
return (
- '"
+ '"
);
}
ellipse(args) {
return (
- '"
+ '"
);
}
-
}
Scratch.extensions.register(new svg());
From e3e9b8856b8c79710e67a620b331455f71a7994c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 18:05:10 +0300
Subject: [PATCH 33/63] Create SVG.svg
---
images/WAYLIVES/SVG.svg | 50 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 images/WAYLIVES/SVG.svg
diff --git a/images/WAYLIVES/SVG.svg b/images/WAYLIVES/SVG.svg
new file mode 100644
index 0000000000..d10ab7c44d
--- /dev/null
+++ b/images/WAYLIVES/SVG.svg
@@ -0,0 +1,50 @@
+
From a803ef627ee4a899c120f5a537502a005dbaac14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Mon, 3 Mar 2025 18:06:19 +0300
Subject: [PATCH 34/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 95 ++------------------------------
1 file changed, 6 insertions(+), 89 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index a688258e6a..7df46cbf78 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -215,6 +215,7 @@
},
},
},
+
],
menus: {
LINECAPmenu: {
@@ -227,112 +228,28 @@
svg(args) {
return (
- '"
+ '"
);
}
line(args) {
return (
- '"
+ '"
);
}
rect(args) {
return (
- '"
+ '"
);
}
ellipse(args) {
return (
- '"
+ '"
);
}
+
}
Scratch.extensions.register(new svg());
From 38c8a1fa819d0ca2cca2693c0da6750ecd8a8fa7 Mon Sep 17 00:00:00 2001
From: "DangoCat[bot]"
Date: Mon, 3 Mar 2025 15:07:45 +0000
Subject: [PATCH 35/63] [Automated] Format code
---
extensions/WAYLIVES/SVG/1.0.1.js | 95 ++++++++++++++++++++++++++++++--
1 file changed, 89 insertions(+), 6 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 7df46cbf78..a688258e6a 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -215,7 +215,6 @@
},
},
},
-
],
menus: {
LINECAPmenu: {
@@ -228,28 +227,112 @@
svg(args) {
return (
- '"
+ '"
);
}
line(args) {
return (
- '"
+ '"
);
}
rect(args) {
return (
- '"
+ '"
);
}
ellipse(args) {
return (
- '"
+ '"
);
}
-
}
Scratch.extensions.register(new svg());
From acecb61ba7bfe2fd98d100f7dee2d4a9b4ba71a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Tue, 4 Mar 2025 16:33:33 +0300
Subject: [PATCH 36/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index a688258e6a..6505370a27 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -1,7 +1,7 @@
// Name: SVG
// ID: WRsvg
// Description: Create SVG elements.
-// By: WAYLIVES
+// By: WAYLIVES
// License: MIT
// Version: 1.0.1
From 669d9bd1cf3d127b5ffc5ca7c77504a1efd9dacb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Tue, 4 Mar 2025 19:26:39 +0300
Subject: [PATCH 37/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 6505370a27..3032746cb6 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -1,7 +1,7 @@
// Name: SVG
// ID: WRsvg
// Description: Create SVG elements.
-// By: WAYLIVES
+// By: WAYLIVES
// License: MIT
// Version: 1.0.1
From b178019c61522949178345a254922ed0c89bd6f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Tue, 4 Mar 2025 19:30:12 +0300
Subject: [PATCH 38/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index 3032746cb6..a688258e6a 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -1,7 +1,7 @@
// Name: SVG
// ID: WRsvg
// Description: Create SVG elements.
-// By: WAYLIVES
+// By: WAYLIVES
// License: MIT
// Version: 1.0.1
From ea6a2b257240b351ab70991c45ef3848d9a70bc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Richard=20Melentyev=20=E2=98=9D=F0=9F=98=8C=20=28RIHART=29?=
<130656326+WAYLIVES@users.noreply.github.com>
Date: Tue, 4 Mar 2025 19:51:16 +0300
Subject: [PATCH 39/63] Update 1.0.1.js
---
extensions/WAYLIVES/SVG/1.0.1.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/extensions/WAYLIVES/SVG/1.0.1.js b/extensions/WAYLIVES/SVG/1.0.1.js
index a688258e6a..cfd8e44fbd 100644
--- a/extensions/WAYLIVES/SVG/1.0.1.js
+++ b/extensions/WAYLIVES/SVG/1.0.1.js
@@ -225,7 +225,7 @@
};
}
- svg(args) {
+ svg(args) { // prettier-ignore
return (
'