// ==UserScript== // @name Wide Chat — Claude / ChatGPT / Gemini // @namespace https://github.com/Rayce185 // @version 1.0.0 // @description Removes max-width constraints on AI chat interfaces for full-width conversations // @author Ray DiRenzo // @license MIT // @match https://claude.ai/* // @match https://chat.openai.com/* // @match https://chatgpt.com/* // @match https://gemini.google.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @run-at document-start // @homepageURL https://github.com/Rayce185/ai-chat-widener // @supportURL https://github.com/Rayce185/ai-chat-widener/issues // ==/UserScript== (function() { 'use strict'; const WIDTH = '98%'; function injectCSS(css) { const style = document.createElement('style'); style.textContent = css; (document.head || document.documentElement).appendChild(style); } function runWhenReady(selector, callback, maxAttempts = 34) { let attempts = 0; (function tryNow() { const elem = document.querySelector(selector); if (elem) { callback(elem); } else if (++attempts < maxAttempts) { setTimeout(tryNow, 250 * Math.pow(1.1, attempts)); } else { console.warn(`[Wide Chat] Gave up after ${attempts} attempts — selector not found: ${selector}`); } })(); } function applyWidth(getElements) { for (const el of getElements()) { el.style.setProperty('max-width', WIDTH, 'important'); } } function observeAndApply(getElements) { applyWidth(getElements); new MutationObserver((mutations) => { if (mutations.some(m => m.type === 'childList')) { applyWidth(getElements); } }).observe(document.documentElement, { childList: true, subtree: true }); } const hostname = window.location.hostname; if (hostname === 'claude.ai') { // CSS injection — no DOM timing issues, survives SPA navigation injectCSS(` div[data-test-render-count], div[data-test-render-count] > div, div[data-is-streaming], div[data-is-streaming] > div, [class*="max-w-"] { max-width: ${WIDTH} !important; } `); } else if (hostname === 'chat.openai.com' || hostname === 'chatgpt.com') { const getElements = () => document.querySelectorAll('.text-base, .text-base > div:first-child'); runWhenReady('.text-base', () => observeAndApply(getElements)); } else if (hostname === 'gemini.google.com') { const getElements = () => document.querySelectorAll('.conversation-container'); runWhenReady('.conversation-container', () => observeAndApply(getElements)); } })();