Greasy Fork is available in English.
Expand the width of the page
当前为
// ==UserScript==
// @name Expand-Gpt
// @namespace https://github.com/neokyuubi/expand-chatgpt
// @version 0.0.6
// @description Expand the width of the page
// @author Neokyuubi
// @match https://chat.openai.com/*
// @match https://chatgpt.com/c/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant none
// @require https://code.jquery.com/jquery-3.6.0.min.js
// ==/UserScript==
(function() {
'use strict';
$(document).ready(function() {
// Function to update max-width of elements
function updateMaxWidth() {
$('[class*="xl:max-w-[48rem]"]').css('max-width', '100rem');
$('[class*="max-w-[90%]"]').css('width', '100%');
}
// Initial update
updateMaxWidth();
// Create a MutationObserver to watch for added nodes
const observer = new MutationObserver(function(mutationsList) {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
// Check added nodes for the target class
for (const node of mutation.addedNodes) { // max-w-[90%]
if ($(node).is('[class*="xl:max-w-[48rem]"]') || $(node).find('[class*="xl:max-w-[48rem]"]').length > 0) {
updateMaxWidth();
}
if ($(node).is('[class*="max-w-[90%]"]') || $(node).find('[class*="max-w-[90%]"]').length > 0) {
updateMaxWidth();
}
}
}
}
});
// Start observing the document body for added nodes
observer.observe(document.body, { childList: true, subtree: true });
});
})();