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() {
(function($) {
$(function() {
(function($) {
$(function() {
let otrs_link = document.querySelector(".field-otrs > div > p.url > a").href;
console.log(otrs_link);
alert(otrs_link);
// let linkElement = document.querySelector(".field-otrs > div > p.url > a");
let linkElement = document.querySelector(".field-otrs p.url a");
if (!linkElement) {
console.error("OTRS-Link not found!");
return;
}
let otrs_link_pret = otrs_link.replace(/%3B/g, ";");
let otrs_link_pretty = otrs_link_pret.replace(/%3D/g, "=");
let otrs_link = linkElement.href;
//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);
});