-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathdhtmlxscheduler_expand.js
More file actions
89 lines (78 loc) · 2.59 KB
/
dhtmlxscheduler_expand.js
File metadata and controls
89 lines (78 loc) · 2.59 KB
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
/*
@license
dhtmlxScheduler v.5.3.6 Standard
To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxScheduler/#licensing or contact us at sales@dhtmlx.com
(c) XB Software Ltd.
*/
Scheduler.plugin(function(scheduler){
scheduler.expand = function() {
if(!scheduler.callEvent("onBeforeExpand", []))
return;
var t = scheduler._obj;
t.className += " dhx_scheduler_expanded";
do {
t._position = t.style.position || "";
t.style.position = "static";
} while ((t = t.parentNode) && t.style);
t = scheduler._obj;
t.style.position = "absolute";
t._width = t.style.width;
t._height = t.style.height;
t.style.width = t.style.height = "100%";
t.style.top = t.style.left = "0px";
var top = document.body;
top.scrollTop = 0;
top = top.parentNode;
if (top)
top.scrollTop = 0;
document.body._overflow = document.body.style.overflow || "";
document.body.style.overflow = "hidden";
scheduler._maximize();
scheduler.callEvent("onExpand", []);
};
scheduler.collapse = function() {
if(!scheduler.callEvent("onBeforeCollapse", []))
return;
var t = scheduler._obj;
t.className = t.className.replace("dhx_scheduler_expanded", "").replace(" "," ");
do {
t.style.position = t._position;
} while ((t = t.parentNode) && t.style);
t = scheduler._obj;
t.style.width = t._width;
t.style.height = t._height;
document.body.style.overflow = document.body._overflow;
scheduler._maximize();
scheduler.callEvent("onCollapse", []);
};
scheduler.attachEvent("onTemplatesReady", function() {
var t = document.createElement("div");
t.className = "dhx_expand_icon";
scheduler.toggleIcon = t;
scheduler._obj.appendChild(t);
t.onclick = function() {
if (!scheduler.expanded)
scheduler.expand(); else
scheduler.collapse();
};
});
scheduler._maximize = function() {
this.expanded = !this.expanded;
this.toggleIcon.style.backgroundPosition = "0 " + (this.expanded ? "0" : "18") + "px";
var directions = ['left', 'top'];
for (var i = 0; i < directions.length; i++) {
var margin = scheduler.xy['margin_' + directions[i]];
var prev_margin = scheduler['_prev_margin_' + directions[i]];
if (scheduler.xy['margin_' + directions[i]]) {
scheduler['_prev_margin_' + directions[i]] = scheduler.xy['margin_' + directions[i]];
scheduler.xy['margin_' + directions[i]] = 0;
} else {
if (prev_margin) {
scheduler.xy['margin_' + directions[i]] = scheduler['_prev_margin_' + directions[i]];
delete scheduler['_prev_margin_' + directions[i]];
}
}
}
scheduler.setCurrentView();
};
});