blob: ee66b4919e8a77f6aecd96f613139cf6766a47db (
plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
<html>
<head>
<link REL="stylesheet" TYPE="text/css">
</head>
<body>
<div id="_UID_main" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"><img src="img/header.png" />
<div id="_UID_features" style="top: 62px; width: 200px; position: absolute; overflow: auto; left: 0;" location="tree">
<div style="width: 100%; height: 100%; border: 1px solid red;">tree</div>
</div>
<div id="_UID_demo" style="overflow: auto; position: absolute; top: 62px; left: 215px; ">
<table width="100%" height="100%" cellspacing="0" cellpadding="0"
border="0">
<tbody>
<tr>
<td valign="middle" align="center">
<table>
<tbody>
<tr>
<td style="text-align: left;" location="demo">
<div style="width: 100%; height: 100%; border: 1px solid red;">demo</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div id="_UID_tabs" style="overflow: hidden; position: absolute; left: 215px;" location="tabsheet">
<div style="width: 100%; height: 100%; border: 1px solid red;">tabsheet</div>
</div>
<img id="_UID_prop-toggle" src="img/show_properties.png" style=" top: 23px; position: absolute;"/>
<div id="_UID_props" style="overflow: hidden; position: absolute; top: 23px; width: 0px;" location="properties">
<div style="width: 100%; height: 100%; border: 1px solid red;">properties</div>
</div>
<div id="_UID_cntr"
style="overflow: hidden; position: absolute; bottom: 10px; left: 0pt; width: 200px; height: 50px;">
<table width="100%" height="100%" border="0">
<tbody>
<tr>
<td width="50%" valign="middle" align="center" id="_UID_cntr-left" location="themes">themes</td>
<td width="50%" valign="middle" align="center" id="_UID_cntr-right" location="restart">restart</td>
</tr>
</tbody>
</table>
</div>
<img id="_UID_divider" src="img/tab_handle.png" style="position: absolute;" />
</div>
<script type="text/javascript">
/** Recalculate feature browser main layout dimensions for all components */
_UID_layout = function() {
// Then animations are needed, this will be reset to true
var animationNeeded = false;
// References to all elements
var mainDiv = document.getElementById("_UID_main");
if (mainDiv == null) { alert("maindiv is null"); return;}
var featuresDiv = document.getElementById("_UID_features");
var demoDiv = document.getElementById("_UID_demo");
var tabsDiv = document.getElementById("_UID_tabs");
var propertiesDiv = document.getElementById("_UID_props");
var controlDiv = document.getElementById("_UID_cntr");
var dividerDiv = document.getElementById("_UID_divider");
// Logobar height
var logoBarHeight = 62;
// Get whole window contents size
document.body.style.padding = 0;
document.body.style.margin = 0;
document.body.style.position = "absolute";
document.body.style.height = "100%";
document.body.style.width = "100%";
var width = document.body.offsetWidth;
var height = document.body.offsetHeight;
mainDiv.style.height = height + "px";
mainDiv.style.width = width + "px";
// Recalc features div dimensions
var featuresWidth = 200;
var controlHeight = 50;
featuresDiv.style.top="" + logoBarHeight + "px";
featuresDiv.style.width="" + featuresWidth + "px";
featuresDiv.style.height="" + (height-controlHeight-logoBarHeight) + "px";
// Recalc properties div dimensions
if (typeof propertiesDiv.targetWidth == 'undefined') propertiesDiv.targetWidth = 0;
var propWidth = Math.floor((propertiesDiv.offsetWidth + propertiesDiv.targetWidth)/2);
if (Math.abs(propWidth - propertiesDiv.targetWidth) <= 1) propWidth = propertiesDiv.targetWidth;
if (propWidth >width-featuresWidth) propWidth = width-featuresWidth;
if (propWidth < 0) propWidth = 0;
if ((propWidth+1) != (propertiesDiv.targetWidth+1)) animationNeeded=true;
var centerWidth = width - propWidth - featuresWidth - 40;
propertiesDiv.style.position="absolute";
propertiesDiv.style.overflow="hidden";
propertiesDiv.style.top="" + 23 + "px";
propertiesDiv.style.left="" + (centerWidth + featuresWidth + 40) + "px";
propertiesDiv.style.width=propWidth + "px";
propertiesDiv.style.height="" + (height - 23) + "px";
var buttonDiv = document.getElementById("_UID_prop-toggle");
buttonDiv.style.left = "" + (centerWidth + featuresWidth - 20 + 40) + "px"
if (propWidth == 0) { //buttonDiv.src = buttonDiv.showPng;
buttonDiv.style.height = "92px"; }
if (propWidth == propertiesDiv.maxWidth) { //buttonDiv.src = buttonDiv.hidePng;
buttonDiv.style.height = "23px"; }
buttonDiv.onclick = function() {
var propertiesDiv = document.getElementById("_UID_props");
propertiesDiv.targetWidth = propertiesDiv.targetWidth == 0 ? 265 : 0;
_UID_layout();
};
// Recalc divider div dimensions
if (typeof dividerDiv.demoHeight == 'undefined') dividerDiv.demoHeight = Math.floor(height/2);
if (dividerDiv.isActive) {
dividerDiv.demoHeight = dividerDiv.mouseY-10 - logoBarHeight;
if (dividerDiv.demoHeight < 0) dividerDiv.demoHeight = 0;
} else {
if (dividerDiv.demoHeight + logoBarHeight > height - 20) dividerDiv.demoHeight = height - 20 - logoBarHeight;
if (dividerDiv.demoHeight < 0) dividerDiv.demoHeight = 0;
}
var dividerHeight = 17;
dividerDiv.style.position="absolute";
dividerDiv.style.overflow="hidden";
dividerDiv.style.top="" + (dividerDiv.demoHeight + logoBarHeight)+ "px";
dividerDiv.style.left="" + (15+featuresWidth+Math.round((centerWidth-137)/2)) +"px";
dividerDiv.style.width="" + 137 + "px";
dividerDiv.style.height="" + dividerHeight + "px";
// Recalc tabs div dimensions
tabsDiv.style.position="absolute";
tabsDiv.style.overflow="hidden";
tabsDiv.style.top="" + (dividerDiv.demoHeight + dividerHeight + logoBarHeight) + "px";
tabsDiv.style.left="" + (featuresWidth + 15) + "px";
tabsDiv.style.width="" + centerWidth + "px";
tabsDiv.style.height="" + (height - dividerDiv.demoHeight - dividerHeight - logoBarHeight) + "px";
_UID_updateTabs();
// Recalc demo div dimensions
demoDiv.style.position="absolute";
demoDiv.style.overflow="auto";
demoDiv.style.top="" + logoBarHeight + "px";
demoDiv.style.left="" + (featuresWidth + 15) + "px";
demoDiv.style.width="" + centerWidth + "px";
demoDiv.style.height="" + dividerDiv.demoHeight + "px";
// Recalc control div dimensions
// TODO, make floating
controlDiv.style.position="absolute";
controlDiv.style.overflow="hidden";
controlDiv.style.top="" + (height - controlHeight) + "px";
controlDiv.style.left="0";
controlDiv.style.width="" + featuresWidth + "px";
controlDiv.style.height="" + controlHeight + "px";
if (animationNeeded) {
setTimeout("_UID_layout()",30);
}
};
/** Recalculate tabs content width */
_UID_updateTabs = function() {
try {
var tabsDiv = document.getElementById("_UID_tabs");
var tabsComponent = itmill.themes.Demo.prototype._UID_elemByIndex(tabsDiv.childNodes,0);
if (tabsComponent == null) return;
var tabs = itmill.themes.Demo.prototype._UID_elemByIndex(tabsComponent.childNodes,0);
if (tabs == null) return;
var content = itmill.themes.Demo.prototype._UID_elemByIndex(tabsComponent.childNodes,1);
if (content == null) return;
content.style.height="" + (tabsDiv.offsetHeight - tabs.offsetHeight-13) + "px";
content.style.borderBottom="0";
content.style.overflow='auto';
var iframe = content.getElementsByTagName("iframe").item(0);
if (iframe != null) {
content.style.overflow='hidden';
content.style.padding='0';
content.style.height="" + (tabsDiv.offsetHeight - tabs.offsetHeight) + "px";
iframe.height=content.style.height;
iframe.style.border='0';
}
} catch (e) {}
};
/** Helper method. Get element from node array by index */
_UID_elemByIndex = function(nodeArray, index) {
if (typeof nodeArray == 'undefined' || nodeArray == null) return null;
var i=0;
while (index>=0 && i < nodeArray.length) {
while(i < nodeArray.length && nodeArray[i].nodeType != Node.ELEMENT_NODE) i++;
if (index == 0) return nodeArray[i];
index--; i++;
}
return null;
}
_UID_dividerUpdate = function() {
var dividerDiv = document.getElementById("_UID_divider");
var div = document.getElementById("_UID_main");
dividerDiv.isActive = true;
div.onmouseup = function() {
dividerDiv.isActive = false;
div.onmouseup = null;
div.onmousemove = null;
}
div.onmousemove = function(e) {
dividerDiv.mouseY = typeof e != 'undefined' ? e.clientY : window.event.clientY;
_UID_layout();
}
return false;
};
_UID_initFeatureBrowserLayout = function() {
var dividerDiv = document.getElementById("_UID_divider");
if (dividerDiv == null) alert("no divider div");
dividerDiv.isActive = false;
dividerDiv.onmousedown = _UID_dividerUpdate;
window.onresize=_UID_layout;
_UID_layout();
};
_UID_initFeatureBrowserLayout();
</script>
</body>
</html>
|