Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New extension "Screen resolution" #836

Merged
merged 16 commits into from
Aug 26, 2023
Merged
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
1 change: 1 addition & 0 deletions extensions/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"NexusKitten/moremotion",
"CubesterYT/WindowControls",
"veggiecan/browserfullscreen",
"shreder95ua/resolution",
"navigator",
"battery",
"TheShovel/CustomStyles",
Expand Down
39 changes: 39 additions & 0 deletions extensions/shreder95ua/resolution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Name: Screen Resolution
// ID: shreder95resolution
// Description: Get the resolution of the primary screen.
// By: shreder95ua <https://scratch.mit.edu/users/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);
1 change: 1 addition & 0 deletions images/shreder95ua/resolution.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.