1356 lines
60 KiB
Text
1356 lines
60 KiB
Text
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.0*/ if(typeof YAHOO=="undefined"){YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};YAHOO.log=function(_2,_3,_4){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};YAHOO.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};YAHOO.augment=function(r,s){var _13=[r.prototype,s.prototype];for(var i=2;i<arguments.length;++i){_13.push(arguments[i]);}r.prototype=YAHOO.compose.apply(YAHOO,_13);};YAHOO.compose=function(a,b){var _15=arguments,c={},i,p;for(p in a){c[p]=a[p];}if(_15[2]){for(i=2;i<_15.length;++i){c[_15[i]]=b[_15[i]];}}else{for(p in b){if(!c[p]){c[p]=b[p];}}}return c;};YAHOO.namespace("util","widget","example");
|
|
|
|
|
|
(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(window.getComputedStyle){getStyle=function(el,property){return el.style[property]||getComputedStyle(el,null)[property];};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':try{return(el.filters['DXImageTransform.Microsoft.Alpha']||el.filters['alpha']||100)/100;}catch(e){}break;default:return(el.currentStyle)?el.currentStyle[property]:el.style[property];}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}YAHOO.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=Y.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if(el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){if(Y.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;}var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=Y.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=Y.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}return width;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txtversion: 0.12.0*/ YAHOO.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new YAHOO.util.CustomEvent(_5,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new YAHOO.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_9)){this._delete(i);_10=true;}}return _10;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}var _14=[],ret=true,i;for(i=0;i<arguments.length;++i){_14.push(arguments[i]);}var _15=_14.length;if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _16=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var _17=null;if(_14.length>0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_18){var s=this.subscribers[_18];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_18,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_20){this.fn=fn;this.obj=obj||null;this.override=_20;};YAHOO.util.Subscriber.prototype.getScope=function(_21){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return _21;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return (this.fn==fn&&this.obj==obj);}else{return (this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _22=false;var _23=[];var _24=[];var _25=[];var _26=[];var _27=0;var _28=[];var _29=[];var _30=0;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var _31=this;var _32=function(){_31._tryPreloadAttach();};this._interval=setInterval(_32,this.POLL_INTERVAL);}},onAvailable:function(_33,_34,_35,_36){_28.push({id:_33,fn:_34,obj:_35,override:_36,checkReady:false});_27=this.POLL_RETRYS;this.startInterval();},onContentReady:function(_37,_38,_39,_40){_28.push({id:_37,fn:_38,obj:_39,override:_40,checkReady:true});_27=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_42,fn,obj,_43){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],_42,fn,obj,_43)&&ok;}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,_42,fn,obj,_43);});return true;}}}if(!el){return false;}if("unload"==_42&&obj!==this){_24[_24.length]=[el,_42,fn,obj,_43];return true;}var _46=el;if(_43){if(_43===true){_46=obj;}else{_46=_43;}}var _47=function(e){return fn.call(_46,YAHOO.util.Event.getEvent(e),obj);};var li=[el,_42,fn,_47,_46];var _50=_23.length;_23[_50]=li;if(this.useLegacyEvent(el,_42)){var _51=this.getLegacyIndex(el,_42);if(_51==-1||el!=_25[_51][0]){_51=_25.length;_29[el.id+_42]=_51;_25[_51]=[el,_42,el["on"+_42]];_26[_51]=[];el["on"+_42]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_51);};}_26[_51].push(li);}else{this._simpleAdd(el,_42,_47,false);}return true;},fireLegacyEvent:function(e,_52){var ok=true;var le=_26[_52];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _54=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_54,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_56){var key=this.generateId(el)+_56;if(typeof _29[key]=="undefined"){return -1;}else{return _29[key];}},useLegacyEvent:function(el,_58){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_58||"dblclick"==_58){return true;}}}return false;},removeListener:function(el,_59,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_59,fn)&&ok);}return ok;}}if(!fn||!fn.call){return this.purgeElement(el,false,_59);}if("unload"==_59){for(i=0,len=_24.length;i<len;i++){var li=_24[i];if(li&&li[0]==el&&li[1]==_59&&li[2]==fn){_24.splice(i,1);return true;}}return false;}var _60=null;var _61=arguments[3];if("undefined"==typeof _61){_61=this._getCacheIndex(el,_59,fn);}if(_61>=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i<len;++i){li=_63[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_59&&li[this.FN]==fn){_63.splice(i,1);}}}}else{this._simpleRemove(el,_59,_60[this.WFN],false);}delete _23[_61][this.WFN];delete _23[_61][this.FN];_23.splice(_61,1);return true;},getTarget:function(ev,_65){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_67){if(_67&&3==_67.nodeType){return _67.parentNode;}else{return _67;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_71,fn){for(var i=0,len=_23.length;i<len;++i){var li=_23[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_71){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_30;++_30;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_22=true;var EU=YAHOO.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _75=!_22;if(!_75){_75=(_27>0);}var _76=[];for(var i=0,len=_28.length;i<len;++i){var _77=_28[i];if(_77){var el=this.getEl(_77.id);if(el){if(!_77.checkReady||_22||el.nextSibling||(document&&document.body)){var _78=el;if(_77.override){if(_77.override===true){_78=_77.obj;}else{_78=_77.override;}}_77.fn.call(_78,_77.obj);delete _28[i];}}else{_76.push(_77);}}}_27=(_76.length===0)?0:_27-1;if(_75){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_79,_80){var _81=this.getListeners(el,_80);if(_81){for(var i=0,len=_81.length;i<len;++i){var l=_81[i];this.removeListener(el,l.type,l.fn);}}if(_79&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_79,_80);}}},getListeners:function(el,_83){var _84=[];if(_23&&_23.length>0){for(var i=0,len=_23.length;i<len;++i){var l=_23[i];if(l&&l[this.EL]===el&&(!_83||_83===l[this.TYPE])){_84.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_84.length)?_84:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=_24.length;i<len;++i){l=_24[i];if(l){var _85=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_85=l[EU.OBJ];}else{_85=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_85,EU.getEvent(e),l[EU.OBJ]);delete _24[i];l=null;_85=null;}}if(_23&&_23.length>0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i<len;++i){delete _25[i][0];delete _25[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(){if(window.addEventListener){return function(el,_87,fn,_88){el.addEventListener(_87,fn,(_88));};}else{if(window.attachEvent){return function(el,_89,fn,_90){el.attachEvent("on"+_89,fn);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,_91,fn,_92){el.removeEventListener(_91,fn,(_92));};}else{if(window.detachEvent){return function(el,_93,fn){el.detachEvent("on"+_93,fn);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(_94,_95,_96,_97){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_94];if(ce){ce.subscribe(_95,_96,_97);}else{this.__yui_subscribers=this.__yui_subscribers||{};var _99=this.__yui_subscribers;if(!_99[_94]){_99[_94]=[];}_99[_94].push({fn:_95,obj:_96,override:_97});}},unsubscribe:function(_100,p_fn,_102){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_100];if(ce){return ce.unsubscribe(p_fn,_102);}else{return false;}},createEvent:function(_103,_104){this.__yui_events=this.__yui_events||{};var opts=_104||{};var _106=this.__yui_events;if(_106[_103]){}else{var _107=opts.scope||this;var _108=opts.silent||null;var ce=new YAHOO.util.CustomEvent(_103,_107,_108,YAHOO.util.CustomEvent.FLAT);_106[_103]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[_103];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}return _106[_103];},fireEvent:function(_110,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_110];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}return false;}};
|
|
|
|
|
|
YAHOO.widget.AutoComplete=function(_1,_2,_3,_4){
|
|
if(_1&&_2&&_3){
|
|
if(_3&&(_3 instanceof YAHOO.widget.DataSource)){
|
|
this.dataSource=_3;
|
|
}else{
|
|
alert("1");
|
|
return;
|
|
}
|
|
if(YAHOO.util.Dom.inDocument(_1)){
|
|
if(typeof _1=="string"){
|
|
this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+_1;
|
|
this._oTextbox=document.getElementById(_1);
|
|
}else{
|
|
this._sName=(_1.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+_1.id:"instance"+YAHOO.widget.AutoComplete._nIndex;
|
|
this._oTextbox=_1;
|
|
}
|
|
}else{
|
|
alert(_1);
|
|
return;
|
|
}
|
|
if(YAHOO.util.Dom.inDocument(_2)){
|
|
if(typeof _2=="string"){
|
|
this._oContainer=document.getElementById(_2);
|
|
}else{
|
|
this._oContainer=_2;
|
|
}
|
|
if(this._oContainer.style.display=="none"){
|
|
}
|
|
}else{
|
|
alert("3");
|
|
return;
|
|
}
|
|
if(typeof _4=="object"){
|
|
for(var _5 in _4){
|
|
if(_5){
|
|
this[_5]=_4[_5];
|
|
}
|
|
}
|
|
}
|
|
this._initContainer();
|
|
this._initProps();
|
|
this._initList();
|
|
this._initContainerHelpers();
|
|
var _6=this;
|
|
var _7=this._oTextbox;
|
|
var _8=this._oContainer._oContent;
|
|
YAHOO.util.Event.addListener(_7,"keyup",_6._onTextboxKeyUp,_6);
|
|
YAHOO.util.Event.addListener(_7,"keydown",_6._onTextboxKeyDown,_6);
|
|
YAHOO.util.Event.addListener(_7,"focus",_6._onTextboxFocus,_6);
|
|
YAHOO.util.Event.addListener(_7,"blur",_6._onTextboxBlur,_6);
|
|
YAHOO.util.Event.addListener(_8,"mouseover",_6._onContainerMouseover,_6);
|
|
YAHOO.util.Event.addListener(_8,"mouseout",_6._onContainerMouseout,_6);
|
|
YAHOO.util.Event.addListener(_8,"scroll",_6._onContainerScroll,_6);
|
|
YAHOO.util.Event.addListener(_8,"resize",_6._onContainerResize,_6);
|
|
if(_7.form){
|
|
YAHOO.util.Event.addListener(_7.form,"submit",_6._onFormSubmit,_6);
|
|
}
|
|
YAHOO.util.Event.addListener(_7,"keypress",_6._onTextboxKeyPress,_6);
|
|
this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);
|
|
this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);
|
|
this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);
|
|
this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);
|
|
this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);
|
|
this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);
|
|
this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);
|
|
this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);
|
|
this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);
|
|
this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);
|
|
this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);
|
|
this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);
|
|
this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);
|
|
this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);
|
|
this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);
|
|
this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);
|
|
_7.setAttribute("autocomplete","off");
|
|
YAHOO.widget.AutoComplete._nIndex++;
|
|
}else{
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.dataSource=null;
|
|
YAHOO.widget.AutoComplete.prototype.minQueryLength=1;
|
|
YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;
|
|
YAHOO.widget.AutoComplete.prototype.queryDelay=0.5;
|
|
YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";
|
|
YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;
|
|
YAHOO.widget.AutoComplete.prototype.delimChar=null;
|
|
YAHOO.widget.AutoComplete.prototype.autoHighlight=true;
|
|
YAHOO.widget.AutoComplete.prototype.typeAhead=false;
|
|
YAHOO.widget.AutoComplete.prototype.animHoriz=false;
|
|
YAHOO.widget.AutoComplete.prototype.animVert=true;
|
|
YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;
|
|
YAHOO.widget.AutoComplete.prototype.forceSelection=false;
|
|
YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;
|
|
YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;
|
|
YAHOO.widget.AutoComplete.prototype.useIFrame=false;
|
|
YAHOO.widget.AutoComplete.prototype.useShadow=false;
|
|
YAHOO.widget.AutoComplete.prototype.toString=function(){
|
|
return "AutoComplete "+this._sName;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.getListItems=function(){
|
|
return this._aListItems;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.getListItemData=function(_9){
|
|
if(_9._oResultData){
|
|
return _9._oResultData;
|
|
}else{
|
|
return false;
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.setHeader=function(_10){
|
|
if(_10){
|
|
if(this._oContainer._oContent._oHeader){
|
|
this._oContainer._oContent._oHeader.innerHTML=_10;
|
|
this._oContainer._oContent._oHeader.style.display="block";
|
|
}
|
|
}else{
|
|
this._oContainer._oContent._oHeader.innerHTML="";
|
|
this._oContainer._oContent._oHeader.style.display="none";
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.setFooter=function(_11){
|
|
if(_11){
|
|
if(this._oContainer._oContent._oFooter){
|
|
this._oContainer._oContent._oFooter.innerHTML=_11;
|
|
this._oContainer._oContent._oFooter.style.display="block";
|
|
}
|
|
}else{
|
|
this._oContainer._oContent._oFooter.innerHTML="";
|
|
this._oContainer._oContent._oFooter.style.display="none";
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.setBody=function(_12){
|
|
if(_12){
|
|
if(this._oContainer._oContent._oBody){
|
|
this._oContainer._oContent._oBody.innerHTML=_12;
|
|
this._oContainer._oContent._oBody.style.display="block";
|
|
this._oContainer._oContent.style.display="block";
|
|
}
|
|
}else{
|
|
this._oContainer._oContent._oBody.innerHTML="";
|
|
this._oContainer._oContent.style.display="none";
|
|
}
|
|
this._maxResultsDisplayed=0;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.formatResult=function(_13,_14){
|
|
var _15=_13[0];
|
|
if(_15){
|
|
return _15;
|
|
}else{
|
|
return "";
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.sendQuery=function(_16){
|
|
this._sendQuery(_16);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;
|
|
YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;
|
|
YAHOO.widget.AutoComplete._nIndex=0;
|
|
YAHOO.widget.AutoComplete.prototype._sName=null;
|
|
YAHOO.widget.AutoComplete.prototype._oTextbox=null;
|
|
YAHOO.widget.AutoComplete.prototype._bFocused=true;
|
|
YAHOO.widget.AutoComplete.prototype._oAnim=null;
|
|
YAHOO.widget.AutoComplete.prototype._oContainer=null;
|
|
YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;
|
|
YAHOO.widget.AutoComplete.prototype._bOverContainer=false;
|
|
YAHOO.widget.AutoComplete.prototype._aListItems=null;
|
|
YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;
|
|
YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;
|
|
YAHOO.widget.AutoComplete.prototype._sCurQuery=null;
|
|
YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;
|
|
YAHOO.widget.AutoComplete.prototype._oCurItem=null;
|
|
YAHOO.widget.AutoComplete.prototype._bItemSelected=false;
|
|
YAHOO.widget.AutoComplete.prototype._nKeyCode=null;
|
|
YAHOO.widget.AutoComplete.prototype._nDelayID=-1;
|
|
YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";
|
|
YAHOO.widget.AutoComplete.prototype._queryInterval=null;
|
|
YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;
|
|
YAHOO.widget.AutoComplete.prototype._initProps=function(){
|
|
var _17=this.minQueryLength;
|
|
if(isNaN(_17)||(_17<1)){
|
|
_17=1;
|
|
}
|
|
var _18=this.maxResultsDisplayed;
|
|
if(isNaN(this.maxResultsDisplayed)||(this.maxResultsDisplayed<1)){
|
|
this.maxResultsDisplayed=10;
|
|
}
|
|
var _19=this.queryDelay;
|
|
if(isNaN(this.queryDelay)||(this.queryDelay<0)){
|
|
this.queryDelay=0.5;
|
|
}
|
|
var _20=(this.delimChar)?this.delimChar:null;
|
|
if(_20){
|
|
if(typeof _20=="string"){
|
|
this.delimChar=[_20];
|
|
}else{
|
|
if(_20.constructor!=Array){
|
|
this.delimChar=null;
|
|
}
|
|
}
|
|
}
|
|
var _21=this.animSpeed;
|
|
if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){
|
|
if(isNaN(_21)||(_21<0)){
|
|
_21=0.3;
|
|
}
|
|
if(!this._oAnim){
|
|
oAnim=new YAHOO.util.Anim(this._oContainer._oContent,{},this.animSpeed);
|
|
this._oAnim=oAnim;
|
|
}else{
|
|
this._oAnim.duration=_21;
|
|
}
|
|
}
|
|
if(this.forceSelection&&this.delimChar){
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){
|
|
if(this.useShadow&&!this._oContainer._oShadow){
|
|
var _22=document.createElement("div");
|
|
_22.className="yui-ac-shadow";
|
|
this._oContainer._oShadow=this._oContainer.appendChild(_22);
|
|
}
|
|
if(this.useIFrame&&!this._oContainer._oIFrame){
|
|
var _23=document.createElement("iframe");
|
|
_23.src=this._iFrameSrc;
|
|
_23.frameBorder=0;
|
|
_23.scrolling="no";
|
|
_23.style.position="absolute";
|
|
_23.style.width="100%";
|
|
_23.style.height="100%";
|
|
_23.tabIndex=-1;
|
|
this._oContainer._oIFrame=this._oContainer.appendChild(_23);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._initContainer=function(){
|
|
if(!this._oContainer._oContent){
|
|
var _24=document.createElement("div");
|
|
_24.className="yui-ac-content";
|
|
_24.style.display="none";
|
|
this._oContainer._oContent=this._oContainer.appendChild(_24);
|
|
var _25=document.createElement("div");
|
|
_25.className="yui-ac-hd";
|
|
_25.style.display="none";
|
|
this._oContainer._oContent._oHeader=this._oContainer._oContent.appendChild(_25);
|
|
var _26=document.createElement("div");
|
|
_26.className="yui-ac-bd";
|
|
this._oContainer._oContent._oBody=this._oContainer._oContent.appendChild(_26);
|
|
var _27=document.createElement("div");
|
|
_27.className="yui-ac-ft";
|
|
_27.style.display="none";
|
|
this._oContainer._oContent._oFooter=this._oContainer._oContent.appendChild(_27);
|
|
}else{
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._initList=function(){
|
|
this._aListItems=[];
|
|
while(this._oContainer._oContent._oBody.hasChildNodes()){
|
|
var _28=this.getListItems();
|
|
if(_28){
|
|
for(var _29=_28.length-1;_29>=0;i--){
|
|
_28[_29]=null;
|
|
}
|
|
}
|
|
this._oContainer._oContent._oBody.innerHTML="";
|
|
}
|
|
var _30=document.createElement("ul");
|
|
_30=this._oContainer._oContent._oBody.appendChild(_30);
|
|
for(var i=0;i<this.maxResultsDisplayed;i++){
|
|
var _32=document.createElement("li");
|
|
_32=_30.appendChild(_32);
|
|
this._aListItems[i]=_32;
|
|
this._initListItem(_32,i);
|
|
}
|
|
this._maxResultsDisplayed=this.maxResultsDisplayed;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._initListItem=function(_33,_34){
|
|
var _35=this;
|
|
_33.style.display="none";
|
|
_33._nItemIndex=_34;
|
|
_33.mouseover=_33.mouseout=_33.onclick=null;
|
|
YAHOO.util.Event.addListener(_33,"mouseover",_35._onItemMouseover,_35);
|
|
YAHOO.util.Event.addListener(_33,"mouseout",_35._onItemMouseout,_35);
|
|
YAHOO.util.Event.addListener(_33,"click",_35._onItemMouseclick,_35);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(v,_37){
|
|
if(_37.prehighlightClassName){
|
|
_37._togglePrehighlight(this,"mouseover");
|
|
}else{
|
|
_37._toggleHighlight(this,"to");
|
|
}
|
|
_37.itemMouseOverEvent.fire(_37,this);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(v,_38){
|
|
if(_38.prehighlightClassName){
|
|
_38._togglePrehighlight(this,"mouseout");
|
|
}else{
|
|
_38._toggleHighlight(this,"from");
|
|
}
|
|
_38.itemMouseOutEvent.fire(_38,this);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(v,_39){
|
|
_39._toggleHighlight(this,"to");
|
|
_39._selectItem(this);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(v,_40){
|
|
_40._bOverContainer=true;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(v,_41){
|
|
_41._bOverContainer=false;
|
|
if(_41._oCurItem){
|
|
_41._toggleHighlight(_41._oCurItem,"to");
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(v,_42){
|
|
_42._oTextbox.focus();
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onContainerResize=function(v,_43){
|
|
_43._toggleContainerHelpers(_43._bContainerOpen);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(v,_44){
|
|
var _45=v.keyCode;
|
|
switch(_45){
|
|
case 9:
|
|
if(_44.delimChar&&(_44._nKeyCode!=_45)){
|
|
if(_44._bContainerOpen){
|
|
YAHOO.util.Event.stopEvent(v);
|
|
}
|
|
}
|
|
if(_44._oCurItem){
|
|
_44._selectItem(_44._oCurItem);
|
|
}else{
|
|
_44._toggleContainer(false);
|
|
}
|
|
break;
|
|
case 13:
|
|
if(_44._nKeyCode!=_45){
|
|
if(_44._bContainerOpen){
|
|
YAHOO.util.Event.stopEvent(v);
|
|
}
|
|
}
|
|
if(_44._oCurItem){
|
|
_44._selectItem(_44._oCurItem);
|
|
}else{
|
|
_44._toggleContainer(false);
|
|
}
|
|
break;
|
|
case 27:
|
|
_44._toggleContainer(false);
|
|
return;
|
|
case 39:
|
|
_44._jumpSelection();
|
|
break;
|
|
case 38:
|
|
YAHOO.util.Event.stopEvent(v);
|
|
_44._moveSelection(_45);
|
|
break;
|
|
case 40:
|
|
YAHOO.util.Event.stopEvent(v);
|
|
_44._moveSelection(_45);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(v,_46){
|
|
var _47=v.keyCode;
|
|
var _48=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);
|
|
if(_48){
|
|
switch(_47){
|
|
case 9:
|
|
if(_46.delimChar&&(_46._nKeyCode!=_47)){
|
|
if(_46._bContainerOpen){
|
|
YAHOO.util.Event.stopEvent(v);
|
|
}
|
|
}
|
|
break;
|
|
case 13:
|
|
if(_46._nKeyCode!=_47){
|
|
if(_46._bContainerOpen){
|
|
YAHOO.util.Event.stopEvent(v);
|
|
}
|
|
}
|
|
break;
|
|
case 38:
|
|
case 40:
|
|
YAHOO.util.Event.stopEvent(v);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
switch(_47){
|
|
case 229:
|
|
_46._queryInterval=setInterval(function(){
|
|
_46._onIMEDetected(_46);
|
|
},500);
|
|
break;
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onIMEDetected=function(_49){
|
|
_49._enableIntervalDetection();
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){
|
|
var _50=this._oTextbox.value;
|
|
var _51=this._sLastTextboxValue;
|
|
if(_50!=_51){
|
|
this._sLastTextboxValue=_50;
|
|
this._sendQuery(_50);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection=function(_52){
|
|
if(_52._queryInterval){
|
|
clearInterval(_52._queryInterval);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(v,_53){
|
|
_53._initProps();
|
|
var _54=v.keyCode;
|
|
_53._nKeyCode=_54;
|
|
var _55=this.value;
|
|
if(_53._isIgnoreKey(_54)||(_55.toLowerCase()==_53._sCurQuery)){
|
|
return;
|
|
}else{
|
|
_53.textboxKeyEvent.fire(_53,_54);
|
|
}
|
|
if(_53.queryDelay>0){
|
|
var _56=setTimeout(function(){
|
|
_53._sendQuery(_55);
|
|
},(_53.queryDelay*1000));
|
|
if(_53._nDelayID!=-1){
|
|
clearTimeout(_53._nDelayID);
|
|
}
|
|
_53._nDelayID=_56;
|
|
}else{
|
|
_53._sendQuery(_55);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(_57){
|
|
if((_57==9)||(_57==13)||(_57==16)||(_57==17)||(_57>=18&&_57<=20)||(_57==27)||(_57>=33&&_57<=35)||(_57>=36&&_57<=38)||(_57==40)||(_57>=44&&_57<=45)){
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(v,_58){
|
|
_58._oTextbox.setAttribute("autocomplete","off");
|
|
_58._bFocused=true;
|
|
_58.textboxFocusEvent.fire(_58);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(v,_59){
|
|
if(!_59._bOverContainer||(_59._nKeyCode==9)){
|
|
if(!_59._bItemSelected){
|
|
if(!_59._bContainerOpen||(_59._bContainerOpen&&!_59._textMatchesOption())){
|
|
if(_59.forceSelection){
|
|
_59._clearSelection();
|
|
}else{
|
|
_59.unmatchedItemSelectEvent.fire(_59,_59._sCurQuery);
|
|
}
|
|
}
|
|
}
|
|
if(_59._bContainerOpen){
|
|
_59._toggleContainer(false);
|
|
}
|
|
_59._cancelIntervalDetection(_59);
|
|
_59._bFocused=false;
|
|
_59.textboxBlurEvent.fire(_59);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._onFormSubmit=function(v,_60){
|
|
if(_60.allowBrowserAutocomplete){
|
|
_60._oTextbox.setAttribute("autocomplete","on");
|
|
}else{
|
|
_60._oTextbox.setAttribute("autocomplete","off");
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._sendQuery=function(_61){
|
|
var _62=(this.delimChar)?this.delimChar:null;
|
|
if(_62){
|
|
var _63=-1;
|
|
for(var i=_62.length-1;i>=0;i--){
|
|
var _64=_61.lastIndexOf(_62[i]);
|
|
if(_64>_63){
|
|
_63=_64;
|
|
}
|
|
}
|
|
if(_62[i]==" "){
|
|
for(var j=_62.length-1;j>=0;j--){
|
|
if(_61[_63-1]==_62[j]){
|
|
_63--;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if(_63>-1){
|
|
var _66=_63+1;
|
|
while(_61.charAt(_66)==" "){
|
|
_66+=1;
|
|
}
|
|
this._sSavedQuery=_61.substring(0,_66);
|
|
_61=_61.substr(_66);
|
|
}else{
|
|
if(_61.indexOf(this._sSavedQuery)<0){
|
|
this._sSavedQuery=null;
|
|
}
|
|
}
|
|
}
|
|
if(_61&&(_61.length<this.minQueryLength)){
|
|
if(this._nDelayID!=-1){
|
|
clearTimeout(this._nDelayID);
|
|
}
|
|
this._toggleContainer(false);
|
|
return;
|
|
}
|
|
_61=encodeURIComponent(_61);
|
|
this._nDelayID=-1;
|
|
this.dataRequestEvent.fire(this,_61);
|
|
this.dataSource.getResults(this._populateList,_61,this);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._populateList=function(_67,_68,_69){
|
|
if(_68===null){
|
|
_69.dataErrorEvent.fire(_69,_67);
|
|
}
|
|
if(!_69._bFocused||!_68){
|
|
return;
|
|
}
|
|
var _70=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
|
|
var _71=_69._oContainer._oContent.style;
|
|
_71.width=(!_70)?null:"";
|
|
_71.height=(!_70)?null:"";
|
|
var _72=decodeURIComponent(_67);
|
|
_69._sCurQuery=_72;
|
|
_69._bItemSelected=false;
|
|
if(_69._maxResultsDisplayed!=_69.maxResultsDisplayed){
|
|
_69._initList();
|
|
}
|
|
var _73=Math.min(_68.length,_69.maxResultsDisplayed);
|
|
_69._nDisplayedItems=_73;
|
|
if(_73>0){
|
|
_69._initContainerHelpers();
|
|
var _74=_69._aListItems;
|
|
for(var i=_73-1;i>=0;i--){
|
|
var _75=_74[i];
|
|
var _76=_68[i];
|
|
_75.innerHTML=_69.formatResult(_76,_72);
|
|
_75.style.display="list-item";
|
|
_75._sResultKey=_76[0];
|
|
_75._oResultData=_76;
|
|
}
|
|
for(var j=_74.length-1;j>=_73;j--){
|
|
var _77=_74[j];
|
|
_77.innerHTML=null;
|
|
_77.style.display="none";
|
|
_77._sResultKey=null;
|
|
_77._oResultData=null;
|
|
}
|
|
if(_69.autoHighlight){
|
|
var _78=_74[0];
|
|
_69._toggleHighlight(_78,"to");
|
|
_69.itemArrowToEvent.fire(_69,_78);
|
|
_69._typeAhead(_78,_67);
|
|
}else{
|
|
_69._oCurItem=null;
|
|
}
|
|
_69._toggleContainer(true);
|
|
}else{
|
|
_69._toggleContainer(false);
|
|
}
|
|
_69.dataReturnEvent.fire(_69,_67,_68);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._clearSelection=function(){
|
|
var _79=this._oTextbox.value;
|
|
var _80=(this.delimChar)?this.delimChar[0]:null;
|
|
var _81=(_80)?_79.lastIndexOf(_80,_79.length-2):-1;
|
|
if(_81>-1){
|
|
this._oTextbox.value=_79.substring(0,_81);
|
|
}else{
|
|
this._oTextbox.value="";
|
|
}
|
|
this._sSavedQuery=this._oTextbox.value;
|
|
this.selectionEnforceEvent.fire(this);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){
|
|
var _82=false;
|
|
for(var i=this._nDisplayedItems-1;i>=0;i--){
|
|
var _83=this._aListItems[i];
|
|
var _84=_83._sResultKey.toLowerCase();
|
|
if(_84==this._sCurQuery.toLowerCase()){
|
|
_82=true;
|
|
break;
|
|
}
|
|
}
|
|
return (_82);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._typeAhead=function(_85,_86){
|
|
if(!this.typeAhead){
|
|
return;
|
|
}
|
|
var _87=this._oTextbox;
|
|
var _88=this._oTextbox.value;
|
|
if(!_87.setSelectionRange&&!_87.createTextRange){
|
|
return;
|
|
}
|
|
var _89=_88.length;
|
|
this._updateValue(_85);
|
|
var _90=_87.value.length;
|
|
this._selectText(_87,_89,_90);
|
|
var _91=_87.value.substr(_89,_90);
|
|
this.typeAheadEvent.fire(this,_86,_91);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._selectText=function(_92,_93,_94){
|
|
if(_92.setSelectionRange){
|
|
_92.setSelectionRange(_93,_94);
|
|
}else{
|
|
if(_92.createTextRange){
|
|
var _95=_92.createTextRange();
|
|
_95.moveStart("character",_93);
|
|
_95.moveEnd("character",_94-_92.value.length);
|
|
_95.select();
|
|
}else{
|
|
_92.select();
|
|
}
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(_96){
|
|
var _97=false;
|
|
var _98=this._oContainer._oContent.offsetWidth+"px";
|
|
var _99=this._oContainer._oContent.offsetHeight+"px";
|
|
if(this.useIFrame&&this._oContainer._oIFrame){
|
|
_97=true;
|
|
if(_96){
|
|
this._oContainer._oIFrame.style.width=_98;
|
|
this._oContainer._oIFrame.style.height=_99;
|
|
}else{
|
|
this._oContainer._oIFrame.style.width=0;
|
|
this._oContainer._oIFrame.style.height=0;
|
|
}
|
|
}
|
|
if(this.useShadow&&this._oContainer._oShadow){
|
|
_97=true;
|
|
if(_96){
|
|
this._oContainer._oShadow.style.width=_98;
|
|
this._oContainer._oShadow.style.height=_99;
|
|
}else{
|
|
this._oContainer._oShadow.style.width=0;
|
|
this._oContainer._oShadow.style.height=0;
|
|
}
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._toggleContainer=function(_100){
|
|
var _101=this._oContainer;
|
|
if(this.alwaysShowContainer&&this._bContainerOpen){
|
|
return;
|
|
}
|
|
if(!_100){
|
|
this._oContainer._oContent.scrollTop=0;
|
|
var _102=this._aListItems;
|
|
if(_102&&(_102.length>0)){
|
|
for(var i=_102.length-1;i>=0;i--){
|
|
_102[i].style.display="none";
|
|
}
|
|
}
|
|
if(this._oCurItem){
|
|
this._toggleHighlight(this._oCurItem,"from");
|
|
}
|
|
this._oCurItem=null;
|
|
this._nDisplayedItems=0;
|
|
this._sCurQuery=null;
|
|
}
|
|
if(!_100&&!this._bContainerOpen){
|
|
_101._oContent.style.display="none";
|
|
return;
|
|
}
|
|
var _103=this._oAnim;
|
|
if(_103&&_103.getEl()&&(this.animHoriz||this.animVert)){
|
|
if(!_100){
|
|
this._toggleContainerHelpers(_100);
|
|
}
|
|
if(_103.isAnimated()){
|
|
_103.stop();
|
|
}
|
|
var _104=_101._oContent.cloneNode(true);
|
|
_101.appendChild(_104);
|
|
_104.style.top="-9000px";
|
|
_104.style.display="block";
|
|
var wExp=_104.offsetWidth;
|
|
var hExp=_104.offsetHeight;
|
|
var _107=(this.animHoriz)?0:wExp;
|
|
var _108=(this.animVert)?0:hExp;
|
|
_103.attributes=(_100)?{width:{to:wExp},height:{to:hExp}}:{width:{to:_107},height:{to:_108}};
|
|
if(_100&&!this._bContainerOpen){
|
|
_101._oContent.style.width=_107+"px";
|
|
_101._oContent.style.height=_108+"px";
|
|
}else{
|
|
_101._oContent.style.width=wExp+"px";
|
|
_101._oContent.style.height=hExp+"px";
|
|
}
|
|
_101.removeChild(_104);
|
|
_104=null;
|
|
var _109=this;
|
|
var _110=function(){
|
|
_103.onComplete.unsubscribeAll();
|
|
if(_100){
|
|
_109.containerExpandEvent.fire(_109);
|
|
}else{
|
|
_101._oContent.style.display="none";
|
|
_109.containerCollapseEvent.fire(_109);
|
|
}
|
|
_109._toggleContainerHelpers(_100);
|
|
};
|
|
_101._oContent.style.display="block";
|
|
_103.onComplete.subscribe(_110);
|
|
_103.animate();
|
|
this._bContainerOpen=_100;
|
|
}else{
|
|
if(_100){
|
|
_101._oContent.style.display="block";
|
|
this.containerExpandEvent.fire(this);
|
|
}else{
|
|
_101._oContent.style.display="none";
|
|
this.containerCollapseEvent.fire(this);
|
|
}
|
|
this._toggleContainerHelpers(_100);
|
|
this._bContainerOpen=_100;
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(_111,_112){
|
|
var _113=this.highlightClassName;
|
|
if(this._oCurItem){
|
|
YAHOO.util.Dom.removeClass(this._oCurItem,_113);
|
|
}
|
|
if((_112=="to")&&_113){
|
|
YAHOO.util.Dom.addClass(_111,_113);
|
|
this._oCurItem=_111;
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(_114,_115){
|
|
if(_114==this._oCurItem){
|
|
return;
|
|
}
|
|
var _116=this.prehighlightClassName;
|
|
if((_115=="mouseover")&&_116){
|
|
YAHOO.util.Dom.addClass(_114,_116);
|
|
}else{
|
|
YAHOO.util.Dom.removeClass(_114,_116);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._updateValue=function(_117){
|
|
var _118=this._oTextbox;
|
|
var _119=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;
|
|
var _120=this._sSavedQuery;
|
|
var _121=_117._sResultKey;
|
|
_118.focus();
|
|
_118.value="";
|
|
if(_119){
|
|
if(_120){
|
|
_118.value=_120;
|
|
}
|
|
_118.value+=_121+_119;
|
|
if(_119!=" "){
|
|
_118.value+=" ";
|
|
}
|
|
}else{
|
|
_118.value=_121;
|
|
}
|
|
if(_118.type=="textarea"){
|
|
_118.scrollTop=_118.scrollHeight;
|
|
}
|
|
var end=_118.value.length;
|
|
this._selectText(_118,end,end);
|
|
this._oCurItem=_117;
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._selectItem=function(_123){
|
|
this._bItemSelected=true;
|
|
this._updateValue(_123);
|
|
this._cancelIntervalDetection(this);
|
|
this.itemSelectEvent.fire(this,_123,_123._oResultData);
|
|
this._toggleContainer(false);
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){
|
|
if(!this.typeAhead){
|
|
return;
|
|
}else{
|
|
this._toggleContainer(false);
|
|
}
|
|
};
|
|
YAHOO.widget.AutoComplete.prototype._moveSelection=function(_124){
|
|
if(this._bContainerOpen){
|
|
var _125=this._oCurItem;
|
|
var _126=-1;
|
|
if(_125){
|
|
_126=_125._nItemIndex;
|
|
}
|
|
var _127=(_124==40)?(_126+1):(_126-1);
|
|
if(_127<-2||_127>=this._nDisplayedItems){
|
|
return;
|
|
}
|
|
if(_125){
|
|
this._toggleHighlight(_125,"from");
|
|
this.itemArrowFromEvent.fire(this,_125);
|
|
}
|
|
if(_127==-1){
|
|
if(this.delimChar&&this._sSavedQuery){
|
|
if(!this._textMatchesOption()){
|
|
this._oTextbox.value=this._sSavedQuery;
|
|
}else{
|
|
this._oTextbox.value=this._sSavedQuery+this._sCurQuery;
|
|
}
|
|
}else{
|
|
this._oTextbox.value=this._sCurQuery;
|
|
}
|
|
this._oCurItem=null;
|
|
return;
|
|
}
|
|
if(_127==-2){
|
|
this._toggleContainer(false);
|
|
return;
|
|
}
|
|
var _128=this._aListItems[_127];
|
|
var _129=this._oContainer._oContent;
|
|
var _130=((YAHOO.util.Dom.getStyle(_129,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(_129,"overflowY")=="auto"));
|
|
if(_130&&(_127>-1)&&(_127<this._nDisplayedItems)){
|
|
if(_124==40){
|
|
if((_128.offsetTop+_128.offsetHeight)>(_129.scrollTop+_129.offsetHeight)){
|
|
_129.scrollTop=(_128.offsetTop+_128.offsetHeight)-_129.offsetHeight;
|
|
}else{
|
|
if((_128.offsetTop+_128.offsetHeight)<_129.scrollTop){
|
|
_129.scrollTop=_128.offsetTop;
|
|
}
|
|
}
|
|
}else{
|
|
if(_128.offsetTop<_129.scrollTop){
|
|
this._oContainer._oContent.scrollTop=_128.offsetTop;
|
|
}else{
|
|
if(_128.offsetTop>(_129.scrollTop+_129.offsetHeight)){
|
|
this._oContainer._oContent.scrollTop=(_128.offsetTop+_128.offsetHeight)-_129.offsetHeight;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._toggleHighlight(_128,"to");
|
|
this.itemArrowToEvent.fire(this,_128);
|
|
if(this.typeAhead){
|
|
this._updateValue(_128);
|
|
}
|
|
}
|
|
};
|
|
YAHOO.widget.DataSource=function(){
|
|
};
|
|
YAHOO.widget.DataSource.prototype.ERROR_DATANULL="Response data was null";
|
|
YAHOO.widget.DataSource.prototype.ERROR_DATAPARSE="Response data could not be parsed";
|
|
YAHOO.widget.DataSource.prototype.maxCacheEntries=15;
|
|
YAHOO.widget.DataSource.prototype.queryMatchContains=false;
|
|
YAHOO.widget.DataSource.prototype.queryMatchSubset=false;
|
|
YAHOO.widget.DataSource.prototype.queryMatchCase=false;
|
|
YAHOO.widget.DataSource.prototype.getName=function(){
|
|
return this._sName;
|
|
};
|
|
YAHOO.widget.DataSource.prototype.toString=function(){
|
|
return "DataSource "+this._sName;
|
|
};
|
|
YAHOO.widget.DataSource.prototype.getResults=function(_131,_132,_133){
|
|
var _134=this._doQueryCache(_131,_132,_133);
|
|
if(_134.length===0){
|
|
this.queryEvent.fire(this,_133,_132);
|
|
this.doQuery(_131,_132,_133);
|
|
}
|
|
};
|
|
YAHOO.widget.DataSource.prototype.doQuery=function(_135,_136,_137){
|
|
};
|
|
YAHOO.widget.DataSource.prototype.flushCache=function(){
|
|
if(this._aCache){
|
|
this._aCache=[];
|
|
}
|
|
if(this._aCacheHelper){
|
|
this._aCacheHelper=[];
|
|
}
|
|
this.cacheFlushEvent.fire(this);
|
|
};
|
|
YAHOO.widget.DataSource.prototype.queryEvent=null;
|
|
YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;
|
|
YAHOO.widget.DataSource.prototype.getResultsEvent=null;
|
|
YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;
|
|
YAHOO.widget.DataSource.prototype.dataErrorEvent=null;
|
|
YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;
|
|
YAHOO.widget.DataSource._nIndex=0;
|
|
YAHOO.widget.DataSource.prototype._sName=null;
|
|
YAHOO.widget.DataSource.prototype._aCache=null;
|
|
YAHOO.widget.DataSource.prototype._init=function(){
|
|
var _138=this.maxCacheEntries;
|
|
if(isNaN(_138)||(_138<0)){
|
|
_138=0;
|
|
}
|
|
if(_138>0&&!this._aCache){
|
|
this._aCache=[];
|
|
}
|
|
this._sName="instance"+YAHOO.widget.DataSource._nIndex;
|
|
YAHOO.widget.DataSource._nIndex++;
|
|
this.queryEvent=new YAHOO.util.CustomEvent("query",this);
|
|
this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);
|
|
this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);
|
|
this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);
|
|
this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);
|
|
this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);
|
|
};
|
|
YAHOO.widget.DataSource.prototype._addCacheElem=function(_139){
|
|
var _140=this._aCache;
|
|
if(!_140||!_139||!_139.query||!_139.results){
|
|
return;
|
|
}
|
|
if(_140.length>=this.maxCacheEntries){
|
|
_140.shift();
|
|
}
|
|
_140.push(_139);
|
|
};
|
|
YAHOO.widget.DataSource.prototype._doQueryCache=function(_141,_142,_143){
|
|
var _144=[];
|
|
var _145=false;
|
|
var _146=this._aCache;
|
|
var _147=(_146)?_146.length:0;
|
|
var _148=this.queryMatchContains;
|
|
if((this.maxCacheEntries>0)&&_146&&(_147>0)){
|
|
this.cacheQueryEvent.fire(this,_143,_142);
|
|
if(!this.queryMatchCase){
|
|
var _149=_142;
|
|
_142=_142.toLowerCase();
|
|
}
|
|
for(var i=_147-1;i>=0;i--){
|
|
var _150=_146[i];
|
|
var _151=_150.results;
|
|
var _152=(!this.queryMatchCase)?encodeURIComponent(_150.query).toLowerCase():encodeURIComponent(_150.query);
|
|
if(_152==_142){
|
|
_145=true;
|
|
_144=_151;
|
|
if(i!=_147-1){
|
|
_146.splice(i,1);
|
|
this._addCacheElem(_150);
|
|
}
|
|
break;
|
|
}else{
|
|
if(this.queryMatchSubset){
|
|
for(var j=_142.length-1;j>=0;j--){
|
|
var _153=_142.substr(0,j);
|
|
if(_152==_153){
|
|
_145=true;
|
|
for(var k=_151.length-1;k>=0;k--){
|
|
var _155=_151[k];
|
|
var _156=(this.queryMatchCase)?encodeURIComponent(_155[0]).indexOf(_142):encodeURIComponent(_155[0]).toLowerCase().indexOf(_142);
|
|
if((!_148&&(_156===0))||(_148&&(_156>-1))){
|
|
_144.unshift(_155);
|
|
}
|
|
}
|
|
_150={};
|
|
_150.query=_142;
|
|
_150.results=_144;
|
|
this._addCacheElem(_150);
|
|
break;
|
|
}
|
|
}
|
|
if(_145){
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(_145){
|
|
this.getCachedResultsEvent.fire(this,_143,_149,_144);
|
|
_141(_149,_144,_143);
|
|
}
|
|
}
|
|
return _144;
|
|
};
|
|
YAHOO.widget.DS_XHR=function(_157,_158,_159){
|
|
if(typeof _159=="object"){
|
|
for(var _160 in _159){
|
|
this[_160]=_159[_160];
|
|
}
|
|
}
|
|
if(!_158||(_158.constructor!=Array)){
|
|
return;
|
|
}else{
|
|
this.schema=_158;
|
|
}
|
|
this.scriptURI=_157;
|
|
this._init();
|
|
};
|
|
YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();
|
|
YAHOO.widget.DS_XHR.prototype.TYPE_JSON=0;
|
|
YAHOO.widget.DS_XHR.prototype.TYPE_XML=1;
|
|
YAHOO.widget.DS_XHR.prototype.TYPE_FLAT=2;
|
|
YAHOO.widget.DS_XHR.prototype.ERROR_DATAXHR="XHR response failed";
|
|
YAHOO.widget.DS_XHR.prototype.connMgr=YAHOO.util.Connect;
|
|
YAHOO.widget.DS_XHR.prototype.connTimeout=0;
|
|
YAHOO.widget.DS_XHR.prototype.scriptURI=null;
|
|
YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";
|
|
YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";
|
|
YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.prototype.TYPE_JSON;
|
|
YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n<!--";
|
|
YAHOO.widget.DS_XHR.prototype.doQuery=function(_161,_162,_163){
|
|
var _164=(this.responseType==this.TYPE_XML);
|
|
var sUri=this.scriptURI+"?"+this.scriptQueryParam+"="+_162;
|
|
if(this.scriptQueryAppend.length>0){
|
|
sUri+="&"+this.scriptQueryAppend;
|
|
}
|
|
var _166=null;
|
|
var _167=this;
|
|
var _168=function(_169){
|
|
if(!_167._oConn||(_169.tId!=_167._oConn.tId)){
|
|
_167.dataErrorEvent.fire(_167,_163,_162,_167.ERROR_DATANULL);
|
|
return;
|
|
}
|
|
for(var foo in _169){
|
|
}
|
|
if(!_164){
|
|
_169=_169.responseText;
|
|
}else{
|
|
_169=_169.responseXML;
|
|
}
|
|
if(_169===null){
|
|
_167.dataErrorEvent.fire(_167,_163,_162,_167.ERROR_DATANULL);
|
|
return;
|
|
}
|
|
var _171=_167.parseResponse(_162,_169,_163);
|
|
var _172={};
|
|
_172.query=decodeURIComponent(_162);
|
|
_172.results=_171;
|
|
if(_171===null){
|
|
_167.dataErrorEvent.fire(_167,_163,_162,_167.ERROR_DATAPARSE);
|
|
return;
|
|
}else{
|
|
_167.getResultsEvent.fire(_167,_163,_162,_171);
|
|
_167._addCacheElem(_172);
|
|
_161(_162,_171,_163);
|
|
}
|
|
};
|
|
var _173=function(_174){
|
|
_167.dataErrorEvent.fire(_167,_163,_162,_167.ERROR_DATAXHR);
|
|
return;
|
|
};
|
|
var _175={success:_168,failure:_173};
|
|
if(!isNaN(this.connTimeout)&&this.connTimeout>0){
|
|
_175.timeout=this.connTimeout;
|
|
}
|
|
if(this._oConn){
|
|
this.connMgr.abort(this._oConn);
|
|
}
|
|
_167._oConn=this.connMgr.asyncRequest("GET",sUri,_175,null);
|
|
};
|
|
YAHOO.widget.DS_XHR.prototype.parseResponse=function(_176,_177,_178){
|
|
var _179=this.schema;
|
|
var _180=[];
|
|
var _181=false;
|
|
var nEnd=((this.responseStripAfter!=="")&&(_177.indexOf))?_177.indexOf(this.responseStripAfter):-1;
|
|
if(nEnd!=-1){
|
|
_177=_177.substring(0,nEnd);
|
|
}
|
|
switch(this.responseType){
|
|
case this.TYPE_JSON:
|
|
var _183;
|
|
if(window.JSON&&(navigator.userAgent.toLowerCase().indexOf("khtml")==-1)){
|
|
var _184=JSON.parse(_177);
|
|
if(!_184){
|
|
_181=true;
|
|
break;
|
|
}else{
|
|
_183=eval("jsonObjParsed."+_179[0]);
|
|
}
|
|
}else{
|
|
try{
|
|
while(_177.substring(0,1)==" "){
|
|
_177=_177.substring(1,_177.length);
|
|
}
|
|
if(_177.indexOf("{")<0){
|
|
_181=true;
|
|
break;
|
|
}
|
|
if(_177.indexOf("{}")===0){
|
|
break;
|
|
}
|
|
var _185=eval("("+_177+")");
|
|
if(!_185){
|
|
_181=true;
|
|
break;
|
|
}
|
|
_183=eval("(jsonObjRaw."+_179[0]+")");
|
|
}
|
|
catch(e){
|
|
_181=true;
|
|
break;
|
|
}
|
|
}
|
|
if(!_183){
|
|
_181=true;
|
|
break;
|
|
}
|
|
if(_183.constructor!=Array){
|
|
_183=[_183];
|
|
}
|
|
for(var i=_183.length-1;i>=0;i--){
|
|
var _186=[];
|
|
var _187=_183[i];
|
|
for(var j=_179.length-1;j>=1;j--){
|
|
var _188=_187[_179[j]];
|
|
if(!_188){
|
|
_188="";
|
|
}
|
|
_186.unshift(_188);
|
|
}
|
|
_180.unshift(_186);
|
|
}
|
|
break;
|
|
case this.TYPE_XML:
|
|
var _189=_177.getElementsByTagName(_179[0]);
|
|
if(!_189){
|
|
_181=true;
|
|
break;
|
|
}
|
|
for(var k=_189.length-1;k>=0;k--){
|
|
var _190=_189.item(k);
|
|
var _191=[];
|
|
for(var m=_179.length-1;m>=1;m--){
|
|
var _193=null;
|
|
var _194=_190.attributes.getNamedItem(_179[m]);
|
|
if(_194){
|
|
_193=_194.value;
|
|
}else{
|
|
var _195=_190.getElementsByTagName(_179[m]);
|
|
if(_195&&_195.item(0)&&_195.item(0).firstChild){
|
|
_193=_195.item(0).firstChild.nodeValue;
|
|
}else{
|
|
_193="";
|
|
}
|
|
}
|
|
_191.unshift(_193);
|
|
}
|
|
_180.unshift(_191);
|
|
}
|
|
break;
|
|
case this.TYPE_FLAT:
|
|
if(_177.length>0){
|
|
var _196=_177.length-_179[0].length;
|
|
if(_177.substr(_196)==_179[0]){
|
|
_177=_177.substr(0,_196);
|
|
}
|
|
var _197=_177.split(_179[0]);
|
|
for(var n=_197.length-1;n>=0;n--){
|
|
_180[n]=_197[n].split(_179[1]);
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
_176=null;
|
|
_177=null;
|
|
_178=null;
|
|
if(_181){
|
|
return null;
|
|
}else{
|
|
return _180;
|
|
}
|
|
};
|
|
YAHOO.widget.DS_XHR.prototype._oConn=null;
|
|
YAHOO.widget.DS_JSFunction=function(_199,_200){
|
|
if(typeof _200=="object"){
|
|
for(var _201 in _200){
|
|
this[_201]=_200[_201];
|
|
}
|
|
}
|
|
if(!_199||(_199.constructor!=Function)){
|
|
return;
|
|
}else{
|
|
this.dataFunction=_199;
|
|
this._init();
|
|
}
|
|
};
|
|
YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();
|
|
YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;
|
|
YAHOO.widget.DS_JSFunction.prototype.doQuery=function(_202,_203,_204){
|
|
var _205=this.dataFunction;
|
|
var _206=[];
|
|
_206=_205(_203);
|
|
if(_206===null){
|
|
this.dataErrorEvent.fire(this,_204,_203,this.ERROR_DATANULL);
|
|
return;
|
|
}
|
|
var _207={};
|
|
_207.query=decodeURIComponent(_203);
|
|
_207.results=_206;
|
|
this._addCacheElem(_207);
|
|
this.getResultsEvent.fire(this,_204,_203,_206);
|
|
_202(_203,_206,_204);
|
|
return;
|
|
};
|
|
YAHOO.widget.DS_JSArray=function(_208,_209){
|
|
if(typeof _209=="object"){
|
|
for(var _210 in _209){
|
|
this[_210]=_209[_210];
|
|
}
|
|
}
|
|
if(!_208||(_208.constructor!=Array)){
|
|
return;
|
|
}else{
|
|
this.data=_208;
|
|
this._init();
|
|
}
|
|
};
|
|
YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();
|
|
YAHOO.widget.DS_JSArray.prototype.data=null;
|
|
YAHOO.widget.DS_JSArray.prototype.doQuery=function(_211,_212,_213){
|
|
var _214=this.data;
|
|
var _215=[];
|
|
var _216=false;
|
|
var _217=this.queryMatchContains;
|
|
if(!this.queryMatchCase){
|
|
_212=_212.toLowerCase();
|
|
}
|
|
for(var i=_214.length-1;i>=0;i--){
|
|
var _218=[];
|
|
if(_214[i]){
|
|
if(_214[i].constructor==String){
|
|
_218[0]=_214[i];
|
|
}else{
|
|
if(_214[i].constructor==Array){
|
|
_218=_214[i];
|
|
}
|
|
}
|
|
}
|
|
if(_218[0]&&(_218[0].constructor==String)){
|
|
var _219=(this.queryMatchCase)?encodeURIComponent(_218[0]).indexOf(_212):encodeURIComponent(_218[0]).toLowerCase().indexOf(_212);
|
|
if((!_217&&(_219===0))||(_217&&(_219>-1))){
|
|
_215.unshift(_218);
|
|
}
|
|
}
|
|
}
|
|
this.getResultsEvent.fire(this,_213,_212,_215);
|
|
_211(_212,_215,_213);
|
|
};
|
|
|
|
|
|
|
|
(function() {
|
|
var oACDS;
|
|
var oAutoComp;
|
|
|
|
var propsort = function(a, b) {
|
|
//return (a.url > b.url) ? 1 : ((a.url < b.url) ? -1 : 0);
|
|
return (a.name.toLowerCase() > b.name.toLowerCase()) ? 1 : ((a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 0);
|
|
}
|
|
|
|
var allprops = ALL_YUI_PROPS;
|
|
|
|
// allprops.sort(propsort);
|
|
|
|
var getResults = function(query) {
|
|
var results = [];
|
|
if(query && query.length > 0) {
|
|
for (var i=0, len=allprops.length; i<len; ++i) {
|
|
var prop = allprops[i];
|
|
//var searchStr = prop.host.toLowerCase() + '.' + prop.name.toLowerCase();
|
|
var searchStr = prop.url.toLowerCase();
|
|
if (searchStr.indexOf(query.toLowerCase()) > -1) {
|
|
results.push([query,prop]);
|
|
}
|
|
}
|
|
}
|
|
|
|
return results;
|
|
};
|
|
|
|
// Define Custom Event handlers
|
|
var myOnDataReturn = function(sType, aArgs) {
|
|
var oAutoComp = aArgs[0];
|
|
var query = aArgs[1];
|
|
var aResults = aArgs[2];
|
|
|
|
if(aResults.length == 0) {
|
|
if (query.length > 0) {
|
|
oAutoComp.setBody("<div id=\"resultsdefault\">Not found</div>");
|
|
} else {
|
|
oAutoComp.setBody("<div id=\"resultsdefault\">Start typing to find a property/method/event/config " +
|
|
" or browse a module by clicking a link on the left.</div>");
|
|
}
|
|
}
|
|
};
|
|
|
|
var myOnContainerCollapse = function(sType, aArgs) {
|
|
var oAutoComp = aArgs[0];
|
|
oAutoComp.setBody("<div id=\"resultsdefault\">Start typing to find a property/method/event/config</div>");
|
|
};
|
|
|
|
var myOnItemSelect = function(sType, aArgs) {
|
|
var ac = aArgs[0];
|
|
var item = aArgs[2];
|
|
//ac._oTextbox.value = item.name;
|
|
location.href = item[1].url;
|
|
};
|
|
|
|
|
|
var init = function() {
|
|
|
|
// Instantiate JS Function DataSource
|
|
oACDS = new YAHOO.widget.DS_JSFunction(getResults);
|
|
oACDS.maxCacheEntries = 30;
|
|
|
|
// Instantiate AutoComplete
|
|
oAutoComp = new YAHOO.widget.AutoComplete('searchinput','searchresults', oACDS);
|
|
oAutoComp.alwaysShowContainer = true;
|
|
oAutoComp.queryDelay = 0.2;
|
|
oAutoComp.maxResultsDisplayed = 200;
|
|
oAutoComp.formatResult = function(oResultItem, query) {
|
|
var sMarkup = "<em>" + oResultItem[1].host + '</em> <span>' + oResultItem[1].name + '</span>';
|
|
//var sMarkup = "<em>" + oResultItem.host + '</em> :: ' + oResultItem.name;
|
|
//var sMarkup = "<span>" + oResultItem.name + "</span><em>" + oResultItem.host + "</em>";
|
|
//var sMarkup = oResultItem.name + "<em>" + oResultItem.host + "</em>";
|
|
return sMarkup;
|
|
};
|
|
|
|
// Subscribe to Custom Events
|
|
oAutoComp.dataReturnEvent.subscribe(myOnDataReturn);
|
|
oAutoComp.containerCollapseEvent.subscribe(myOnContainerCollapse);
|
|
oAutoComp.itemSelectEvent.subscribe(myOnItemSelect);
|
|
|
|
// Set initial content in the container
|
|
oAutoComp.sendQuery(document.getElementById("searchinput").value);
|
|
};
|
|
|
|
var validateForm = function() {
|
|
// Validate form inputs here
|
|
return false;
|
|
};
|
|
|
|
init();
|
|
|
|
})();
|
|
|