MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / setupCopyButtons

Function setupCopyButtons

codeclash/viewer/static/js/clipboard.js:125–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123
124// Setup copy and download button event listeners
125function setupCopyButtons() {
126 // Add event listeners to all copy path buttons
127 document
128 .querySelectorAll(".copy-path-btn, .copy-path-btn-small")
129 .forEach((button) => {
130 button.addEventListener("click", function (e) {
131 e.preventDefault();
132 e.stopPropagation();
133
134 const path = this.getAttribute("data-path");
135 if (path) {
136 copyToClipboard(path, this);
137 } else {
138 console.error("No path found on button:", this);
139 }
140 });
141 });
142
143 // Add event listeners to AWS command copy buttons
144 document.querySelectorAll(".copy-aws-command-btn").forEach((button) => {
145 button.addEventListener("click", function (e) {
146 e.preventDefault();
147 e.stopPropagation();
148
149 // Get the AWS command from the code element next to this button
150 const codeElement = this.parentElement.querySelector(".folder-path");
151 if (codeElement) {
152 const command = codeElement.textContent.trim();
153 copyToClipboard(command, this);
154 } else {
155 console.error("No AWS command found near button:", this);
156 }
157 });
158 });
159}
160
161// Setup download button event listeners
162function setupDownloadButtons() {

Callers 1

renderMessagesFunction · 0.85

Calls 1

copyToClipboardFunction · 0.70

Tested by

no test coverage detected