Skip to content

Instantly share code, notes, and snippets.

@dlech
Last active July 26, 2023 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlech/f60782358c074668f23d44a5c16b58c1 to your computer and use it in GitHub Desktop.
Save dlech/f60782358c074668f23d44a5c16b58c1 to your computer and use it in GitHub Desktop.
Pybricks Code Full Screen Editor TamperMonkey Script
// ==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