diff --git a/scripts/topdesk/topdesk.user.js b/scripts/topdesk/topdesk.user.js index 6778513..53dec96 100644 --- a/scripts/topdesk/topdesk.user.js +++ b/scripts/topdesk/topdesk.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name TopDesk - Copy Issuenumber // @namespace https://git.ntnu.no/M365-Drift/MonkeyMagic/ -// @version 1.2.3 +// @version 1.2.4 // @author Øyvind Nilsen (on@ntnu.no) // @description Copies the issue number if you click it in TopDesk or with the hotkey `ctrl` + `alt` + `c`. It copies plain text and a clickable HTML version. So if the place you paste supports HTML, you can paste a clickable link to the issue. // @match https://hjelp.ntnu.no/tas/secure/mango/window/* @@ -16,8 +16,8 @@ 'use strict'; // Regex patterns - const incidentRegex = /(NTNU[0-9]{7})/gi; - const changeRegex = /(NTNU_C[0-9]{7})/gi; + const incidentRegex = /(NTNU[0-9]{7})/i; + const changeRegex = /(NTNU_C[0-9]{7})/i; //const issueRegex = /(NTNU(?:_C)?[0-9]{7})/gi; // Function to copy text to clipboard @@ -100,14 +100,14 @@ // Replace incident matches if (incidentRegex.test(content)) { - newContent = newContent.replace(incidentRegex, (match) => { + newContent = newContent.replace(/(NTNU[0-9]{7})/gi, (match) => { return `${match}`; }); } // Replace change matches if (changeRegex.test(content)) { - newContent = newContent.replace(changeRegex, (match) => { + newContent = newContent.replace(/(NTNU_C[0-9]{7})/gi, (match) => { return `${match}`; }); }