1/* 2* Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget - LAST UPDATE: MARCH 23rd, 2011 3* 4* Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him. 5* Special thanks to Karl Swedberg for valuable input. 6* 7* Dec 28th, 2010 - Modified for the Superfish project for Drupal (http://drupal.org/project/superfish) 8* 9* jQuery version: 1.3.x or higher. 10* 11* Dual licensed under the MIT and GPL licenses: 12* http://www.opensource.org/licenses/mit-license.php 13* http://www.gnu.org/licenses/gpl.html 14*/ 15 16(function($){ 17 $.fn.supposition = function(){ 18 var $w = $(window), /*do this once instead of every onBeforeShow call*/ 19 _offset = function(dir) { 20 return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset'] 21 || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft'] 22 || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft']; 23 }, 24 onHide = function(){ 25 this.css({Top:'',Right:'',Bottom:'',Left:''}); 26 }, 27 onBeforeShow = function(){ 28 this.each(function(){ 29 var $u = $(this); 30 $u.css('display','block'); 31 var menuWidth = $u.width(), 32 menuParentWidth = $u.closest('li').outerWidth(true), 33 menuParentLeft = $u.closest('li').offset().left, 34 totalRight = $w.width() + _offset('x'), 35 menuRight = $u.offset().left + menuWidth, 36 exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth; 37 if ($u.parents('.sf-js-enabled').hasClass('rtl')) { 38 if (menuParentLeft < exactMenuWidth) { 39 $u.css('left', menuParentWidth + 'px'); 40 $u.css('right', 'auto'); 41 } 42 } 43 else { 44 if (menuRight > totalRight && menuParentLeft > menuWidth) { 45 $u.css('right', menuParentWidth + 'px'); 46 $u.css('left', 'auto'); 47 } 48 } 49 var windowHeight = $w.height(), 50 offsetTop = $u.offset().top, 51 menuParentHeight = $u.parent().outerHeight(true), 52 menuHeight = $u.height(), 53 baseline = windowHeight + _offset('y'); 54 var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight)); 55 if (expandUp) { 56 $u.css('bottom', menuParentHeight + 'px'); 57 $u.css('top', 'auto'); 58 } 59 $u.css('display','none'); 60 }); 61 }; 62 63 return this.each(function() { 64 var o = $.fn.superfish.o[this.serial]; /* get this menu's options */ 65 66 /* if callbacks already set, store them */ 67 var _onBeforeShow = o.onBeforeShow, 68 _onHide = o.onHide; 69 70 $.extend($.fn.superfish.o[this.serial],{ 71 onBeforeShow: function() { 72 onBeforeShow.call(this); /* fire our Supposition callback */ 73 _onBeforeShow.call(this); /* fire stored callbacks */ 74 }, 75 onHide: function() { 76 onHide.call(this); /* fire our Supposition callback */ 77 _onHide.call(this); /* fire stored callbacks */ 78 } 79 }); 80 }); 81 }; 82})(jQuery);; 83/** 84* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ 85* <http://cherne.net/brian/resources/jquery.hoverIntent.html> 86* 87* @param f onMouseOver function || An object with configuration options 88* @param g onMouseOut function || Nothing (use configuration options object) 89* @author Brian Cherne brian(at)cherne(dot)net 90*/ 91(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);; 92/* 93 * Superfish v1.4.8 - jQuery menu widget 94 * Copyright (c) 2008 Joel Birch 95 * 96 * Dual licensed under the MIT and GPL licenses: 97 * http://www.opensource.org/licenses/mit-license.php 98 * http://www.gnu.org/licenses/gpl.html 99 * 100 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 101 */ 102 103(function($){ 104 $.fn.superfish = function(op){ 105 var sf = $.fn.superfish, 106 c = sf.c, 107 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 108 over = function(){ 109 var $$ = $(this), menu = getMenu($$); 110 clearTimeout(menu.sfTimer); 111 $$.showSuperfishUl().siblings().hideSuperfishUl(); 112 }, 113 out = function(){ 114 var $$ = $(this), menu = getMenu($$), o = sf.op; 115 clearTimeout(menu.sfTimer); 116 menu.sfTimer=setTimeout(function(){ 117 o.retainPath=($.inArray($$[0],o.$path)>-1);
118 $$.hideSuperfishUl(); 119 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 120 },o.delay); 121 }, 122 getMenu = function($menu){ 123 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 124 sf.op = sf.o[menu.serial]; 125 return menu; 126 }, 127 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 128 129 return this.each(function() { 130 var s = this.serial = sf.o.length; 131 var o = $.extend({},sf.defaults,op); 132 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 133 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 134 .filter('li:has(ul)').removeClass(o.pathClass); 135 }); 136 sf.o[s] = sf.op = o; 137 138 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 139 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 140 }) 141 .not('.'+c.bcClass) 142 .hideSuperfishUl(); 143 144 var $a = $('a',this); 145 $a.each(function(i){ 146 var $li = $a.eq(i).parents('li'); 147 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 148 }); 149 o.onInit.call(this); 150 151 }).each(function() { 152 var menuClasses = [c.menuClass]; 153 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 154 $(this).addClass(menuClasses.join(' ')); 155 }); 156 }; 157 158 var sf = $.fn.superfish; 159 sf.o = []; 160 sf.op = {}; 161 sf.IE7fix = function(){ 162 var o = sf.op; 163 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) 164 this.toggleClass(sf.c.shadowClass+'-off'); 165 }; 166 sf.c = { 167 bcClass: 'sf-breadcrumb', 168 menuClass: 'sf-js-enabled', 169 anchorClass: 'sf-with-ul', 170 arrowClass: 'sf-sub-indicator', 171 shadowClass: 'sf-shadow' 172 }; 173 sf.defaults = { 174 hoverClass: 'sfHover', 175 pathClass: 'overideThisToUse', 176 pathLevels: 1, 177 delay: 800, 178 animation: {opacity:'show'}, 179 speed: 'normal', 180 autoArrows: true, 181 dropShadows: true, 182 disableHI: false, // true disables hoverIntent detection 183 onInit: function(){}, // callback functions 184 onBeforeShow: function(){}, 185 onShow: function(){}, 186 onHide: function(){} 187 }; 188 $.fn.extend({ 189 hideSuperfishUl : function(){ 190 var o = sf.op, 191 not = (o.retainPath===true) ? o.$path : ''; 192 o.retainPath = false; 193 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 194 .find('>ul').hide().css('visibility','hidden'); 195 o.onHide.call($ul); 196 return this; 197 }, 198 showSuperfishUl : function(){ 199 var o = sf.op, 200 sh = sf.c.shadowClass+'-off', 201 $ul = this.addClass(o.hoverClass) 202 .find('>ul:hidden').css('visibility','visible'); 203 sf.IE7fix.call($ul); 204 o.onBeforeShow.call($ul); 205 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 206 return this; 207 } 208 }); 209})(jQuery);; 210/* 211 * Supersubs v0.2b - jQuery plugin - LAST UPDATE: MARCH 23rd, 2011 212 * Copyright (c) 2008 Joel Birch 213 * 214 * Jan 16th, 2011 - Modified a little in order to work with NavBar menus as well. 215 * 216 * Dual licensed under the MIT and GPL licenses: 217 * http://www.opensource.org/licenses/mit-license.php 218 * http://www.gnu.org/licenses/gpl.html 219 * 220 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of 221 * their longest list item children. If you use this, please expect bugs and report them 222 * to the jQuery Google Group with the word 'Superfish' in the subject line. 223 * 224 */ 225 226(function($){ // $ will refer to jQuery within this closure 227 228 $.fn.supersubs = function(options){ 229 var opts = $.extend({}, $.fn.supersubs.defaults, options); 230 // return original object to support chaining 231 return this.each(function() { 232 // cache selections 233 var $$ = $(this); 234 // support metadata 235 var o = $.meta ? $.extend({}, opts, $$.data()) : opts; 236 // get the font size of menu. 237 // .css('fontSize') returns various results cross-browser, so measure an em dash instead 238 var fontsize = $('<li id="menu-fontsize">—</li>').css({ 239 'padding' : 0, 240 'position' : 'absolute', 241 'top' : '-99999em', 242 'width' : 'auto' 243 }).appendTo($$).width(); //clientWidth is faster, but was incorrect here 244 // remove em dash 245 $('#menu-fontsize').remove(); 246 247 // Jump on level if it's a "NavBar" 248 if ($$.hasClass('sf-navbar')) { 249 $$ = $('li > ul', $$); 250 } 251 // cache all ul elements
252 $ULs = $$.find('ul:not(.sf-megamenu)'); 253 // loop through each ul in menu 254 $ULs.each(function(i) { 255 // cache this ul 256 var $ul = $ULs.eq(i); 257 // get all (li) children of this ul 258 var $LIs = $ul.children(); 259 // get all anchor grand-children 260 var $As = $LIs.children('a'); 261 // force content to one line and save current float property 262 var liFloat = $LIs.css('white-space','nowrap').css('float'); 263 // remove width restrictions and floats so elements remain vertically stacked 264 var emWidth = $ul.add($LIs).add($As).css({ 265 'float' : 'none', 266 'width' : 'auto' 267 }) 268 // this ul will now be shrink-wrapped to longest li due to position:absolute 269 // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer 270 .end().end()[0].clientWidth / fontsize; 271 // add more width to ensure lines don't turn over at certain sizes in various browsers 272 emWidth += o.extraWidth; 273 // restrict to at least minWidth and at most maxWidth 274 if (emWidth > o.maxWidth) { emWidth = o.maxWidth; } 275 else if (emWidth < o.minWidth) { emWidth = o.minWidth; } 276 emWidth += 'em'; 277 // set ul to width in ems 278 $ul.css('width',emWidth); 279 // restore li floats to avoid IE bugs 280 // set li width to full width of this ul 281 // revert white-space to normal 282 $LIs.css({ 283 'float' : liFloat, 284 'width' : '100%', 285 'white-space' : 'normal' 286 }) 287 // update offset position of descendant ul to reflect new width of parent 288 .each(function(){ 289 var $childUl = $('>ul',this); 290 var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right'; 291 $childUl.css(offsetDirection,emWidth); 292 }); 293 }); 294 295 }); 296 }; 297 // expose defaults 298 $.fn.supersubs.defaults = { 299 minWidth: 9, // requires em unit. 300 maxWidth: 25, // requires em unit. 301 extraWidth: 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values 302 }; 303 304})(jQuery); // plugin code ends; 305/** 306 * @file 307 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists. 308 */ 309 310(function ($) { 311 Drupal.behaviors.superfish = { 312 attach: function (context, settings) { 313 // Take a look at each list to apply Superfish to. 314 $.each(settings.superfish || {}, function(index, options) { 315 // Process all Superfish lists. 316 $('#superfish-' + options.id, context).once('superfish', function() { 317 var list = $(this); 318 319 // Check if we are to apply the Supersubs plug-in to it. 320 if (options.plugins || false) { 321 if (options.plugins.supersubs || false) { 322 list.supersubs(options.plugins.supersubs); 323 } 324 } 325 326 // Apply Superfish to the list. 327 list.superfish(options.sf); 328 329 // Check if we are to apply any other plug-in to it. 330 if (options.plugins || false) { 331 if (options.plugins.touchscreen || false) { 332 list.sftouchscreen(options.plugins.touchscreen); 333 } 334 if (options.plugins.smallscreen || false) { 335 list.sfsmallscreen(options.plugins.smallscreen); 336 } 337 if (options.plugins.supposition || false) { 338 list.supposition(); 339 } 340 if (options.plugins.bgiframe || false) { 341 list.find('ul').bgIframe({opacity:false}); 342 } 343 } 344 }); 345 }); 346 } 347 }; 348})(jQuery);;
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.