diff --git a/data/conf/sogo/custom-sogo.js b/data/conf/sogo/custom-sogo.js
index 44afa2998..0f1d5d342 100644
--- a/data/conf/sogo/custom-sogo.js
+++ b/data/conf/sogo/custom-sogo.js
@@ -6,42 +6,48 @@ document.addEventListener('DOMContentLoaded', function () {
}
angularReady = false;
- // Wait for the Angular components to be initialized
- function waitForAngularComponents(callback) {
- const targetNode = document.body;
+ function observe() {
+ angularReady = toolbarExists();
+ if (angularReady && !mcElementsExists()) addMCElements();
const observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (mutation.addedNodes.length > 0) {
- const toolbarElement = document.body.querySelector('md-toolbar');
- if (toolbarElement) {
- observer.disconnect();
- callback();
- }
+ if (!angularReady) {
+ mutations.forEach(function(mutation) {
+ if (mutation.addedNodes.length > 0) angularReady = toolbarExists();
+ });
+ } else if (angularReady && !mcElementsExists()) {
+ addMCElements();
}
- });
});
+ const targetNode = document.body;
const config = { childList: true, subtree: true };
observer.observe(targetNode, config);
}
+ function toolbarExists() {
+ const toolbarElement = document.body.querySelector('md-toolbar');
+ if (toolbarElement)
+ return true;
+ else
+ return false;
+ }
+ function mcElementsExists() {
+ if (document.getElementById("mc_logout"))
+ return true;
+ else
+ return false;
+ }
+ function addMCElements() {
+ const toolbarElement = document.body.querySelector('.md-toolbar-tools.sg-toolbar-group-last.layout-align-end-center.layout-row');
+ var htmlCode = '' +
+ '