Greasy Fork is available in English.
尝试在每次页面加载时更改特定元素的样式
当前为
// ==UserScript==
// @name chatgpt全屏样式
// @namespace http://tampermonkey.net/
// @version 1.1
// @description 尝试在每次页面加载时更改特定元素的样式
// @author bruceWang
// @match https://chat.openai.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function modifyStyle() {
var bodyElements = document.querySelectorAll('.flex.flex-1.gap-4.text-base.mx-auto');
var buttonElements = document.querySelectorAll('.stretch.mx-2.flex.flex-row.gap-3');
if (bodyElements) {
// 修改样式
bodyElements.forEach(item =>{
item.style.maxWidth = 'none';
})
}
if (buttonElements) {
// 修改样式
buttonElements.forEach(item =>{
item.style.maxWidth = '90%';
})
}
}
var observer = new MutationObserver(function(mutations) {
if(mutations.length > 0){
modifyStyle();
}
});
observer.observe(document.body, { childList: true, subtree: true });
})();