Skip to content

Instantly share code, notes, and snippets.

@effervescentia
Last active December 7, 2022 05:49
Show Gist options
  • Save effervescentia/f0049180b5f8f894b477c8eb69fb0076 to your computer and use it in GitHub Desktop.
Save effervescentia/f0049180b5f8f894b477c8eb69fb0076 to your computer and use it in GitHub Desktop.
ChatGPT fullscreen script
// ==UserScript==
// @name ChatGPT fulscreen script
// @namespace effervescentia.chatgpt
// @version 0.1
// @description Adds a fullscreen button to ChatGPT to make screenshots easier to capture with browser's built in capture functions
// @author effervescentia
// @match https://chat.openai.com/chat
// @grant none
// @updateURL https://gist.github.com/effervescentia/f0049180b5f8f894b477c8eb69fb0076/raw/ee509ca6ee47788df2826fb86a5afa0798031928/chatgpt.user.js
// @downloadURL https://gist.github.com/effervescentia/f0049180b5f8f894b477c8eb69fb0076/raw/ee509ca6ee47788df2826fb86a5afa0798031928/chatgpt.user.js
// ==/UserScript==
(() => {
'use strict';
const next = document.querySelector('#__next');
let isFullscreen = false;
let isInitialized = false;
let parent;
let main;
const button = document.createElement('button');
Object.assign(button.style, {
position: 'fixed',
bottom: '10px',
left: '10px',
zIndex: 10,
backgroundColor: 'red',
color: 'white',
});
button.innerText = 'fullscreen';
button.addEventListener('click', () => {
if (!isInitialized) {
isInitialized = true;
main = document.querySelector('#__next main .items-center');
parent = main.parentElement;
}
function fullscreenChat() {
parent.removeChild(main);
document.body.appendChild(main);
next.style.display = 'none';
document.body.style.overflow = 'scroll';
}
function restoreChat() {
document.body.removeChild(main);
parent.appendChild(main);
document.body.style.overflow = '';
next.style.display = '';
}
if (isFullscreen) {
restoreChat();
} else {
fullscreenChat();
}
isFullscreen = !isFullscreen;
button.innerText = isFullscreen ? 'restore' : 'fullscreen';
});
document.body.appendChild(button);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment