-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatgpt-style-changes.user.js
More file actions
56 lines (49 loc) · 1.65 KB
/
chatgpt-style-changes.user.js
File metadata and controls
56 lines (49 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// ==UserScript==
// @name ChatGPT Style Changes
// @namespace nisc
// @version 2025.09.25-B
// @description Various style changes to the ChatGPT UI
// @homepageURL https://github.com/nisc/chatgpt-userscripts/
// @downloadURL https://raw.githubusercontent.com/nisc/chatgpt-userscripts/main/chatgpt-style-changes.user.js
// @author nisc
// @match https://chatgpt.com/*
// @icon https://chatgpt.com/favicon.ico
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Configuration
const CONFIG = {
customProperties: {
'--user-chat-width': '85%',
'--sidebar-width': '200px'
},
styles: `
#prompt-textarea {
max-height: 160px;
overflow-y: auto;
}
`,
reapplyDelay: 100
};
function applyStyles() {
// Apply CSS custom properties
Object.entries(CONFIG.customProperties).forEach(([property, value]) => {
document.documentElement.style.setProperty(property, value);
});
// Apply CSS styles
document.getElementById('chatgpt-style-changes')?.remove();
const style = Object.assign(document.createElement('style'), {
id: 'chatgpt-style-changes',
textContent: CONFIG.styles
});
document.head.appendChild(style);
}
// Apply styles immediately and on changes
applyStyles();
const reapply = () => setTimeout(applyStyles, CONFIG.reapplyDelay);
// Reapply on DOM changes and visibility changes
new MutationObserver(() => reapply()).observe(document.body, { childList: true, subtree: true });
document.addEventListener('visibilitychange', () => !document.hidden && reapply());
})();