-
Notifications
You must be signed in to change notification settings - Fork 0
/
submenu.js
147 lines (134 loc) · 5.78 KB
/
submenu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Ext.namespace('Zarafa.plugins.fehler');
Zarafa.plugins.fehler.SP = Ext.extend(Zarafa.core.Plugin, {
initPlugin : function()
{
this.registerInsertionPoint('main.maintabbar.left', this.SPButton, this);
},
SPButton:function()
{
return {
text: this.getDisplayName(),
tabOrderIndex: 9,
handler : this.onClick_SPButton,
context: this.getName()
};
},
onClick_SPButton: function (btn) {
//Add links and description for your menu here into the array
var menuitems = [
"/client/resources/medienausleihe/medienausleihe.php", "Medienausleihe",
"/client/resources/fehler/fehler_unw.php", "Fehlermeldung"
];
window.addEventListener("click", function(event){
if(document.getElementById("breakout-1") && event.target.innerText != "FORMULARE"){
if (document.getElementById("breakout-1").style.display === "block") {
var op = 1; // initial opacity
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
document.getElementById("breakout-1").style.display = 'none';
}
document.getElementById("breakout-1").style.opacity = op;
document.getElementById("breakout-1").style.filter = 'alpha(opacity=' + op * 100 + ')';
op -= op * 0.1;
}, 10);
}
}
});
window.addEventListener("resize", function(event) {
var offsets1 = document.getElementById('ext-comp-1008').getBoundingClientRect();
var offsets2 = document.getElementById('zarafa-mainmenu').getBoundingClientRect();
var fontsize = window.getComputedStyle(document.getElementById('ext-gen293'),null).getPropertyValue('font-size');
var height = parseFloat (fontsize)+19;
fontsize = height - 17 + "px";
divsize = height - 8 + "px";
var left = offsets1.left;
document.getElementById("breakout-1").style.top = height+"px";
document.getElementById("breakout-1").style.left = left+"px";
document.getElementById("breakout-1").style.fontSize = divsize;
for (i = 0; i < menuitems.length; i+=2) {
document.getElementById("breakoutmenulink"+i).setAttribute("style", "text-decoration: none; color: rgb(255, 255, 255);opacity: 0.7; font-size : "+ fontsize +" !important;");
}
});
var offsets1 = document.getElementById('ext-comp-1008').getBoundingClientRect();
var offsets2 = document.getElementById('zarafa-mainmenu').getBoundingClientRect();
var fontsize = window.getComputedStyle(document.getElementById('ext-gen293'),null).getPropertyValue('font-size');
var height = parseFloat (fontsize)+19;
fontsize = height - 17 + "px";
divsize = height -8 + "px";
var left = offsets1.left;
if(!document.getElementById("breakout-1")){
var div = document.createElement("div");
div.style.top = height+"px";
div.style.left = left+"px";
div.style.fontSize = divsize;
div.style.marginBottom = "-100%";
div.style.position = "fixed";
div.style.display = "block";
var bgcolor = window.getComputedStyle(document.getElementById('zarafa-mainmenu'),null).getPropertyValue('border-top-color');
if(bgcolor=="rgb(230, 230, 230)" || bgcolor == "rgb(207, 210, 220)"){
bgcolor = "rgb(56, 112, 190)";
}
div.style.backgroundColor = bgcolor;
div.style.borderBottom = "thick solid "+bgcolor;
div.className = "x-toolbar-cell";
div.setAttribute("id", "breakout-1");
div.style.opacity = 0;
div.style.filter = 'alpha(opacity=0)';
var menuitemshtml = "";
for (i = 0; i < menuitems.length; i+=2) {
menuitemshtml += ' <a id="breakoutmenulink'+i+'" href="'+ menuitems [i] +'" style="text-decoration: none; color: rgb(255, 255, 255);opacity: 0.7; font-size : '+ fontsize + ' !important;" target="_blank" rel="noopener">'+ menuitems [i+1] +'</a> <br>';
}
div.innerHTML = menuitemshtml;
document.getElementById("ext-gen3").appendChild(div);
var op = 0.01; // initial opacity
var timer = setInterval(function () {
if (op >= 0.9){
clearInterval(timer);
}
document.getElementById("breakout-1").style.opacity = op;
document.getElementById("breakout-1").style.filter = 'alpha(opacity=' + op * 100 + ')';
op += op * 0.2;
}, 2);
} else {
document.getElementById("breakout-1").style.top = height+"px";
document.getElementById("breakout-1").style.left = left+"px";
document.getElementById("breakout-1").style.fontSize = divsize;
for (i = 0; i < menuitems.length; i+=2) {
document.getElementById("breakoutmenulink"+i).setAttribute("style", "text-decoration: none; color: rgb(255, 255, 255);opacity: 0.7; font-size : "+ fontsize +" !important;");
}
if (document.getElementById("breakout-1").style.display === "none") {
document.getElementById("breakout-1").style.opacity = 0;
document.getElementById("breakout-1").style.filter = 'alpha(opacity=0)';
document.getElementById("breakout-1").style.display = 'block';
var op = 0.01; // initial opacity
var timer = setInterval(function () {
if (op >= 0.9){
clearInterval(timer);
}
document.getElementById("breakout-1").style.opacity = op;
document.getElementById("breakout-1").style.filter = 'alpha(opacity=' + op * 100 + ')';
op += op * 0.2;
}, 2);
} else {
var op = 1; // initial opacity
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
document.getElementById("breakout-1").style.display = 'none';
}
document.getElementById("breakout-1").style.opacity = op;
document.getElementById("breakout-1").style.filter = 'alpha(opacity=' + op * 100 + ')';
op -= op * 0.1;
}, 10);
}
}
}
});
Zarafa.onReady(function() {
container.registerPlugin(new Zarafa.core.PluginMetaData({
name: "fehler",
displayName : _('Formulare'),
pluginConstructor: Zarafa.plugins.fehler.SP
}))
});