MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / foldLongMessages

Function foldLongMessages

chatgpt-plus/chatgpt-plus.user.js:127–146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125 window.addEventListener('load', function () {
126 // Function to fold long messages
127 function foldLongMessages() {
128 const messages = document.querySelectorAll('div[data-message-author-role="user"]')
129 messages.forEach(message => {
130 if (message.innerText.split('\n').length > 3) {
131 message.style.overflow = 'hidden'
132 message.style.height = '100px' // Adjust as needed
133 message.style.cursor = 'pointer'
134 // Click to expand
135 message.addEventListener('click', function () {
136 if (message.style.overflow === 'hidden') {
137 message.style.overflow = 'visible'
138 message.style.height = 'auto'
139 } else {
140 message.style.overflow = 'hidden'
141 message.style.height = '100px'
142 }
143 })
144 }
145 })
146 }
147 function handleKeyPress(event) {
148 const textarea = document.getElementById('prompt-textarea')
149 if (textarea && event.target === textarea && event.key === 'Enter' && !event.shiftKey) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected