Skip to content

Instantly share code, notes, and snippets.

@yjsoon
Last active May 17, 2023 00:07
Show Gist options
  • Save yjsoon/09761c74f8a8a8dfd7d10b4b9b147055 to your computer and use it in GitHub Desktop.
Save yjsoon/09761c74f8a8a8dfd7d10b4b9b147055 to your computer and use it in GitHub Desktop.
JS inject to hide ChatGPT sidebar, with button to toggle back
// should load after DOM, e.g. document.addEventListener('DOMContentLoaded', function() { }
const targetDiv = document.querySelector('div.dark.flex-shrink-0.overflow-x-hidden.bg-gray-900');
if (targetDiv) {
targetDiv.style.display = 'none';
const button = document.createElement("button")
button.innerHTML = "≡"
button.style.position = "absolute"
button.style.left = "10px"
button.style.top = "10px"
button.onclick = () => {
if (targetDiv.style.display == 'none') {
targetDiv.style.display = 'flex'
button.style.left = "280px"
}
else if (targetDiv.style.display == 'flex') {
targetDiv.style.display = 'none'
button.style.left = "10px"
}
}
document.body.appendChild(button)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment