From d1345cc2b853f3370d0ab2c990d55b5d90c84ebd Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 19 Feb 2026 21:59:44 -0500 Subject: [PATCH] Removed logging and only run on issue view --- assets/javascripts/application.js | 41 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/assets/javascripts/application.js b/assets/javascripts/application.js index 75a8a90..3356e24 100644 --- a/assets/javascripts/application.js +++ b/assets/javascripts/application.js @@ -1,26 +1,25 @@ $(function() { + const regex = /^\/issues\/\d+/; + if (regex.test(window.location.pathname)) { + const firstElement = document.getElementsByClassName('int_cf cf_4 attribute')[0].children[1]; + if (firstElement) { // Check if the element exists + firstElement.addEventListener('click', function() { + try { + const text = firstElement.innerText; + navigator.clipboard.writeText(text); + + firstElement.innerHTML = "Copied!"; + firstElement.style.color = "#4CAF50"; // Turn green - const firstElement = document.getElementsByClassName('int_cf cf_4 attribute')[0].children[1]; - console.log(firstElement); - if (firstElement) { // Check if the element exists - firstElement.addEventListener('click', function() { - console.log('The first element was clicked!'); - try { - const text = firstElement.innerText; - console.log(text); - navigator.clipboard.writeText(text); - - firstElement.innerHTML = "Copied!"; - firstElement.style.color = "#4CAF50"; // Turn green + setTimeout(() => { + firstElement.innerText = text; + firstElement.style.color = ""; + }, 2000); - setTimeout(() => { - firstElement.innerText = text; - firstElement.style.color = ""; - }, 2000); - - } catch (err) { - console.error('Unable to copy', err); - } - }); + } catch (err) { + console.error('Unable to copy', err); + } + }); + } } });