2
1
Fork 0

Fix otrs links correctly

This commit is contained in:
Tobias Herre 2025-02-19 12:59:42 +00:00
parent 5b7838334e
commit fc2b748664
1 changed files with 20 additions and 14 deletions

View File

@ -1,19 +1,25 @@
window.addEventListener("load", function() { window.addEventListener("load", function() {
(function($) { (function($) {
$(function() { $(function() {
let otrs_link = document.querySelector(".field-otrs > div > p.url > a").href; // let linkElement = document.querySelector(".field-otrs > div > p.url > a");
console.log(otrs_link); let linkElement = document.querySelector(".field-otrs p.url a");
alert(otrs_link); if (!linkElement) {
console.error("OTRS-Link not found!");
return;
}
let otrs_link_pret = otrs_link.replace(/%3B/g, ";"); let otrs_link = linkElement.href;
let otrs_link_pretty = otrs_link_pret.replace(/%3D/g, "="); //console.log("Original link:", otrs_link);
//alert("Original link: " + otrs_link);
console.log(otrs_link_pretty); // Ersetze %3B mit ; und %3D mit =
let otrs_link_pretty = otrs_link.replace(/%3B/g, ";").replace(/%3D/g, "=");
document.querySelector(".field-otrs > div > p.url > a").href = otrs_link_pretty;
//console.log("Modified link:", otrs_link_pretty);
linkElement.href = otrs_link_pretty;
}); });
})(django.jQuery); })(django.jQuery);
}); });