diff --git a/topdesk.user.js b/topdesk.user.js
index daa1657..cd476e3 100644
--- a/topdesk.user.js
+++ b/topdesk.user.js
@@ -31,7 +31,7 @@
'text/plain': textBlob
})
];
-
+
navigator.clipboard.write(data).then(() => {
console.log(html ? 'HTML and text copied to clipboard' : 'Text copied to clipboard');
}).catch(err => {
@@ -64,14 +64,15 @@
}, 900);
}
- // Find the first div tag and modify its id
+ // Find the first div tag
const firstDiv = document.querySelector('div');
+
if (firstDiv && firstDiv.id) {
const modifiedId = firstDiv.id.slice(0, -1) + '8';
const targetDiv = document.getElementById(modifiedId);
- targetDiv.style.cursor = "copy";
- if (targetDiv) {
+ if (targetDiv) {
+ targetDiv.style.cursor = "copy";
targetDiv.addEventListener('click', function() {
const content = targetDiv.textContent || targetDiv.innerText;
let newContent = content;
@@ -82,16 +83,16 @@
return `${match}`;
});
}
-
+
// Replace change matches
if (changeRegex.test(content)) {
newContent = newContent.replace(changeRegex, (match) => {
return `${match}`;
});
}
-
+
// Only update and copy if there were changes
- if (newContent !== content) {
+ if (newContent !== content) {
// Copy the updated content to clipboard
copyToClipboard(newContent, content);
} else {