diff --git a/extensions/extensions.json b/extensions/extensions.json index 2cf066f897..366dd6a96f 100644 --- a/extensions/extensions.json +++ b/extensions/extensions.json @@ -27,6 +27,7 @@ "NexusKitten/moremotion", "CubesterYT/WindowControls", "veggiecan/browserfullscreen", + "shreder95ua/resolution", "navigator", "battery", "TheShovel/CustomStyles", diff --git a/extensions/shreder95ua/resolution.js b/extensions/shreder95ua/resolution.js new file mode 100644 index 0000000000..bd95940086 --- /dev/null +++ b/extensions/shreder95ua/resolution.js @@ -0,0 +1,39 @@ +// Name: Screen Resolution +// ID: shreder95resolution +// Description: Get the resolution of the primary screen. +// By: shreder95ua + +(function (Scratch) { + "use strict"; + + class Resolution { + getInfo() { + return { + id: "shreder95resolution", + name: "Screen resolution", + color1: "#FFAB19", + color2: "#EC9C13", + color3: "#CF8B17", + blocks: [ + { + opcode: "getWidth", + text: "primary screen width", + blockType: Scratch.BlockType.REPORTER, + }, + { + opcode: "getHeight", + text: "primary screen height", + blockType: Scratch.BlockType.REPORTER, + }, + ], + }; + } + getWidth() { + return window.screen.width; + } + getHeight() { + return window.screen.height; + } + } + Scratch.extensions.register(new Resolution()); +})(Scratch); diff --git a/images/shreder95ua/resolution.svg b/images/shreder95ua/resolution.svg new file mode 100644 index 0000000000..0136b41040 --- /dev/null +++ b/images/shreder95ua/resolution.svg @@ -0,0 +1 @@ + \ No newline at end of file