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

Function observeCodeBlocks

chatgpt-code-tools/chatgpt-code-tools.user.js:571–577  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

569
570 // Function to observe code blocks and add buttons
571 const observeCodeBlocks = () => {
572 const codeBlocks = document.querySelectorAll('pre:not(.processed)')
573 codeBlocks.forEach(block => {
574 addButtonsToCodeBlock(block)
575 block.classList.add('processed')
576 })
577 }
578
579 // Mutation observer to detect new code blocks added dynamically
580 const observer = new MutationObserver(observeCodeBlocks)

Callers 1

Calls 1

addButtonsToCodeBlockFunction · 0.85

Tested by

no test coverage detected