Last active
April 14, 2020 17:36
-
-
Save Glench/18945fe0859e81230e6eceb0d03c2a4c to your computer and use it in GitHub Desktop.
Set Scratch UI to black
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// sets everything but stage to black on full-screened https://scratch.mit.edu/projects/editor/ | |
const stage = document.querySelector('[class^="stage_stage-bottom-wrapper"]') | |
const rect = stage.getBoundingClientRect(); | |
const pageHeight = document.documentElement.scrollHeight; | |
var leftCover = document.createElement('div'); | |
leftCover.setAttribute('style',` | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: ${rect.left}px; | |
height: ${pageHeight}px; | |
background-color: black; | |
z-index: 999999; | |
`) | |
document.body.appendChild(leftCover) | |
var topCover = document.createElement('div'); | |
topCover.setAttribute('style', ` | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: ${rect.top}px; | |
background-color: black; | |
z-index: 999999; | |
`) | |
document.body.appendChild(topCover) | |
var bottomCover = document.createElement('div'); | |
bottomCover.setAttribute('style', ` | |
position: absolute; | |
left: ${rect.left}px; | |
top: ${rect.bottom}px; | |
width: 100%; | |
height: ${pageHeight}px; | |
background-color: black; | |
z-index: 999999; | |
`) | |
document.body.appendChild(bottomCover) | |
var rightCover = document.createElement('div'); | |
bottomCover.setAttribute('style', ` | |
position: absolute; | |
left: ${rect.right}px; | |
top: 0; | |
width: 100%; | |
height: ${pageHeight}px; | |
background-color: black; | |
z-index: 999999; | |
`) | |
document.body.appendChild(rightCover) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment