From d3ad8f2022e564f1d7025025e7845d980863ea04 Mon Sep 17 00:00:00 2001 From: SergeyScratch <154001315+SergeyScratch@users.noreply.github.com> Date: Sat, 16 Dec 2023 18:00:40 +0300 Subject: [PATCH] Create OpenLink for the pinguinmod extensions there are two blocks in the extension, the first block opens the link in a new tab, the second block opens the link in a separate window --- .../OpenLink for the pinguinmod extensions | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 static/extensions/OpenLink for the pinguinmod extensions diff --git a/static/extensions/OpenLink for the pinguinmod extensions b/static/extensions/OpenLink for the pinguinmod extensions new file mode 100644 index 00000000..2ae07b9e --- /dev/null +++ b/static/extensions/OpenLink for the pinguinmod extensions @@ -0,0 +1,45 @@ +class OpenLinkExtension { + getInfo() { + return { + id: 'openLinks', + name: 'Open Link', + color1: '#A0A0A0', // GREY + blocks: [ + { + opcode: 'openLinkccc', + blockType: Scratch.BlockType.COMMAND, + text: 'open Link new window [URL]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'https://turbowarp.org/editor' + } + } + }, + { + opcode: 'openLink', + blockType: Scratch.BlockType.COMMAND, + text: 'Open link [URL]', + arguments: { + URL: { + type: Scratch.ArgumentType.STRING, + defaultValue: 'https://turbowarp.org/editor' + } + } + } + ] + }; + } + + openLinkccc(args) { + const url = args.URL; + window.open(url, '_blank','width=400,height=500'); + } + + openLink(args) { + const url = args.URL; + window.open(url, '_blank'); + } +} + +Scratch.extensions.register(new OpenLinkExtension());