- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 31 May 2007 02:32:16 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/htdocs/scripts In directory hutz:/tmp/cvs-serv8394/htdocs/scripts Added Files: mootools.js w3c-validator.js Log Message: In collaboration with (and mostly courtesy of) Valerio Proietti (mad4milk/mootools), cleanup and revamp of the CSS and scripting used, mostly by the main UI of the validator. Changes include: * cleaner CSS for the UI * (more) accessible, gracefully degrading tab and toggle scripting * smooth, unobtrusive transition effects * form styling * Toggle and tab scripting now use mootools as framework, allowing for addressing of each "view" (e.g one can link directly to the "by upload", "with options toggled on" this was an issue in earlier toggle script versions for the CSS validator * scripting with smaller footprint * minor CSS changes (page and UI takes all width, etc) --- NEW FILE: w3c-validator.js --- var W3C = { start: function(){ //select elements W3C.Legends = $$('legend.toggletext'); W3C.Options = $$('div.options'); W3C.TabSet = $('tabset_tabs'); W3C.Tabs = W3C.TabSet.getElements('li'); W3C.TabLinks = W3C.TabSet.getElements('a'); W3C.Sections = $$('fieldset.tabset_content'); W3C.Submits = $$('input[type=submit]'); W3C.Forms = $$('form'); W3C.Submits.each(function(submit, i){ var value = submit.value; submit.setStyle('display', 'none'); var link = new Element('a', {'class': 'submit', 'href': '#'}); var span = new Element('span').setHTML(value).inject(link); link.injectAfter(submit).addEvent('click', function(event){ new Event(event).stop(); W3C.Forms[i].submit(); }); }); //initialize effects arrays W3C.SectionFx = []; W3C.OptionsFx = []; //creating the Effects for the Options W3C.Options.each(function(option, i){ W3C.OptionsFx[i] = new Fx.Slide(option, {'wait': false, 'duration': 180}); W3C.OptionsFx[i].addEvent('onComplete', function(){ if (this.element.getStyle('margin-top').toInt() == 0){ this.wrapper.setStyle('height', 'auto'); } }); }); //creating links on legends, with event listeners W3C.Legends.each(function(legend, i){ var html = legend.innerHTML; var pid = W3C.Sections[i].id.replace(/-/g, '_'); var opt = '+with_options'; legend.setHTML('<a href="#'+ pid + opt + '">' + html + '</a>'); var option = W3C.Options[i]; var link = legend.getFirst(); link.addEvent('click', function(event){ var block = (option.getStyle('margin-top').toInt() == 0); W3C.setHash((block) ? pid : pid + opt); new Event(event).stop(); W3C.refreshOptionLinks(!block, i); }); }); //creating event listeners on tabs W3C.Tabs.each(function(li, i){ var link = li.getFirst(); link.href = link.original = link.href.replace(/-/g, '_'); li.addEvent('click', function(){ W3C.updateLocation(); W3C.displaySection(i); }); }); //updating the location W3C.updateLocation(); //setting the initial display of the options, based on the location W3C.refreshOptionLinks(W3C.WithOptions); //attaching the Sections effects, and display section based on the uri W3C.Sections.each(function(section, i){ var fakeId = section.id.replace(/-/g, '_'); W3C.SectionFx[i] = new Fx.Style(section, 'opacity', {'wait': false, 'duration': 220}); section.setStyle('display', 'none'); if (W3C.Location[0] && fakeId.contains(W3C.Location[0].replace(/-/g, '_'))){ W3C.displaySection(i, true); W3C.Located = true; } }); //displaying the first section if no one is located if (!W3C.Located) W3C.displaySection(0, true); if (window.ie) $$('legend').setStyle('margin-left', '-0.4em'); }, updateLocation: function(){ W3C.Location = window.location.hash.replace('#', '').split('+'); W3C.WithOptions = (W3C.Location[1] && W3C.Location[1].contains('with_options')); }, refreshOptionLinks: function(options, idx){ if (!options){ if ($chk(idx)) W3C.OptionsFx[idx].slideOut(); W3C.Legends.removeClass('toggled'); } else { if ($chk(idx)) W3C.OptionsFx[idx].slideIn(); W3C.Legends.addClass('toggled'); } W3C.TabLinks.each(function(link){ link.href = (options) ? link.original + '+with_options' : link.original; }); }, displaySection: function(i, sudden){ W3C.Sections.each(function(section, j){ var block = section.getStyle('display') == 'block'; if (j == i){ if (block) return; W3C.Sections[j].setStyles({'opacity': sudden ? 1 : 0, 'display': 'block'}); if (!sudden) W3C.SectionFx[j].start(0.999999); if (W3C.WithOptions) W3C.OptionsFx[j].show().fireEvent('onComplete'); else W3C.OptionsFx[j].hide(); } else { if (!block) return; W3C.Sections[j].setStyles({'display': 'none', 'opacity': 0}); } }); W3C.Tabs.each(function(link, j){ if (j == i) link.addClass('selected'); else link.removeClass('selected'); }); }, setHash: function(hash){ if (window.webkit419){ W3C.FakeForm = W3C.FakeForm || new Element('form', {'method': 'get'}).injectInside(document.body); W3C.FakeForm.setProperty('action', '#' + hash).submit(); } else { window.location.hash = hash; } } }; window.addEvent('domready', W3C.start); --- NEW FILE: mootools.js --- //MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, <http://mad4milk.net>, MIT Style License. var MooTools={version:"1.2dev"};function $defined(_1){return(_1!=undefined);} function $type(_2){if(!$defined(_2)){return false;} if(_2.htmlElement){return"element";} var _3=typeof _2;if(_3=="object"&&_2.nodeName){switch(_2.nodeType){case 1:return"element";case 3:return(/\S/).test(_2.nodeValue)?"textnode":"whitespace";}} if(_3=="object"||_3=="function"){switch(_2.constructor){case Array:return"array";case RegExp:return"regexp";case Class:return"class";} if(typeof _2.length=="number"){if(_2.item){return"collection";} if(_2.callee){return"arguments";}}} return _3;} function $merge(){var _4={};for(var i=0;i<arguments.length;i++){for(var _6 in arguments[i]){var ap=arguments[i][_6];var mp=_4[_6];if(mp&&$type(ap)=="object"&&$type(mp)=="object"){_4[_6]=$merge(mp,ap);}else{_4[_6]=ap;}}} return _4;} var $extend=function(){var _9=arguments;if(!_9[1]){_9=[this,_9[0]];} for(var _a in _9[1]){_9[0][_a]=_9[1][_a];} return _9[0];};var $native=function(){for(var i=0,l=arguments.length;i<l;i++){arguments[i].extend=function(_d){for(var _e in _d){if(!this.prototype[_e]){this.prototype[_e]=_d[_e];} if(!this[_e]){this[_e]=$native.generic(_e);}}};}};$native.generic=function(_f){return function(_10){return this.prototype[_f].apply(_10,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);var Abstract=function(obj){obj=obj||{};obj.extend=$extend;return obj;};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName("head")[0];function $chk(obj){return!!(obj||obj===0);} function $pick(obj,_14){return $defined(obj)?obj:_14;} function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);} function $time(){return new Date().getTime();} function $clear(_17){clearTimeout(_17);clearInterval(_17);return null;} window.xpath=!!(document.evaluate);if(window.ActiveXObject){window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true;}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){window.webkit=window[window.xpath?"webkit420":"webkit419"]=true;}else{if(document.getBoxObjectFor!=null){window.gecko=true;}}} if(typeof HTMLElement=="undefined"){var HTMLElement=function(){};if(window.webkit){document.createElement("iframe");} HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};} HTMLElement.prototype.htmlElement=function(){};if(window.ie6){try{document.execCommand("BackgroundImageCache",false,true);} catch(e){}} var Class=function(_18){var _19=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this;};$extend(_19,this);_19.prototype=_18;_19.constructor=Class;return _19;};Class.empty=function(){};Class.prototype={extend:function(_1a){var _1b=new this(null);for(var _1c in _1a){var pp=_1b[_1c];_1b[_1c]=Class.Merge(pp,_1a[_1c]);} return new Class(_1b);},implement:function(){for(var i=0,l=arguments.length;i<l;i++){$extend(this.prototype,arguments[i]);}}};Class.Merge=function(_20,_21){if(_20&&_20!=_21){var _22=$type(_21);if(_22!=$type(_20)){return _21;} switch(_22){case"function":var _23=function(){this.parent=arguments.callee.parent;return _21.apply(this,arguments);};_23.parent=_20;return _23;case"object":return $merge(_20,_21);}} return _21;};var Chain=new Class({chain:function(fn){this.chains=this.chains||[];this.chains.push(fn);return this;},callChain:function(){if(this.chains&&this.chains.length){this.chains.shift().delay(10,this);}},clearChain:function(){this.chains=[];}});var Events=new Class({addEvent:function(_25,fn){if(fn!=Class.empty){this.$events=this.$events||{};this.$events[_25]=this.$events[_25]||[];this.$events[_25].include(fn);} return this;},fireEvent:function(_27,_28,_29){if(this.$events&&this.$events[_27]){this.$events[_27].each(function(fn){fn.create({"bind":this,"delay":_29,"arguments":_28})();},this);} return this;},removeEvent:function(_2b,fn){if(this.$events&&this.$events[_2b]){this.$events[_2b].remove(fn);} return this;}});var Options=new Class({setOptions:function(){this.options=$merge.apply(null,[this.options].extend(arguments));if(this.addEvent){for(var _2d in this.options){if($type(this.options[_2d]=="function")&&(/^on[A-Z]/).test(_2d)){this.addEvent(_2d,this.options[_2d]);}}} return this;}});Array.extend({forEach:function(fn,_2f){for(var i=0,j=this.length;i<j;i++){fn.call(_2f,this[i],i,this);}},filter:function(fn,_33){var _34=[];for(var i=0,j=this.length;i<j;i++){if(fn.call(_33,this[i],i,this)){_34.push(this[i]);}} return _34;},map:function(fn,_38){var _39=[];for(var i=0,j=this.length;i<j;i++){_39[i]=fn.call(_38,this[i],i,this);} return _39;},every:function(fn,_3d){for(var i=0,j=this.length;i<j;i++){if(!fn.call(_3d,this[i],i,this)){return false;}} return true;},some:function(fn,_41){for(var i=0,j=this.length;i<j;i++){if(fn.call(_41,this[i],i,this)){return true;}} return false;},indexOf:function(_44,_45){var len=this.length;for(var i=(_45<0)?Math.max(0,len+_45):_45||0;i<len;i++){if(this[i]===_44){return i;}} return-1;},copy:function(_48,_49){_48=_48||0;if(_48<0){_48=this.length+_48;} _49=_49||(this.length-_48);var _4a=[];for(var i=0;i<_49;i++){_4a[i]=this[_48++];} return _4a;},remove:function(_4c){var i=0;var len=this.length;while(i<len){if(this[i]===_4c){this.splice(i,1);len--;}else{i++;}} return this;},contains:function(_4f,_50){return this.indexOf(_4f,_50)!=-1;},associate:function(_51){var obj={},_53=Math.min(this.length,_51.length);for(var i=0;i<_53;i++){obj[_51[i]]=this[i];} return obj;},extend:function(_55){for(var i=0,j=_55.length;i<j;i++){this.push(_55[i]);} return this;},merge:function(_58){for(var i=0,l=_58.length;i<l;i++){this.include(_58[i]);} return this;},include:function(_5b){if(!this.contains(_5b)){this.push(_5b);} return this;},getRandom:function(){return this[$random(0,this.length-1)]||null;},getLast:function(){return this[this.length-1]||null;}});Array.prototype.each=Array.prototype.forEach;Array.each=Array.forEach;function $A(_5c){return Array.copy(_5c);} function $each(_5d,fn,_5f){if(_5d&&typeof _5d.length=="number"&&$type(_5d)!="object"){Array.forEach(_5d,fn,_5f);}else{for(var _60 in _5d){fn.call(_5f||_5d,_5d[_60],_60);}}} String.extend({test:function(_61,_62){return(($type(_61)=="string")?new RegExp(_61,_62):_61).test(this);},toInt:function(){return parseInt(this,10);},toFloat:function(){return parseFloat(this);},camelCase:function(){return this.replace(/-\D/g,function(_63){return _63.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/\w[A-Z]/g,function(_64){return(_64.charAt(0)+"-"+_64.charAt(1).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(_65){return _65.toUpperCase();});},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s{2,}/g," ").trim();},rgbToHex:function(_66){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(_66):false;},hexToRgb:function(_68){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(_68):false;},contains:function(_6a,s){return(s)?(s+this+s).indexOf(s+_6a+s)>-1:this.indexOf(_6a)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");}});rray.extend({rgbToHex:function(_6c){if(this.length<3){return false;} if(this.length==4&&this[3]==0&&!_6c){return"transparent";} var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?"0"+bit:bit);} return _6c?hex:"#"+hex.join("");},hexToRgb:function(_70){if(this.length!=3){return false;} var rgb=[];for(var i=0;i<3;i++){rgb.push(parseInt((this[i].length==1)?this[i]+this[i]:this[i],16));} return _70?rgb:"rgb("+rgb.join(",")+")";}});Function.extend({create:function(_73){var fn=this;_73=$merge({"bind":fn,"event":false,"arguments":null,"delay":false,"periodical":false,"attempt":false},_73);if($chk(_73.arguments)&&$type(_73.arguments)!="array"){_73.arguments=[_73.arguments];} return function(_75){var _76;if(_73.event){_75=_75||window.event;_76=[(_73.event===true)?_75:new _73.event(_75)];if(_73.arguments){_76.extend(_73.arguments);}}else{_76=_73.arguments||arguments;} var _77=function(){return fn.apply($pick(_73.bind,fn),_76);};if(_73.delay){return setTimeout(_77,_73.delay);} if(_73.periodical){return setInterval(_77,_73.periodical);} if(_73.attempt){try{return _77();} catch(err){return false;}} return _77();};},pass:function(_78,_79){return this.create({"arguments":_78,"bind":_79});},attempt:function(_7a,_7b){return this.create({"arguments":_7a,"bind":_7b,"attempt":true})();},bind:function(_7c,_7d){return this.create({"bind":_7c,"arguments":_7d});},bindAsEventListener:function(_7e,_7f){return this.create({"bind":_7e,"event":true,"arguments":_7f});},delay:function(_80,_81,_82){return this.create({"delay":_80,"bind":_81,"arguments":_82})();},periodical:function(_83,_84,_85){return this.create({"periodical":_83,"bind":_84,"arguments":_85})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(_88){_88=Math.pow(10,_88||0);return Math.round(this*_88)/_88;},times:function(fn){for(var i=0;i<this;i++){fn(i);}}});var Element=new Class({initialize:function(el,_8c){if($type(el)=="string"){if(window.ie&&_8c&&(_8c.name||_8c.type)){var _8d=(_8c.name)?" name=\""+_8c.name+"\"":"";vr _8e=(_8c.type)?" type=\""+_8c.type+"\"":"";delete _8c.name;delete _8c.type;el="<"+el+_8d+_8e+">";} el=document.createElement(el);} el=$(el);return(!_8c||!el)?el:el.set(_8c);}});var Elements=new Class({initialize:function(_8f){return(_8f)?$extend(_8f,this):this;}});Elements.extend=function(_90){for(var _91 in _90){this.prototype[_91]=_90[_91];this[_91]=$native.generic(_91);}};function $(el){if(!el){return false;} if(el.htmlElement){return Garbage.collect(el);} if([window,document].contains(el)){return el;} var _93=$type(el);if(_93=="string"){el=document.getElementById(el);_93=(el)?"element":false;} if(_93!="element"){return false;} if(el.htmlElement){return Garbage.collect(el);} if(["object","embed"].contains(el.tagName.toLowerCase())){return el;} $extend(el,Element.prototype);el.htmlElement=function(){};return Garbage.collect(el);} document.getElementsBySelector=document.getElementsByTagName;function $$(){var _94=[];for(var i=0,j=arguments.length;i<j;i++){var _97=arguments[i];switch($type(_97)){case"element":_94.push(_97);case"boolean":break;case false:break;case"string":_97=document.getElementsBySelector(_97,true);default:_94.extend(_97);}} return $$.unique(_94);} $$.unique=function(_98){var _99=[];for(var i=0,l=_98.length;i<l;i++){if(_98[i].$included){continue;} var _9c=$(_98[i]);if(_9c&&!_9c.$included){_9c.$included=true;_99.push(_9c);}} for(var n=0,d=_99.length;n<d;n++){_99[n].$included=null;} return new Elements(_99);};Elements.Multi=function(_9f){return function(){var _a0=arguments;var _a1=[];var _a2=true;for(var i=0,j=this.length,_a5;i<j;i++){_a5=this[i][_9f].apply(this[i],_a0);if($type(_a5)!="element"){_a2=false;} _a1.push(_a5);} return(_a2)?$$.unique(_a1):_a1;};};Element.extend=function(_a6){for(var _a7 in _a6){HTMLElement.prototype[_a7]=_a6[_a7];Element.prototype[_a7]=_a6[_a7];Element[_a7]=$native.generic(_a7);var _a8=(Array.prototype[_a7])?_a7+"Elements":_a7;Elements.prototype[_a8]=Elements.Multi(_a7);}};Element.extend({set:function(_a9){for(var _aa in _a9){var val=_a9[_aa];switch(_aa){case"styles":this.setStyles(val);break;case"events":if(this.addEvents){this.addEvents(val);} break;case"properties":this.setProperties(val);break;default:this.setProperty(_aa,val);}} return this;},inject:function(el,_ad){el=$(el);switch(_ad){case"before":el.parentNode.insertBefore(this,el);break;case"after":var _ae=el.getNext();if(!_ae){el.parentNode.appendChild(this);}else{el.parentNode.insertBefore(this,_ae);} break;case"top":var _af=el.firstChild;if(_af){el.insertBefore(this,_af);break;} default:el.appendChild(this);} return this;},injectBefore:function(el){return this.inject(el,"before");},injectAfter:function(el){return this.inject(el,"after");},injectInside:function(el){return this.inject(el,"bottom");},injectTop:function(el){return this.inject(el,"top");},adopt:function(){var _b4=[];$each(arguments,function(_b5){_b4=_b4.concat(_b5);});$$(_b4).inject(this);return this;},remove:function(){return this.parentNode.removeChild(this);},clone:function(_b6){var el=$(this.cloneNode(_b6!==false));if(!el.$events){return el;} el.$events={};for(var _b8 in this.$events){el.$events[_b8]={"keys":$A(this.$events[_b8].keys),"values":$A(this.$events[_b8].values)};} return el.removeEvents();},replaceWith:function(el){el=$(el);this.parentNode.replaceChild(el,this);return el;},appendText:function(_ba){if(window.ie){switch(this.getTag()){case"style":this.styleSheet.cssText=_ba;return this;case"script":return this.setProperty("text",_ba);}} this.appendChild(document.createTextNode(_ba));return this;},hasClass:function(_bb){return this.className.contains(_bb," ");},addClass:function(_bc){if(!this.hasClass(_bc)){this.className=(this.className+" "+_bc).clean();} return this;},removeClass:function(_bd){this.className=this.className.replace(new RegExp("(^|\\s)"+_bd+"(?:\\s|$)"),"$1").clean();return this;},toggleClass:function(_be){return this.hasClass(_be)?this.removeClass(_be):this.addClass(_be);},setStyle:function(_bf,_c0){switch(_bf){case"opacity":return this.setOpacity(parseFloat(_c0));case"float":_bf=(window.ie)?"styleFloat":"cssFloat";} _bf=_bf.camelCase();switch($type(_c0)){case"number":if(!["zIndex","zoom"].contains(_bf)){_c0+="px";} break;case"array":_c0="rgb("+_c0.join(",")+")";} this.style[_bf]=_c0;return this;},setStyles:function(_c1){switch($type(_c1)){case"object":Element.setMany(this,"setStyle",_c1);break;case"string":this.style.cssText=_c1;} return this;},setOpacity:function(_c2){if(_c2==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}} if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;} if(window.ie){this.style.filter=(_c2==1)?"":"alpha(opacity="+_c2*100+")";} this.style.opacity=this.$tmp.opacity=_c2;return this;},getStyle:function(_c3){_c3=_c3.camelCase();var _c4=this.style[_c3];if(!$chk(_c4)){if(_c3=="opacity"){return this.$tmp.opacity;} _c4=[];for(var _c5 in Element.Styles){if(_c3==_c5){Element.Styles[_c5].each(function(s){var _c7=this.getStyle(s);_c4.push(parseInt(_c7)?_c7:"0px");},this);if(_c3=="border"){var _c8=_c4.every(function(bit){return(bit==_c4[0]);});return(_c8)?_c4[0]:false;} return _c4.join(" ");}} if(_c3.contains("border")){if(Element.Styles.border.contains(_c3)){return["Width","Style","Color"].map(function(p){return this.getStyle(_c3+p);},this).join(" ");}else{if(Element.borderShort.contains(_c3)){return["Top","Right","Bottom","Left"].map(function(p){return this.getStyle("border"+p+_c3.replace("border",""));},this).join(" ");}}} if(document.defaultView){_c4=document.defaultView.getComputedStyle(this,null).getPropertyValue(_c3.hyphenate());}else{if(this.currentStyle){_c4=this.currentStyle[_c3];}}} if(window.ie){_c4=Element.fixStyle(_c3,_c4,this);} if(_c4&&_c3.test(/color/i)&&_c4.contains("rgb")){return _c4.split("rgb").splice(1,4).map(function(_cc){return _cc.rgbToHex();}).join(" ");} return _c4;},getStyles:function(){return Element.getMany(this,"getStyle",arguments);},walk:function(_cd,_ce){_cd+="Sibling";var el=(_ce)?this[_ce]:this[_cd];while(el&&$type(el)!="element"){el=el[_cd];} return $(el);},getPrevious:function(){return this.walk("previous");},getNext:function(){return this.walk("next");},getFirst:function(){return this.walk("next","firstChild");},getLast:function(){return this.walk("previous","lastChild");},getParent:function(){return $(this.parentNode);},getChildren:function(){return $$(this.childNodes);},hasChild:function(el){return!!$A(this.getElementsByTagName("*")).contains(el);},getProperty:function(_d1){var _d2=Element.Properties[_d1];if(_d2){return this[_d2];} var _d3=Element.PropertiesIFlag[_d1]||0;if(!window.ie||_d3){return this.getAttribute(_d1,_d3);} var _d4=this.attributes[_d1];return(_d4)?_d4.nodeValue:null;},removeProperty:function(_d5){var _d6=Element.Properties[_d5];if(_d6){this[_d6]="";}else{this.removeAttribute(_d5);} return this;},getProperties:function(){return Element.getMany(this,"getProperty",arguments);},setProperty:function(_d7,_d8){var _d9=Element.Properties[_d7];if(_d9){this[_d9]=_d8;}else{this.setAttribute(_d7,_d8);} return this;},setProperties:function(_da){return Element.setMany(this,"setProperty",_da);},setHTML:function(){this.innerHTML=$A(arguments).join("");return this;},getTag:function(){return this.tagName.toLowerCase();},empty:function(){Garbage.trash(this.getElementsByTagName("*"));return this.setHTML("");}});Element.fixStyle=function(_db,_dc,_dd){if($chk(parseInt(_dc))){return _dc;} if(["height","width"].contains(_db)){var _de=(_db=="width")?["left","right"]:["top","bottom"];var _df=0;_de.each(function(_e0){_df+=_dd.getStyle("border-"+_e0+"-width").toInt()+_dd.getStyle("padding-"+_e0).toInt();});return _dd["offset"+_db.capitalize()]-_df+"px";}else{if(_db.test(/border(.+)Width|margin|padding/)){return"0px";}} return _dc;};Element.Styles={"border":[],"padding":[],"margin":[]};["Top","Right","Bottom","Left"].each(function(_e1){for(var _e2 in Element.Styles){Element.Styles[_e2].push(_e2+_e1);}});Element.borderShort=["borderWidth","borderStyle","borderColor"];Element.getMany=function(el,_e4,_e5){var _e6={};$each(_e5,function(key){_e6[key]=el[_e4](key);});return _e6;};Element.setMany=function(el,_e9,_ea){for(var key in _ea){el[_e9](key,_ea[key]);} return el;};Element.Properties=new Abstract({"class":"className","for":"htmlFor","colspan":"colSpan","rowspan":"rowSpan","accesskey":"accessKey","tabindex":"tabIndex","maxlength":"maxLength","readonly":"readOnly","frameborder":"frameBorder","value":"value","disabled":"disabled","checked":"checked","multiple":"multiple","selected":"selected"});Element.PropertiesIFlag={"href":2,"src":2};Element.Methods={Listeners:{addListener:function(_ec,fn){if(this.addEventListener){this.addEventListener(_ec,fn,false);}else{this.attachEvent("on"+_ec,fn);} return this;},removeListener:function(_ee,fn){if(this.removeEventListener){this.removeEventListener(_ee,fn,false);}else{this.detachEvent("on"+_ee,fn);} return this;}}};window.extend(Element.Methods.Listeners);document.extend(Element.Methods.Listeners);Element.extend(Element.Methods.Listeners);var Garbage={elements:[],collect:function(el){if(!el.$tmp){Garbage.elements.push(el);el.$tmp={"opacity":1};} return el;},trash:function(_f1){for(var i=0,j=_f1.length,el;i<j;i++){if(!(el=_f1[i])||!el.$tmp){continue;} if(el.$events){el.fireEvent("trash").removeEvents();} for(var p in el.$tmp){el.$tmp[p]=null;} for(var d in Element.prototype){el[d]=null;} Garbage.elements[Garbage.elements.indexOf(el)]=null;el.htmlElement=el.$tmp=el=null;} Garbage.elements.remove(null);},empty:function(){Garbage.collect(window);Garbage.collect(document);Garbage.trash(Garbage.elements);}};window.addListener("beforeunload",function(){window.addListener("unload",Garbage.empty);if(window.ie){window.addListener("unload",CollectGarbage);}});var Event=new Class({initialize:function(_f7){if(_f7&&_f7.$extended){return _f7;} this.$extended=true;_f7=_f7||window.event;this.event=_f7;this.type=_f7.type;this.target=_f7.target||_f7.srcElement;if(this.target.nodeType==3){this.target=this.target.parentNode;} this.shift=_f7.shiftKey;this.control=_f7.ctrlKey;this.alt=_f7.altKey;this.meta=_f7.metaKey;if(["DOMMouseScroll","mousewheel"].contains(this.type)){this.wheel=(_f7.wheelDelta)?_f7.wheelDelta/120:-(_f7.detail||0)/3;}else{if(this.type.contains("key")){this.code=_f7.which||_f7.keyCode;for(var _f8 in Event.keys){if(Event.keys[_f8]==this.code){this.key=_f8;break;}} if(this.type=="keydown"){var _f9=this.code-111;if(_f9>0&&_f9<13){this.key="f"+_f9;}} this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else{if(this.type.test(/(click|mouse|menu)/)){this.page={"x":_f7.pageX||_f7.clientX+document.documentElement.scrollLeft,"y":_f7.pageY||_f7.clientY+document.documentElement.scrollTop};this.client={"x":_f7.pageX?_f7.pageX-window.pageXOffset:_f7.clientX,"y":_f7.pageY?_f7.pageY-window.pageYOffset:_f7.clientY};this.rightClick=(_f7.which==3)||(_f7.button==2);switch(this.type){case"mouseover":this.relatedTarget=_f7.relatedTarget||_f7.fromElement;break;case"mouseout":this.relatedTarget=_f7.relatedTarget||_f7.toElement;} this.fixRelatedTarget();}}} return this;},stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;} return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();}else{this.event.returnValue=false;} return this;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode;}},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);} catch(e){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({"enter":13,"up":38,"down":40,"left":37,"right":39,"esc":27,"space":32,"backspace":8,"tab":9,"delete":46});Element.Methods.Events={addEvent:function(_fa,fn){this.$events=this.$events||{};this.$events[_fa]=this.$events[_fa]||{"keys":[],"values":[]};if(this.$events[_fa].keys.contains(fn)){return this;} this.$events[_fa].keys.push(fn);var _fc=_fa;var _fd=Element.Events[_fa];if(_fd){if(_fd.add){_fd.add.call(this,fn);} if(_fd.map){fn=_fd.map;} if(_fd.type){_fc=_fd.type;}} if(!this.addEventListener){fn=fn.create({"bind":this,"event":true});} this.$events[_fa].values.push(fn);return(Element.NativeEvents.contains(_fc))?this.addListener(_fc,fn):this;},removeEvent:function(_fe,fn){if(!this.$events||!this.$events[_fe]){return this;} var pos=this.$events[_fe].keys.indexOf(fn);if(pos==-1){return this;} var key=this.$events[_fe].keys.splice(pos,1)[0];var _102=this.$events[_fe].values.splice(pos,1)[0];var _103=Element.Events[_fe];if(_103){if(_103.remove){_103.remove.call(this,fn);} if(_103.type){_fe=_103.type;}} return(Element.NativeEvents.contains(_fe))?this.removeListener(_fe,_102):this;},addEvents:function(_104){return Element.setMany(this,"addEvent",_104);},removeEvents:function(type){if(!this.$events){return this;} if(!type){for(var _106 in this.$events){this.removeEvents(_106);} this.$events=null;}else{if(this.$events[type]){this.$events[type].keys.each(function(fn){this.removeEvent(type,fn);},this);this.$events[type]=null;}} return this;},fireEvent:function(type,args,_10a){if(this.$events&&this.$events[type]){this.$events[type].keys.each(function(fn){fn.create({"bind":this,"delay":_10a,"arguments":args})();},this);} return this;},cloneEvents:function(from,type){if(!from.$events){return this;} if(!type){for(var _10e in from.$events){this.cloneEvents(from,_10e);}}else{if(from.$events[type]){from.$events[type].keys.each(function(fn){this.addEvent(type,fn);},this);}} return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({"mouseenter":{type:"mouseover",map:function(_110){_110=new Event(_110);if(_110.relatedTarget!=this&&!this.hasChild(_110.relatedTarget)){this.fireEvent("mouseenter",_110);}}},"mouseleave":{type:"mouseout",map:function(_111){_111=new Event(_111);if(_111.relatedTarget!=this&&!this.hasChild(_111.relatedTarget)){this.fireEvent("mouseleave",_111);}}},"mousewheel":{type:(window.gecko)?"DOMMouseScroll":"mousewheel"}});Element.NativeEvents=["click","dblclick","mouseup","mousedown","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","keydown","keypress","keyup","load","unload","beforeunload","resize","move","focus","blur","change","submit","reset","select","error","abort","contextmenu"];Function.extend({bindWithEvent:function(bind,args){return this.create({"bind":bind,"arguments":args,"event":Event});}});Elements.extend({filterByTag:function(tag)return new Elements(this.filter(function(el){return(Element.getTag(el)==tag);}));},filterByClass:function(_116,_117){var _118=this.filter(function(el){return(el.className&&el.className.contains(_116," "));});return(_117)?_118:new Elements(_118);},filterById:function(id,_11b){var _11c=this.filter(function(el){return(el.id==id);});return(_11b)?_11c:new Elements(_11c);},filterByAttribute:function(name,_11f,_120,_121){var _122=this.filter(function(el){var _124=Element.getProperty(el,name);if(!_124){return false;} if(!_11f){return true;} switch(_11f){case"=":return(_124==_120);case"*=":return(_124.contains(_120));case"^=":return(_124.substr(0,_120.length)==_120);case"$=":return(_124.substr(_124.length-_120.length)==_120);case"!=":return(_124!=_120);case"~=":return _124.contains(_120," ");} return false;});return(_121)?_122:new Elements(_122);}});function $E(_125,_126){return($(_126)||document).getElement(_125);} function $ES(_127,_128){return($(_128)||document).getElementsBySelector(_127);} $$.shared={"regexp":/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,"xpath":{getParam:function(_129,_12a,_12b,i){var temp=[_12a.namespaceURI?"xhtml:":"",_12b[1]];if(_12b[2]){temp.push("[@id=\"",_12b[2],"\"]");} if(_12b[3]){temp.push("[contains(concat(\" \", @class, \" \"), \" ",_12b[3]," \")]");} if(_12b[4]){if(_12b[5]&&_12b[6]){switch(_12b[5]){case"*=":temp.push("[contains(@",_12b[4],", \"",_12b[6],"\")]");break;case"^=":temp.push("[starts-with(@",_12b[4],", \"",_12b[6],"\")]");break;case"$=":temp.push("[substring(@",_12b[4],", string-length(@",_12b[4],") - ",_12b[6].length," + 1) = \"",_12b[6],"\"]");break;case"=":temp.push("[@",_12b[4],"=\"",_12b[6],"\"]");break;case"!=":temp.push("[@",_12b[4],"!=\"",_12b[6],"\"]");}}else{temp.push("[@",_12b[4],"]");}} _129.push(temp.join(""));return _129;},getItems:function(_12e,_12f,_130){var _131=[];var _132=document.evaluate(".//"+_12e.join("//"),_12f,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,j=_132.snapshotLength;i<j;i++){_131.push(_132.snapshotItem(i));} return(_130)?_131:new Elements(_131.map($));}},"normal":{getParam:function(_135,_136,_137,i){if(i==0){if(_137[2]){var el=_136.getElementById(_137[2]);if(!el||((_137[1]!="*")&&(Element.getTag(el)!=_137[1]))){return false;} _135=[el];}else{_135=$A(_136.getElementsByTagName(_137[1]));}}else{_135=$$.shared.getElementsByTagName(_135,_137[1]);if(_137[2]){_135=Elements.filterById(_135,_137[2],true);}} if(_137[3]){_135=Elements.filterByClass(_135,_137[3],true);} if(_137[4]){_135=Elements.filterByAttribute(_135,_137[4],_137[5],_137[6],true);} return _135;},getItems:function(_13a,_13b,_13c){return(_13c)?_13a:$$.unique(_13a);}},resolver:function(_13d){return(_13d=="xhtml")?"http://www.w3.org/1999/xhtml":false;},getElementsByTagName:function(_13e,_13f){var _140=[];for(var i=0,j=_13e.length;i<j;i++){_140.extend(_13e[i].getElementsByTagName(_13f));} return _140;}};$$.shared.method=(window.xpath)?"xpath":"normal";Element.Methods.Dom={getElements:function(_143,_144){var _145=[];_143=_143.trim().split(" ");for(var i=0,j=_143.length;i<j;i++){var sel=_143[i];var _149=sel.match($$.shared.regexp);if(!_149){break;} _149[1]=_149[1]||"*";var temp=$$.shared[$$.shared.method].getParam(_145,this,_149,i);if(!temp){break;} _145=temp;} return $$.shared[$$.shared.method].getItems(_145,this,_144);},getElement:function(_14b){return $(this.getElements(_14b,true)[0]||false);},getElementsBySelector:function(_14c,_14d){var _14e=[];_14c=_14c.split(",");for(var i=0,j=_14c.length;i<j;i++){_14e=_14e.concat(this.getElements(_14c[i],true));} return(_14d)?_14e:$$.unique(_14e);}};Element.extend({getElementById:function(id){var el=document.getElementById(id);if(!el){return false;} for(var _153=el.parentNode;_153!=this;_153=_153.parentNode){if(!_153){return false;}} return el;}});document.extend(Element.Methods.Dom);Element.extend(Element.Methods.Dom);Element.Events.domready={add:function(fn){if(window.loaded){fn.call(this);return;} var _155=function(){if(window.loaded){return;} window.loaded=true;window.timer=$clear(window.timer);this.fireEvent("domready");}.bind(this);if(document.readyState&&window.webkit){window.timer=function(){if(["loaded","complete"].contains(document.readyState)){_155();}}.periodical(50);}else{if(document.readyState&&window.ie){if(!$("ie_ready")){var src=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write("<script id=\"ie_ready\" defer src=\""+src+"\"></script>");$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){_155();}};}}else{window.addListener("load",_155);document.addListener("DOMContentLoaded",_155);}}}};var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(p){return-(Math.cos(Math.PI*p)-1)/2;},duration:500,unit:"px",wait:true,fps:50},initialize:function(_158){this.element=this.element||null;this.setOptions(_158);if(this.options.initialize){this.options.initialize.call(this);}},step:function(){var time=$time();if(time<this.time+thisoptions.duration){this.delta=this.options.transition((time-this.time)/this.options.duration);this.setNow();this.increase();}else{this.stop(true);this.set(this.to);this.fireEvent("onComplete",this.element,10);this.callChain();}},set:function(to){this.now=to;this.increase();return this;},setNow:function(){this.now=this.compute(this.from,this.to);},compute:function(from,to){return(to-from)*this.delta+from;},start:function(from,to){if(!this.options.wait){this.stop();}else{if(this.timer){return this;}} this.from=from;this.to=to;this.change=this.to-this.from;this.time=$time();this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);this.fireEvent("onStart",this.element);return this;},stop:function(end){if(!this.timer){return this;} this.timer=$clear(this.timer);if(!end){this.fireEvent("onCancel",this.element);} return this;}});Fx.Base.implement(new Chain,new Events,new Options);Fx.CSS={select:function(_160,to){if(_160.test(/color/i)){return this.Color;} var type=$type(to);if((type=="array")||(type=="string"&&to.contains(" "))){return this.Multi;} return this.Single;},parse:function(el,_164,_165){if(!_165.push){_165=[_165];} var from=_165[0],to=_165[1];if(!$chk(to)){to=from;from=el.getStyle(_164);} var css=this.select(_164,to);return{"from":css.parse(from),"to":css.parse(to),"css":css};}};Fx.CSS.Single={parse:function(_169){return parseFloat(_169);},getNow:function(from,to,fx){return fx.compute(from,to);},getValue:function(_16d,unit,_16f){if(unit=="px"&&_16f!="opacity"){_16d=Math.round(_16d);} return _16d+unit;}};Fx.CSS.Multi={parse:function(_170){return _170.push?_170:_170.split(" ").map(function(v){return parseFloat(v);});},getNow:function(from,to,fx){var now=[];for(var i=0;i<from.length;i++){now[i]=fx.compute(from[i],to[i]);} return now;},getValue:function(_177,unit,_179){if(unit=="px"&&_179!="opacity"){_177=_177.map(Math.round);} return _177.join(unit+" ")+unit;}};Fx.CSS.Color={parse:function(_17a){return _17a.push?_17a:_17a.hexToRgb(true);},getNow:function(from,to,fx){var now=[];for(var i=0;i<from.length;i++){now[i]=Math.round(fx.compute(from[i],to[i]));} return now;},getValue:function(_180){return"rgb("+_180.join(",")+")";}};Fx.Style=Fx.Base.extend({initialize:function(el,_182,_183){this.element=$(el);this.property=_182;this.parent(_183);},hide:function(){return this.set(0);},setNow:function(){this.now=this.css.getNow(this.from,this.to,this);},set:function(to){this.css=Fx.CSS.select(this.property,to);return this.parent(this.css.parse(to));},start:function(from,to){if(this.timer&&this.options.wait){return this;} var _187=Fx.CSS.parse(this.element,this.property,[from,to]);this.css=_187.css;return this.parent(_187.from,_187.to);},increase:function(){this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property));}});Element.extend({effect:function(_188,_189){return new Fx.Style(this,_188,_189);}});Fx.Slide=Fx.Base.extend({options:{mode:"vertical"},initialize:function(el,_18b){this.element=$(el);this.wrapper=new Element("div",{"styles":$extend(this.element.getStyles("margin"),{"overflow":"hidden"})}).injectAfter(this.element).adopt(this.element);this.element.setStyle("margin",0);this.setOptions(_18b);this.now=[];this.parent(this.options);this.open=true;this.addEvent("onComplete",function(){this.open=(this.now[0]===0);});if(window.webkit419){this.addEvent("onComplete",function(){if(this.open){this.element.remove().inject(this.wrapper);}});}},setNow:function(){for(var i=0;i<2;i++){this.now[i]=this.compute(this.from[i],this.to[i]);}},vertical:function(){this.margin="margin-top";this.layou="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},slideIn:function(mode){this[mode||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[0,this.offset]);},slideOut:function(mode){this[mode||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[-this.offset,0]);},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(mode){if(this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0){return this.slideIn(mode);} return this.slideOut(mode);},increase:function(){this.element.setStyle(this.margin,this.now[0]+this.options.unit);this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit);}});
Received on Thursday, 31 May 2007 02:32:21 UTC