forked from beba/foerderbarometer
Fix otrs links correctly
This commit is contained in:
parent
5b7838334e
commit
fc2b748664
|
@ -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);
|
|
||||||
|
|
||||||
document.querySelector(".field-otrs > div > p.url > a").href = otrs_link_pretty;
|
|
||||||
|
|
||||||
|
|
||||||
});
|
// Ersetze %3B mit ; und %3D mit =
|
||||||
})(django.jQuery);
|
let otrs_link_pretty = otrs_link.replace(/%3B/g, ";").replace(/%3D/g, "=");
|
||||||
|
|
||||||
|
//console.log("Modified link:", otrs_link_pretty);
|
||||||
|
linkElement.href = otrs_link_pretty;
|
||||||
|
|
||||||
|
});
|
||||||
|
})(django.jQuery);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue