Removed logging and only run on issue view

This commit is contained in:
2026-02-19 21:59:44 -05:00
parent 4ebcace14c
commit d1345cc2b8

View File

@@ -1,26 +1,25 @@
$(function() { $(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);
const firstElement = document.getElementsByClassName('int_cf cf_4 attribute')[0].children[1]; firstElement.innerHTML = "<b>Copied!</b>";
console.log(firstElement); firstElement.style.color = "#4CAF50"; // Turn green
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 = "<b>Copied!</b>"; setTimeout(() => {
firstElement.style.color = "#4CAF50"; // Turn green firstElement.innerText = text;
firstElement.style.color = "";
}, 2000);
setTimeout(() => { } catch (err) {
firstElement.innerText = text; console.error('Unable to copy', err);
firstElement.style.color = ""; }
}, 2000); });
}
} catch (err) {
console.error('Unable to copy', err);
}
});
} }
}); });