From e437ea9de329b83c52df945e14aa878c7125b8bb Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Fri, 21 Jun 2024 21:37:05 -0500 Subject: [PATCH 01/38] Create timeutills.js timeutills V1 --- extensions/timeutills.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 extensions/timeutills.js diff --git a/extensions/timeutills.js b/extensions/timeutills.js new file mode 100644 index 0000000000..8a77c346f0 --- /dev/null +++ b/extensions/timeutills.js @@ -0,0 +1,32 @@ +class timeutills { + getInfo() { + return { + id: 'unknowntimeutills', + name: 'timeutills', + blocks: [ + { + opcode: 'wait', + blockType: Scratch.BlockType.BOOLEAN, + text: 'wait [ONE] in milliseconds', + arguments: { + MS: { + type: Scratch.ArgumentType.NUMBER + } + } + } + ] + }; + } + + + + wait(args) { + return new Promise(resolve => setTimeout(resolve, args.MS)); +} + + hello() { + return 'World!'; + } +} + +Scratch.extensions.register(new HelloWorld()); From f0f99b693b41ee0fafd825971549681c07591d5f Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 25 Jun 2024 18:29:48 -0500 Subject: [PATCH 02/38] Rename extensions/timeutills.js to extensions/unknown/timeutills.js --- extensions/{ => unknown}/timeutills.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename extensions/{ => unknown}/timeutills.js (100%) diff --git a/extensions/timeutills.js b/extensions/unknown/timeutills.js similarity index 100% rename from extensions/timeutills.js rename to extensions/unknown/timeutills.js From 17680ea37be838c3053bf7948272644d4d85e2a5 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 25 Jun 2024 18:31:44 -0500 Subject: [PATCH 03/38] Update timeutills.js --- extensions/unknown/timeutills.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extensions/unknown/timeutills.js b/extensions/unknown/timeutills.js index 8a77c346f0..6422cbf044 100644 --- a/extensions/unknown/timeutills.js +++ b/extensions/unknown/timeutills.js @@ -1,3 +1,10 @@ +// Name: time utills +// ID: unknowntimeutils +// Description: utilities for time +// By: unknown07724 +// License: MIT + + class timeutills { getInfo() { return { @@ -7,7 +14,7 @@ class timeutills { { opcode: 'wait', blockType: Scratch.BlockType.BOOLEAN, - text: 'wait [ONE] in milliseconds', + text: 'wait [MS] in milliseconds', arguments: { MS: { type: Scratch.ArgumentType.NUMBER @@ -24,9 +31,5 @@ class timeutills { return new Promise(resolve => setTimeout(resolve, args.MS)); } - hello() { - return 'World!'; - } -} Scratch.extensions.register(new HelloWorld()); From af93815ce273821bf2a79243afd6a2ae0b00ba21 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 25 Jun 2024 18:41:56 -0500 Subject: [PATCH 04/38] Update timeutills.js --- extensions/unknown/timeutills.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/unknown/timeutills.js b/extensions/unknown/timeutills.js index 6422cbf044..3990265050 100644 --- a/extensions/unknown/timeutills.js +++ b/extensions/unknown/timeutills.js @@ -1,15 +1,16 @@ -// Name: time utills -// ID: unknowntimeutils -// Description: utilities for time -// By: unknown07724 -// License: MIT +// Name: Time utills +// ID: unknowntimeutills +// Description: +// By: Unknown +// Original: Unknown +// License: MPL-2.0 class timeutills { getInfo() { return { id: 'unknowntimeutills', - name: 'timeutills', + name: 'time utills', blocks: [ { opcode: 'wait', From 5d4882b9c884b32f9cea0696b2ed4afc0e5abb49 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 26 Jun 2024 11:57:47 -0500 Subject: [PATCH 05/38] Update timeutills.js --- extensions/unknown/timeutills.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/timeutills.js b/extensions/unknown/timeutills.js index 3990265050..526ab12e67 100644 --- a/extensions/unknown/timeutills.js +++ b/extensions/unknown/timeutills.js @@ -1,6 +1,6 @@ // Name: Time utills // ID: unknowntimeutills -// Description: +// Description: utilities for time. // By: Unknown // Original: Unknown // License: MPL-2.0 From b9ad34eec64d02fd754b6d2c1f61a5287ea2efe0 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 26 Jun 2024 12:13:46 -0500 Subject: [PATCH 06/38] Update timeutills.js --- extensions/unknown/timeutills.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/unknown/timeutills.js b/extensions/unknown/timeutills.js index 526ab12e67..d3c73ca73f 100644 --- a/extensions/unknown/timeutills.js +++ b/extensions/unknown/timeutills.js @@ -1,6 +1,6 @@ // Name: Time utills // ID: unknowntimeutills -// Description: utilities for time. +// Description: utilities for waiting a amount of milliseconds. // By: Unknown // Original: Unknown // License: MPL-2.0 @@ -33,4 +33,4 @@ class timeutills { } -Scratch.extensions.register(new HelloWorld()); +Scratch.extensions.register(new unknowntimeutills()); From 8cd2ad5d43ac2f22db7a281ef5316f273791d371 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 19 Aug 2024 14:38:35 -0500 Subject: [PATCH 07/38] Create mailutils.js --- extensions/unknown/mailutils.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 extensions/unknown/mailutils.js diff --git a/extensions/unknown/mailutils.js b/extensions/unknown/mailutils.js new file mode 100644 index 0000000000..4162746bee --- /dev/null +++ b/extensions/unknown/mailutils.js @@ -0,0 +1,25 @@ +class Mailutils { + getInfo() { + return { + id: 'Unknownmail', + name: 'Mailutils', + blocks: [ + { + opcode: 'mailto', + blockType: Scratch.BlockType.COMMAND, + text: 'mail to [email]', + arguments: { + str: { + type: Scratch.ArgumentType.STRING + }, + } + } + ] + }; + } + + mailto(args) { + window.location.href = ("mailto:" + args.str); + } + } + Scratch.extensions.register(new Mailutils()); From c8ba4218093caa650a32a0818302a3b4abe6e76d Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 21 Aug 2024 13:47:12 -0500 Subject: [PATCH 08/38] Update mailutils.js --- extensions/unknown/mailutils.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/extensions/unknown/mailutils.js b/extensions/unknown/mailutils.js index 4162746bee..d3f39f7a4b 100644 --- a/extensions/unknown/mailutils.js +++ b/extensions/unknown/mailutils.js @@ -9,7 +9,17 @@ class Mailutils { blockType: Scratch.BlockType.COMMAND, text: 'mail to [email]', arguments: { - str: { + email: { + type: Scratch.ArgumentType.STRING + }, + } + }, + { + opcode: 'mailprovider', + blockType: Scratch.BlockType.COMMAND, + text: 'mail provider of [email]', + arguments: { + email: { type: Scratch.ArgumentType.STRING }, } @@ -19,7 +29,17 @@ class Mailutils { } mailto(args) { - window.location.href = ("mailto:" + args.str); + window.location.href = ("mailto:" + args.email); } } + function mailProvider(args) { + if (args.email.includes("@protonmail.com") || args.email.includes("@proton.me")) { + return "proton.me"; + } else if (args.email.includes("@gmail.com")) { + return "gmail"; + } else { + return "unknown"; + } +} + Scratch.extensions.register(new Mailutils()); From 1425e97f124c5def258296c13fdcfe1a962dbb41 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 21 Aug 2024 13:48:23 -0500 Subject: [PATCH 09/38] Update mailutils.js --- extensions/unknown/mailutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/mailutils.js b/extensions/unknown/mailutils.js index d3f39f7a4b..b5de49ef23 100644 --- a/extensions/unknown/mailutils.js +++ b/extensions/unknown/mailutils.js @@ -16,7 +16,7 @@ class Mailutils { }, { opcode: 'mailprovider', - blockType: Scratch.BlockType.COMMAND, + blockType: Scratch.BlockType.REPORTER, text: 'mail provider of [email]', arguments: { email: { From c83d9f42691b7bc7ab3bbb688adbbd2cc82a8680 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Fri, 29 Nov 2024 23:54:54 -0600 Subject: [PATCH 10/38] Delete extensions/unknown/mailutils.js --- extensions/unknown/mailutils.js | 45 --------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 extensions/unknown/mailutils.js diff --git a/extensions/unknown/mailutils.js b/extensions/unknown/mailutils.js deleted file mode 100644 index b5de49ef23..0000000000 --- a/extensions/unknown/mailutils.js +++ /dev/null @@ -1,45 +0,0 @@ -class Mailutils { - getInfo() { - return { - id: 'Unknownmail', - name: 'Mailutils', - blocks: [ - { - opcode: 'mailto', - blockType: Scratch.BlockType.COMMAND, - text: 'mail to [email]', - arguments: { - email: { - type: Scratch.ArgumentType.STRING - }, - } - }, - { - opcode: 'mailprovider', - blockType: Scratch.BlockType.REPORTER, - text: 'mail provider of [email]', - arguments: { - email: { - type: Scratch.ArgumentType.STRING - }, - } - } - ] - }; - } - - mailto(args) { - window.location.href = ("mailto:" + args.email); - } - } - function mailProvider(args) { - if (args.email.includes("@protonmail.com") || args.email.includes("@proton.me")) { - return "proton.me"; - } else if (args.email.includes("@gmail.com")) { - return "gmail"; - } else { - return "unknown"; - } -} - - Scratch.extensions.register(new Mailutils()); From 080e790aec15b3b05002ba18b615d7c2c0c6fdc9 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Fri, 29 Nov 2024 23:55:04 -0600 Subject: [PATCH 11/38] Delete extensions/unknown/timeutills.js --- extensions/unknown/timeutills.js | 36 -------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 extensions/unknown/timeutills.js diff --git a/extensions/unknown/timeutills.js b/extensions/unknown/timeutills.js deleted file mode 100644 index d3c73ca73f..0000000000 --- a/extensions/unknown/timeutills.js +++ /dev/null @@ -1,36 +0,0 @@ -// Name: Time utills -// ID: unknowntimeutills -// Description: utilities for waiting a amount of milliseconds. -// By: Unknown -// Original: Unknown -// License: MPL-2.0 - - -class timeutills { - getInfo() { - return { - id: 'unknowntimeutills', - name: 'time utills', - blocks: [ - { - opcode: 'wait', - blockType: Scratch.BlockType.BOOLEAN, - text: 'wait [MS] in milliseconds', - arguments: { - MS: { - type: Scratch.ArgumentType.NUMBER - } - } - } - ] - }; - } - - - - wait(args) { - return new Promise(resolve => setTimeout(resolve, args.MS)); -} - - -Scratch.extensions.register(new unknowntimeutills()); From 293efd2058576aa239cf8dbf59da1872608272f6 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:37:09 -0500 Subject: [PATCH 12/38] Create api-toolbox.js --- extensions/unknown07724/api-toolbox.js | 105 +++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 extensions/unknown07724/api-toolbox.js diff --git a/extensions/unknown07724/api-toolbox.js b/extensions/unknown07724/api-toolbox.js new file mode 100644 index 0000000000..1a1c784c10 --- /dev/null +++ b/extensions/unknown07724/api-toolbox.js @@ -0,0 +1,105 @@ +// Name: API Toolbox +// ID: U07apitoolbox +// Description: API for Frogs +// By: Unknown07724 https://scratch.mit.edu/users/Unknown07724/ +(function(Scratch) { +'use strict'; + +// API Toolbox Extension +class API_Toolbox { +getInfo() { +return { +id: 'apiToolbox', +name: 'API Toolbox', +color1: '#99C68E', +blocks: [ +{ +opcode: 'getProjects', +blockType: Scratch.BlockType.REPORTER, +text: 'give projects json pls', +arguments: {} +}, +{ +opcode: 'getAuthors', +blockType: Scratch.BlockType.REPORTER, +text: 'who are the authors?', +arguments: {} // No arguments here +}, +{ +opcode: 'getLanguages', +blockType: Scratch.BlockType.REPORTER, +text: 'list o’ languages pls', +arguments: {} +}, + +{ +blockType: "label", +text: "I forgot what root is", +}, + + { + opcode: 'getRootData', + blockType: Scratch.BlockType.REPORTER, + text: 'get root data', + arguments: {} + } + ] + }; +} + +// Fetch data from a specific folder in the API +async getJson(folder) { + const URL = 'https://unknown07724.github.io/api'; + try { + const u = `${URL}/${folder}/main.json`; + const res = await fetch(u); + if (!res.ok) throw new Error(`Error: ${res.status}`); + return await res.json(); + } catch (err) { + console.log('Failed for ' + folder, err); + return null; + } +} + +// Block: Get all projects +async getProjects() { + const data = await this.getJson('projects'); + if (data) { + // Return each project with creator and author + return data.map(p => ({ + creator: p.creator, + author: p.author + })); + } + return []; // return empty array if no data +} + +// Block: Get authors without any arguments +async getAuthors() { + const data = await this.getJson('users'); // Always fetch from the 'users' folder + if (data) { + return data.map(a => ({ + ID: a.ID, + Username: a.Username, + JoinedDate: a.JoinedDate + })); + } + return []; // return empty array if no data +} + +// Block: Get languages data +async getLanguages() { + return await this.getJson('langs'); +} + +// Block: Get root API data +async getRootData() { + return await this.getJson(''); +} + +} + +// Register the extension +Scratch.extensions.register(new API_Toolbox()); + +})(Scratch); From 84784db2972c027ceb693d77dd0de7188fbeaaec Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:38:50 -0500 Subject: [PATCH 13/38] Rename api-toolbox.js to api-toolbox.js --- extensions/{unknown07724 => unknown}/api-toolbox.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename extensions/{unknown07724 => unknown}/api-toolbox.js (100%) diff --git a/extensions/unknown07724/api-toolbox.js b/extensions/unknown/api-toolbox.js similarity index 100% rename from extensions/unknown07724/api-toolbox.js rename to extensions/unknown/api-toolbox.js From 2bdeb7086af657b66b7d930133bfb57cc3f682c4 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:43:32 -0500 Subject: [PATCH 14/38] Update extensions.json --- extensions/extensions.json | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/extensions.json b/extensions/extensions.json index d8ed71e33d..216f58d0b4 100644 --- a/extensions/extensions.json +++ b/extensions/extensions.json @@ -76,6 +76,7 @@ "Longboost/color_channels", "CST1229/zip", "CST1229/images", + "Unknown/api-toolbox" "TheShovel/LZ-String", "0832/rxFS2", "NexusKitten/sgrab", From fe8abcc37c8f98df310466806507d51cbb1bcf63 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:44:38 -0500 Subject: [PATCH 15/38] Update api-toolbox.js --- extensions/unknown/api-toolbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/unknown/api-toolbox.js b/extensions/unknown/api-toolbox.js index 1a1c784c10..0240546d2a 100644 --- a/extensions/unknown/api-toolbox.js +++ b/extensions/unknown/api-toolbox.js @@ -1,5 +1,5 @@ // Name: API Toolbox -// ID: U07apitoolbox +// ID: unkapiToolbox // Description: API for Frogs // By: Unknown07724 https://scratch.mit.edu/users/Unknown07724/ (function(Scratch) { @@ -9,7 +9,7 @@ class API_Toolbox { getInfo() { return { -id: 'apiToolbox', +id: 'unkapiToolbox', name: 'API Toolbox', color1: '#99C68E', blocks: [ From 6c6085d6c2885f8dee3bdfa453d6d9d4d8643804 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:48:05 -0500 Subject: [PATCH 16/38] Update api-toolbox.js --- extensions/unknown/api-toolbox.js | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/unknown/api-toolbox.js b/extensions/unknown/api-toolbox.js index 0240546d2a..ef33adf788 100644 --- a/extensions/unknown/api-toolbox.js +++ b/extensions/unknown/api-toolbox.js @@ -2,6 +2,7 @@ // ID: unkapiToolbox // Description: API for Frogs // By: Unknown07724 https://scratch.mit.edu/users/Unknown07724/ +// License: MPL-2.0 (function(Scratch) { 'use strict'; From 766784df0c0e04424845ffb965164e16a83c89a9 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Mon, 7 Apr 2025 14:59:48 -0500 Subject: [PATCH 17/38] Update api-toolbox.js --- extensions/unknown/api-toolbox.js | 182 +++++++++++++++--------------- 1 file changed, 94 insertions(+), 88 deletions(-) diff --git a/extensions/unknown/api-toolbox.js b/extensions/unknown/api-toolbox.js index ef33adf788..51cb5315f6 100644 --- a/extensions/unknown/api-toolbox.js +++ b/extensions/unknown/api-toolbox.js @@ -3,104 +3,110 @@ // Description: API for Frogs // By: Unknown07724 https://scratch.mit.edu/users/Unknown07724/ // License: MPL-2.0 + (function(Scratch) { -'use strict'; + 'use strict'; -// API Toolbox Extension -class API_Toolbox { -getInfo() { -return { -id: 'unkapiToolbox', -name: 'API Toolbox', -color1: '#99C68E', -blocks: [ -{ -opcode: 'getProjects', -blockType: Scratch.BlockType.REPORTER, -text: 'give projects json pls', -arguments: {} -}, -{ -opcode: 'getAuthors', -blockType: Scratch.BlockType.REPORTER, -text: 'who are the authors?', -arguments: {} // No arguments here -}, -{ -opcode: 'getLanguages', -blockType: Scratch.BlockType.REPORTER, -text: 'list o’ languages pls', -arguments: {} -}, + // API Toolbox Extension + class API_Toolbox { + getInfo() { + return { + id: 'unkapiToolbox', + name: 'API Toolbox', + color1: '#99C68E', + blocks: [ + { + opcode: 'getProjects', + blockType: Scratch.BlockType.REPORTER, + text: 'give projects json pls', + arguments: {} + }, + { + opcode: 'getAuthors', + blockType: Scratch.BlockType.REPORTER, + text: 'who are the authors?', + arguments: {} // No arguments here + }, + { + opcode: 'getLanguages', + blockType: Scratch.BlockType.REPORTER, + text: 'list o’ languages pls', + arguments: {} + }, + { + blockType: "label", + text: "I forgot what root is", + }, + { + opcode: 'getRootData', + blockType: Scratch.BlockType.REPORTER, + text: 'get root data', + arguments: {} + } + ] + }; + } -{ -blockType: "label", -text: "I forgot what root is", -}, + // constructor with optional caching (could help performance) + constructor() { + this.cache = {}; + } - { - opcode: 'getRootData', - blockType: Scratch.BlockType.REPORTER, - text: 'get root data', - arguments: {} - } - ] - }; -} + // Fetch data from a specific folder in the API + async getJson(folder) { + const URL = 'https://unknown07724.github.io/api'; + try { + // Fix double slash issue if folder is empty + const path = folder ? `${URL}/${folder}/main.json` : `${URL}/main.json`; -// Fetch data from a specific folder in the API -async getJson(folder) { - const URL = 'https://unknown07724.github.io/api'; - try { - const u = `${URL}/${folder}/main.json`; - const res = await fetch(u); - if (!res.ok) throw new Error(`Error: ${res.status}`); - return await res.json(); - } catch (err) { - console.log('Failed for ' + folder, err); - return null; - } -} + // check cache first + if (this.cache[path]) return this.cache[path]; -// Block: Get all projects -async getProjects() { - const data = await this.getJson('projects'); - if (data) { - // Return each project with creator and author - return data.map(p => ({ - creator: p.creator, - author: p.author - })); - } - return []; // return empty array if no data -} + const res = await fetch(path); + if (!res.ok) throw new Error(`Error: ${res.status}`); -// Block: Get authors without any arguments -async getAuthors() { - const data = await this.getJson('users'); // Always fetch from the 'users' folder - if (data) { - return data.map(a => ({ - ID: a.ID, - Username: a.Username, - JoinedDate: a.JoinedDate - })); - } - return []; // return empty array if no data -} + const data = await res.json(); + this.cache[path] = data; // save to cache + return data; + } catch (err) { + console.log('Failed for ' + folder, err); + return null; + } + } -// Block: Get languages data -async getLanguages() { - return await this.getJson('langs'); -} + // Block: Get all projects + async getProjects() { + const data = await this.getJson('projects'); + if (data) { + // Return each project with creator and author (as a string for Scratch) + return JSON.stringify(data.map(p => `${p.creator} (${p.author})`)); + } + return '[]'; // return empty array if no data + } -// Block: Get root API data -async getRootData() { - return await this.getJson(''); -} + // Block: Get authors without any arguments + async getAuthors() { + const data = await this.getJson('users'); // Always fetch from the 'users' folder + if (data) { + return JSON.stringify(data.map(a => `${a.Username} [${a.ID}]`)); + } + return '[]'; // return empty array if no data + } -} + // Block: Get languages data + async getLanguages() { + const data = await this.getJson('langs'); + return data ? JSON.stringify(data) : '[]'; + } + + // Block: Get root API data + async getRootData() { + const data = await this.getJson(''); + return data ? JSON.stringify(data) : '{}'; + } + } -// Register the extension -Scratch.extensions.register(new API_Toolbox()); + // Register the extension + Scratch.extensions.register(new API_Toolbox()); })(Scratch); From 58b0ecae266b84cf9ee97613f424dadf20a03174 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 8 Apr 2025 21:34:42 +0000 Subject: [PATCH 18/38] Create vectors.js --- extensions/unknown/vectors.js | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 extensions/unknown/vectors.js diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js new file mode 100644 index 0000000000..7161c90b3a --- /dev/null +++ b/extensions/unknown/vectors.js @@ -0,0 +1,87 @@ +let ids = []; +let directions = {}; +let magnitudes = {}; + +class unknownvectors { + getInfo() { + return { + color1: "#3495eb", + id: 'unknownvectors', + name: 'Vectors', + blocks: [ + { + opcode: 'vectorCreate', + blockType: Scratch.BlockType.COMMAND, + text: 'create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 } + } + }, + { + opcode: 'vectorChange', + blockType: Scratch.BlockType.COMMAND, + text: 'change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 } + } + }, + { + opcode: 'vectorMag', + blockType: Scratch.BlockType.REPORTER, + text: 'Mag of vector [ID]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' } + } + }, + { + opcode: 'listofIDs', + blockType: Scratch.BlockType.REPORTER, + text: 'List of IDs', + }, + { + opcode: 'vectorDir', + blockType: Scratch.BlockType.REPORTER, + text: 'direction of vector [ID]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' } + } + } + ] + }; + } + + vectorCreate(args) { + const id = args.ID; + if (!ids.includes(id)) { + ids.push(id); + } + directions[id] = args.DIRECTION; + magnitudes[id] = args.MAGNITUDE; + } + + vectorChange(args) { + const id = args.ID; + directions[id] = args.DIRECTION; + magnitudes[id] = args.MAGNITUDE; + } + + vectorMag(args) { + const id = args.ID; + return magnitudes[id] ?? 'vector not found'; + } + + vectorDir(args) { + const id = args.ID; + return directions[id] ?? 'vector not found'; + } + + listofIDs() { + return ids.join(', '); + } +} + +Scratch.extensions.register(new unknownvectors()); From 6587f1b5b097d2b10474938e851449b07ffa0aec Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 8 Apr 2025 21:34:51 +0000 Subject: [PATCH 19/38] Delete extensions/unknown/api-toolbox.js --- extensions/unknown/api-toolbox.js | 112 ------------------------------ 1 file changed, 112 deletions(-) delete mode 100644 extensions/unknown/api-toolbox.js diff --git a/extensions/unknown/api-toolbox.js b/extensions/unknown/api-toolbox.js deleted file mode 100644 index 51cb5315f6..0000000000 --- a/extensions/unknown/api-toolbox.js +++ /dev/null @@ -1,112 +0,0 @@ -// Name: API Toolbox -// ID: unkapiToolbox -// Description: API for Frogs -// By: Unknown07724 https://scratch.mit.edu/users/Unknown07724/ -// License: MPL-2.0 - -(function(Scratch) { - 'use strict'; - - // API Toolbox Extension - class API_Toolbox { - getInfo() { - return { - id: 'unkapiToolbox', - name: 'API Toolbox', - color1: '#99C68E', - blocks: [ - { - opcode: 'getProjects', - blockType: Scratch.BlockType.REPORTER, - text: 'give projects json pls', - arguments: {} - }, - { - opcode: 'getAuthors', - blockType: Scratch.BlockType.REPORTER, - text: 'who are the authors?', - arguments: {} // No arguments here - }, - { - opcode: 'getLanguages', - blockType: Scratch.BlockType.REPORTER, - text: 'list o’ languages pls', - arguments: {} - }, - { - blockType: "label", - text: "I forgot what root is", - }, - { - opcode: 'getRootData', - blockType: Scratch.BlockType.REPORTER, - text: 'get root data', - arguments: {} - } - ] - }; - } - - // constructor with optional caching (could help performance) - constructor() { - this.cache = {}; - } - - // Fetch data from a specific folder in the API - async getJson(folder) { - const URL = 'https://unknown07724.github.io/api'; - try { - // Fix double slash issue if folder is empty - const path = folder ? `${URL}/${folder}/main.json` : `${URL}/main.json`; - - // check cache first - if (this.cache[path]) return this.cache[path]; - - const res = await fetch(path); - if (!res.ok) throw new Error(`Error: ${res.status}`); - - const data = await res.json(); - this.cache[path] = data; // save to cache - return data; - } catch (err) { - console.log('Failed for ' + folder, err); - return null; - } - } - - // Block: Get all projects - async getProjects() { - const data = await this.getJson('projects'); - if (data) { - // Return each project with creator and author (as a string for Scratch) - return JSON.stringify(data.map(p => `${p.creator} (${p.author})`)); - } - return '[]'; // return empty array if no data - } - - // Block: Get authors without any arguments - async getAuthors() { - const data = await this.getJson('users'); // Always fetch from the 'users' folder - if (data) { - return JSON.stringify(data.map(a => `${a.Username} [${a.ID}]`)); - } - return '[]'; // return empty array if no data - } - - // Block: Get languages data - async getLanguages() { - const data = await this.getJson('langs'); - return data ? JSON.stringify(data) : '[]'; - } - - // Block: Get root API data - async getRootData() { - const data = await this.getJson(''); - return data ? JSON.stringify(data) : '{}'; - } - } - - // Register the extension - Scratch.extensions.register(new API_Toolbox()); - -})(Scratch); From 215bcf8251960d892c5e88a5feaf4edb53cc861c Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 8 Apr 2025 21:35:30 +0000 Subject: [PATCH 20/38] Update extensions.json --- extensions/extensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/extensions.json b/extensions/extensions.json index 216f58d0b4..fd85752c5d 100644 --- a/extensions/extensions.json +++ b/extensions/extensions.json @@ -59,6 +59,7 @@ "Lily/AllMenus", "Lily/HackedBlocks", "Lily/Cast", + "Unknown/vectors", "-SIPC-/time", "-SIPC-/consoles", "ZXMushroom63/searchApi", @@ -76,7 +77,6 @@ "Longboost/color_channels", "CST1229/zip", "CST1229/images", - "Unknown/api-toolbox" "TheShovel/LZ-String", "0832/rxFS2", "NexusKitten/sgrab", From 7f5daee5c20b58dc514166ae4fadbab1772ea532 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Tue, 8 Apr 2025 23:02:49 -0500 Subject: [PATCH 21/38] Update vectors.js --- extensions/unknown/vectors.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 7161c90b3a..b9d63a9ef4 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -1,3 +1,9 @@ +// Name: Vectors +// ID: unknownvectors +// Description: variables with a direction. +// By: Unknown07724 +// License: MPL-2.0 + let ids = []; let directions = {}; let magnitudes = {}; From 094a2425457e283fcff1f2439b5ef23dbddd75a8 Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Wed, 9 Apr 2025 09:06:08 +0000 Subject: [PATCH 22/38] [Automated] Format code --- extensions/unknown/vectors.js | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index b9d63a9ef4..285ae4b47c 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -12,51 +12,51 @@ class unknownvectors { getInfo() { return { color1: "#3495eb", - id: 'unknownvectors', - name: 'Vectors', + id: "unknownvectors", + name: "Vectors", blocks: [ { - opcode: 'vectorCreate', + opcode: "vectorCreate", blockType: Scratch.BlockType.COMMAND, - text: 'create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]', + text: "create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 } - } + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + }, }, { - opcode: 'vectorChange', + opcode: "vectorChange", blockType: Scratch.BlockType.COMMAND, - text: 'change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]', + text: "change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 } - } + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + }, }, { - opcode: 'vectorMag', + opcode: "vectorMag", blockType: Scratch.BlockType.REPORTER, - text: 'Mag of vector [ID]', + text: "Mag of vector [ID]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' } - } + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + }, }, { - opcode: 'listofIDs', + opcode: "listofIDs", blockType: Scratch.BlockType.REPORTER, - text: 'List of IDs', + text: "List of IDs", }, { - opcode: 'vectorDir', + opcode: "vectorDir", blockType: Scratch.BlockType.REPORTER, - text: 'direction of vector [ID]', + text: "direction of vector [ID]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' } - } - } - ] + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + }, + }, + ], }; } @@ -77,16 +77,16 @@ class unknownvectors { vectorMag(args) { const id = args.ID; - return magnitudes[id] ?? 'vector not found'; + return magnitudes[id] ?? "vector not found"; } vectorDir(args) { const id = args.ID; - return directions[id] ?? 'vector not found'; + return directions[id] ?? "vector not found"; } listofIDs() { - return ids.join(', '); + return ids.join(", "); } } From 7dfa05a25055292d25c58b7209868dbdd8075271 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 9 Apr 2025 04:32:54 -0500 Subject: [PATCH 23/38] Update vectors.js --- extensions/unknown/vectors.js | 155 ++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 71 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 285ae4b47c..0bb681afe9 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -8,86 +8,99 @@ let ids = []; let directions = {}; let magnitudes = {}; -class unknownvectors { - getInfo() { - return { - color1: "#3495eb", - id: "unknownvectors", - name: "Vectors", - blocks: [ - { - opcode: "vectorCreate", - blockType: Scratch.BlockType.COMMAND, - text: "create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]", - arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, +(function(Scratch) { + 'use strict'; + + // Ensure we're running in an unsandboxed environment + if (!Scratch.extensions.unsandboxed) { + throw new Error('This extension must run unsandboxed'); + } + + let ids = []; + let directions = {}; + let magnitudes = {}; + + class UnknownVectors { + getInfo() { + return { + id: 'unknownvectors', + name: 'Vectors', + blocks: [ + { + opcode: 'vectorCreate', + blockType: Scratch.BlockType.COMMAND, + text: 'create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + }, }, - }, - { - opcode: "vectorChange", - blockType: Scratch.BlockType.COMMAND, - text: "change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]", - arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + { + opcode: 'vectorChange', + blockType: Scratch.BlockType.COMMAND, + text: 'change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + }, }, - }, - { - opcode: "vectorMag", - blockType: Scratch.BlockType.REPORTER, - text: "Mag of vector [ID]", - arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + { + opcode: 'vectorMag', + blockType: Scratch.BlockType.REPORTER, + text: 'Mag of vector [ID]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + }, }, - }, - { - opcode: "listofIDs", - blockType: Scratch.BlockType.REPORTER, - text: "List of IDs", - }, - { - opcode: "vectorDir", - blockType: Scratch.BlockType.REPORTER, - text: "direction of vector [ID]", - arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + { + opcode: 'listofIDs', + blockType: Scratch.BlockType.REPORTER, + text: 'List of IDs', }, - }, - ], - }; - } + { + opcode: 'vectorDir', + blockType: Scratch.BlockType.REPORTER, + text: 'direction of vector [ID]', + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + }, + }, + ], + }; + } - vectorCreate(args) { - const id = args.ID; - if (!ids.includes(id)) { - ids.push(id); + vectorCreate(args) { + const id = args.ID; + if (!ids.includes(id)) { + ids.push(id); + } + directions[id] = args.DIRECTION; + magnitudes[id] = args.MAGNITUDE; } - directions[id] = args.DIRECTION; - magnitudes[id] = args.MAGNITUDE; - } - vectorChange(args) { - const id = args.ID; - directions[id] = args.DIRECTION; - magnitudes[id] = args.MAGNITUDE; - } + vectorChange(args) { + const id = args.ID; + directions[id] = args.DIRECTION; + magnitudes[id] = args.MAGNITUDE; + } - vectorMag(args) { - const id = args.ID; - return magnitudes[id] ?? "vector not found"; - } + vectorMag(args) { + const id = args.ID; + return magnitudes[id] ?? 'vector not found'; + } - vectorDir(args) { - const id = args.ID; - return directions[id] ?? "vector not found"; - } + vectorDir(args) { + const id = args.ID; + return directions[id] ?? 'vector not found'; + } - listofIDs() { - return ids.join(", "); + listofIDs() { + return ids.join(', '); + } } -} -Scratch.extensions.register(new unknownvectors()); + Scratch.extensions.register(new UnknownVectors()); + +})(Scratch); From db0edbdd6131666322902d98552507dcfe14cf9e Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Wed, 9 Apr 2025 09:35:46 +0000 Subject: [PATCH 24/38] [Automated] Format code --- extensions/unknown/vectors.js | 65 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 0bb681afe9..13799e7ef7 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -8,12 +8,12 @@ let ids = []; let directions = {}; let magnitudes = {}; -(function(Scratch) { - 'use strict'; +(function (Scratch) { + "use strict"; // Ensure we're running in an unsandboxed environment if (!Scratch.extensions.unsandboxed) { - throw new Error('This extension must run unsandboxed'); + throw new Error("This extension must run unsandboxed"); } let ids = []; @@ -23,48 +23,60 @@ let magnitudes = {}; class UnknownVectors { getInfo() { return { - id: 'unknownvectors', - name: 'Vectors', + id: "unknownvectors", + name: "Vectors", blocks: [ { - opcode: 'vectorCreate', + opcode: "vectorCreate", blockType: Scratch.BlockType.COMMAND, - text: 'create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]', + text: "create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { - opcode: 'vectorChange', + opcode: "vectorChange", blockType: Scratch.BlockType.COMMAND, - text: 'change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]', + text: "change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { - opcode: 'vectorMag', + opcode: "vectorMag", blockType: Scratch.BlockType.REPORTER, - text: 'Mag of vector [ID]', + text: "Mag of vector [ID]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, }, { - opcode: 'listofIDs', + opcode: "listofIDs", blockType: Scratch.BlockType.REPORTER, - text: 'List of IDs', + text: "List of IDs", }, { - opcode: 'vectorDir', + opcode: "vectorDir", blockType: Scratch.BlockType.REPORTER, - text: 'direction of vector [ID]', + text: "direction of vector [ID]", arguments: { - ID: { type: Scratch.ArgumentType.STRING, defaultValue: 'vec1' }, + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, }, ], @@ -88,19 +100,18 @@ let magnitudes = {}; vectorMag(args) { const id = args.ID; - return magnitudes[id] ?? 'vector not found'; + return magnitudes[id] ?? "vector not found"; } vectorDir(args) { const id = args.ID; - return directions[id] ?? 'vector not found'; + return directions[id] ?? "vector not found"; } listofIDs() { - return ids.join(', '); + return ids.join(", "); } } Scratch.extensions.register(new UnknownVectors()); - })(Scratch); From 86ddd010968a7c697e6fe261d4ad6520a775d70b Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 9 Apr 2025 09:36:51 -0500 Subject: [PATCH 25/38] Update vectors.js --- extensions/unknown/vectors.js | 48 ++++++++++++----------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 13799e7ef7..fbf430e7b6 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -4,64 +4,48 @@ // By: Unknown07724 // License: MPL-2.0 -let ids = []; -let directions = {}; -let magnitudes = {}; - (function (Scratch) { "use strict"; - // Ensure we're running in an unsandboxed environment if (!Scratch.extensions.unsandboxed) { throw new Error("This extension must run unsandboxed"); } - let ids = []; - let directions = {}; - let magnitudes = {}; + const ids = []; + const directions = {}; + const magnitudes = {}; class UnknownVectors { getInfo() { return { id: "unknownvectors", - name: "Vectors", + name: Scratch.translate("Vectors"), + color1: "#d63384", blocks: [ { opcode: "vectorCreate", blockType: Scratch.BlockType.COMMAND, - text: "create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]", + text: Scratch.translate("create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 90, - }, - MAGNITUDE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 10, - }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, }, }, { opcode: "vectorChange", blockType: Scratch.BlockType.COMMAND, - text: "change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]", + text: Scratch.translate("change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 90, - }, - MAGNITUDE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 10, - }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, }, }, { opcode: "vectorMag", blockType: Scratch.BlockType.REPORTER, - text: "Mag of vector [ID]", + text: Scratch.translate("Magnitude of vector [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, @@ -69,12 +53,12 @@ let magnitudes = {}; { opcode: "listofIDs", blockType: Scratch.BlockType.REPORTER, - text: "List of IDs", + text: Scratch.translate("List of IDs"), }, { opcode: "vectorDir", blockType: Scratch.BlockType.REPORTER, - text: "direction of vector [ID]", + text: Scratch.translate("Direction of vector [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, @@ -100,12 +84,12 @@ let magnitudes = {}; vectorMag(args) { const id = args.ID; - return magnitudes[id] ?? "vector not found"; + return magnitudes[id] ?? Scratch.translate("vector not found"); } vectorDir(args) { const id = args.ID; - return directions[id] ?? "vector not found"; + return directions[id] ?? Scratch.translate("vector not found"); } listofIDs() { From fa0d902037cc0f07787dc036950122f0606a16e8 Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Wed, 9 Apr 2025 14:40:15 +0000 Subject: [PATCH 26/38] [Automated] Format code --- extensions/unknown/vectors.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index fbf430e7b6..983ae2b58d 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -25,21 +25,37 @@ { opcode: "vectorCreate", blockType: Scratch.BlockType.COMMAND, - text: Scratch.translate("create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]"), + text: Scratch.translate( + "create vector with ID [ID], direction [DIRECTION] and magnitude [MAGNITUDE]" + ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { opcode: "vectorChange", blockType: Scratch.BlockType.COMMAND, - text: Scratch.translate("change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]"), + text: Scratch.translate( + "change vector [ID] to direction [DIRECTION] and magnitude [MAGNITUDE]" + ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { From abbdf2f592f9c81cb0a3a7b2081993245db281b3 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 9 Apr 2025 09:50:40 -0500 Subject: [PATCH 27/38] Update vectors.js --- extensions/unknown/vectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 983ae2b58d..8eadc528e7 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -20,7 +20,7 @@ return { id: "unknownvectors", name: Scratch.translate("Vectors"), - color1: "#d63384", + color1: "#2e75d1", blocks: [ { opcode: "vectorCreate", From a481dcb9e39178b89881e0480b4c3df295d16357 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 9 Apr 2025 09:53:00 -0500 Subject: [PATCH 28/38] Update vectors.js --- extensions/unknown/vectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 8eadc528e7..37bcdf2e47 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -20,7 +20,7 @@ return { id: "unknownvectors", name: Scratch.translate("Vectors"), - color1: "#2e75d1", + color1: "#275efe" blocks: [ { opcode: "vectorCreate", From 14cdeccd4b533bac2d491de37d205e99c108caac Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Wed, 9 Apr 2025 09:53:22 -0500 Subject: [PATCH 29/38] Update vectors.js --- extensions/unknown/vectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 37bcdf2e47..0e5970721d 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -20,7 +20,7 @@ return { id: "unknownvectors", name: Scratch.translate("Vectors"), - color1: "#275efe" + color1: "#275efe", blocks: [ { opcode: "vectorCreate", From 7e9c6fcb35671296c3426364e15ab947af85b646 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 07:39:18 -0500 Subject: [PATCH 30/38] Update vectors.js --- extensions/unknown/vectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 0e5970721d..2cefd4558e 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -20,7 +20,7 @@ return { id: "unknownvectors", name: Scratch.translate("Vectors"), - color1: "#275efe", + color1: "#3495eb", blocks: [ { opcode: "vectorCreate", From 2c7e9da9206d94d521b3445141c5192af51febfc Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 09:20:21 -0500 Subject: [PATCH 31/38] Update vectors.js --- extensions/unknown/vectors.js | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 2cefd4558e..bae47926a9 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -40,6 +40,20 @@ }, }, }, + { + opcode: "vectorChangeMag", + blockType: Scratch.BlockType.COMMAND, + text: Scratch.translate( + "change vector [ID]'s magnitude to [MAGNITUDE]" + ), + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, + }, + }, { opcode: "vectorChange", blockType: Scratch.BlockType.COMMAND, @@ -58,6 +72,20 @@ }, }, }, + { + opcode: "vectorChangedir", + blockType: Scratch.BlockType.COMMAND, + text: Scratch.translate( + "change vector [ID]'s direction to [DIRECTION]" + ), + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + }, + }, { opcode: "vectorMag", blockType: Scratch.BlockType.REPORTER, @@ -97,6 +125,15 @@ directions[id] = args.DIRECTION; magnitudes[id] = args.MAGNITUDE; } + vectorChangedir(args) { + const id = args.ID; + directions[id] = args.DIRECTION; + } + + vectorChangeMag(args) { + const id = args.ID; + magnitudes[id] = args.MAGNITUDE; + } vectorMag(args) { const id = args.ID; From 38f99bffa2924dd4ba7b3c69e1d0f771db5bfce3 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 09:25:33 -0500 Subject: [PATCH 32/38] Update vectors.js --- extensions/unknown/vectors.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index bae47926a9..d86389dc7a 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -72,6 +72,16 @@ }, }, }, + { + opcode: "vectorDelete", + blockType: Scratch.BlockType.COMMAND, + text: Scratch.translate( + "Delete vector with [ID]" + ), + arguments: { + ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, + }, + }, { opcode: "vectorChangedir", blockType: Scratch.BlockType.COMMAND, @@ -139,6 +149,14 @@ const id = args.ID; return magnitudes[id] ?? Scratch.translate("vector not found"); } + vectordelete(args) { + const id = args.ID; + const index = ids.indexOf(id); + if (index !== -1) { + ids.splice(index, 1); + delete directions[id]; + delete magnitudes[id]; + } vectorDir(args) { const id = args.ID; From 7fe7b1a9c6916af1746d35c3493b3db25ab26993 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 09:26:51 -0500 Subject: [PATCH 33/38] Update vectors.js --- extensions/unknown/vectors.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index d86389dc7a..750c0479de 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -151,13 +151,9 @@ } vectordelete(args) { const id = args.ID; - const index = ids.indexOf(id); - if (index !== -1) { - ids.splice(index, 1); - delete directions[id]; - delete magnitudes[id]; + delete[directions.id] + delete[magnitudes.id] } - vectorDir(args) { const id = args.ID; return directions[id] ?? Scratch.translate("vector not found"); From 1d505e43253d2ebabba33ca96c921869e0c2b161 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 09:28:32 -0500 Subject: [PATCH 34/38] Update vectors.js --- extensions/unknown/vectors.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 750c0479de..12a06da853 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -1,9 +1,3 @@ -// Name: Vectors -// ID: unknownvectors -// Description: variables with a direction. -// By: Unknown07724 -// License: MPL-2.0 - (function (Scratch) { "use strict"; @@ -135,6 +129,7 @@ directions[id] = args.DIRECTION; magnitudes[id] = args.MAGNITUDE; } + vectorChangedir(args) { const id = args.ID; directions[id] = args.DIRECTION; @@ -149,11 +144,17 @@ const id = args.ID; return magnitudes[id] ?? Scratch.translate("vector not found"); } - vectordelete(args) { + + vectorDelete(args) { const id = args.ID; - delete[directions.id] - delete[magnitudes.id] + const index = ids.indexOf(id); + if (index !== -1) { + ids.splice(index, 1); + delete directions[id]; + delete magnitudes[id]; + } } + vectorDir(args) { const id = args.ID; return directions[id] ?? Scratch.translate("vector not found"); From f3745661492eb0d43d647d6a49ed4b8f9c5c6f36 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Thu, 17 Apr 2025 09:30:20 -0500 Subject: [PATCH 35/38] Update vectors.js --- extensions/unknown/vectors.js | 36 +++++++++-------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 12a06da853..9a5c906ae5 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -1,10 +1,12 @@ (function (Scratch) { "use strict"; + // Ensuring the extension is unsandboxed if (!Scratch.extensions.unsandboxed) { throw new Error("This extension must run unsandboxed"); } + // Vectors storage const ids = []; const directions = {}; const magnitudes = {}; @@ -24,14 +26,8 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 90, - }, - MAGNITUDE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 10, - }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, }, }, { @@ -42,10 +38,7 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - MAGNITUDE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 10, - }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, }, }, { @@ -56,22 +49,14 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 90, - }, - MAGNITUDE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 10, - }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, }, }, { opcode: "vectorDelete", blockType: Scratch.BlockType.COMMAND, - text: Scratch.translate( - "Delete vector with [ID]" - ), + text: Scratch.translate("Delete vector with [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, @@ -84,10 +69,7 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 90, - }, + DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, }, }, { From 30b67f0832cc7a9eeac5d54ddc8ba7adbe0d8b56 Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Thu, 17 Apr 2025 14:36:40 +0000 Subject: [PATCH 36/38] [Automated] Format code --- extensions/unknown/vectors.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 9a5c906ae5..5344d1e465 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -26,8 +26,14 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { @@ -38,7 +44,10 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { @@ -49,8 +58,14 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, - MAGNITUDE: { type: Scratch.ArgumentType.NUMBER, defaultValue: 10 }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, + MAGNITUDE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 10, + }, }, }, { @@ -69,7 +84,10 @@ ), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, - DIRECTION: { type: Scratch.ArgumentType.NUMBER, defaultValue: 90 }, + DIRECTION: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 90, + }, }, }, { From 605495f53080089163d0064ccbec42f87d1cab55 Mon Sep 17 00:00:00 2001 From: unknown07724 Date: Sun, 20 Apr 2025 15:28:51 -0500 Subject: [PATCH 37/38] Update vectors.js --- extensions/unknown/vectors.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index 5344d1e465..ef27d76109 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -1,3 +1,10 @@ +// Name: Vectors +// ID: unknownvectors +// Description: variables with a direction. +// By: Unknown07724 +// License: MPL-2.0 + + (function (Scratch) { "use strict"; @@ -71,7 +78,7 @@ { opcode: "vectorDelete", blockType: Scratch.BlockType.COMMAND, - text: Scratch.translate("Delete vector with [ID]"), + text: Scratch.translate("delete vector with [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, @@ -93,7 +100,7 @@ { opcode: "vectorMag", blockType: Scratch.BlockType.REPORTER, - text: Scratch.translate("Magnitude of vector [ID]"), + text: Scratch.translate("magnitude of vector [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, @@ -106,7 +113,7 @@ { opcode: "vectorDir", blockType: Scratch.BlockType.REPORTER, - text: Scratch.translate("Direction of vector [ID]"), + text: Scratch.translate("direction of vector [ID]"), arguments: { ID: { type: Scratch.ArgumentType.STRING, defaultValue: "vec1" }, }, From 84a6583ef10d0154fdeee34986ae39ebfe513078 Mon Sep 17 00:00:00 2001 From: "DangoCat[bot]" Date: Sun, 20 Apr 2025 20:30:04 +0000 Subject: [PATCH 38/38] [Automated] Format code --- extensions/unknown/vectors.js | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/unknown/vectors.js b/extensions/unknown/vectors.js index ef27d76109..98ad245579 100644 --- a/extensions/unknown/vectors.js +++ b/extensions/unknown/vectors.js @@ -4,7 +4,6 @@ // By: Unknown07724 // License: MPL-2.0 - (function (Scratch) { "use strict";