|
3 | 3 | // @namespace Violentmonkey Scripts |
4 | 4 | // @match https://collaboration.dataminer.services/* |
5 | 5 | // @grant none |
6 | | -// @version 1.1.1 |
| 6 | +// @version 1.1.2 |
7 | 7 | // @author JKE, TCR |
8 | 8 | // @description 28/3/2024, 17:26:21 |
9 | 9 | // ==/UserScript== |
|
26 | 26 | function buttonClickFunction() { |
27 | 27 | // Find the input field with id "taskTitle" |
28 | 28 | const taskTitleInput = document.getElementById('taskTitle'); |
| 29 | + const releaseNoteTitle = document.getElementById('releaseNoteTitle'); |
29 | 30 |
|
30 | 31 | if (taskTitleInput) { |
31 | 32 | // Get the current URL |
|
41 | 42 | } |
42 | 43 |
|
43 | 44 | // 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 + ')'); |
45 | 46 | } else { |
46 | | - alert('URL could not be identified.'); |
| 47 | + alert('Task URL could not be identified.'); |
47 | 48 | } |
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!'); |
50 | 70 | } |
51 | 71 | } |
52 | 72 |
|
|
0 commit comments