Skip to content

Instantly share code, notes, and snippets.

@thibault-ketterer
Created January 18, 2024 10:19
Show Gist options
  • Save thibault-ketterer/18b9d60db179aeb0fc1efca6539c7668 to your computer and use it in GitHub Desktop.
Save thibault-ketterer/18b9d60db179aeb0fc1efca6539c7668 to your computer and use it in GitHub Desktop.
make chat gpt wider
// ==UserScript==
// @name Makes ChatGPT Conversations wider
// @namespace [http://tampermonkey.net/ ](http://tampermonkey.net/)
// @version 2.0
// @description Makes ChatGPT Conversations wider
// @author reach4thelasers. Thibault Ketterer
// @match https://chat.openai.com/*
// @grant none
// @icon [https://www.google.com/s2/favicons?sz=64&domain=chat.openai.com ](https://www.google.com/s2/favicons?sz=64&domain=chat.openai.com)
// ==/UserScript==
(function() {
//use strict;
function makeWider(element) {
console.log("element", element);
const classesToRemove = [
'lg:max-w-[38rem]',
'md:max-w-3xl',
'lg:max-w-[40rem]',
'xl:max-w-[48rem]',
// 'xl:max-w-3xl',
// 'md:max-w-2xl',
// 'md:max-w-3xl',
// 'md:px-5',
// 'lg:px-1',
'xl:px-5',
// dialogs
'max-w-lg',
'max-h-[75vh]'
];
element.classList.remove(...classesToRemove);
}
function findAndMakeWider() {
const flexDivs = document.querySelectorAll('div.flex.flex-1');
//flex flex-1 text-base mx-auto gap-3 md:px-5 lg:px-1 xl:px-5 lg:max-w-[40rem] xl:max-w-[48rem] group final-completion
//flex flex-1 text-base mx-auto gap-3 group final-completion
flexDivs.forEach(makeWider);
const diagDivs = document.querySelectorAll('div[role="dialog"]');
diagDivs.forEach(makeWider);
}
function observeDOM() {
const targetNode = document.body;
const config = { childList: true, subtree: true };
const observer = new MutationObserver(function(mutationsList) {
for (let mutation of mutationsList) {
if (mutation.addedNodes.length > 0) {
findAndMakeWider();
}
}
});
observer.observe(targetNode, config);
}
observeDOM();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment