File: calendar3.js

package info (click to toggle)
tdiary 5.0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,852 kB
  • sloc: ruby: 22,925; xml: 325; makefile: 16; sh: 10
file content (130 lines) | stat: -rw-r--r-- 3,161 bytes parent folder | download | duplicates (4)
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
// http://www.din.or.jp/~hagi3/JavaScript/JSTips/Mozilla/
// _dom : kind of DOM.
//        IE4 = 1, IE5+ = 2, NN4 = 3, NN6+ = 4, others = 0
_dom = document.all?(document.getElementById?2:1)
                   :(document.getElementById?4
                   :(document.layers?3:0));
var _calendar3_popElement = null;
var _calendar3_popCount = 0;

if (document.compatMode){
  if (_dom==2 && document.compatMode=="CSS1Compat") _dom = 2.5;
} // Win IE6

function getLeft(div){
  result = 0;
  while (1){
    div = div.offsetParent;
    result += div.offsetLeft;
    if (div.tagName=="BODY") return result;
  }
}

function getTop(div){
  result = 0;
  while (1){
    div = div.offsetParent;
    result += div.offsetTop;
    if (div.tagName=="BODY") return result;
  }
}

function moveDivTo(div,left,top){
  if(_dom==4){
    div.style.left=left+'px';
    div.style.top =top +'px';
    return;
  }
  if(_dom==2.5 || _dom==2 || _dom==1){
    div.style.pixelLeft=left;
    div.style.pixelTop =top;
    return;
  }
  if(_dom==3){
    div.moveTo(left,top);
    return;
  }
}

function moveDivBy(div,left,top){
  if(_dom==4){
    div.style.left=div.offsetLeft+left;
    div.style.top =div.offsetTop +top;
    return;
  }
  if(_dom==2.5 || _dom==2){
    div.style.pixelLeft=div.offsetLeft+left;
    div.style.pixelTop =div.offsetTop +top;
    return;
  }
  if(_dom==1){
    div.style.pixelLeft+=left;
    div.style.pixelTop +=top;
    return;
  }
  if(_dom==3){
    div.moveBy(left,top);
    return;
  }
}

function getDivLeft(div){
  if(_dom==2.5) return div.offsetLeft+getLeft(div);
  if(_dom==4 || _dom==2) return div.offsetLeft;
  if(_dom==1)            return div.style.pixelLeft;
  if(_dom==3)            return div.left;
  return 0;
}

function getDivTop(div){
  if(_dom==2.5) return div.offsetTop+getTop(div);
  if(_dom==4 || _dom==2) return div.offsetTop;
  if(_dom==1)            return div.style.pixelTop;
  if(_dom==3)            return div.top;
  return 0;
}

function getDivWidth (div){
  if(_dom==4 || _dom==2.5 || _dom==2) return div.offsetWidth;
  if(_dom==1)            return div.style.pixelWidth;
  if(_dom==3)            return div.clip.width;
  return 0;
}

function getDivHeight(div){
  if(_dom==4 || _dom==2.5 || _dom==2) return div.offsetHeight;
  if(_dom==1)            return div.style.pixelHeight;
  if(_dom==3)            return div.clip.height;
  return 0;
}

function popup(target,element,notitle) {
  _calendar3_popCount++;
  popdownNow();
  if (navigator.appName=='Microsoft Internet Explorer') {
    moveDivTo(element,getDivLeft(target)+getDivWidth(target),getDivTop(target)+getDivHeight(target)*13/8);
  } else {
    moveDivTo(element,getDivLeft(target)+getDivWidth(target)/2,getDivTop(target)+(getDivHeight(target)*2)/3);
  }
  element.style.display="block";
  notitle.title="";
}

function popdown(element) {
  _calendar3_popElement=element;
  setTimeout('popdownDelay()', 2000);
}

function popdownDelay() {
  _calendar3_popCount--;
  if (_calendar3_popCount==0) {
    popdownNow();
  }
}

function popdownNow() {
  if (_calendar3_popElement!=null) {
    _calendar3_popElement.style.display="none";
    _calendar3_popElement=null;
  }
}