Skip to content

Instantly share code, notes, and snippets.

@zudsniper
Created February 1, 2024 04:27
Show Gist options
  • Save zudsniper/989ad05b7f4203bab7a2b9bfe2f6f552 to your computer and use it in GitHub Desktop.
Save zudsniper/989ad05b7f4203bab7a2b9bfe2f6f552 to your computer and use it in GitHub Desktop.
πŸ”› widen it! author is __nickerbocker__ on reddit
// ==UserScript==
// @name OpenAI Chat Full Width Adjustment for All Messages
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Adjust the max-width of all message elements on OpenAI Chat website, for both user and ChatGPT messages
// @author __nickerbocker__
// @match https://chat.openai.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function adjustWidth() {
// Select all message elements using a more inclusive selector
var elements = document.querySelectorAll('.flex.flex-1.text-base.mx-auto.gap-3.md\\:px-5.lg\\:px-1.xl\\:px-5');
elements.forEach(function(element) {
// Adjust the max-width property with !important to override media queries
element.style.cssText = 'max-width: 100% !important;';
});
console.log(elements.length + " chat elements adjusted.");
}
// Adjust the width of all messages on page load
window.addEventListener('load', adjustWidth);
// Continuously adjust the width of new messages
setInterval(adjustWidth, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment