From 48fae82958d3bddc0339c11fff8007164251304b Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Sat, 29 Jan 2022 19:07:28 +0100 Subject: [PATCH] Nav Translate Part 2 + mkdocs.yml rework --- docs/assets/css/extra.css | 17 ++++++ docs/assets/js/client.js | 112 ++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 28 ++++++++++ 3 files changed, 157 insertions(+) create mode 100644 docs/assets/css/extra.css create mode 100644 docs/assets/js/client.js diff --git a/docs/assets/css/extra.css b/docs/assets/css/extra.css new file mode 100644 index 000000000..ebe944222 --- /dev/null +++ b/docs/assets/css/extra.css @@ -0,0 +1,17 @@ +@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i'); +.md-nav { + font-size: 14px; + line-height: 1.4; +} +.md-typeset { + font-size: 14px; + line-height: 1.5; +} +body, input { + font-family: "Source Sans Pro", "Roboto","Helvetica Neue",Helvetica,Arial,sans-serif; + color: black; +} +code { + display: inline-block; + white-space: pre-wrap; +} \ No newline at end of file diff --git a/docs/assets/js/client.js b/docs/assets/js/client.js new file mode 100644 index 000000000..e8fdf1cf4 --- /dev/null +++ b/docs/assets/js/client.js @@ -0,0 +1,112 @@ +if (window.location.href.indexOf('/client/') >= 0) { + window.window.addEventListener('load', function () { + function setCookie(name, value) { + sessionStorage.setItem(name, value); + } + + function getParameterByName(name) { + var match = RegExp('[?#&]' + name + '=([^&]*)').exec(window.location.hash); + return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); + } + + /* Store URL variables in cookies */ + if (getParameterByName('host')) { + setCookie("host", getParameterByName('host')); + } + if (getParameterByName('email')) { + var email = getParameterByName('email'); + setCookie("email", email); + setCookie("domain", email.substring(email.indexOf('@') + 1)); + } + if (getParameterByName('name')) { + setCookie("name", getParameterByName('name')); + } + if (getParameterByName('ui')) { + setCookie("ui", getParameterByName('ui')); + } + if (getParameterByName('port')) { + setCookie("port", getParameterByName('port')); + } + if (getParameterByName('connector')) { + setCookie("connector", getParameterByName('connector')); + } + if (getParameterByName('outlookEAS')) { + setCookie("outlookEAS", getParameterByName('outlookEAS')); + } + }); +} + +if (window.location.href.indexOf('/client') >= 0) { + window.window.addEventListener('load', function () { + function getCookie(cn) { + return sessionStorage.getItem(cn); + } + + /* Hide variable fields if no values are available */ + if (!getCookie('host')) { + Array.prototype.forEach.call(document.getElementsByClassName('client_variables_available'), function(el) { + el.style.display = 'none'; + }); + } else { + Array.prototype.forEach.call(document.getElementsByClassName('client_variables_unavailable'), function(el) { + el.style.display = 'none'; + }); + } + + /* Hide the TOC, which might contain hidden content */ + Array.prototype.forEach.call(document.getElementsByClassName('md-sidebar--secondary'), function(el) { + el.style.display = 'none'; + }); + + /* Substitute variables */ + Array.prototype.forEach.call(document.getElementsByClassName('client_var_host'), function(el) { + el.innerText = getCookie('host'); + }); + Array.prototype.forEach.call(document.getElementsByClassName('client_var_link'), function(el) { + if (!getCookie('ui') && !getCookie('host')) { + el.href = '#'; + } else { + 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) { + el.innerText = getCookie('email'); + }); + Array.prototype.forEach.call(document.getElementsByClassName('client_var_name'), function(el) { + el.innerText = getCookie('name'); + }); + if (getCookie('port') != '443') { + Array.prototype.forEach.call(document.getElementsByClassName('client_var_port'), function(el) { + el.innerText = ':' + getCookie('port'); + }); + } + + /* Hide those sections that are not applicable because useOutlookForEAS is disabled or SOGo Connector is not available */ + if (getCookie('connector')) { + Array.prototype.forEach.call(document.getElementsByClassName('client_var_connector_link'), function(el) { + el.href = el.href.replace('__DOMAIN__', getCookie('domain')).replace('__VERSION__', getCookie('connector')); + }); + Array.prototype.forEach.call(document.getElementsByClassName('client_connector_disabled'), function(el) { + el.style.display = 'none'; + }); + } else if (getCookie('host')) { + Array.prototype.forEach.call(document.getElementsByClassName('client_connector_enabled'), function(el) { + el.style.display = 'none'; + }); + } + if (getCookie('outlookEAS') || !getCookie('host')) { + Array.prototype.forEach.call(document.getElementsByClassName('client_outlookEAS_disabled'), function(el) { + el.style.display = 'none'; + }); + } else { + Array.prototype.forEach.call(document.getElementsByClassName('client_outlookEAS_enabled'), function(el) { + el.style.display = 'none'; + }); + } + }); +} \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index f229420fb..2030c06a3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -66,6 +66,13 @@ plugins: 'Tagging' : 'Tagging (Markierungen)' 'Temporary email aliases' : 'Temporäre E-Mail-Aliase' 'Two-Factor Authentication' : 'Zwei-Faktoren-Authentifizierung' + 'Add trusted networks': 'Vertrauenswürdige Netzwerke hinzufügen' + 'Custom transport maps': 'Benutzerdefinierte Transportmaps' + 'Customize/Expand main.cf': 'main.cf anpassen/erweitern' + 'Disable Sender Addresses Verification': 'Überprüfung der Absenderadressen deaktivieren' + 'Max. message size (attachment size)': 'Maximale Nachrichtengröße (Größe des Anhangs)' + 'Statistics with pflogsumm': 'Statistik mit pflogsumm' + 'Whitelist IP in Postscreen': 'IP in Postscreen auf die Whitelist setzen' markdown_extensions: @@ -192,3 +199,24 @@ nav: - 'Nextcloud': 'third_party-nextcloud.md' - 'Portainer': 'third_party-portainer.md' - 'Roundcube': 'third_party-roundcube.md' +extra: + palette: + primary: "indigo" + accent: "orange" + social: + - icon: fontawesome/solid/globe-americas + link: https://mailcow.email + - icon: fontawesome/brands/github-alt + link: https://github.com/mailcow + - icon: fontawesome/brands/twitter + link: https://twitter.com/mailcow_email +extra_css: [ assets/css/extra.css ] +extra_javascript: [ assets/js/clients.js ] +plugins: + - search + - redirects: + redirect_maps: + # 'old': 'new' + 'u_e-mailpiler-integration.md': 'third_party-mailpiler_integration.md' + 'b_n_r_accidental_deletion.md': 'b_n_r-accidental_deletion.md' + 'debug-reset-tls.md': 'debug-reset_tls.md' \ No newline at end of file