compass-jsbundle 0.1.0.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/LICENSE +20 -0
  2. data/README.md +0 -0
  3. data/bundles/dd-belatedpng/DD_belatedPNG_0.0.8a-min.js +13 -0
  4. data/bundles/dd-belatedpng/DD_belatedPNG_0.0.8a.js +289 -0
  5. data/bundles/dd-belatedpng/manifest.rb +22 -0
  6. data/bundles/domassistant/DOMAssistantComplete-2.8.js +1529 -0
  7. data/bundles/domassistant/DOMAssistantCompressed-2.8.js +4 -0
  8. data/bundles/domassistant/manifest.rb +22 -0
  9. data/bundles/ie-css3/ie-css3-0.9.5b.min.js +5 -0
  10. data/bundles/ie-css3/manifest.rb +25 -0
  11. data/bundles/jquery/jquery-1.4.2.js +6240 -0
  12. data/bundles/jquery/jquery-1.4.2.min.js +154 -0
  13. data/bundles/jquery/manifest.rb +22 -0
  14. data/bundles/modernizr/manifest.rb +22 -0
  15. data/bundles/modernizr/modernizr-1.1.js +558 -0
  16. data/bundles/modernizr/modernizr-1.1.min.js +13 -0
  17. data/bundles/mootools/manifest.rb +23 -0
  18. data/bundles/mootools/mootools-1.2.4-core-jm.js +132 -0
  19. data/bundles/mootools/mootools-1.2.4-core-nc.js +4329 -0
  20. data/bundles/mootools/mootools-1.2.4-core-yc.js +357 -0
  21. data/bundles/prototype/manifest.rb +21 -0
  22. data/bundles/prototype/prototype-1.6.1.js +4874 -0
  23. data/bundles/scriptaculous/manifest.rb +32 -0
  24. data/bundles/scriptaculous/scriptaculous-1.8.3/builder.js +136 -0
  25. data/bundles/scriptaculous/scriptaculous-1.8.3/controls.js +965 -0
  26. data/bundles/scriptaculous/scriptaculous-1.8.3/dragdrop.js +974 -0
  27. data/bundles/scriptaculous/scriptaculous-1.8.3/effects.js +1123 -0
  28. data/bundles/scriptaculous/scriptaculous-1.8.3/scriptaculous.js +68 -0
  29. data/bundles/scriptaculous/scriptaculous-1.8.3/slider.js +275 -0
  30. data/bundles/scriptaculous/scriptaculous-1.8.3/sound.js +59 -0
  31. data/bundles/scriptaculous/scriptaculous-1.8.3/unittest.js +568 -0
  32. data/lib/jsbundle.rb +6 -0
  33. metadata +107 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Aaron Russell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
@@ -0,0 +1,13 @@
1
+ /**
2
+ * DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
3
+ * Author: Drew Diller
4
+ * Email: drew.diller@gmail.com
5
+ * URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
6
+ * Version: 0.0.8a
7
+ * Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
8
+ *
9
+ * Example usage:
10
+ * DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
11
+ * DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
12
+ **/
13
+ var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
@@ -0,0 +1,289 @@
1
+ /**
2
+ * DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
3
+ * Author: Drew Diller
4
+ * Email: drew.diller@gmail.com
5
+ * URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
6
+ * Version: 0.0.8a
7
+ * Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
8
+ *
9
+ * Example usage:
10
+ * DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
11
+ * DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
12
+ **/
13
+
14
+ /*
15
+ PLEASE READ:
16
+ Absolutely everything in this script is SILLY. I know this. IE's rendering of certain pixels doesn't make sense, so neither does this code!
17
+ */
18
+
19
+ var DD_belatedPNG = {
20
+ ns: 'DD_belatedPNG',
21
+ imgSize: {},
22
+ delay: 10,
23
+ nodesFixed: 0,
24
+ createVmlNameSpace: function () { /* enable VML */
25
+ if (document.namespaces && !document.namespaces[this.ns]) {
26
+ document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
27
+ }
28
+ },
29
+ createVmlStyleSheet: function () { /* style VML, enable behaviors */
30
+ /*
31
+ Just in case lots of other developers have added
32
+ lots of other stylesheets using document.createStyleSheet
33
+ and hit the 31-limit mark, let's not use that method!
34
+ further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
35
+ */
36
+ var screenStyleSheet, printStyleSheet;
37
+ screenStyleSheet = document.createElement('style');
38
+ screenStyleSheet.setAttribute('media', 'screen');
39
+ document.documentElement.firstChild.insertBefore(screenStyleSheet, document.documentElement.firstChild.firstChild);
40
+ if (screenStyleSheet.styleSheet) {
41
+ screenStyleSheet = screenStyleSheet.styleSheet;
42
+ screenStyleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
43
+ screenStyleSheet.addRule(this.ns + '\\:shape', 'position:absolute;');
44
+ screenStyleSheet.addRule('img.' + this.ns + '_sizeFinder', 'behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;'); /* large negative top value for avoiding vertical scrollbars for large images, suggested by James O'Brien, http://www.thanatopsic.org/hendrik/ */
45
+ this.screenStyleSheet = screenStyleSheet;
46
+
47
+ /* Add a print-media stylesheet, for preventing VML artifacts from showing up in print (including preview). */
48
+ /* Thanks to R�mi Pr�vost for automating this! */
49
+ printStyleSheet = document.createElement('style');
50
+ printStyleSheet.setAttribute('media', 'print');
51
+ document.documentElement.firstChild.insertBefore(printStyleSheet, document.documentElement.firstChild.firstChild);
52
+ printStyleSheet = printStyleSheet.styleSheet;
53
+ printStyleSheet.addRule(this.ns + '\\:*', '{display: none !important;}');
54
+ printStyleSheet.addRule('img.' + this.ns + '_sizeFinder', '{display: none !important;}');
55
+ }
56
+ },
57
+ readPropertyChange: function () {
58
+ var el, display, v;
59
+ el = event.srcElement;
60
+ if (!el.vmlInitiated) {
61
+ return;
62
+ }
63
+ if (event.propertyName.search('background') != -1 || event.propertyName.search('border') != -1) {
64
+ DD_belatedPNG.applyVML(el);
65
+ }
66
+ if (event.propertyName == 'style.display') {
67
+ display = (el.currentStyle.display == 'none') ? 'none' : 'block';
68
+ for (v in el.vml) {
69
+ if (el.vml.hasOwnProperty(v)) {
70
+ el.vml[v].shape.style.display = display;
71
+ }
72
+ }
73
+ }
74
+ if (event.propertyName.search('filter') != -1) {
75
+ DD_belatedPNG.vmlOpacity(el);
76
+ }
77
+ },
78
+ vmlOpacity: function (el) {
79
+ if (el.currentStyle.filter.search('lpha') != -1) {
80
+ var trans = el.currentStyle.filter;
81
+ trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
82
+ el.vml.color.shape.style.filter = el.currentStyle.filter; /* complete guesswork */
83
+ el.vml.image.fill.opacity = trans; /* complete guesswork */
84
+ }
85
+ },
86
+ handlePseudoHover: function (el) {
87
+ setTimeout(function () { /* wouldn't work as intended without setTimeout */
88
+ DD_belatedPNG.applyVML(el);
89
+ }, 1);
90
+ },
91
+ /**
92
+ * This is the method to use in a document.
93
+ * @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
94
+ **/
95
+ fix: function (selector) {
96
+ if (this.screenStyleSheet) {
97
+ var selectors, i;
98
+ selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
99
+ for (i=0; i<selectors.length; i++) {
100
+ this.screenStyleSheet.addRule(selectors[i], 'behavior:expression(DD_belatedPNG.fixPng(this))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
101
+ }
102
+ }
103
+ },
104
+ applyVML: function (el) {
105
+ el.runtimeStyle.cssText = '';
106
+ this.vmlFill(el);
107
+ this.vmlOffsets(el);
108
+ this.vmlOpacity(el);
109
+ if (el.isImg) {
110
+ this.copyImageBorders(el);
111
+ }
112
+ },
113
+ attachHandlers: function (el) {
114
+ var self, handlers, handler, moreForAs, a, h;
115
+ self = this;
116
+ handlers = {resize: 'vmlOffsets', move: 'vmlOffsets'};
117
+ if (el.nodeName == 'A') {
118
+ moreForAs = {mouseleave: 'handlePseudoHover', mouseenter: 'handlePseudoHover', focus: 'handlePseudoHover', blur: 'handlePseudoHover'};
119
+ for (a in moreForAs) {
120
+ if (moreForAs.hasOwnProperty(a)) {
121
+ handlers[a] = moreForAs[a];
122
+ }
123
+ }
124
+ }
125
+ for (h in handlers) {
126
+ if (handlers.hasOwnProperty(h)) {
127
+ el.attachEvent('on' + h, handler);
128
+ }
129
+ }
130
+ el.attachEvent('onpropertychange', this.readPropertyChange);
131
+ },
132
+ giveLayout: function (el) {
133
+ el.style.zoom = 1;
134
+ if (el.currentStyle.position == 'static') {
135
+ el.style.position = 'relative';
136
+ }
137
+ },
138
+ copyImageBorders: function (el) {
139
+ var styles, s;
140
+ styles = {'borderStyle':true, 'borderWidth':true, 'borderColor':true};
141
+ for (s in styles) {
142
+ if (styles.hasOwnProperty(s)) {
143
+ el.vml.color.shape.style[s] = el.currentStyle[s];
144
+ }
145
+ }
146
+ },
147
+ vmlFill: function (el) {
148
+ if (!el.currentStyle) {
149
+ return;
150
+ } else {
151
+ var elStyle, noImg, lib, v, img, imgLoaded;
152
+ elStyle = el.currentStyle;
153
+ }
154
+ for (v in el.vml) {
155
+ if (el.vml.hasOwnProperty(v)) {
156
+ el.vml[v].shape.style.zIndex = elStyle.zIndex;
157
+ }
158
+ }
159
+ el.runtimeStyle.backgroundColor = '';
160
+ el.runtimeStyle.backgroundImage = '';
161
+ noImg = true;
162
+ if (elStyle.backgroundImage != 'none' || el.isImg) {
163
+ if (!el.isImg) {
164
+ el.vmlBg = elStyle.backgroundImage;
165
+ el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
166
+ }
167
+ else {
168
+ el.vmlBg = el.src;
169
+ }
170
+ lib = this;
171
+ if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
172
+ img = document.createElement('img');
173
+ lib.imgSize[el.vmlBg] = img;
174
+ img.className = lib.ns + '_sizeFinder';
175
+ img.runtimeStyle.cssText = 'behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
176
+ img.attachEvent('onload', imgLoaded);
177
+ img.src = el.vmlBg;
178
+ img.removeAttribute('width');
179
+ img.removeAttribute('height');
180
+ document.body.insertBefore(img, document.body.firstChild);
181
+ }
182
+ el.vml.image.fill.src = el.vmlBg;
183
+ noImg = false;
184
+ }
185
+ el.vml.image.fill.on = !noImg;
186
+ el.vml.image.fill.color = 'none';
187
+ el.vml.color.shape.style.backgroundColor = elStyle.backgroundColor;
188
+ el.runtimeStyle.backgroundImage = 'none';
189
+ el.runtimeStyle.backgroundColor = 'transparent';
190
+ },
191
+ /* IE can't figure out what do when the offsetLeft and the clientLeft add up to 1, and the VML ends up getting fuzzy... so we have to push/enlarge things by 1 pixel and then clip off the excess */
192
+ vmlOffsets: function (el) {
193
+ var thisStyle, size, fudge, makeVisible, bg, bgR, dC, altC, b, c, v;
194
+ thisStyle = el.currentStyle;
195
+ size = {'W':el.clientWidth+1, 'H':el.clientHeight+1, 'w':this.imgSize[el.vmlBg].width, 'h':this.imgSize[el.vmlBg].height, 'L':el.offsetLeft, 'T':el.offsetTop, 'bLW':el.clientLeft, 'bTW':el.clientTop};
196
+ fudge = (size.L + size.bLW == 1) ? 1 : 0;
197
+ /* vml shape, left, top, width, height, origin */
198
+ makeVisible = function (vml, l, t, w, h, o) {
199
+ vml.coordsize = w+','+h;
200
+ vml.coordorigin = o+','+o;
201
+ vml.path = 'm0,0l'+w+',0l'+w+','+h+'l0,'+h+' xe';
202
+ vml.style.width = w + 'px';
203
+ vml.style.height = h + 'px';
204
+ vml.style.left = l + 'px';
205
+ vml.style.top = t + 'px';
206
+ };
207
+ makeVisible(el.vml.color.shape, (size.L + (el.isImg ? 0 : size.bLW)), (size.T + (el.isImg ? 0 : size.bTW)), (size.W-1), (size.H-1), 0);
208
+ makeVisible(el.vml.image.shape, (size.L + size.bLW), (size.T + size.bTW), (size.W), (size.H), 1 );
209
+ bg = {'X':0, 'Y':0};
210
+ if (el.isImg) {
211
+ bg.X = parseInt(thisStyle.paddingLeft, 10) + 1;
212
+ bg.Y = parseInt(thisStyle.paddingTop, 10) + 1;
213
+ }
214
+ else {
215
+ for (b in bg) {
216
+ if (bg.hasOwnProperty(b)) {
217
+ this.figurePercentage(bg, size, b, thisStyle['backgroundPosition'+b]);
218
+ }
219
+ }
220
+ }
221
+ el.vml.image.fill.position = (bg.X/size.W) + ',' + (bg.Y/size.H);
222
+ bgR = thisStyle.backgroundRepeat;
223
+ dC = {'T':1, 'R':size.W+fudge, 'B':size.H, 'L':1+fudge}; /* these are defaults for repeat of any kind */
224
+ altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'W'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'H'} };
225
+ if (bgR != 'repeat' || el.isImg) {
226
+ c = {'T':(bg.Y), 'R':(bg.X+size.w), 'B':(bg.Y+size.h), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
227
+ if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
228
+ v = bgR.split('repeat-')[1].toUpperCase();
229
+ c[altC[v].b1] = 1;
230
+ c[altC[v].b2] = size[altC[v].d];
231
+ }
232
+ if (c.B > size.H) {
233
+ c.B = size.H;
234
+ }
235
+ el.vml.image.shape.style.clip = 'rect('+c.T+'px '+(c.R+fudge)+'px '+c.B+'px '+(c.L+fudge)+'px)';
236
+ }
237
+ else {
238
+ el.vml.image.shape.style.clip = 'rect('+dC.T+'px '+dC.R+'px '+dC.B+'px '+dC.L+'px)';
239
+ }
240
+ },
241
+ fixPng: function (el) {
242
+ el.style.behavior = 'none';
243
+ if (el.nodeName == 'BODY' || el.nodeName == 'TD' || el.nodeName == 'TR') { /* elements not supported yet */
244
+ return;
245
+ }
246
+ el.isImg = false;
247
+ if (el.nodeName == 'IMG') {
248
+ if(el.src.toLowerCase().search(/\.png$/) != -1) {
249
+ el.isImg = true;
250
+ el.style.visibility = 'hidden';
251
+ }
252
+ else {
253
+ return;
254
+ }
255
+ }
256
+ else if (el.currentStyle.backgroundImage.toLowerCase().search('.png') == -1) {
257
+ return;
258
+ }
259
+ lib = DD_belatedPNG;
260
+ el.vml = {color: {}, image: {}};
261
+ els = {shape: {}, fill: {}};
262
+ for (v in el.vml) {
263
+ if (el.vml.hasOwnProperty(v)) {
264
+ for (e in els) {
265
+ if (els.hasOwnProperty(e)) {
266
+ nodeStr = lib.ns + ':' + e;
267
+ el.vml[v][e] = document.createElement(nodeStr);
268
+ }
269
+ }
270
+ el.vml[v].shape.stroked = false;
271
+ el.vml[v].shape.appendChild(el.vml[v].fill);
272
+ el.parentNode.insertBefore(el.vml[v].shape, el);
273
+ }
274
+ }
275
+ el.vml.image.shape.fillcolor = 'none'; /* Don't show blank white shapeangle when waiting for image to load. */
276
+ el.vml.image.fill.type = 'tile'; /* Makes image show up. */
277
+ el.vml.color.fill.on = false; /* Actually going to apply vml element's style.backgroundColor, so hide the whiteness. */
278
+ lib.attachHandlers(el);
279
+ lib.giveLayout(el);
280
+ lib.giveLayout(el.offsetParent);
281
+ el.vmlInitiated = true;
282
+ lib.applyVML(el); /* Render! */
283
+ }
284
+ };
285
+ try {
286
+ document.execCommand("BackgroundImageCache", false, true); /* TredoSoft Multiple IE doesn't like this, so try{} it */
287
+ } catch(r) {}
288
+ DD_belatedPNG.createVmlNameSpace();
289
+ DD_belatedPNG.createVmlStyleSheet();
@@ -0,0 +1,22 @@
1
+ VERSION = "0.0.8a"
2
+
3
+ javascript "DD_belatedPNG_#{VERSION}.js"
4
+ javascript "DD_belatedPNG_#{VERSION}-min.js"
5
+
6
+ description "The DD_belatedPNG JavaScript library"
7
+
8
+ help %Q{
9
+ This is a Javascript library that sandwiches PNG image support into IE6 without much fuss.
10
+
11
+ For more information about DD_belatedPNG:
12
+
13
+ http://www.dillerdesign.com/experiment/DD_belatedPNG/
14
+
15
+ }
16
+
17
+ welcome_message %Q{
18
+ DD_belatedPNG is now installed. Make sure you include it in your HTML:
19
+
20
+ <script src="./javascripts/DD_belatedPNG_#{VERSION}-min.js" type="text/javascript" charset="utf-8"></script>
21
+
22
+ }
@@ -0,0 +1,1529 @@
1
+ // Developed by Robert Nyman/DOMAssistant team, code/licensing: http://domassistant.googlecode.com/, documentation: http://www.domassistant.com/documentation, version 2.8
2
+ var DOMAssistant = function () {
3
+ var HTMLArray = function () {
4
+ // Constructor
5
+ },
6
+ w = window, _$ = w.$, _$$ = w.$$,
7
+ isIE = /*@cc_on!@*/false,
8
+ isIE5 = isIE && parseFloat(navigator.appVersion) < 6,
9
+ sort, tagCache = {}, lastCache = {}, useCache = true,
10
+ slice = Array.prototype.slice,
11
+ camel = {
12
+ "accesskey": "accessKey",
13
+ "class": "className",
14
+ "colspan": "colSpan",
15
+ "for": "htmlFor",
16
+ "maxlength": "maxLength",
17
+ "readonly": "readOnly",
18
+ "rowspan": "rowSpan",
19
+ "tabindex": "tabIndex",
20
+ "valign": "vAlign",
21
+ "cellspacing": "cellSpacing",
22
+ "cellpadding": "cellPadding"
23
+ },
24
+ regex = {
25
+ rules: /\s*,\s*/g,
26
+ selector: /^(\w+|\*)?(#[\w\u00C0-\uFFFF\-=$]+)?((\.[\w\u00C0-\uFFFF\-]+)*)?((\[\w+\s*([~^$*|])?(=\s*([-\w\u00C0-\uFFFF\s.]+|"[^"]*"|'[^']*'))?\]+)*)?((:\w[-\w]*(\((odd|even|\-?\d*n?([-+]\d+)?|[:#]?[-\w\u00C0-\uFFFF.]+|"[^"]*"|'[^']*'|((\w*\.[-\w\u00C0-\uFFFF]+)*)?|(\[#?\w+([~^$*|])?=?[-\w\u00C0-\uFFFF\s.'"]+\]+)|(:\w[-\w]*\(.+\)))\))?)*)?([+>~])?/,
27
+ selectorSplit: /(?:\[.*\]|\(.*\)|[^\s+>~[(])+|[+>~]/g,
28
+ id: /^#([-\w\u00C0-\uFFFF=$]+)$/,
29
+ tag: /^\w+/,
30
+ relation: /^[+>~]$/,
31
+ pseudo: /^:(\w[-\w]*)(\((.+)\))?$/,
32
+ pseudos: /:(\w[-\w]*)(\((([^(]+)|([^(]+\([^(]+)\))\))?/g,
33
+ attribs: /\[(\w+)\s*([~^$*|])?(=)?\s*([^\[\]]*|"[^"]*"|'[^']*')?\](?=$|\[|:|\s)/g,
34
+ classes: /\.([-\w\u00C0-\uFFFF]+)/g,
35
+ quoted: /^["'](.*)["']$/,
36
+ nth: /^((odd|even)|([1-9]\d*)|((([1-9]\d*)?)n([-+]\d+)?)|(-(([1-9]\d*)?)n\+(\d+)))$/,
37
+ special: /(:check|:enabl|\bselect)ed\b/
38
+ },
39
+ navigate = function (node, direction, checkTagName) {
40
+ var oldName = node.tagName;
41
+ while ((node = node[direction + "Sibling"]) && (node.nodeType !== 1 || (checkTagName? node.tagName !== oldName : node.tagName === "!"))) {}
42
+ return node;
43
+ },
44
+ def = function (obj) {
45
+ return typeof obj !== "undefined";
46
+ },
47
+ sortDocumentOrder = function (elmArray) {
48
+ return (sortDocumentOrder = elmArray[0].compareDocumentPosition? function (elmArray) { return elmArray.sort( function (a, b) { return 3 - (a.compareDocumentPosition(b) & 6); } ); } :
49
+ isIE? function (elmArray) { return elmArray.sort( function (a, b) { return a.sourceIndex - b.sourceIndex; } ); } :
50
+ function (elmArray) { return elmArray.sort( function (a, b) {
51
+ var range1 = document.createRange(), range2 = document.createRange();
52
+ range1.setStart(a, 0);
53
+ range1.setEnd(a, 0);
54
+ range2.setStart(b, 0);
55
+ range2.setEnd(b, 0);
56
+ return range1.compareBoundaryPoints(Range.START_TO_END, range2);
57
+ } ); })(elmArray);
58
+ };
59
+ var pushAll = function (set1, set2) {
60
+ set1.push.apply(set1, slice.apply(set2));
61
+ return set1;
62
+ };
63
+ if (isIE) {
64
+ pushAll = function (set1, set2) {
65
+ if (set2.slice) {
66
+ return set1.concat(set2);
67
+ }
68
+ var i=0, item;
69
+ while ((item = set2[i++])) {
70
+ set1[set1.length] = item;
71
+ }
72
+ return set1;
73
+ };
74
+ }
75
+ return {
76
+ isIE : isIE,
77
+ camel : camel,
78
+ def : def,
79
+ allMethods : [],
80
+ publicMethods : [
81
+ "prev",
82
+ "next",
83
+ "hasChild",
84
+ "cssSelect",
85
+ "elmsByClass",
86
+ "elmsByAttribute",
87
+ "elmsByTag"
88
+ ],
89
+
90
+ harmonize : function () {
91
+ w.$ = _$;
92
+ w.$$ = _$$;
93
+ return this;
94
+ },
95
+
96
+ initCore : function () {
97
+ this.applyMethod.call(w, "$", this.$);
98
+ this.applyMethod.call(w, "$$", this.$$);
99
+ w.DOMAssistant = this;
100
+ if (isIE) {
101
+ HTMLArray = Array;
102
+ }
103
+ HTMLArray.prototype = [];
104
+ (function (H) {
105
+ H.each = function (fn, context) {
106
+ for (var i=0, il=this.length; i<il; i++) {
107
+ if (fn.call(context || this[i], this[i], i, this) === false) {
108
+ break;
109
+ }
110
+ }
111
+ return this;
112
+ };
113
+ H.first = function () {
114
+ return def(this[0])? DOMAssistant.addMethodsToElm(this[0]) : null;
115
+ };
116
+ H.end = function () {
117
+ return this.previousSet;
118
+ };
119
+ H.indexOf = H.indexOf || function (elm) {
120
+ for (var i=0, il=this.length; i<il; i++) {
121
+ if (i in this && this[i] === elm) {
122
+ return i;
123
+ }
124
+ }
125
+ return -1;
126
+ };
127
+ H.map = function (fn, context) {
128
+ var res = [];
129
+ for (var i=0, il=this.length; i<il; i++) {
130
+ if (i in this) {
131
+ res[i] = fn.call(context || this[i], this[i], i, this);
132
+ }
133
+ }
134
+ return res;
135
+ };
136
+ H.filter = function (fn, context) {
137
+ var res = new HTMLArray();
138
+ res.previousSet = this;
139
+ for (var i=0, il=this.length; i<il; i++) {
140
+ if (i in this && fn.call(context || this[i], this[i], i, this)) {
141
+ res.push(this[i]);
142
+ }
143
+ }
144
+ return res;
145
+ };
146
+ H.every = function (fn, context) {
147
+ for (var i=0, il=this.length; i<il; i++) {
148
+ if (i in this && !fn.call(context || this[i], this[i], i, this)) {
149
+ return false;
150
+ }
151
+ }
152
+ return true;
153
+ };
154
+ H.some = function (fn, context) {
155
+ for (var i=0, il=this.length; i<il; i++) {
156
+ if (i in this && fn.call(context || this[i], this[i], i, this)) {
157
+ return true;
158
+ }
159
+ }
160
+ return false;
161
+ };
162
+ })(HTMLArray.prototype);
163
+ this.attach(this);
164
+ },
165
+
166
+ addMethods : function (name, method) {
167
+ if (!def(this.allMethods[name])) {
168
+ this.allMethods[name] = method;
169
+ this.addHTMLArrayPrototype(name, method);
170
+ }
171
+ },
172
+
173
+ addMethodsToElm : function (elm) {
174
+ for (var method in this.allMethods) {
175
+ if (def(this.allMethods[method])) {
176
+ this.applyMethod.call(elm, method, this.allMethods[method]);
177
+ }
178
+ }
179
+ return elm;
180
+ },
181
+
182
+ applyMethod : function (method, func) {
183
+ if (typeof this[method] !== "function") {
184
+ this[method] = func;
185
+ }
186
+ },
187
+
188
+ attach : function (plugin) {
189
+ var publicMethods = plugin.publicMethods;
190
+ if (!def(publicMethods)) {
191
+ for (var method in plugin) {
192
+ if (method !== "init" && def(plugin[method])) {
193
+ this.addMethods(method, plugin[method]);
194
+ }
195
+ }
196
+ }
197
+ else if (publicMethods.constructor === Array) {
198
+ for (var i=0, current; (current=publicMethods[i]); i++) {
199
+ this.addMethods(current, plugin[current]);
200
+ }
201
+ }
202
+ if (typeof plugin.init === "function") {
203
+ plugin.init();
204
+ }
205
+ },
206
+
207
+ addHTMLArrayPrototype : function (name, method) {
208
+ HTMLArray.prototype[name] = function () {
209
+ var elmsToReturn = new HTMLArray();
210
+ elmsToReturn.previousSet = this;
211
+ for (var i=0, il=this.length; i<il; i++) {
212
+ elmsToReturn.push(method.apply(DOMAssistant.$$(this[i]), arguments));
213
+ }
214
+ return elmsToReturn;
215
+ };
216
+ },
217
+
218
+ cleanUp : function (elm) {
219
+ var children = elm.all || elm.getElementsByTagName("*");
220
+ for (var i=0, child; (child=children[i++]);) {
221
+ if (child.hasData && child.hasData()) {
222
+ if (child.removeEvent) { child.removeEvent(); }
223
+ child.unstore();
224
+ }
225
+ }
226
+ elm.innerHTML = "";
227
+ },
228
+
229
+ setCache : function (cache) {
230
+ useCache = cache;
231
+ },
232
+
233
+ $ : function () {
234
+ var obj = arguments[0];
235
+ if (arguments.length === 1 && (typeof obj === "object" || (typeof obj === "function" && !!obj.nodeName))) {
236
+ return DOMAssistant.$$(obj);
237
+ }
238
+ var elm = !!obj? new HTMLArray() : null;
239
+ for (var i=0, arg, idMatch; (arg=arguments[i]); i++) {
240
+ if (typeof arg === "string") {
241
+ arg = arg.replace(/^[^#\(]*(#)/, "$1");
242
+ if (regex.id.test(arg)) {
243
+ if ((idMatch = DOMAssistant.$$(arg.substr(1), false))) {
244
+ elm.push(idMatch);
245
+ }
246
+ }
247
+ else {
248
+ var doc = (document.all || document.getElementsByTagName("*")).length;
249
+ elm = (!document.querySelectorAll && useCache && lastCache.rule && lastCache.rule === arg && lastCache.doc === doc)? lastCache.elms : pushAll(elm, DOMAssistant.cssSelection.call(document, arg));
250
+ lastCache = { rule: arg, elms: elm, doc: doc };
251
+ }
252
+ }
253
+ }
254
+ return elm;
255
+ },
256
+
257
+ $$ : function (id, addMethods) {
258
+ var elm = (typeof id === "object" || typeof id === "function" && !!id.nodeName)? id : document.getElementById(id),
259
+ applyMethods = def(addMethods)? addMethods : true,
260
+ getId = function(el) { var eid = el.id; return typeof eid !== "object"? eid : el.attributes.id.nodeValue; };
261
+ if (typeof id === "string" && elm && getId(elm) !== id) {
262
+ elm = null;
263
+ for (var i=0, item; (item=document.all[i]); i++) {
264
+ if (getId(item) === id) {
265
+ elm = item;
266
+ break;
267
+ }
268
+ }
269
+ }
270
+ if (elm && applyMethods && !elm.next) {
271
+ DOMAssistant.addMethodsToElm(elm);
272
+ }
273
+ return elm;
274
+ },
275
+
276
+ prev : function () {
277
+ return DOMAssistant.$$(navigate(this, "previous"));
278
+ },
279
+
280
+ next : function () {
281
+ return DOMAssistant.$$(navigate(this, "next"));
282
+ },
283
+
284
+ hasChild: function (elm) {
285
+ return this === document || this !== elm && (this.contains? this.contains(elm) : !!(this.compareDocumentPosition(elm) & 16));
286
+ },
287
+
288
+ getSequence : function (expression) {
289
+ var start, add = 2, max = -1, modVal = -1,
290
+ pseudoVal = regex.nth.exec(expression.replace(/^0n\+/, "").replace(/^2n$/, "even").replace(/^2n+1$/, "odd"));
291
+ if (!pseudoVal) {
292
+ return null;
293
+ }
294
+ if (pseudoVal[2]) { // odd or even
295
+ start = (pseudoVal[2] === "odd")? 1 : 2;
296
+ modVal = (start === 1)? 1 : 0;
297
+ }
298
+ else if (pseudoVal[3]) { // single digit
299
+ start = max = parseInt(pseudoVal[3], 10);
300
+ add = 0;
301
+ }
302
+ else if (pseudoVal[4]) { // an+b
303
+ add = pseudoVal[6]? parseInt(pseudoVal[6], 10) : 1;
304
+ start = pseudoVal[7]? parseInt(pseudoVal[7], 10) : 0;
305
+ while (start < 1) {
306
+ start += add;
307
+ }
308
+ modVal = (start >= add)? (start - add) % add : start;
309
+ }
310
+ else if (pseudoVal[8]) { // -an+b
311
+ add = pseudoVal[10]? parseInt(pseudoVal[10], 10) : 1;
312
+ start = max = parseInt(pseudoVal[11], 10);
313
+ while (start > add) {
314
+ start -= add;
315
+ }
316
+ modVal = (max >= add)? (max - add) % add : max;
317
+ }
318
+ return { start: start, add: add, max: max, modVal: modVal };
319
+ },
320
+
321
+ cssByDOM : function (cssRule) {
322
+ var prevParents, currentRule, cssSelectors, childOrSiblingRef, nextTag, nextRegExp, current, previous, prevParent, notElm, addElm, iteratorNext, childElm, sequence, anyTag,
323
+ elm = new HTMLArray(), index = elm.indexOf, prevElm = [], matchingElms = [], cssRules = cssRule.replace(regex.rules, ",").split(","), splitRule = {};
324
+ function clearAdded (elm) {
325
+ elm = elm || prevElm;
326
+ for (var n=elm.length; n--;) {
327
+ elm[n].added = null;
328
+ elm[n].removeAttribute("added");
329
+ }
330
+ }
331
+ function clearChildElms () {
332
+ for (var n=prevParents.length; n--;) {
333
+ prevParents[n].childElms = null;
334
+ }
335
+ }
336
+ function subtractArray (arr1, arr2) {
337
+ for (var i=0, src1; (src1=arr1[i]); i++) {
338
+ var found = false;
339
+ for (var j=0, src2; (src2=arr2[j]); j++) {
340
+ if (src2 === src1) {
341
+ found = true;
342
+ arr2.splice(j, 1);
343
+ break;
344
+ }
345
+ }
346
+ if (found) {
347
+ arr1.splice(i--, 1);
348
+ }
349
+ }
350
+ return arr1;
351
+ }
352
+ function getAttr (elm, attr) {
353
+ return (isIE || regex.special.test(attr))? elm[camel[attr.toLowerCase()] || attr] : elm.getAttribute(attr, 2);
354
+ }
355
+ function attrToRegExp (attrVal, substrOperator) {
356
+ attrVal = attrVal? attrVal.replace(regex.quoted, "$1").replace(/(\.|\[|\])/g, "\\$1") : null;
357
+ return {
358
+ "^": "^" + attrVal,
359
+ "$": attrVal + "$",
360
+ "*": attrVal,
361
+ "|": "^" + attrVal + "(\\-\\w+)*$",
362
+ "~": "\\b" + attrVal + "\\b"
363
+ }[substrOperator] || (attrVal !== null? "^" + attrVal + "$" : attrVal);
364
+ }
365
+ function notComment(el) {
366
+ return (el || this).tagName !== "!";
367
+ }
368
+ function getTags (tag, context) {
369
+ return isIE5? (tag === "*"? context.all : context.all.tags(tag)) : context.getElementsByTagName(tag);
370
+ }
371
+ function getElementsByTagName (tag, parent) {
372
+ tag = tag || "*";
373
+ parent = parent || document;
374
+ return (parent === document || parent.lastModified)? tagCache[tag] || (tagCache[tag] = getTags(tag, document)) : getTags(tag, parent);
375
+ }
376
+ function getElementsByPseudo (previousMatch, pseudoClass, pseudoValue) {
377
+ prevParents = [];
378
+ var pseudo = pseudoClass.split("-"), matchingElms = [], idx = 0, checkNodeName = /\-of\-type$/.test(pseudoClass), recur,
379
+ match = {
380
+ first: function(el) { return !navigate(el, "previous", checkNodeName); },
381
+ last: function(el) { return !navigate(el, "next", checkNodeName); },
382
+ empty: function(el) { return !el.firstChild; },
383
+ enabled: function(el) { return !el.disabled && el.type !== "hidden"; },
384
+ disabled: function(el) { return el.disabled; },
385
+ checked: function(el) { return el.checked; },
386
+ contains: function(el) { return (el.innerText || el.textContent || "").indexOf(pseudoValue.replace(regex.quoted, "$1")) > -1; },
387
+ other: function(el) { return getAttr(el, pseudoClass) === pseudoValue; }
388
+ };
389
+ function basicMatch(key) {
390
+ while ((previous=previousMatch[idx++])) {
391
+ if (notComment(previous) && match[key](previous)) {
392
+ matchingElms[matchingElms.length] = previous;
393
+ }
394
+ }
395
+ return matchingElms;
396
+ }
397
+ var word = pseudo[0] || null;
398
+ if (word && match[word]) {
399
+ return basicMatch(word);
400
+ }
401
+ switch (word) {
402
+ case "only":
403
+ var kParent, kTag;
404
+ while ((previous=previousMatch[idx++])) {
405
+ prevParent = previous.parentNode;
406
+ var q = previous.nodeName;
407
+ if (prevParent !== kParent || q !== kTag) {
408
+ if (match.first(previous) && match.last(previous)) {
409
+ matchingElms[matchingElms.length] = previous;
410
+ }
411
+ kParent = prevParent;
412
+ kTag = q;
413
+ }
414
+ }
415
+ break;
416
+ case "nth":
417
+ if (pseudoValue === "n") {
418
+ matchingElms = previousMatch;
419
+ }
420
+ else {
421
+ var direction = (pseudo[1] === "last")? ["lastChild", "previousSibling"] : ["firstChild", "nextSibling"];
422
+ sequence = DOMAssistant.getSequence(pseudoValue);
423
+ if (sequence) {
424
+ while ((previous=previousMatch[idx++])) {
425
+ prevParent = previous.parentNode;
426
+ prevParent.childElms = prevParent.childElms || {};
427
+ var p = previous.nodeName;
428
+ if (!prevParent.childElms[p]) {
429
+ var childCount = 0;
430
+ iteratorNext = sequence.start;
431
+ childElm = prevParent[direction[0]];
432
+ while (childElm && (sequence.max < 0 || iteratorNext <= sequence.max)) {
433
+ var c = childElm.nodeName;
434
+ if ((checkNodeName && c === p) || (!checkNodeName && childElm.nodeType === 1 && c !== "!")) {
435
+ if (++childCount === iteratorNext) {
436
+ if (c === p) { matchingElms[matchingElms.length] = childElm; }
437
+ iteratorNext += sequence.add;
438
+ }
439
+ }
440
+ childElm = childElm[direction[1]];
441
+ }
442
+ if (anyTag) { sort++; }
443
+ prevParent.childElms[p] = true;
444
+ prevParents[prevParents.length] = prevParent;
445
+ }
446
+ }
447
+ clearChildElms();
448
+ }
449
+ }
450
+ break;
451
+ case "target":
452
+ var hash = document.location.hash.slice(1);
453
+ if (hash) {
454
+ while ((previous=previousMatch[idx++])) {
455
+ if (getAttr(previous, "name") === hash || getAttr(previous, "id") === hash) {
456
+ matchingElms[matchingElms.length] = previous;
457
+ break;
458
+ }
459
+ }
460
+ }
461
+ break;
462
+ case "not":
463
+ if ((recur = regex.pseudo.exec(pseudoValue))) {
464
+ matchingElms = subtractArray(previousMatch, getElementsByPseudo(previousMatch, recur[1]? recur[1].toLowerCase() : null, recur[3] || null));
465
+ }
466
+ else {
467
+ for (var re in regex) {
468
+ if (regex[re].lastIndex) {
469
+ regex[re].lastIndex = 0;
470
+ }
471
+ }
472
+ pseudoValue = pseudoValue.replace(regex.id, "[id=$1]");
473
+ var notTag = regex.tag.exec(pseudoValue);
474
+ var notClass = regex.classes.exec(pseudoValue);
475
+ var notAttr = regex.attribs.exec(pseudoValue);
476
+ var notRegExp = new RegExp(notAttr? attrToRegExp(notAttr[4], notAttr[2]) : "(^|\\s)" + (notTag? notTag[0] : notClass? notClass[1] : "") + "(\\s|$)", "i");
477
+ while ((notElm=previousMatch[idx++])) {
478
+ addElm = null;
479
+ if (notTag && !notRegExp.test(notElm.nodeName) || notClass && !notRegExp.test(notElm.className)) {
480
+ addElm = notElm;
481
+ }
482
+ else if (notAttr) {
483
+ var att = getAttr(notElm, notAttr[1]);
484
+ if (!def(att) || att === false || typeof att === "string" && !notRegExp.test(att)) {
485
+ addElm = notElm;
486
+ }
487
+ }
488
+ if (addElm && !addElm.added) {
489
+ addElm.added = true;
490
+ matchingElms[matchingElms.length] = addElm;
491
+ }
492
+ }
493
+ }
494
+ break;
495
+ default: return basicMatch("other");
496
+ }
497
+ return matchingElms;
498
+ }
499
+ function pushUnique(set1, set2) {
500
+ var i=0, s=set1, item;
501
+ while ((item = set2[i++])) {
502
+ if (!s.length || s.indexOf(item) < 0) {
503
+ set1.push(item);
504
+ }
505
+ }
506
+ return set1;
507
+ }
508
+ sort = -1;
509
+ for (var a=0, tagBin=[]; (currentRule=cssRules[a]); a++) {
510
+ if (!(cssSelectors = currentRule.match(regex.selectorSplit)) || a && index.call(cssRules.slice(0, a), currentRule) > -1) { continue; }
511
+ prevElm = [this];
512
+ for (var i=0, rule; (rule=cssSelectors[i]); i++) {
513
+ matchingElms = [];
514
+ if ((childOrSiblingRef = regex.relation.exec(rule))) {
515
+ var idElm = null, nextWord = cssSelectors[i+1];
516
+ if ((nextTag = regex.tag.exec(nextWord))) {
517
+ nextTag = nextTag[0];
518
+ nextRegExp = new RegExp("(^|\\s)" + nextTag + "(\\s|$)", "i");
519
+ }
520
+ else if (regex.id.test(nextWord)) {
521
+ idElm = DOMAssistant.$(nextWord) || null;
522
+ }
523
+ for (var j=0, prevRef; (prevRef=prevElm[j]); j++) {
524
+ switch (childOrSiblingRef[0]) {
525
+ case ">":
526
+ var children = idElm || getElementsByTagName(nextTag, prevRef);
527
+ for (var k=0, child; (child=children[k]); k++) {
528
+ if (child.parentNode === prevRef) {
529
+ matchingElms[matchingElms.length] = child;
530
+ }
531
+ }
532
+ break;
533
+ case "+":
534
+ if ((prevRef = navigate(prevRef, "next"))) {
535
+ if ((idElm && idElm[0] === prevRef) || (!idElm && (!nextTag || nextRegExp.test(prevRef.nodeName)))) {
536
+ matchingElms[matchingElms.length] = prevRef;
537
+ }
538
+ }
539
+ break;
540
+ case "~":
541
+ while ((prevRef = prevRef.nextSibling) && !prevRef.added) {
542
+ if ((idElm && idElm[0] === prevRef) || (!idElm && (!nextTag || nextRegExp.test(prevRef.nodeName)))) {
543
+ prevRef.added = true;
544
+ matchingElms[matchingElms.length] = prevRef;
545
+ }
546
+ }
547
+ break;
548
+ }
549
+ }
550
+ prevElm = matchingElms;
551
+ clearAdded();
552
+ rule = cssSelectors[++i];
553
+ if (/^\w+$/.test(rule) || regex.id.test(rule)) {
554
+ continue;
555
+ }
556
+ prevElm.skipTag = true;
557
+ }
558
+ var cssSelector = regex.selector.exec(rule);
559
+ splitRule = {
560
+ tag : cssSelector[1]? cssSelector[1] : "*",
561
+ id : cssSelector[2],
562
+ allClasses : cssSelector[3],
563
+ allAttr : cssSelector[5],
564
+ allPseudos : cssSelector[10]
565
+ };
566
+ anyTag = (splitRule.tag === "*");
567
+ if (splitRule.id) {
568
+ var u = 0, DOMElm = document.getElementById(splitRule.id.slice(1));
569
+ if (DOMElm) {
570
+ while (prevElm[u] && !DOMAssistant.hasChild.call(prevElm[u], DOMElm)) { u++; }
571
+ matchingElms = (u < prevElm.length && (anyTag || splitRule.tag === DOMElm.tagName.toLowerCase()))? [DOMElm] : [];
572
+ }
573
+ prevElm = matchingElms;
574
+ }
575
+ else if (splitRule.tag && !prevElm.skipTag) {
576
+ if (i===0 && !matchingElms.length && prevElm.length === 1) {
577
+ prevElm = matchingElms = pushAll([], getElementsByTagName(splitRule.tag, prevElm[0]));
578
+ }
579
+ else {
580
+ for (var l=0, ll=prevElm.length, tagCollectionMatches, tagMatch; l<ll; l++) {
581
+ tagCollectionMatches = getElementsByTagName(splitRule.tag, prevElm[l]);
582
+ for (var m=0; (tagMatch=tagCollectionMatches[m]); m++) {
583
+ if (!tagMatch.added) {
584
+ tagMatch.added = true;
585
+ matchingElms[matchingElms.length] = tagMatch;
586
+ }
587
+ }
588
+ }
589
+ prevElm = matchingElms;
590
+ clearAdded();
591
+ }
592
+ }
593
+ if (!matchingElms.length) {
594
+ break;
595
+ }
596
+ prevElm.skipTag = false;
597
+ if (splitRule.allClasses) {
598
+ var n = 0, matchingClassElms = [], allClasses = splitRule.allClasses.split(".").slice(1);
599
+ while ((current = prevElm[n++])) {
600
+ var matchCls = true, elmClass = current.className;
601
+ if (elmClass && elmClass.length) {
602
+ elmClass = elmClass.split(" ");
603
+ for (var o=allClasses.length; o--;) {
604
+ if (elmClass.indexOf(allClasses[o]) < 0) {
605
+ matchCls = false;
606
+ break;
607
+ }
608
+ }
609
+ if (matchCls) {
610
+ matchingClassElms[matchingClassElms.length] = current;
611
+ }
612
+ }
613
+ }
614
+ prevElm = matchingElms = matchingClassElms;
615
+ }
616
+ if (splitRule.allAttr) {
617
+ var matchAttr, r = 0, regExpAttributes = [], matchingAttributeElms = [], allAttr = splitRule.allAttr.match(regex.attribs);
618
+ for (var specialStrip = /^\[(selected|readonly)(\s*=.+)?\]$/, q=0, ql=allAttr.length, attributeMatch, attrVal; q<ql; q++) {
619
+ regex.attribs.lastIndex = 0;
620
+ attributeMatch = regex.attribs.exec(allAttr[q].replace(specialStrip, "[$1]"));
621
+ attrVal = attrToRegExp(attributeMatch[4], attributeMatch[2] || null);
622
+ regExpAttributes[q] = [(attrVal? new RegExp(attrVal) : null), attributeMatch[1]];
623
+ }
624
+ while ((current = matchingElms[r++])) {
625
+ for (var s=0, sl=regExpAttributes.length; s<sl; s++) {
626
+ var attributeRegExp = regExpAttributes[s][0], currentAttr = getAttr(current, regExpAttributes[s][1]);
627
+ matchAttr = true;
628
+ if (!attributeRegExp && currentAttr === true) { continue; }
629
+ if ((!attributeRegExp && (!currentAttr || typeof currentAttr !== "string" || !currentAttr.length)) || (!!attributeRegExp && !attributeRegExp.test(currentAttr))) {
630
+ matchAttr = false;
631
+ break;
632
+ }
633
+ }
634
+ if (matchAttr) {
635
+ matchingAttributeElms[matchingAttributeElms.length] = current;
636
+ }
637
+ }
638
+ prevElm = matchingElms = matchingAttributeElms;
639
+ }
640
+ if (splitRule.allPseudos) {
641
+ var allPseudos = splitRule.allPseudos.match(regex.pseudos);
642
+ for (var t=0, tl=allPseudos.length; t<tl; t++) {
643
+ regex.pseudos.lastIndex = 0;
644
+ var pseudo = regex.pseudos.exec(allPseudos[t]);
645
+ var pseudoClass = pseudo[1]? pseudo[1].toLowerCase() : null;
646
+ var pseudoValue = pseudo[3] || null;
647
+ matchingElms = getElementsByPseudo(matchingElms, pseudoClass, pseudoValue);
648
+ clearAdded(matchingElms);
649
+ }
650
+ prevElm = matchingElms;
651
+ }
652
+ }
653
+ elm = ((tagBin.length && (anyTag || index.call(tagBin, splitRule.tag) >= 0 || index.call(tagBin, "*") >= 0))? pushUnique : pushAll)(elm, prevElm);
654
+ tagBin.push(splitRule.tag);
655
+ if (isIE && anyTag) { elm = elm.filter(notComment); }
656
+ }
657
+ return ((elm.length > 1 && cssRules.length > 1) || sort > 0)? sortDocumentOrder(elm) : elm;
658
+ },
659
+
660
+ cssByXpath : function (cssRule) {
661
+ var ns = { xhtml: "http://www.w3.org/1999/xhtml" },
662
+ prefix = (document.documentElement.namespaceURI === ns.xhtml)? "xhtml:" : "",
663
+ nsResolver = function lookupNamespaceURI (prefix) {
664
+ return ns[prefix] || null;
665
+ };
666
+ DOMAssistant.cssByXpath = function (cssRule) {
667
+ var currentRule, cssSelectors, xPathExpression, cssSelector, splitRule, sequence,
668
+ elm = new HTMLArray(), cssRules = cssRule.replace(regex.rules, ",").split(",");
669
+ function attrToXPath (wrap) {
670
+ var pre = wrap? "[" : "", post = wrap? "]" : "";
671
+ return function (match, p1, p2, p3, p4) {
672
+ p4 = (p4 || "").replace(regex.quoted, "$1");
673
+ if (p1 === p4 && p1 === "readonly") { p3 = null; }
674
+ return pre + ({
675
+ "^": "starts-with(@" + p1 + ", \"" + p4 + "\")",
676
+ "$": "substring(@" + p1 + ", (string-length(@" + p1 + ") - " + (p4.length - 1) + "), " + p4.length + ") = \"" + p4 + "\"",
677
+ "*": "contains(concat(\" \", @" + p1 + ", \" \"), \"" + p4 + "\")",
678
+ "|": "@" + p1 + "=\"" + p4 + "\" or starts-with(@" + p1 + ", \"" + p4 + "-\")",
679
+ "~": "contains(concat(\" \", @" + p1 + ", \" \"), \" " + p4 + " \")"
680
+ }[p2] || ("@" + p1 + (p3? "=\"" + p4 + "\"" : ""))) + post;
681
+ };
682
+ }
683
+ function pseudoToXPath (tag, pseudoClass, pseudoValue) {
684
+ tag = /\-child$/.test(pseudoClass)? "*" : tag;
685
+ var pseudo = pseudoClass.split("-"), position = ((pseudo[1] === "last")? "(count(following-sibling::" : "(count(preceding-sibling::") + tag + ") + 1)", recur, hash;
686
+ switch (pseudo[0]) {
687
+ case "nth": return (pseudoValue !== "n" && (sequence = DOMAssistant.getSequence(pseudoValue)))? ((sequence.start === sequence.max)? position + " = " + sequence.start : position + " mod " + sequence.add + " = " + sequence.modVal + ((sequence.start > 1)? " and " + position + " >= " + sequence.start : "") + ((sequence.max > 0)? " and " + position + " <= " + sequence.max: "")) : "";
688
+ case "not": return "not(" + ((recur = regex.pseudo.exec(pseudoValue))? pseudoToXPath(tag, recur[1]? recur[1].toLowerCase() : null, recur[3] || null) : pseudoValue.replace(regex.id, "[id=$1]").replace(regex.tag, "self::$0").replace(regex.classes, "contains(concat(\" \", @class, \" \"), \" $1 \")").replace(regex.attribs, attrToXPath())) + ")";
689
+ case "first": return "not(preceding-sibling::" + tag + ")";
690
+ case "last": return "not(following-sibling::" + tag + ")";
691
+ case "only": return "not(preceding-sibling::" + tag + " or following-sibling::" + tag + ")";
692
+ case "empty": return "not(child::*) and not(text())";
693
+ case "contains": return "contains(., \"" + pseudoValue.replace(regex.quoted, "$1") + "\")";
694
+ case "enabled": return "not(@disabled) and not(@type=\"hidden\")";
695
+ case "disabled": return "@disabled";
696
+ case "target": return "@name=\"" + (hash = document.location.hash.slice(1)) + "\" or @id=\"" + hash + "\"";
697
+ default: return "@" + pseudoClass + "=\"" + pseudoValue + "\"";
698
+ }
699
+ }
700
+ for (var i=0; (currentRule=cssRules[i]); i++) {
701
+ if (!(cssSelectors = currentRule.match(regex.selectorSplit)) || i && elm.indexOf.call(cssRules.slice(0, i), currentRule) > -1) { continue; }
702
+ xPathExpression = xPathExpression? xPathExpression + " | ." : ".";
703
+ for (var j=0, jl=cssSelectors.length; j<jl; j++) {
704
+ cssSelector = regex.selector.exec(cssSelectors[j]);
705
+ splitRule = {
706
+ tag: prefix + (cssSelector[1]? cssSelector[1] : "*"),
707
+ id: cssSelector[2],
708
+ allClasses: cssSelector[3],
709
+ allAttr: cssSelector[5],
710
+ allPseudos: cssSelector[10],
711
+ tagRelation: cssSelector[20]
712
+ };
713
+ xPathExpression +=
714
+ (splitRule.tagRelation? ({ ">": "/", "+": "/following-sibling::*[1]/self::", "~": "/following-sibling::" }[splitRule.tagRelation] || "") : ((j > 0 && regex.relation.test(cssSelectors[j-1]))? splitRule.tag : ("//" + splitRule.tag))) +
715
+ (splitRule.id || "").replace(regex.id, "[@id = \"$1\"]") +
716
+ (splitRule.allClasses || "").replace(regex.classes, "[contains(concat(\" \", @class, \" \"), \" $1 \")]") +
717
+ (splitRule.allAttr || "").replace(regex.attribs, attrToXPath(true));
718
+ if (splitRule.allPseudos) {
719
+ var allPseudos = splitRule.allPseudos.match(regex.pseudos);
720
+ for (var k=0, kl=allPseudos.length; k<kl; k++) {
721
+ regex.pseudos.lastIndex = 0;
722
+ var pseudo = regex.pseudos.exec(allPseudos[k]),
723
+ pseudoClass = pseudo[1]? pseudo[1].toLowerCase() : null,
724
+ pseudoValue = pseudo[3] || null,
725
+ xpath = pseudoToXPath(splitRule.tag, pseudoClass, pseudoValue);
726
+ if (xpath.length) {
727
+ xPathExpression += "[" + xpath + "]";
728
+ }
729
+ }
730
+ }
731
+ }
732
+ }
733
+ try {
734
+ var xPathNodes = document.evaluate(xPathExpression, this, nsResolver, 7, null), node, p=0;
735
+ while ((node = xPathNodes.snapshotItem(p++))) { elm.push(node); }
736
+ } catch (e) {}
737
+ return elm;
738
+ };
739
+ return DOMAssistant.cssByXpath.call(this, cssRule);
740
+ },
741
+
742
+ cssSelection : function (cssRule) {
743
+ if (!cssRule) { return null; }
744
+ var special = regex.special.test(cssRule);
745
+ try {
746
+ if (document.querySelectorAll && !special) {
747
+ return pushAll(new HTMLArray(), this.querySelectorAll(cssRule));
748
+ }
749
+ } catch (e) {}
750
+ return ((document.evaluate && !special && !/-of-type/.test(cssRule))? DOMAssistant.cssByXpath : DOMAssistant.cssByDOM).call(this, cssRule);
751
+ },
752
+
753
+ cssSelect : function (cssRule) {
754
+ return DOMAssistant.cssSelection.call(this, cssRule);
755
+ },
756
+
757
+ elmsByClass : function (className, tag) {
758
+ var cssRule = (tag || "") + "." + className;
759
+ return DOMAssistant.cssSelection.call(this, cssRule);
760
+ },
761
+
762
+ elmsByAttribute : function (attr, attrVal, tag, substrMatchSelector) {
763
+ var cssRule = (tag || "") + "[" + attr + ((attrVal && attrVal !== "*")? ((substrMatchSelector || "") + "=" + attrVal + "]") : "]");
764
+ return DOMAssistant.cssSelection.call(this, cssRule);
765
+ },
766
+
767
+ elmsByTag : function (tag) {
768
+ return DOMAssistant.cssSelection.call(this, tag);
769
+ }
770
+ };
771
+ }();
772
+ DOMAssistant.initCore();
773
+ DOMAssistant.Storage = function () {
774
+ var uniqueId = 1, data = [], expando = "_da" + +new Date();
775
+ return {
776
+ hasData : function () {
777
+ var uid = this[expando];
778
+ return !!uid && !!data[uid];
779
+ },
780
+ retrieve : function (key) {
781
+ if (!DOMAssistant.def(key)) {
782
+ return this[expando] || (this[expando] = uniqueId++);
783
+ }
784
+ if (!this[expando] || !data[this[expando]]) { return; }
785
+ return data[this[expando]][key];
786
+ },
787
+
788
+ store : function (key, val) {
789
+ var uid = this[expando] || (this[expando] = uniqueId++);
790
+ data[uid] = data[uid] || {};
791
+ if (typeof key === "object") {
792
+ for (var i in key) {
793
+ if (typeof i === "string") {
794
+ data[uid][i] = key[i];
795
+ }
796
+ }
797
+ }
798
+ else {
799
+ data[uid][key] = val;
800
+ }
801
+ return this;
802
+ },
803
+
804
+ unstore : function (key) {
805
+ var uid = this[expando] || (this[expando] = uniqueId++);
806
+ if (data[uid]) {
807
+ if (DOMAssistant.def(key)) {
808
+ delete data[uid][key];
809
+ }
810
+ else {
811
+ data[uid] = null;
812
+ }
813
+ }
814
+ return this;
815
+ }
816
+ };
817
+ }();
818
+ DOMAssistant.attach(DOMAssistant.Storage);
819
+ DOMAssistant.AJAX = function () {
820
+ var globalXMLHttp = null,
821
+ readyState = 0,
822
+ status = -1,
823
+ statusText = "",
824
+ requestPool = [],
825
+ createAjaxObj = function (url, method, callback, addToContent) {
826
+ var params = null;
827
+ if (/POST/i.test(method)) {
828
+ url = url.split("?");
829
+ params = url[1];
830
+ url = url[0];
831
+ }
832
+ return {
833
+ url : url,
834
+ method : method,
835
+ callback : callback,
836
+ params : params,
837
+ headers : {},
838
+ responseType : "text",
839
+ addToContent : addToContent || false
840
+ };
841
+ };
842
+ return {
843
+ publicMethods : [
844
+ "ajax",
845
+ "get",
846
+ "post",
847
+ "load"
848
+ ],
849
+
850
+ initRequest : function () {
851
+ var XMLHttp = null;
852
+ if (!!window.XMLHttpRequest && !DOMAssistant.isIE) {
853
+ XMLHttp = new XMLHttpRequest();
854
+ DOMAssistant.AJAX.initRequest = function () {
855
+ return requestPool.length? requestPool.pop() : new XMLHttpRequest();
856
+ };
857
+ }
858
+ else if (!!window.ActiveXObject) {
859
+ var XMLHttpMS = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
860
+ for (var i=0; i<XMLHttpMS.length; i++) {
861
+ try {
862
+ XMLHttp = new window.ActiveXObject(XMLHttpMS[i]);
863
+ DOMAssistant.AJAX.initRequest = function () {
864
+ return requestPool.length? requestPool.pop() : new window.ActiveXObject(XMLHttpMS[i]);
865
+ };
866
+ break;
867
+ }
868
+ catch (e) {
869
+ XMLHttp = null;
870
+ }
871
+ }
872
+ }
873
+ return XMLHttp;
874
+ },
875
+
876
+ ajax : function (ajaxObj) {
877
+ if (!ajaxObj.noParse && ajaxObj.url && /\?/.test(ajaxObj.url) && ajaxObj.method && /POST/i.test(ajaxObj.method)) {
878
+ var url = ajaxObj.url.split("?");
879
+ ajaxObj.url = url[0];
880
+ ajaxObj.params = url[1] + ((url[1].length > 0 && ajaxObj.params)? ("&" + ajaxObj.params) : "");
881
+ }
882
+ return DOMAssistant.AJAX.makeCall.call(this, ajaxObj);
883
+ },
884
+
885
+ get : function (url, callback, addToContent) {
886
+ return DOMAssistant.AJAX.makeCall.call(this, createAjaxObj(url, "GET", callback, addToContent));
887
+ },
888
+
889
+ post : function (url, callback) {
890
+ return DOMAssistant.AJAX.makeCall.call(this, createAjaxObj(url, "POST", callback));
891
+ },
892
+
893
+ load : function (url, addToContent) {
894
+ this.get(url, DOMAssistant.AJAX.replaceWithAJAXContent, addToContent);
895
+ },
896
+
897
+ makeCall : function (ajaxObj) {
898
+ var XMLHttp = DOMAssistant.AJAX.initRequest();
899
+ if (XMLHttp) {
900
+ globalXMLHttp = XMLHttp;
901
+ (function (elm) {
902
+ var url = ajaxObj.url,
903
+ method = ajaxObj.method || "GET",
904
+ callback = ajaxObj.callback,
905
+ params = ajaxObj.params,
906
+ headers = ajaxObj.headers,
907
+ responseType = ajaxObj.responseType || "text",
908
+ addToContent = ajaxObj.addToContent,
909
+ timeout = ajaxObj.timeout || null,
910
+ ex = ajaxObj.exception,
911
+ timeoutId = null,
912
+ done = false;
913
+ XMLHttp.open(method, url, true);
914
+ XMLHttp.setRequestHeader("AJAX", "true");
915
+ XMLHttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
916
+ if (method === "POST") {
917
+ XMLHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
918
+ XMLHttp.setRequestHeader("Content-length", params? params.length : 0);
919
+ if (XMLHttp.overrideMimeType) {
920
+ XMLHttp.setRequestHeader("Connection", "close");
921
+ }
922
+ }
923
+ if (responseType === "json") {
924
+ XMLHttp.setRequestHeader("Accept", "application/json, text/javascript, */*");
925
+ }
926
+ for (var i in headers) {
927
+ if (typeof i === "string") {
928
+ XMLHttp.setRequestHeader(i, headers[i]);
929
+ }
930
+ }
931
+ if (typeof callback === "function") {
932
+ XMLHttp.onreadystatechange = function () {
933
+ try {
934
+ if (XMLHttp.readyState === 4 && !done) {
935
+ window.clearTimeout(timeoutId);
936
+ done = true;
937
+ status = XMLHttp.status;
938
+ statusText = XMLHttp.statusText;
939
+ readyState = 4;
940
+ if ((status || location.protocol !== "file:") && (status < 200 || status >= 300)) {
941
+ throw new Error(statusText);
942
+ }
943
+ var response = /xml/i.test(responseType)? XMLHttp.responseXML : XMLHttp.responseText;
944
+ if (/json/i.test(responseType) && !!response) {
945
+ response = (typeof JSON === "object" && typeof JSON.parse === "function")? JSON.parse(response) : eval("(" + response + ")");
946
+ }
947
+ globalXMLHttp = null;
948
+ XMLHttp.onreadystatechange = function () {};
949
+ requestPool.push(XMLHttp);
950
+ callback.call(elm, response, addToContent);
951
+ }
952
+ }
953
+ catch (e) {
954
+ globalXMLHttp = XMLHttp = null;
955
+ if (typeof ex === "function") {
956
+ ex.call(elm, e);
957
+ ex = null;
958
+ }
959
+ }
960
+ };
961
+ }
962
+ XMLHttp.send(params);
963
+ if (timeout) {
964
+ timeoutId = window.setTimeout( function () {
965
+ if (!done) {
966
+ XMLHttp.abort();
967
+ done = true;
968
+ if (typeof ex === "function") {
969
+ readyState = 0;
970
+ status = 408;
971
+ statusText = "Request timeout";
972
+ globalXMLHttp = XMLHttp = null;
973
+ ex.call(elm, new Error(statusText));
974
+ ex = null;
975
+ }
976
+ }
977
+ }, timeout);
978
+ }
979
+ })(this);
980
+ }
981
+ return this;
982
+ },
983
+
984
+ replaceWithAJAXContent : function (content, add) {
985
+ if (add) {
986
+ this.innerHTML += content;
987
+ }
988
+ else {
989
+ DOMAssistant.cleanUp(this);
990
+ this.innerHTML = content;
991
+ }
992
+ },
993
+
994
+ getReadyState : function () {
995
+ return (globalXMLHttp && DOMAssistant.def(globalXMLHttp.readyState))? globalXMLHttp.readyState : readyState;
996
+ },
997
+
998
+ getStatus : function () {
999
+ return status;
1000
+ },
1001
+
1002
+ getStatusText : function () {
1003
+ return statusText;
1004
+ }
1005
+ };
1006
+ }();
1007
+ DOMAssistant.attach(DOMAssistant.AJAX);
1008
+ DOMAssistant.CSS = function () {
1009
+ var def = DOMAssistant.def,
1010
+ direct = { display: true };
1011
+ return {
1012
+ addClass : function (className) {
1013
+ if (!this.hasClass(className)) {
1014
+ var currentClass = this.className;
1015
+ this.className = currentClass + (currentClass.length? " " : "") + className;
1016
+ }
1017
+ return this;
1018
+ },
1019
+
1020
+ removeClass : function (className) {
1021
+ return this.replaceClass(className);
1022
+ },
1023
+
1024
+ replaceClass : function (className, newClass) {
1025
+ var classToRemove = new RegExp(("(^|\\s)" + className + "(\\s|$)"), "i");
1026
+ this.className = this.className.replace(classToRemove, function (match, p1, p2) {
1027
+ return newClass? (p1 + newClass + p2) : " ";
1028
+ }).replace(/^\s+|\s+$/g, "");
1029
+ return this;
1030
+ },
1031
+
1032
+ hasClass : function (className) {
1033
+ return (" " + this.className + " ").indexOf(" " + className + " ") > -1;
1034
+ },
1035
+
1036
+ setStyle : function (style, value) {
1037
+ var css = this.style;
1038
+ if ("filters" in this && (typeof style === "string"? /opacity/i.test(style) : def(style.opacity))) {
1039
+ css.zoom = 1;
1040
+ css.filter = (css.filter || "").replace(/alpha\([^)]*\)/, "") + "alpha(opacity=" + (def(style.opacity)? style.opacity : value) * 100 + ")";
1041
+ }
1042
+ if (def(css.cssText)) {
1043
+ var styleToSet = css.cssText;
1044
+ if (typeof style === "object") {
1045
+ for (var i in style) {
1046
+ if (typeof i === "string") {
1047
+ if (direct[i]) { css[i] = style[i]; }
1048
+ styleToSet += ";" + i + ":" + style[i];
1049
+ }
1050
+ }
1051
+ }
1052
+ else {
1053
+ if (direct[style]) { css[style] = value; }
1054
+ styleToSet += ";" + style + ":" + value;
1055
+ }
1056
+ css.cssText = styleToSet;
1057
+ }
1058
+ return this;
1059
+ },
1060
+
1061
+ getStyle : function (cssRule) {
1062
+ var val = "", f;
1063
+ cssRule = cssRule.toLowerCase();
1064
+ if (document.defaultView && document.defaultView.getComputedStyle) {
1065
+ val = document.defaultView.getComputedStyle(this, "").getPropertyValue(cssRule);
1066
+ }
1067
+ else if (this.currentStyle) {
1068
+ if ("filters" in this && cssRule === "opacity") {
1069
+ val = (f = this.style.filter || this.currentStyle.filter) && f.indexOf("opacity=") >= 0? parseFloat(f.match(/opacity=([^)]*)/)[1]) / 100 : 1;
1070
+ }
1071
+ else {
1072
+ cssRule = cssRule.replace(/^float$/, "styleFloat").replace(/\-(\w)/g, function (match, p1) {
1073
+ return p1.toUpperCase();
1074
+ });
1075
+ val = this.currentStyle[cssRule];
1076
+ }
1077
+ if (val === "auto" && /^(width|height)$/.test(cssRule) && this.currentStyle.display !== "none") {
1078
+ val = this["offset" + cssRule.charAt(0).toUpperCase() + cssRule.substr(1)] + "px";
1079
+ }
1080
+ }
1081
+ return val;
1082
+ }
1083
+ };
1084
+ }();
1085
+ DOMAssistant.attach(DOMAssistant.CSS);
1086
+ DOMAssistant.Content = function () {
1087
+ var D$ = DOMAssistant.$$;
1088
+ return {
1089
+ init : function () {
1090
+ DOMAssistant.setCache(false);
1091
+ },
1092
+
1093
+ create : function (name, attr, append, content) {
1094
+ var elm = D$(document.createElement(name));
1095
+ if (attr) {
1096
+ elm = elm.setAttributes(attr);
1097
+ }
1098
+ if (DOMAssistant.def(content)) {
1099
+ elm.addContent(content);
1100
+ }
1101
+ if (append) {
1102
+ this.appendChild(elm);
1103
+ }
1104
+ return elm;
1105
+ },
1106
+
1107
+ setAttributes : function (attr) {
1108
+ if (DOMAssistant.isIE) {
1109
+ var setAttr = function (elm, att, val) {
1110
+ var attLower = att.toLowerCase();
1111
+ switch (attLower) {
1112
+ case "name":
1113
+ case "type":
1114
+ case "multiple":
1115
+ return D$(document.createElement(elm.outerHTML.replace(new RegExp(attLower + "(=[a-zA-Z]+)?"), " ").replace(">", " " + attLower + "=" + val + ">")));
1116
+ case "style":
1117
+ elm.style.cssText = val;
1118
+ return elm;
1119
+ default:
1120
+ elm[DOMAssistant.camel[attLower] || att] = val;
1121
+ return elm;
1122
+ }
1123
+ };
1124
+ DOMAssistant.Content.setAttributes = function (attr) {
1125
+ var elem = this;
1126
+ var parent = this.parentNode;
1127
+ for (var i in attr) {
1128
+ if (typeof attr[i] === "string" || typeof attr[i] === "number") {
1129
+ var newElem = setAttr(elem, i, attr[i]);
1130
+ if (parent && /(name|type)/i.test(i)) {
1131
+ if (elem.innerHTML) {
1132
+ newElem.innerHTML = elem.innerHTML;
1133
+ }
1134
+ parent.replaceChild(newElem, elem);
1135
+ }
1136
+ elem = newElem;
1137
+ }
1138
+ }
1139
+ return elem;
1140
+ };
1141
+ }
1142
+ else {
1143
+ DOMAssistant.Content.setAttributes = function (attr) {
1144
+ for (var i in attr) {
1145
+ if (/class/i.test(i)) {
1146
+ this.className = attr[i];
1147
+ }
1148
+ else {
1149
+ this.setAttribute(i, attr[i]);
1150
+ }
1151
+ }
1152
+ return this;
1153
+ };
1154
+ }
1155
+ return DOMAssistant.Content.setAttributes.call(this, attr);
1156
+ },
1157
+
1158
+ addContent : function (content) {
1159
+ var type = typeof content;
1160
+ if (type === "string" || type === "number") {
1161
+ if (!this.firstChild) {
1162
+ this.innerHTML = content;
1163
+ }
1164
+ else {
1165
+ var tmp = document.createElement("div");
1166
+ tmp.innerHTML = content;
1167
+ for (var i=tmp.childNodes.length-1, last=null; i>=0; i--) {
1168
+ last = this.insertBefore(tmp.childNodes[i], last);
1169
+ }
1170
+ }
1171
+ }
1172
+ else if (type === "object" || (type === "function" && !!content.nodeName)) {
1173
+ this.appendChild(content);
1174
+ }
1175
+ return this;
1176
+ },
1177
+
1178
+ replaceContent : function (content) {
1179
+ DOMAssistant.cleanUp(this);
1180
+ return this.addContent(content);
1181
+ },
1182
+
1183
+ replace : function (content, returnNew) {
1184
+ var type = typeof content;
1185
+ if (type === "string" || type === "number") {
1186
+ var parent = this.parentNode;
1187
+ var tmp = DOMAssistant.Content.create.call(parent, "div", null, false, content);
1188
+ for (var i=tmp.childNodes.length; i--;) {
1189
+ parent.insertBefore(tmp.childNodes[i], this.nextSibling);
1190
+ }
1191
+ content = this.nextSibling;
1192
+ parent.removeChild(this);
1193
+ }
1194
+ else if (type === "object" || (type === "function" && !!content.nodeName)) {
1195
+ this.parentNode.replaceChild(content, this);
1196
+ }
1197
+ return returnNew? content : this;
1198
+ },
1199
+
1200
+ remove : function () {
1201
+ DOMAssistant.cleanUp(this);
1202
+ if (this.hasData()) {
1203
+ if (this.removeEvent) { this.removeEvent(); }
1204
+ this.unstore();
1205
+ }
1206
+ this.parentNode.removeChild(this);
1207
+ return null;
1208
+ }
1209
+ };
1210
+ }();
1211
+ DOMAssistant.attach(DOMAssistant.Content);
1212
+ DOMAssistant.Events = function () {
1213
+ var handler,
1214
+ key = "_events",
1215
+ w3cMode = !!document.addEventListener,
1216
+ useCapture = { focus: true, blur: true },
1217
+ translate = DOMAssistant.isIE? { focus: "activate", blur: "deactivate", mouseenter: "mouseover", mouseleave: "mouseout" } : { mouseenter: "mouseover", mouseleave: "mouseout" },
1218
+ regex = {
1219
+ special: /^submit|reset|change|select$/i,
1220
+ mouseenterleave: /^mouse(enter|leave)$/i,
1221
+ dom: /^DOM/,
1222
+ on: /^on/i
1223
+ },
1224
+ special = function (e) {
1225
+ return DOMAssistant.isIE && regex.special.test(e);
1226
+ },
1227
+ fix = function (e) {
1228
+ return translate[e] || e;
1229
+ },
1230
+ createEvent = function (e, type, target) {
1231
+ e = e || window.event || {};
1232
+ if (e.event) { return e; }
1233
+ var event = {
1234
+ event: e,
1235
+ type: type || e.type,
1236
+ bubbles: e.bubbles || true,
1237
+ cancelable: e.cancelable || false,
1238
+ target: target || e.target || e.srcElement,
1239
+ clientX: e.clientX || 0,
1240
+ clientY: e.clientY || 0,
1241
+ altKey: e.altKey || false,
1242
+ ctrlKey: e.ctrlKey || false,
1243
+ shiftKey: e.shiftKey || false,
1244
+ button: e.button || null,
1245
+ timeStamp: +new Date(),
1246
+ preventDefault: function() {
1247
+ if (e.preventDefault) { e.preventDefault(); }
1248
+ this.returnValue = e.returnValue = false;
1249
+ },
1250
+ stopPropagation: function() {
1251
+ if (e.stopPropagation) { e.stopPropagation(); }
1252
+ this.cancelBubble = e.cancelBubble = true;
1253
+ }
1254
+ };
1255
+ if (event.target && 3 === event.target.nodeType) { // Safari textnode bug
1256
+ event.target = event.target.parentNode;
1257
+ }
1258
+ event.currentTarget = event.target;
1259
+ event.relatedTarget = e.relatedTarget || (e.fromElement === event.target? e.toElement : e.fromElement) || null;
1260
+ var de = document.documentElement, b = document.body;
1261
+ event.pageX = DOMAssistant.def(e.pageX)? e.pageX : (event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0));
1262
+ event.pageY = DOMAssistant.def(e.pageY)? e.pageY : (event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0));
1263
+ if ("number" === typeof e.which) {
1264
+ event.keyCode = e.keyCode;
1265
+ event.charCode = event.which = e.which;
1266
+ }
1267
+ else if (e.keyCode) {
1268
+ event.keyCode = event.charCode = e.keyCode;
1269
+ }
1270
+ return event;
1271
+ };
1272
+
1273
+ return {
1274
+ publicMethods : [
1275
+ "triggerEvent",
1276
+ "addEvent",
1277
+ "removeEvent",
1278
+ "relayEvent",
1279
+ "unrelayEvent",
1280
+ "preventDefault",
1281
+ "cancelBubble"
1282
+ ],
1283
+
1284
+ init : function () {
1285
+ DOMAssistant.preventDefault = this.preventDefault;
1286
+ DOMAssistant.cancelBubble = this.cancelBubble;
1287
+ handler = this.handleEvent;
1288
+ },
1289
+
1290
+ triggerEvent : function (evt, target, e) {
1291
+ var fevt = fix(evt),
1292
+ events = this.retrieve(key),
1293
+ event = e || createEvent(e, fevt, target || this);
1294
+ event.currentTarget = this;
1295
+ if (events && events[fevt]) {
1296
+ for (var i=0, iL=events[fevt].length; i<iL; i++) {
1297
+ if (events[fevt][i].call(this, event) === false) { event.stopPropagation(); }
1298
+ }
1299
+ }
1300
+ else if (typeof this["on" + fevt] === "function") {
1301
+ this["on" + fevt].call(this, event);
1302
+ }
1303
+ var p = DOMAssistant.$$(this.parentNode);
1304
+ if (!event.cancelBubble && p && p.nodeType === 1) {
1305
+ p.triggerEvent(fevt, target, event);
1306
+ }
1307
+ return this;
1308
+ },
1309
+
1310
+ addEvent : function (evt, func, relay, proxy, selector) {
1311
+ var existingEvent,
1312
+ fevt = fix(evt),
1313
+ uid = fevt + this.retrieve(),
1314
+ onevt = "on" + fevt;
1315
+ if (!(func.attachedElements && func.attachedElements[uid])) {
1316
+ var events = this.retrieve(key) || {};
1317
+ if (!events[fevt]) {
1318
+ events[fevt] = [];
1319
+ existingEvent = this[onevt];
1320
+ this[onevt] = null;
1321
+ }
1322
+ if (typeof this.window === "object") { this.window[onevt] = handler; }
1323
+ else if (!events[fevt].length) {
1324
+ if (w3cMode) { this.addEventListener(fevt, handler, useCapture[fevt]); }
1325
+ else { this[onevt] = handler; }
1326
+ }
1327
+ if (existingEvent) {
1328
+ events[fevt].push(existingEvent);
1329
+ }
1330
+ if (fevt !== evt) { func.evt = evt; }
1331
+ func.relay = relay;
1332
+ func.proxy = proxy;
1333
+ func.selector = selector;
1334
+ func.attachedElements = func.attachedElements || {};
1335
+ func.attachedElements[uid] = true;
1336
+ events[fevt].push(func);
1337
+ this.store(key, events);
1338
+ }
1339
+ return this;
1340
+ },
1341
+
1342
+ handleEvent : function (evt) {
1343
+ var currentEvt = (evt && regex.dom.test(evt.type) && w3cMode)? evt : createEvent(evt),
1344
+ type = fix(currentEvt.type),
1345
+ targ = currentEvt.target,
1346
+ relatedTarg = currentEvt.relatedTarget,
1347
+ eventColl = this.retrieve(key)[type].slice(0), eventCollLength, eventReturn, oevt;
1348
+ if ((eventCollLength = eventColl.length)) {
1349
+ for (var i=0; i<eventCollLength; i++) {
1350
+ if (typeof eventColl[i] === "function") {
1351
+ if ((oevt = eventColl[i].evt) && oevt !== type) {
1352
+ currentEvt.type = oevt;
1353
+ if (relatedTarg && regex.mouseenterleave.test(oevt)) {
1354
+ if (eventColl[i].relay) {
1355
+ var elms = eventColl[i].elms || (eventColl[i].elms = this.cssSelect(eventColl[i].selector));
1356
+ if (elms.indexOf(targ) < 0 || !DOMAssistant.hasChild.call(relatedTarg, targ)) { continue; }
1357
+ }
1358
+ else if (this === relatedTarg || this.hasChild(relatedTarg)) { continue; }
1359
+ }
1360
+ }
1361
+ eventReturn = eventColl[i].call(this, currentEvt);
1362
+ }
1363
+ }
1364
+ if (eventReturn === false) { currentEvt.stopPropagation(); }
1365
+ return eventReturn;
1366
+ }
1367
+ },
1368
+
1369
+ removeEvent : function (evt, func, relay, proxy) {
1370
+ var uid = (evt = fix(evt)) + this.retrieve(),
1371
+ events = this.retrieve(key),
1372
+ onevt = "on" + evt;
1373
+ if (events && !evt) {
1374
+ for (var ev in events) {
1375
+ if (events[ev].length) { this.removeEvent(ev); }
1376
+ }
1377
+ var attr = this.attributes;
1378
+ for (var att, j=attr.length; j--;) {
1379
+ att = attr[j].nodeName.toLowerCase();
1380
+ if (regex.on.test(att) && typeof this[att] === "function") {
1381
+ this[att] = null;
1382
+ }
1383
+ }
1384
+ }
1385
+ else if (events && events[evt]) {
1386
+ var eventColl = events[evt];
1387
+ for (var fn, i=eventColl.length; i--;) {
1388
+ fn = func || eventColl[i];
1389
+ if (eventColl[i] === fn && relay === fn.relay && proxy === fn.proxy) {
1390
+ eventColl.splice(i, 1);
1391
+ if (!!proxy && fn.selector) {
1392
+ this.cssSelect(fn.selector).removeEvent(proxy);
1393
+ }
1394
+ if (fn.attachedElements) {
1395
+ fn.attachedElements[uid] = null;
1396
+ }
1397
+ }
1398
+ }
1399
+ if (!events[evt].length) {
1400
+ if (w3cMode) { this.removeEventListener(evt, handler, useCapture[evt]); }
1401
+ else { this[onevt] = null; }
1402
+ }
1403
+ }
1404
+ else if (this[onevt] && !func && !relay) {
1405
+ this[onevt] = null;
1406
+ }
1407
+ return this;
1408
+ },
1409
+
1410
+ relayEvent: function (evt, selector, fn, proxy) {
1411
+ if (special(evt)) {
1412
+ this.relayEvent("focus", selector, function() {
1413
+ DOMAssistant.$$(this).removeEvent(evt).addEvent(evt, function(e) {
1414
+ return fn.call(this, createEvent(e));
1415
+ });
1416
+ }, evt).relayEvent("blur", selector, function() {
1417
+ DOMAssistant.$$(this).removeEvent(evt);
1418
+ }, evt);
1419
+ return this;
1420
+ }
1421
+ return this.addEvent(evt, function(e) {
1422
+ e = createEvent(e);
1423
+ var target = e.target, args = arguments, i = 0, elm, elms = this.cssSelect(selector);
1424
+ while ((elm = elms[i++])) {
1425
+ if ((elm === target || DOMAssistant.hasChild.call(elm, target)) && !elm.disabled) {
1426
+ e.currentTarget = elm;
1427
+ var retVal = fn.apply(elm, args);
1428
+ if (!retVal) { e.preventDefault(); }
1429
+ return retVal;
1430
+ }
1431
+ }
1432
+ }, true, proxy, selector);
1433
+ },
1434
+
1435
+ unrelayEvent: function (evt) {
1436
+ if (special(evt)) {
1437
+ return this.removeEvent("focus", null, true, evt).removeEvent("blur", null, true, evt);
1438
+ }
1439
+ return this.removeEvent(evt, null, true);
1440
+ },
1441
+
1442
+ preventDefault : function (evt) {
1443
+ if (evt.preventDefault) { evt.preventDefault(); }
1444
+ evt.returnValue = false;
1445
+ },
1446
+
1447
+ cancelBubble : function (evt) {
1448
+ if (evt.stopPropagation) { evt.stopPropagation(); }
1449
+ evt.cancelBubble = true;
1450
+ }
1451
+ };
1452
+ }();
1453
+ DOMAssistant.attach(DOMAssistant.Events);
1454
+ DOMAssistant.DOMLoad = function () {
1455
+ var DOMLoaded = false,
1456
+ DOMLoadTimer = null,
1457
+ functionsToCall = [],
1458
+ addedStrings = {},
1459
+ errorHandling = null,
1460
+ execFunctions = function () {
1461
+ for (var i=0, il=functionsToCall.length; i<il; i++) {
1462
+ try {
1463
+ functionsToCall[i]();
1464
+ }
1465
+ catch (e) {
1466
+ if (errorHandling && typeof errorHandling === "function") {
1467
+ errorHandling(e);
1468
+ }
1469
+ }
1470
+ }
1471
+ functionsToCall = [];
1472
+ },
1473
+ DOMHasLoaded = function () {
1474
+ if (DOMLoaded) {
1475
+ return;
1476
+ }
1477
+ DOMLoaded = true;
1478
+ execFunctions();
1479
+ };
1480
+ /* Internet Explorer */
1481
+ /*@cc_on
1482
+ @if (@_win32 || @_win64)
1483
+ document.write("<script id=\"ieScriptLoad\" defer src=\"//:\"><\/script>");
1484
+ document.getElementById("ieScriptLoad").onreadystatechange = function() {
1485
+ if (this.readyState === "complete") {
1486
+ DOMHasLoaded();
1487
+ }
1488
+ };
1489
+ @end @*/
1490
+ /* Mozilla, Chrome, Opera */
1491
+ if (document.addEventListener) {
1492
+ document.addEventListener("DOMContentLoaded", DOMHasLoaded, false);
1493
+ }
1494
+ /* Safari, iCab, Konqueror */
1495
+ if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) {
1496
+ DOMLoadTimer = setInterval(function () {
1497
+ if (/loaded|complete/i.test(document.readyState)) {
1498
+ DOMHasLoaded();
1499
+ clearInterval(DOMLoadTimer);
1500
+ }
1501
+ }, 10);
1502
+ }
1503
+ /* Other web browsers */
1504
+ window.onload = DOMHasLoaded;
1505
+
1506
+ return {
1507
+ DOMReady : function () {
1508
+ for (var i=0, il=arguments.length, funcRef; i<il; i++) {
1509
+ funcRef = arguments[i];
1510
+ if (!funcRef.DOMReady && !addedStrings[funcRef]) {
1511
+ if (typeof funcRef === "string") {
1512
+ addedStrings[funcRef] = true;
1513
+ funcRef = new Function(funcRef);
1514
+ }
1515
+ funcRef.DOMReady = true;
1516
+ functionsToCall.push(funcRef);
1517
+ }
1518
+ }
1519
+ if (DOMLoaded) {
1520
+ execFunctions();
1521
+ }
1522
+ },
1523
+
1524
+ setErrorHandling : function (funcRef) {
1525
+ errorHandling = funcRef;
1526
+ }
1527
+ };
1528
+ }();
1529
+ DOMAssistant.DOMReady = DOMAssistant.DOMLoad.DOMReady;