1 2var ddsmoothmenu={ 3 4/*Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs):*/ 5arrowimages: {down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']}, 6//transition: {overtime:300, outtime:300}, /*duration of slide in/ out animation, in milliseconds*/ 7shadow: {enable:false, offsetx:5, offsety:5}, /*enable shadow?*/ 8//showhidedelay: {showdelay: 100, hidedelay: 100}, /*set delay in milliseconds before sub menus appear and disappear, respectively*/ 9 10/*Stop configuring beyond here*/ 11 12detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, /*detect WebKit browsers (Safari, Chrome etc)*/ 13detectie6: document.all && !window.XMLHttpRequest, 14css3support: window.msPerformance || (!document.all && document.querySelector), /*detect browsers that support CSS3 box shadows (ie9+ or FF3.5+, Safari3+, Chrome etc)*/ 15 16getajaxmenu:function($, setting){ /*function to fetch external page containing the panel DIVs*/ 17 var $menucontainer=$('#'+setting.contentsource[0]) /*reference empty div on page that will hold menu*/ 18 $menucontainer.html("Loading Menu...") 19 $.ajax({ 20 url: setting.contentsource[1], /*path to external menu file*/ 21 async: true, 22 error:function(ajaxrequest){ 23 $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) 24 }, 25 success:function(content){ 26 $menucontainer.html(content) 27 ddsmoothmenu.buildmenu($, setting) 28 } 29 }) 30}, 31 32 33buildmenu:function($, setting){ 34 var smoothmenu=ddsmoothmenu 35 var $mainmenu=$("#"+setting.mainmenuid+">ul") /*reference main menu UL*/ 36 $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" 37 var $headers=$mainmenu.find("div.menunongroup,.lofitem0 > div").parent() 38 $headers.hover( 39 function(e){ 40 $(this).children('a:eq(0)').addClass('selected') 41 }, 42 function(e){ 43 $(this).children('a:eq(0)').removeClass('selected') 44 } 45 ) 46 $headers.each(function(i){ /*loop through each LI header*/ 47 var $curobj=$(this).css({zIndex: setting.lofZindex-i}) /*reference current LI header*/ 48 var $subul=$(this).find('div.menunongroup:eq(0),div.menugroup:eq(0)').css({display:'block'}) 49 $subul.data('timers', {}) 50 this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} 51 this.istopheader=$curobj.parents("div.menunongroup,div.menugroup").length==1? true : false /*is top level header?*/ 52 $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) 53 /* 54 $curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: smoothmenu.arrowimages.down[2]} : {}).append( 55 '<img src="'+ (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[1] : smoothmenu.arrowimages.right[1]) 56 +'" class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0]) 57 + '" style="border:0;" />' 58 ) 59 */ 60 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ /*if shadows enabled and browser doesn't support CSS3 box shadows*/ 61 this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets 62 if (this.istopheader) 63 $parentshadow=$(document.body) 64 else{ 65 var $parentLi=$curobj.parents("li:eq(0)") 66 $parentshadow=$parentLi.get(0).$shadow 67 } 68 this.$shadow=$('<div class="ddshadow'+(this.istopheader? ' toplevelshadow' : '')+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'}) //insert shadow DIV and set it to parent node for the next shadow div 69 } 70 $curobj.hover( 71 function(e){ 72 var $targetul=$subul /*reference UL to reveal*/ 73 var header=$curobj.get(0) /*reference header LI as DOM object*/ 74 clearTimeout($targetul.data('timers').hidetimer) 75 $targetul.data('timers').showtimer=setTimeout(function(){ 76 header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} 77 var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w 78 menuleft=(header._offsets.left+menuleft+header._dimensions.subulw>$(window).width())? (header.istopheader && setting.orientation!='v'? -header._dimensions.subulw+header._dimensions.w : -header._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent 79 if ($targetul.queue().length<=1){ /*if 1 or less queued animations*/ 80 $targetul.css({left:menuleft+"px"}).animate({height:'show',opacity:'show'}, setting.overtime)
81 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 82 var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 83 var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y 84 if (!header.istopheader && ddsmoothmenu.detectwebkit){ /*in WebKit browsers, restore shadow's opacity to full*/ 85 header.$shadow.css({opacity:1}) 86 } 87 header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, setting.overtime) 88 } 89 } 90 }, setting.showdelay) 91 }, 92 function(e){ 93 var $targetul=$subul 94 var header=$curobj.get(0) 95 clearTimeout($targetul.data('timers').showtimer) 96 $targetul.data('timers').hidetimer=setTimeout(function(){ 97 $targetul.animate({height:'hide', opacity:'hide'}, setting.outtime) 98 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 99 if (ddsmoothmenu.detectwebkit){ /*in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them*/ 100 header.$shadow.children('div:eq(0)').css({opacity:0}) 101 } 102 header.$shadow.css({overflow:'hidden'}).animate({height:0}, setting.outtime) 103 } 104 }, setting.hidedelay) 105 } 106 ) /*end hover*/ 107 }) /*end $headers.each()*/ 108 if (smoothmenu.shadow.enable && smoothmenu.css3support){ /*if shadows enabled and browser supports CSS3 shadows*/ 109 var $toplevelul=$('#'+setting.mainmenuid+' div.menunongroup li div.menunongroup') 110 var css3shadow=parseInt(smoothmenu.shadow.offsetx)+"px "+parseInt(smoothmenu.shadow.offsety)+"px 5px #aaa" /*construct CSS3 box-shadow value*/ 111 var shadowprop=["boxShadow", "MozBoxShadow", "WebkitBoxShadow", "MsBoxShadow"] /*possible vendor specific CSS3 shadow properties*/ 112 for (var i=0; i<shadowprop.length; i++){ 113 $toplevelul.css(shadowprop[i], css3shadow) 114 } 115 } 116 $mainmenu.find("div.menunongroup").css({display:'none', visibility:'visible'}) 117 $mainmenu.find("li.lofitem0 > div.menugroup").css({display:'none', visibility:'visible'}) 118}, 119 120init:function(setting){ 121 if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ /*override default menu colors (default/hover) with custom set?*/ 122 var mainmenuid='#'+setting.mainmenuid; 123 var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid; 124 /*
125 document.write('<style type="text/css">\n' 126 +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' 127 +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' 128 +'</style>') 129 */ 130 } 131 this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable /*in IE6, always disable shadow*/ 132 jQuery(document).ready(function($){ /*ajax menu?*/ 133 if (typeof setting.contentsource=="object"){ /*if external ajax menu*/ 134 ddsmoothmenu.getajaxmenu($, setting) 135 } 136 else{ /*else if markup menu*/ 137 ddsmoothmenu.buildmenu($, setting) 138 } 139 }) 140} 141 142} //end ddsmoothmenu variable
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.