Last active
July 26, 2023 17:13
Pybricks Code Full Screen Editor TamperMonkey Script
This file contains hidden or 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
// ==UserScript== | |
// @name Pybricks Code Full Screen Editor | |
// @namespace https://pybricks.com/tampermonkey/full-screen-editor | |
// @version 1.0.0 | |
// @description Full screen text editor for Pybricks Code. | |
// @author David Lechner | |
// @match https://code.pybricks.com | |
// @match https://beta.pybricks.com | |
// @icon https://pybricks.com/favion.ico | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const requestFullScreen = () => { | |
const editors = document.getElementsByClassName('pb-editor'); | |
console.debug("editors", editors); | |
const editorDiv = editors[0]; | |
editorDiv.requestFullscreen(); | |
}; | |
const fullscreenButton = document.createElement('button'); | |
fullscreenButton.classList.add('bp4-button', 'bp5-button'); | |
fullscreenButton.classList.add('bp4-intent-primary', 'bp5-intent-primary'); | |
fullscreenButton.classList.add('pb-toolbar-action-button'); | |
fullscreenButton.setHTML('FS'); | |
fullscreenButton.addEventListener('click', requestFullScreen); | |
const sponsorButton = document.getElementById('pb-toolbar-sponsor-button'); | |
sponsorButton.parentElement.insertBefore(fullscreenButton, sponsorButton); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment