Skip to content

Commit 0d8f790

Browse files
authored
Update main.js
1 parent 8373e1c commit 0d8f790

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

main.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @namespace Violentmonkey Scripts
44
// @match https://collaboration.dataminer.services/*
55
// @grant none
6-
// @version 1.1.1
6+
// @version 1.1.2
77
// @author JKE, TCR
88
// @description 28/3/2024, 17:26:21
99
// ==/UserScript==
@@ -26,6 +26,7 @@
2626
function buttonClickFunction() {
2727
// Find the input field with id "taskTitle"
2828
const taskTitleInput = document.getElementById('taskTitle');
29+
const releaseNoteTitle = document.getElementById('releaseNoteTitle');
2930

3031
if (taskTitleInput) {
3132
// Get the current URL
@@ -41,12 +42,31 @@
4142
}
4243

4344
// Copy the extracted number to the clipboard
44-
copyToClipboard('<a href="https://collaboration.dataminer.services/task/' + number + '">' + taskTitleInput.value + '</a> (' + number + ')');
45+
copyToClipboard('<a href="https://collaboration.dataminer.services/task/' + number + '">' + taskTitleInput.value + '</a> (task ' + number + ')');
4546
} else {
46-
alert('URL could not be identified.');
47+
alert('Task URL could not be identified.');
4748
}
48-
} else {
49-
alert('Input field with id "taskTitle" not found!');
49+
} else if (releaseNoteTitle) {
50+
// Get the current URL
51+
const currentUrl = window.location.href;
52+
53+
if (currentUrl) {
54+
// Extract the number from the URL
55+
let number = currentUrl.substring(currentUrl.lastIndexOf('/') + 1);
56+
const queryIndex = number.indexOf('?');
57+
58+
if (queryIndex != -1) {
59+
number = number.substring(0, queryIndex);
60+
}
61+
62+
// Copy the extracted number to the clipboard
63+
copyToClipboard('<a href="https://collaboration.dataminer.services/releasenotes/' + number + '">' + releaseNoteTitle.value + '</a> (RN ' + number + ')');
64+
} else {
65+
alert('RN URL could not be identified.');
66+
}
67+
} else
68+
{
69+
alert('Input field with id "taskTitle" or "releaseNoteTitle" not found!');
5070
}
5171
}
5272

0 commit comments

Comments
 (0)