Merge pull request #131 from heavygale/ui-domain

hostname ≠ ui-domain
Dieser Commit ist enthalten in:
André Peters 2019-02-08 20:57:39 +01:00 committet von GitHub
Commit 6d5085dc8b
Es konnte kein GPG-SchlĂĽssel zu dieser Signatur gefunden werden
GPG-SchlĂĽssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -3,12 +3,12 @@ if (window.location.href.indexOf('/client/') >= 0) {
function setCookie(name, value) { function setCookie(name, value) {
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + "; path=/"; document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + "; path=/";
} }
function getParameterByName(name) { function getParameterByName(name) {
var match = RegExp('[?#&]' + name + '=([^&]*)').exec(window.location.hash); var match = RegExp('[?#&]' + name + '=([^&]*)').exec(window.location.hash);
return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
} }
/* Store URL variables in cookies */ /* Store URL variables in cookies */
if (getParameterByName('host')) { if (getParameterByName('host')) {
setCookie("host", getParameterByName('host')); setCookie("host", getParameterByName('host'));
@ -21,6 +21,9 @@ if (window.location.href.indexOf('/client/') >= 0) {
if (getParameterByName('name')) { if (getParameterByName('name')) {
setCookie("name", getParameterByName('name')); setCookie("name", getParameterByName('name'));
} }
if (getParameterByName('ui')) {
setCookie("ui", getParameterByName('ui'));
}
if (getParameterByName('port')) { if (getParameterByName('port')) {
setCookie("port", getParameterByName('port')); setCookie("port", getParameterByName('port'));
} }
@ -49,7 +52,7 @@ if (window.location.href.indexOf('/client') >= 0) {
} }
return ""; return "";
} }
/* Hide variable fields if no values are available */ /* Hide variable fields if no values are available */
if (!getCookie('host')) { if (!getCookie('host')) {
Array.prototype.forEach.call(document.getElementsByClassName('client_variables_available'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_variables_available'), function(el) {
@ -60,23 +63,26 @@ if (window.location.href.indexOf('/client') >= 0) {
el.style.display = 'none'; el.style.display = 'none';
}); });
} }
/* Hide the TOC, which might contain hidden content */ /* Hide the TOC, which might contain hidden content */
Array.prototype.forEach.call(document.getElementsByClassName('md-sidebar--secondary'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('md-sidebar--secondary'), function(el) {
el.style.display = 'none'; el.style.display = 'none';
}); });
/* Substitute variables */ /* Substitute variables */
Array.prototype.forEach.call(document.getElementsByClassName('client_var_host'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_host'), function(el) {
el.innerText = getCookie('host'); el.innerText = getCookie('host');
}); });
Array.prototype.forEach.call(document.getElementsByClassName('client_var_link'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_link'), function(el) {
if (!getCookie('host')) { if (!getCookie('ui') && !getCookie('host')) {
el.href = '#'; el.href = '#';
} else if (getCookie('port') != '443') {
el.href = 'https://' + getCookie('host') + ':' + getCookie('port') + '/' + el.getAttribute("href");
} else { } else {
el.href = 'https://' + getCookie('host') + '/' + el.getAttribute("href"); var ui_domain = getCookie('ui') ? getCookie('ui') : getCookie('host');
if (getCookie('port') != '443') {
el.href = 'https://' + ui_domain + ':' + getCookie('port') + '/' + el.getAttribute("href");
} else {
el.href = 'https://' + ui_domain + '/' + el.getAttribute("href");
}
} }
}); });
Array.prototype.forEach.call(document.getElementsByClassName('client_var_email'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_email'), function(el) {
@ -90,7 +96,7 @@ if (window.location.href.indexOf('/client') >= 0) {
el.innerText = ':' + getCookie('port'); el.innerText = ':' + getCookie('port');
}); });
} }
/* Hide those sections that are not applicable because useOutlookForEAS is disabled or SOGo integrator is not available */ /* Hide those sections that are not applicable because useOutlookForEAS is disabled or SOGo integrator is not available */
if (getCookie('integrator')) { if (getCookie('integrator')) {
Array.prototype.forEach.call(document.getElementsByClassName('client_var_integrator_link'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_integrator_link'), function(el) {