Last active
December 7, 2022 05:49
-
-
Save effervescentia/f0049180b5f8f894b477c8eb69fb0076 to your computer and use it in GitHub Desktop.
ChatGPT fullscreen script
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
// ==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