(e)
| 179 | const downcheckIcon = buttonToDown.querySelector('.octicon-check') |
| 180 | let timeoutId = null |
| 181 | const copyHandler = (e) => { |
| 182 | if (timeoutId) { |
| 183 | return |
| 184 | } |
| 185 | e.preventDefault() |
| 186 | const rawUrl = rawButton.href |
| 187 | GM_xmlhttpRequest({ |
| 188 | method: 'GET', |
| 189 | url: rawUrl, |
| 190 | onload: function (response) { |
| 191 | if (response.status === 200) { |
| 192 | navigator.clipboard.writeText(response.responseText).then(() => { |
| 193 | copyIcon.style.display = 'none' |
| 194 | checkIcon.style.display = 'inline-block' |
| 195 | timeoutId = setTimeout(() => { |
| 196 | copyIcon.style.display = 'inline-block' |
| 197 | checkIcon.style.display = 'none' |
| 198 | timeoutId = null |
| 199 | }, 500) |
| 200 | }).catch(err => { |
| 201 | console.error('Failed to copy text: ', err) |
| 202 | }) |
| 203 | } |
| 204 | }, |
| 205 | onerror: function (error) { |
| 206 | timeoutId = null |
| 207 | } |
| 208 | }) |
| 209 | } |
| 210 | const downHandler = (e, element) => { |
| 211 | if (timeoutId) { |
| 212 | return |
nothing calls this directly
no outgoing calls
no test coverage detected