Lib_Js_Calendar - Version 1.3.1

Version Notes

1.3.1

Download this release

Release Info

Developer Magento Core Team
Extension Lib_Js_Calendar
Version 1.3.1
Comparing to
See all releases


Code changes from version 1.2.0 to 1.3.1

Files changed (2) hide show
  1. js/calendar/calendar.js +81 -14
  2. package.xml +5 -5
js/calendar/calendar.js CHANGED
@@ -95,23 +95,90 @@ Calendar.is_opera = /opera/i.test(navigator.userAgent);
95
  /// detect KHTML-based browsers
96
  Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
97
 
 
 
 
98
  // BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
99
  // library, at some point.
100
 
101
- Calendar.getAbsolutePos = function(el) {
102
- var SL = 0, ST = 0;
103
- var is_div = /^div$/i.test(el.tagName);
104
- if (is_div && el.scrollLeft)
105
- SL = el.scrollLeft;
106
- if (is_div && el.scrollTop)
107
- ST = el.scrollTop;
108
- var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
109
- if (el.offsetParent) {
110
- var tmp = this.getAbsolutePos(el.offsetParent);
111
- r.x += tmp.x;
112
- r.y += tmp.y;
113
- }
114
- return r;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  };
116
 
117
  Calendar.isRelated = function (el, evt) {
95
  /// detect KHTML-based browsers
96
  Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
97
 
98
+ /// detect Gecko browsers
99
+ Calendar.is_gecko = navigator.userAgent.match(/gecko/i);
100
+
101
  // BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
102
  // library, at some point.
103
 
104
+ // Returns CSS property for element
105
+ Calendar.getStyle = function(element, style) {
106
+ if (element.currentStyle) {
107
+ var y = element.currentStyle[style];
108
+ } else if (window.getComputedStyle) {
109
+ var y = document.defaultView.getComputedStyle(element,null).getPropertyValue(style);
110
+ }
111
+
112
+ return y;
113
+ };
114
+
115
+ /*
116
+ * Different ways to find element's absolute position
117
+ */
118
+ Calendar.getAbsolutePos = function(element) {
119
+
120
+ var res = new Object();
121
+ res.x = 0; res.y = 0;
122
+
123
+ // variant 1 (working best, copy-paste from prototype library)
124
+ do {
125
+ res.x += element.offsetLeft || 0;
126
+ res.y += element.offsetTop || 0;
127
+ element = element.offsetParent;
128
+ if (element) {
129
+ if (element.tagName.toUpperCase() == 'BODY') break;
130
+ var p = Calendar.getStyle(element, 'position');
131
+ if (p !== 'static') break;
132
+ }
133
+ } while (element);
134
+
135
+ return res;
136
+
137
+ // variant 2 (good solution, but lost in IE8)
138
+ if (element !== null) {
139
+ res.x = element.offsetLeft;
140
+ res.y = element.offsetTop;
141
+
142
+ var offsetParent = element.offsetParent;
143
+ var parentNode = element.parentNode;
144
+
145
+ while (offsetParent !== null) {
146
+ res.x += offsetParent.offsetLeft;
147
+ res.y += offsetParent.offsetTop;
148
+
149
+ if (offsetParent != document.body && offsetParent != document.documentElement) {
150
+ res.x -= offsetParent.scrollLeft;
151
+ res.y -= offsetParent.scrollTop;
152
+ }
153
+ //next lines are necessary to support FireFox problem with offsetParent
154
+ if (Calendar.is_gecko) {
155
+ while (offsetParent != parentNode && parentNode !== null) {
156
+ res.x -= parentNode.scrollLeft;
157
+ res.y -= parentNode.scrollTop;
158
+ parentNode = parentNode.parentNode;
159
+ }
160
+ }
161
+ parentNode = offsetParent.parentNode;
162
+ offsetParent = offsetParent.offsetParent;
163
+ }
164
+ }
165
+ return res;
166
+
167
+ // variant 2 (not working)
168
+
169
+ // var SL = 0, ST = 0;
170
+ // var is_div = /^div$/i.test(el.tagName);
171
+ // if (is_div && el.scrollLeft)
172
+ // SL = el.scrollLeft;
173
+ // if (is_div && el.scrollTop)
174
+ // ST = el.scrollTop;
175
+ // var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
176
+ // if (el.offsetParent) {
177
+ // var tmp = this.getAbsolutePos(el.offsetParent);
178
+ // r.x += tmp.x;
179
+ // r.y += tmp.y;
180
+ // }
181
+ // return r;
182
  };
183
 
184
  Calendar.isRelated = function (el, evt) {
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Calendar</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Calendar for Magento</summary>
10
  <description>Javascript Calendar for Magento</description>
11
- <notes>1.2.0</notes>
12
  <authors><author><name>Magento Core Team</name><user>auto-converted</user><email>core@magentocommerce.com</email></author></authors>
13
- <date>2008-12-30</date>
14
- <time>04:36:56</time>
15
- <contents><target name="mageweb"><dir name="js"><dir name="calendar"><dir name="skins"><dir name="aqua"><file name="active-bg.gif" hash="f8fb9f2b7428c94b41320aa1bc9cf601"/><file name="dark-bg.gif" hash="949f6a11667cbdfbb96f8986464ba81b"/><file name="hover-bg.gif" hash="803ac4dbc56c05739f515d6ac6a66163"/><file name="menuarrow.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/><file name="normal-bg.gif" hash="851134e42206fd3b173a3db654981bb6"/><file name="rowhover-bg.gif" hash="c097de7289bcf68723e89c248b9a2749"/><file name="status-bg.gif" hash="123882ca533030f07ee55c3818fc46b9"/><file name="theme.css" hash="ec69465f70d45213258fe1f89c52eceb"/><file name="title-bg.gif" hash="8d652fc5b683706fcbbf1103131c6ac2"/><file name="today-bg.gif" hash="9befc7d912cad22ddf2ec3fc21188bfd"/></dir></dir><file name="calendar-blue.css" hash="b8bb29e3c1573d0d2917cd3112b5052d"/><file name="calendar-blue2.css" hash="654dfacebcdd70c75ccaf2b4aee2d059"/><file name="calendar-brown.css" hash="f326a6a84037e549a9cd71a92346f210"/><file name="calendar-green.css" hash="b44e2c25ff56efaa6e37d84df202e5d5"/><file name="calendar-setup.js" hash="1bd1051973ea17f452fd8fe966940452"/><file name="calendar-system.css" hash="9b446e2ee0e9e4420fce20922405cec7"/><file name="calendar-tas.css" hash="fa3baa9367504954ef03c1f05d44f1a6"/><file name="calendar-win2k-1.css" hash="e3c61212e6abc28844005381d8fe9690"/><file name="calendar-win2k-2.css" hash="332d8bc7dab6acd575dba49a15b62947"/><file name="calendar-win2k-cold-1.css" hash="b0810ce949e6c954c54053c52b21e74a"/><file name="calendar-win2k-cold-2.css" hash="3487ec4e054141057673d794ce6d1032"/><file name="calendar.js" hash="e9f4e499c28dd760daa1e6fe6ae87035"/><file name="img.gif" hash="c1e5255bd358fcd5a0779a0cc310a2fe"/><file name="menuarrow.gif" hash="b5a91d7a2755198b2eb729541ad3288c"/><file name="menuarrow2.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Mage_Pear_Helpers</name><channel>community</channel><min>1.0.18800</min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Calendar</name>
4
+ <version>1.3.1</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Calendar for Magento</summary>
10
  <description>Javascript Calendar for Magento</description>
11
+ <notes>1.3.1</notes>
12
  <authors><author><name>Magento Core Team</name><user>auto-converted</user><email>core@magentocommerce.com</email></author></authors>
13
+ <date>2009-04-17</date>
14
+ <time>23:41:43</time>
15
+ <contents><target name="mageweb"><dir name="js"><dir name="calendar"><dir name="skins"><dir name="aqua"><file name="active-bg.gif" hash="f8fb9f2b7428c94b41320aa1bc9cf601"/><file name="dark-bg.gif" hash="949f6a11667cbdfbb96f8986464ba81b"/><file name="hover-bg.gif" hash="803ac4dbc56c05739f515d6ac6a66163"/><file name="menuarrow.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/><file name="normal-bg.gif" hash="851134e42206fd3b173a3db654981bb6"/><file name="rowhover-bg.gif" hash="c097de7289bcf68723e89c248b9a2749"/><file name="status-bg.gif" hash="123882ca533030f07ee55c3818fc46b9"/><file name="theme.css" hash="ec69465f70d45213258fe1f89c52eceb"/><file name="title-bg.gif" hash="8d652fc5b683706fcbbf1103131c6ac2"/><file name="today-bg.gif" hash="9befc7d912cad22ddf2ec3fc21188bfd"/></dir></dir><file name="calendar-blue.css" hash="b8bb29e3c1573d0d2917cd3112b5052d"/><file name="calendar-blue2.css" hash="654dfacebcdd70c75ccaf2b4aee2d059"/><file name="calendar-brown.css" hash="f326a6a84037e549a9cd71a92346f210"/><file name="calendar-green.css" hash="b44e2c25ff56efaa6e37d84df202e5d5"/><file name="calendar-setup.js" hash="1bd1051973ea17f452fd8fe966940452"/><file name="calendar-system.css" hash="9b446e2ee0e9e4420fce20922405cec7"/><file name="calendar-tas.css" hash="fa3baa9367504954ef03c1f05d44f1a6"/><file name="calendar-win2k-1.css" hash="e3c61212e6abc28844005381d8fe9690"/><file name="calendar-win2k-2.css" hash="332d8bc7dab6acd575dba49a15b62947"/><file name="calendar-win2k-cold-1.css" hash="b0810ce949e6c954c54053c52b21e74a"/><file name="calendar-win2k-cold-2.css" hash="3487ec4e054141057673d794ce6d1032"/><file name="calendar.js" hash="45876c4994a8102c77940ef6e1cf9cdf"/><file name="img.gif" hash="c1e5255bd358fcd5a0779a0cc310a2fe"/><file name="menuarrow.gif" hash="b5a91d7a2755198b2eb729541ad3288c"/><file name="menuarrow2.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Mage_Pear_Helpers</name><channel>community</channel><min>1.0.18800</min><max></max></package></required></dependencies>
18
  </package>