fbretel / OTRS ZoomExpanded

// ==UserScript==
// @id             OTRS_ZoomExpanded
// @name           OTRS ZoomExpanded
// @version        1.0
// @namespace      cc.in2p3.fr
// @author         Foudil BRÉTEL
// @description    Always show all articles on a ticket.
// @include        https://cc-usersupport.in2p3.fr/otrs/index.pl?Action=AgentTicketZoom*
// @run-at         document-start
// ==/UserScript==

const PARAM_VAL = "ZoomExpand";

var url = window.location.href;
var idxParam = url.indexOf(PARAM_VAL);

if (idxParam > -1){
    var paramVal = url.substr(idxParam + PARAM_VAL.length + 1, 1);
    if (paramVal !== "1") 
        window.location.replace(url.replace(PARAM_VAL + '=' + paramVal, PARAM_VAL + '=1'));
}
else {
    window.location.replace(url + ';' + PARAM_VAL + '=1');
}