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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ export default [
creator: "Monochromasity",
isGitHub: true,
},
{
name: "New Windows",
description: "Lets you open websites in new windows.",
code: "Monochromasity/newwindows.js",
banner: "Monochromasity/newwindows.png",
creator: "Monochromasity",
isGithub: true,
},
{
name: "Paint Utils",
description: "A colour extension that lets you mix colours.",
Expand Down
243 changes: 243 additions & 0 deletions static/extensions/Monochromasity/newwindows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
// Name: New Windows
// ID: monowindows
// Description: Lets you open websites in new windows.
// By: Monochromasity

(function (Scratch) {
"use strict";

let menubar = "no";
let status = "no";
let titlebar = "no";
let full = "no";
let location = "no";
let resizable = "no";
let scroll = "no";
let toolbar = "no";
let replace = "false";

class NewWindows {
getInfo() {
return {
id: 'monowindows',
color1: '#297bff',
name: 'New Windows',
blocks: [
{
opcode: 'openwindow',
blockType: Scratch.BlockType.COMMAND,
text: 'open website [WEB] in new window with ID: [ID] width: [WIDTH] height: [HEIGHT] distance from left: [LEFT] distance from top: [TOP]',
Copy link
Contributor

@Steve0Greatness Steve0Greatness Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, but maybe open [WEB] in new window with dimensions [WIDTH]x[HEIGHT] with a distance of [LEFT]x[TOP] from the top left with id [ID]? It's not that much shorter, but given how ridiculously long this block name is it should help a little.

arguments: {
WEB: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'https://penguinmod.com'
},
ID: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'myWindow'
},
WIDTH: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: '400'
},
HEIGHT: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: '400'
},
LEFT: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: '0'
},
TOP: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: '0'
}
}
},
{
opcode: 'setproperty',
blockType: Scratch.BlockType.COMMAND,
text: 'set window property [PROPERTY] to [TOGGLE]',
arguments: {
PROPERTY: {
type: Scratch.ArgumentType.STRING,
menu: 'PROPERTY'
},
TOGGLE: {
type: Scratch.ArgumentType.STRING,
menu: 'TOGGLE'
}
}
},
{
opcode: 'reset',
blockType: Scratch.BlockType.COMMAND,
text: 'reset properties to default',
hideFromPalette: true
},
{
opcode: 'getproperty',
blockType: Scratch.BlockType.REPORTER,
text: 'get value of property [PROPERTY]',
arguments: {
PROPERTY: {
type: Scratch.ArgumentType.STRING,
menu: 'PROPERTY'
}
}
},
{
opcode: 'closewithid',
blockType: Scratch.BlockType.COMMAND,
text: 'close window with id [ID]',
arguments: {
ID: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'myWindow'
}
}
},
{
opcode: 'isopen',
blockType: Scratch.BlockType.BOOLEAN,
text: 'is window with ID [ID] open?',
arguments: {
ID: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'myWindow'
}
}
}
],
menus: {
PROPERTY: {
acceptReporters: true,
items: [
{
text: 'menu bar',
value: 'menubar'
},
{
text: 'status bar',
value: 'status'
},
{
text: 'title bar',
value: 'titlebar'
},
{
text: 'fullscreen (IE only)',
value: 'full'
},
{
text: 'address field (Opera only)',
value: 'location'
},
{
text: 'resizable (IE only)',
value: 'resizable'
},
{
text: 'scrollbars (IE, Firefox, Opera only)',
value: 'scroll',
},
{
text: 'toolbar (IE, Firefox)',
value: 'toolbar',
},
{
text: 'replace (Deprecated)',
value: 'replace'
}
]
},
TOGGLE: {
acceptReporters: true,
items: [
{
text: 'true',
value: 'yes'
},
{
text: 'false',
value: 'no'
}
]
}
}
};
}

openwindow(args) {
let web = args.WEB;
let iduf = args.ID;
let id = iduf.toLowerCase();
let width = args.WIDTH;
let height = args.HEIGHT;
let strstart = "width=";
let left = Math.abs(Number(args.LEFT));
let top = Math.abs(Number(args.TOP));
let str = strstart.concat(width, ",height=", height, ",fullscreen=", full, ",left=", left, ",top=", top, ",menubar=", menubar, ",status=", status, ",titlebar=", titlebar, ",location=", location, ",resizable=", resizable, ",scrollbars=", scroll, ",toolbar=", toolbar);
console.log(str);
let name = "windows" + id;
this[name] = window.open(web, '', str, replace);
}
closewithid(args) {
let iduf = args.ID;
let id = iduf.toLowerCase();
let name = "windows" + id;
this[name].close();
}
isopen(args) {
let iduf = args.ID;
let id = iduf.toLowerCase();
let name = "windows" + id;
try {
if (!this[name].closed) {
return true;
} else {
return false;
}
}
catch(err) {
return false;
}
}
setproperty(args) {
let title = args.PROPERTY;
if (title == "replace") {
let toggle = args.TOGGLE;
if (toggle == "yes") {
this[title] = "true";
} else if (toggle == "no") {
this[title] = "false";
}
} else {
this[title] = args.TOGGLE;
}
}
reset() {
menubar = "no";
status = "no";
titlebar = "no";
full = "no";
location = "no";
resizable = "no";
scroll = "no";
toolbar = "no";
replace = "false";
}
getproperty(args) {
let title = args.PROPERTY;
let propval = this[title];
if (propval == "yes") {
return true;
} else if (propval == "no") {
return false;
} else {
return propval;
}
}
}
Scratch.extensions.register(new NewWindows());
})(Scratch);
Binary file added static/images/Monochromasity/newwindows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.