-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvas.js
54 lines (54 loc) · 2.13 KB
/
canvas.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
function toggle(div_id) {
var el = parent.document.getElementById(div_id);
if ( el.style.display == 'none' ) { el.style.display = 'block';}
else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
if (typeof parent.window.innerWidth != 'undefined') {
viewportheight = parent.window.innerHeight;
} else {
viewportheight = parent.document.documentElement.clientHeight;
}
if ((viewportheight > parent.document.body.parentNode.scrollHeight) && (viewportheight > parent.document.body.parentNode.clientHeight)) {
blanket_height = viewportheight;
} else {
if (parent.document.body.parentNode.clientHeight > parent.document.body.parentNode.scrollHeight) {
blanket_height = parent.document.body.parentNode.clientHeight;
} else {
blanket_height = parent.document.body.parentNode.scrollHeight;
}
}
var blanket = parent.document.getElementById('blanket');
blanket.style.height = blanket_height + 'px';
var popUpDiv = parent.document.getElementById(popUpDivVar);
popUpDiv_height=blanket_height/2-150; //150 is half popup's height
popUpDiv_height=viewportheight/2-150; //150 is half popup's height
if (navigator.appVersion.indexOf("MSIE") != -1)
popUpDiv_height+=200;
popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
if (typeof parent.window.innerWidth != 'undefined') {
viewportwidth = parent.window.innerHeight;
} else {
viewportwidth = parent.document.documentElement.clientHeight;
}
if ((viewportwidth > parent.document.body.parentNode.scrollWidth) && (viewportwidth > parent.document.body.parentNode.clientWidth)) {
window_width = viewportwidth;
} else {
if (parent.document.body.parentNode.clientWidth > parent.document.body.parentNode.scrollWidth) {
window_width = parent.document.body.parentNode.clientWidth;
} else {
window_width = parent.document.body.parentNode.scrollWidth;
}
}
var popUpDiv = parent.document.getElementById(popUpDivVar);
window_width=window_width/2-150;//150 is half popup's width
popUpDiv.style.left = window_width + 'px';
}
function popup(windowname) {
blanket_size(windowname);
window_pos(windowname);
toggle('blanket');
toggle(windowname);
}