1//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com) 2//Last updated: November 14th 06- added iframe shim technique 3 4var cssdropdown={ 5disappeardelay: 550, //set delay in miliseconds before menu disappears onmouseout 6disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link? 7enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no 8enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no 9 10//No need to edit beyond here//////////////////////// 11dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0, 12 13getposOffset:function(what, offsettype){ 14var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 15var parentEl=what.offsetParent; 16while (parentEl!=null){ 17totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 18parentEl=parentEl.offsetParent; 19} 20return totaloffset; 21}, 22 23swipeeffect:function(){ 24if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){ 25this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually 26this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)" 27} 28else 29return 30this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10) 31}, 32 33showhide:function(obj, e){ 34if (this.ie || this.firefox) 35this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px" 36if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){ 37if (this.enableswipe==1){ 38if (typeof this.swipetimer!="undefined") 39clearTimeout(this.swipetimer) 40obj.clip="rect(0 auto 0 0)" //hide menu via clipping 41this.bottomclip=0 42this.swipeeffect() 43} 44obj.visibility="visible" 45} 46else if (e.type=="click") 47obj.visibility="hidden" 48}, 49 50iecompattest:function(){ 51return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 52}, 53 54clearbrowseredge:function(obj, whichedge){ 55var edgeoffset=0 56if (whichedge=="rightedge"){ 57var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15 58this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth 59if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure) //move menu to the left? 60edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth 61} 62else{ 63var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset 64var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 65this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight 66if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up? 67edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight 68if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either? 69edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge 70} 71} 72return edgeoffset 73}, 74 75dropit:function(obj, e, dropmenuID){ 76if (this.dropmenuobj!=null) //hide previous menu 77this.dropmenuobj.style.visibility="hidden" //hide menu 78this.clearhidemenu() 79if (this.ie||this.firefox){ 80obj.onmouseout=function(){cssdropdown.delayhidemenu()} 81obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick? 82this.dropmenuobj=document.getElementById(dropmenuID) 83this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()} 84this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)} 85this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()} 86this.showhide(this.dropmenuobj.style, e) 87this.dropmenuobj.x=this.getposOffset(obj, "left") 88this.dropmenuobj.y=this.getposOffset(obj, "top") 89this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px" 90this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px" 91this.positionshim() //call iframe shim function 92} 93}, 94 95positionshim:function(){ //display iframe shim function 96if (this.enableiframeshim && typeof this.shimobject!="undefined"){ 97if (this.dropmenuobj.style.visibility=="visible"){ 98this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px" 99this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
100this.shimobject.style.left=this.dropmenuobj.style.left 101this.shimobject.style.top=this.dropmenuobj.style.top 102} 103this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none" 104} 105}, 106 107hideshim:function(){ 108if (this.enableiframeshim && typeof this.shimobject!="undefined") 109this.shimobject.style.display='none' 110}, 111 112contains_firefox:function(a, b) { 113while (b.parentNode) 114if ((b = b.parentNode) == a) 115return true; 116return false; 117}, 118 119dynamichide:function(e){ 120var evtobj=window.event? window.event : e 121if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement)) 122this.delayhidemenu() 123else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget)) 124this.delayhidemenu() 125}, 126 127delayhidemenu:function(){ 128this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu 129}, 130 131clearhidemenu:function(){ 132if (this.delayhide!="undefined") 133clearTimeout(this.delayhide) 134}, 135 136startchrome:function(){ 137for (var ids=0; ids<arguments.length; ids++){ 138var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a") 139for (var i=0; i<menuitems.length; i++){ 140if (menuitems[i].getAttribute("rel")){ 141var relvalue=menuitems[i].getAttribute("rel") 142menuitems[i].onmouseover=function(e){ 143var event=typeof e!="undefined"? e : window.event 144cssdropdown.dropit(this,event,this.getAttribute("rel")) 145} 146} 147} 148} 149if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
150document.write('<IFRAME id="iframeshim" src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>') 151this.shimobject=document.getElementById("iframeshim") //reference iframe object 152} 153} 154 155}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.