1/* 2 * sf-Touchscreen v1.3b - Provides touchscreen compatibility for the jQuery Superfish plugin. 3 * 4 * Developer's note: 5 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 6 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 7 * 8 * jQuery version: 1.3.x or higher. 9 * 10 * Dual licensed under the MIT and GPL licenses: 11 * http://www.opensource.org/licenses/mit-license.php 12 * http://www.gnu.org/licenses/gpl.html 13 */ 14 15(function($){ 16 $.fn.sftouchscreen = function(options){ 17 options = $.extend({ 18 mode: 'inactive', 19 breakpoint: 768, 20 breakpointUnit: 'px', 21 useragent: '', 22 behaviour: 2, 23 disableHover: false 24 }, options); 25 26 function activate(menu){ 27 var eventHandler = (('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch)) ? ['click touchstart','mouseup touchend'] : ['click','mouseup']; 28 // Select hyperlinks from parent menu items. 29 menu.find('li:has(ul)').children('a,span.nolink').each(function(){ 30 var item = $(this), 31 parent = item.closest('li'); 32 if (options.disableHover){ 33 parent.unbind('mouseenter mouseleave'); 34 } 35 if (options.behaviour == 2){ 36 if (parent.children('a.menuparent,span.nolink.menuparent').length > 0 && parent.children('ul').children('.sf-clone-parent').length == 0){ 37 var 38 // Cloning the hyperlink of the parent menu item. 39 cloneLink = parent.children('a.menuparent,span.nolink.menuparent').clone(), 40 // Wrapping the hyerplinks in <li>. 41 cloneLink = $('<li class="sf-clone-parent" />').html(cloneLink); 42 // Removing unnecessary stuff. 43 cloneLink.find('.sf-sub-indicator').remove(), 44 // Adding a helper class and attaching them to the sub-menus. 45 parent.children('ul').addClass('sf-has-clone-parent').prepend(cloneLink); 46 } 47 } 48 // No .toggle() here as it's not possible to reset it. 49 item.bind(eventHandler[0], function(event){ 50 // Already clicked? 51 if (item.hasClass('sf-clicked')){ 52 // Depending on the preferred behaviour, either proceed to the URL. 53 if (options.behaviour == 0){ 54 window.location = item.attr('href'); 55 } 56 // or collapse the sub-menu. 57 else if (options.behaviour == 1 || options.behaviour == 2){ 58 event.preventDefault(); 59 item.removeClass('sf-clicked'); 60 parent.hideSuperfishUl().find('a,span.nolink').removeClass('sf-clicked'); 61 } 62 } 63 // Prevent the default action otherwise. 64 else { 65 event.preventDefault(); 66 item.addClass('sf-clicked'); 67 parent.showSuperfishUl().siblings('li:has(ul)').hideSuperfishUl().find('.sf-clicked').removeClass('sf-clicked'); 68 } 69 }); 70 }); 71 72 $(document).bind(eventHandler[1], function(event){ 73 if (menu.not(event.target) && menu.has(event.target).length === 0){ 74 menu.find('.sf-clicked').removeClass('sf-clicked'); 75 menu.find('li:has(ul)').hideSuperfishUl(); 76 } 77 }); 78 } 79 // Return original object to support chaining. 80 // This is not necessary actually because of the way the module uses these plugins. 81 for (var b = 0; b < this.length; b++) { 82 var menu = $(this).eq(b), 83 mode = options.mode; 84 // The rest is crystal clear, isn't it? :) 85 if (mode == 'always_active'){ 86 activate(menu); 87 } 88 else if (mode == 'window_width'){ 89 var breakpoint = (options.breakpointUnit == 'em') ? (options.breakpoint * parseFloat($('body').css('font-size'))) : options.breakpoint, 90 windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 91 timer; 92 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 93 activate(menu); 94 } 95 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 96 activate(menu); 97 } 98 $(window).resize(function(){ 99 clearTimeout(timer); 100 timer = setTimeout(function(){ 101 var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 102 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 103 activate(menu); 104 } 105 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 106 activate(menu); 107 } 108 }, 50); 109 }); 110 } 111 else if (mode == 'useragent_custom'){ 112 if (options.useragent != ''){ 113 var ua = RegExp(options.useragent, 'i'); 114 if (navigator.userAgent.match(ua)){ 115 activate(menu); 116 } 117 } 118 } 119 else if (mode == 'useragent_predefined' && navigator.userAgent.match(/(android|bb\d+|meego)|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i)){ 120 activate(menu); 121 } 122 } 123 return this; 124 } 125})(jQuery); 126; 127/* 128 * sf-Smallscreen v1.2b - Provides small-screen compatibility for the jQuery Superfish plugin. 129 * 130 * Developer's note: 131 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 132 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 133 * 134 * jQuery version: 1.3.x or higher. 135 * 136 * Dual licensed under the MIT and GPL licenses: 137 * http://www.opensource.org/licenses/mit-license.php 138 * http://www.gnu.org/licenses/gpl.html 139 */ 140 141(function($){ 142 $.fn.sfsmallscreen = function(options){ 143 options = $.extend({ 144 mode: 'inactive', 145 type: 'accordion', 146 breakpoint: 768, 147 breakpointUnit: 'px', 148 useragent: '', 149 title: '', 150 addSelected: false, 151 menuClasses: false, 152 hyperlinkClasses: false, 153 excludeClass_menu: '', 154 excludeClass_hyperlink: '', 155 includeClass_menu: '', 156 includeClass_hyperlink: '', 157 accordionButton: 1, 158 expandText: 'Expand', 159 collapseText: 'Collapse' 160 }, options); 161 162 // We need to clean up the menu from anything unnecessary. 163 function refine(menu){ 164 var
165 refined = menu.clone(), 166 // Things that should not be in the small-screen menus. 167 rm = refined.find('span.sf-sub-indicator, span.sf-description'), 168 // This is a helper class for those who need to add extra markup that shouldn't exist 169 // in the small-screen versions. 170 rh = refined.find('.sf-smallscreen-remove'), 171 // Mega-menus has to be removed too. 172 mm = refined.find('ul.sf-megamenu'); 173 for (var a = 0; a < rh.length; a++){ 174 rh.eq(a).replaceWith(rh.eq(a).html()); 175 } 176 for (var b = 0; b < rm.length; b++){ 177 rm.eq(b).remove(); 178 } 179 if (mm.length > 0){ 180 mm.removeClass('sf-megamenu'); 181 var ol = refined.find('div.sf-megamenu-column > ol'); 182 for (var o = 0; o < ol.length; o++){ 183 ol.eq(o).replaceWith('<ul>' + ol.eq(o).html() + '</ul>'); 184 } 185 var elements = ['div.sf-megamenu-column','.sf-megamenu-wrapper > ol','li.sf-megamenu-wrapper']; 186 for (var i = 0; i < elements.length; i++){ 187 obj = refined.find(elements[i]); 188 for (var t = 0; t < obj.length; t++){ 189 obj.eq(t).replaceWith(obj.eq(t).html()); 190 } 191 } 192 refined.find('.sf-megamenu-column').removeClass('sf-megamenu-column'); 193 } 194 refined.add(refined.find('*')).css({width:''}); 195 return refined; 196 } 197 198 // Creating <option> elements out of the menu. 199 function toSelect(menu, level){ 200 var 201 items = '', 202 childLI = $(menu).children('li'); 203 for (var a = 0; a < childLI.length; a++){ 204 var list = childLI.eq(a), parent = list.children('a, span'); 205 for (var b = 0; b < parent.length; b++){ 206 var 207 item = parent.eq(b), 208 path = item.is('a') ? item.attr('href') : '', 209 // Class names modification. 210 itemClone = item.clone(), 211 classes = (options.hyperlinkClasses) ? ((options.excludeClass_hyperlink && itemClone.hasClass(options.excludeClass_hyperlink)) ? itemClone.removeClass(options.excludeClass_hyperlink).attr('class') : itemClone.attr('class')) : '', 212 classes = (options.includeClass_hyperlink && !itemClone.hasClass(options.includeClass_hyperlink)) ? ((options.hyperlinkClasses) ? itemClone.addClass(options.includeClass_hyperlink).attr('class') : options.includeClass_hyperlink) : classes; 213 // Retaining the active class if requested. 214 if (options.addSelected && item.hasClass('active')){ 215 classes += ' active'; 216 } 217 // <option> has to be disabled if the item is not a link. 218 disable = item.is('span') || item.attr('href')=='#' ? ' disabled="disabled"' : '', 219 // Crystal clear. 220 subIndicator = 1 < level ? Array(level).join('-') + ' ' : ''; 221 // Preparing the <option> element. 222 items += '<option value="' + path + '" class="' + classes + '"' + disable + '>' + subIndicator + $.trim(item.text()) +'</option>', 223 childUL = list.find('> ul'); 224 // Using the function for the sub-menu of this item. 225 for (var u = 0; u < childUL.length; u++){ 226 items += toSelect(childUL.eq(u), level + 1); 227 } 228 } 229 } 230 return items; 231 } 232 233 // Create the new version, hide the original. 234 function convert(menu){ 235 var menuID = menu.attr('id'), 236 // Creating a refined version of the menu. 237 refinedMenu = refine(menu); 238 // Currently the plugin provides two reactions to small screens. 239 // Converting the menu to a <select>
239 element, and converting to an accordion version of the menu. 240 if (options.type == 'accordion'){ 241 var 242 toggleID = menuID + '-toggle', 243 accordionID = menuID + '-accordion'; 244 // Making sure the accordion does not exist. 245 if ($('#' + accordionID).length == 0){ 246 var 247 // Getting the style class. 248 styleClass = menu.attr('class').split(' ').filter(function(item){ 249 return item.indexOf('sf-style-') > -1 ? item : ''; 250 }), 251 // Creating the accordion. 252 accordion = $(refinedMenu).attr('id', accordionID); 253 // Removing unnecessary classes. 254 accordion.removeClass('sf-horizontal sf-vertical sf-navbar sf-shadow sf-js-enabled'); 255 // Adding necessary classes. 256 accordion.addClass('sf-accordion sf-hidden'); 257 // Removing style attributes and any unnecessary class. 258 accordion.children('li').removeAttr('style').removeClass('sfHover'); 259 // Doing the same and making sure all the sub-menus are off-screen (hidden). 260 accordion.find('ul').removeAttr('style').not('.sf-hidden').addClass('sf-hidden'); 261 // Creating the accordion toggle switch. 262 var toggle = '<div class="sf-accordion-toggle ' + styleClass + '"><a href="#" id="' + toggleID + '"><span>' + options.title + '</span></a></div>'; 263 264 // Adding Expand\Collapse buttons if requested. 265 if (options.accordionButton == 2){ 266 var parent = accordion.find('li.menuparent'); 267 for (var i = 0; i < parent.length; i++){ 268 parent.eq(i).prepend('<a href="#" class="sf-accordion-button">' + options.expandText + '</a>'); 269 } 270 } 271 // Inserting the according and hiding the original menu. 272 menu.before(toggle).before(accordion).hide(); 273 274 var 275 accordionElement = $('#' + accordionID), 276 // Deciding what should be used as accordion buttons. 277 buttonElement = (options.accordionButton < 2) ? 'a.menuparent,span.nolink.menuparent' : 'a.sf-accordion-button', 278 button = accordionElement.find(buttonElement); 279 280 // Attaching a click event to the toggle switch. 281 $('#' + toggleID).bind('click', function(e){ 282 // Preventing the click. 283 e.preventDefault(); 284 // Adding the sf-expanded class. 285 $(this).toggleClass('sf-expanded'); 286 287 if (accordionElement.hasClass('sf-expanded')){ 288 // If the accordion is already expanded: 289 // Hiding its expanded sub-menus and then the accordion itself as well. 290 accordionElement.add(accordionElement.find('li.sf-expanded')).removeClass('sf-expanded') 291 .end().find('ul').hide() 292 // This is a bit tricky, it's the same trick that has been in use in the main plugin for sometime. 293 // Basically we'll add a class that keeps the sub-menu off-screen and still visible, 294 // and make it invisible and removing the class one moment before showing or hiding it. 295 // This helps screen reader software access all the menu items. 296 .end().hide().addClass('sf-hidden').show(); 297 // Changing the caption of any existing accordion buttons to 'Expand'. 298 if (options.accordionButton == 2){ 299 accordionElement.find('a.sf-accordion-button').text(options.expandText); 300 } 301 } 302 else { 303 // But if it's collapsed, 304 accordionElement.addClass('sf-expanded').hide().removeClass('sf-hidden').show(); 305 } 306 }); 307 308 // Attaching a click event to the buttons. 309 button.bind('click', function(e){ 310 // Making sure the buttons does not exist already. 311 if ($(this).closest('li').children('ul').length > 0){ 312 e.preventDefault(); 313 // Selecting the parent menu items. 314 var parent = $(this).closest('li'); 315 // Creating and inserting Expand\Collapse buttons to the parent menu items, 316 // of course only if not already happened.
317 if (options.accordionButton == 1 && parent.children('a.menuparent,span.nolink.menuparent').length > 0 && parent.children('ul').children('li.sf-clone-parent').length == 0){ 318 var 319 // Cloning the hyperlink of the parent menu item. 320 cloneLink = parent.children('a.menuparent,span.nolink.menuparent').clone(), 321 // Wrapping the hyerplinks in <li>. 322 cloneLink = $('<li class="sf-clone-parent" />').html(cloneLink); 323 // Adding a helper class and attaching them to the sub-menus. 324 parent.children('ul').addClass('sf-has-clone-parent').prepend(cloneLink); 325 } 326 // Once the button is clicked, collapse the sub-menu if it's expanded. 327 if (parent.hasClass('sf-expanded')){ 328 parent.children('ul').slideUp('fast', function(){ 329 // Doing the accessibility trick after hiding the sub-menu. 330 $(this).closest('li').removeClass('sf-expanded').end().addClass('sf-hidden').show(); 331 }); 332 // Changing the caption of the inserted Collapse link to 'Expand', if any is inserted. 333 if (options.accordionButton == 2 && parent.children('.sf-accordion-button').length > 0){ 334 parent.children('.sf-accordion-button').text(options.expandText); 335 } 336 } 337 // Otherwise, expand the sub-menu. 338 else { 339 // Doing the accessibility trick and then showing the sub-menu. 340 parent.children('ul').hide().removeClass('sf-hidden').slideDown('fast') 341 // Changing the caption of the inserted Expand link to 'Collape', if any is inserted. 342 .end().addClass('sf-expanded').children('a.sf-accordion-button').text(options.collapseText) 343 // Hiding any expanded sub-menu of the same level. 344 .end().siblings('li.sf-expanded').children('ul') 345 .slideUp('fast', function(){ 346 // Doing the accessibility trick after hiding it. 347 $(this).closest('li').removeClass('sf-expanded').end().addClass('sf-hidden').show(); 348 }) 349 // Assuming Expand\Collapse buttons do exist, resetting captions, in those hidden sub-menus. 350 .parent().children('a.sf-accordion-button').text(options.expandText); 351 } 352 } 353 }); 354 } 355 } 356 else { 357 var 358 // Class names modification. 359 menuClone = menu.clone(), classes = (options.menuClasses) ? ((options.excludeClass_menu && menuClone.hasClass(options.excludeClass_menu)) ? menuClone.removeClass(options.excludeClass_menu).attr('class') : menuClone.attr('class')) : '', 360 classes = (options.includeClass_menu && !menuClone.hasClass(options.includeClass_menu)) ? ((options.menuClasses) ? menuClone.addClass(options.includeClass_menu).attr('class') : options.includeClass_menu) : classes, 361 classes = (classes) ? ' class="' + classes + '"' : ''; 362 363 // Making sure the <select> element does not exist already. 364 if ($('#' + menuID + '-select').length == 0){ 365 // Creating the <option> elements. 366 var newMenu = toSelect(refinedMenu, 1), 367 // Creating the <select> element and assigning an ID and class name. 368 selectList = $('<select' + classes + ' id="' + menuID + '-select"/>') 369 // Attaching the title and the items to the <select> element. 370 .html('<option>' + options.title + '</option>' + newMenu) 371 // Attaching an event then. 372 .change(function(){ 373 // Except for the first option that is the menu title and not a real menu item. 374 if ($('option:selected', this).index()){ 375 window.location = selectList.val(); 376 } 377 }); 378 // Applying the addSelected option to it. 379 if (options.addSelected){ 380 selectList.find('.active').attr('selected', !0); 381 } 382 // Finally inserting the <select> element into the document then hiding the original menu. 383 menu.before(selectList).hide(); 384 } 385 } 386 } 387 388 // Turn everything back to normal. 389 function turnBack(menu){ 390 var 391 id = '#' + menu.attr('id'); 392 // Removing the small screen version. 393 $(id + '-' + options.type).remove(); 394 // Removing the accordion toggle switch as well. 395 if (options.type == 'accordion'){ 396 $(id + '-toggle').parent('div').remove(); 397 } 398 // Crystal clear! 399 $(id).show(); 400 } 401
402 // Return original object to support chaining. 403 // Although this is unnecessary because of the way the module uses these plugins. 404 for (var s = 0; s < this.length; s++){ 405 var 406 menu = $(this).eq(s), 407 mode = options.mode; 408 // The rest is crystal clear, isn't it? :) 409 if (mode == 'always_active'){ 410 convert(menu); 411 } 412 else if (mode == 'window_width'){ 413 var breakpoint = (options.breakpointUnit == 'em') ? (options.breakpoint * parseFloat($('body').css('font-size'))) : options.breakpoint, 414 windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 415 timer; 416 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 417 convert(menu); 418 } 419 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 420 convert(menu); 421 } 422 $(window).resize(function(){ 423 clearTimeout(timer); 424 timer = setTimeout(function(){ 425 var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 426 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 427 convert(menu); 428 } 429 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 430 convert(menu); 431 } 432 else { 433 turnBack(menu); 434 } 435 }, 50); 436 }); 437 } 438 else if (mode == 'useragent_custom'){ 439 if (options.useragent != ''){ 440 var ua = RegExp(options.useragent, 'i'); 441 if (navigator.userAgent.match(ua)){ 442 convert(menu); 443 } 444 } 445 } 446 else if (mode == 'useragent_predefined' && navigator.userAgent.match(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i)){ 447 convert(menu); 448 } 449 } 450 return this; 451 } 452})(jQuery); 453; 454/* 455 * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget. 456 * 457 * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him. 458 * Special thanks to Karl Swedberg for valuable input. 459 * 460 * Dual licensed under the MIT and GPL licenses: 461 * http://www.opensource.org/licenses/mit-license.php 462 * http://www.gnu.org/licenses/gpl.html 463 */ 464/* 465 * This is not the original jQuery Supposition plugin. 466 * Please refer to the README for more information. 467 */ 468 469(function($){ 470 $.fn.supposition = function(){ 471 var $w = $(window), /*do this once instead of every onBeforeShow call*/ 472 _offset = function(dir) { 473 return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset'] 474 || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft'] 475 || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft']; 476 }, 477 onHide = function(){ 478 this.css({bottom:''}); 479 }, 480 onBeforeShow = function(){ 481 this.each(function(){ 482 var $u = $(this); 483 $u.css('display','block'); 484 var $mul = $u.closest('.sf-menu'), 485 level = $u.parents('ul').length, 486 menuWidth = $u.width(), 487 menuParentWidth = $u.closest('li').outerWidth(true), 488 menuParentLeft = $u.closest('li').offset().left, 489 totalRight = $w.width() + _offset('x'), 490 menuRight = $u.offset().left + menuWidth, 491 exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth; 492 if ($u.parents('.sf-js-enabled').hasClass('rtl')) { 493 if (menuParentLeft < exactMenuWidth) { 494 if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){ 495 $u.css({left:0,right:'auto'}); 496 } 497 else { 498 $u.css({left:menuParentWidth + 'px',right:'auto'}); 499 } 500 } 501 } 502 else { 503 if (menuRight > totalRight && menuParentLeft > menuWidth) { 504 if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){ 505 $u.css({right:0,left:'auto'}); 506 } 507 else { 508 $u.css({right:menuParentWidth + 'px',left:'auto'}); 509 } 510 } 511 } 512 var windowHeight = $w.height(), 513 offsetTop = $u.offset().top, 514 menuParentShadow = ($mul.hasClass('sf-shadow') && $u.css('padding-bottom').length > 0) ? parseInt($u.css('padding-bottom').slice(0,-2)) : 0, 515 menuParentHeight = ($mul.hasClass('sf-vertical')) ? '-' + menuParentShadow : $u.parent().outerHeight(true) - menuParentShadow, 516 menuHeight = $u.height(), 517 baseline = windowHeight + _offset('y'); 518 var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight)); 519 if (expandUp) { 520 $u.css({bottom:menuParentHeight + 'px',top:'auto'}); 521 } 522 $u.css('display','none'); 523 }); 524 }; 525 526 return this.each(function() { 527 var o = $.fn.superfish.o[this.serial]; /* get this menu's options */ 528 529 /* if callbacks already set, store them */ 530 var _onBeforeShow = o.onBeforeShow, 531 _onHide = o.onHide; 532 533 $.extend($.fn.superfish.o[this.serial],{ 534 onBeforeShow: function() { 535 onBeforeShow.call(this); /* fire our Supposition callback */ 536 _onBeforeShow.call(this); /* fire stored callbacks */ 537 }, 538 onHide: function() { 539 onHide.call(this); /* fire our Supposition callback */ 540 _onHide.call(this); /* fire stored callbacks */ 541 } 542 }); 543 }); 544 }; 545})(jQuery);; 546/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) 547 * Licensed under the MIT License (LICENSE.txt). 548 * 549 * Version 2.1.2 550 */ 551(function(a){a.fn.bgiframe=(a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(d){d=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},d);var c='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+d.src+'"style="display:block;position:absolute;z-index:-1;'+(d.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(d.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(d.top))+";left:"+(d.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(d.left))+";width:"+(d.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(d.width))+";height:"+(d.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(d.height))+';"/>';return this.each(function(){if(a(this).children("iframe.bgiframe").length===0){this.insertBefore(document.createElement(c),this.firstChild)}})}:function(){return this});a.fn.bgIframe=a.fn.bgiframe;function b(c){return c&&c.constructor===Number?c+"px":c}})(jQuery);; 552/* 553 * Superfish v1.4.8 - jQuery menu widget 554 * Copyright (c) 2008 Joel Birch 555 * 556 * Dual licensed under the MIT and GPL licenses: 557 * http://www.opensource.org/licenses/mit-license.php 558 * http://www.gnu.org/licenses/gpl.html 559 * 560 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 561 */ 562/* 563 * This is not the original jQuery Superfish plugin. 564 * Please refer to the README for more information. 565 */ 566 567(function($){ 568 $.fn.superfish = function(op){ 569 var sf = $.fn.superfish, 570 c = sf.c, 571 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 572 over = function(){ 573 var $$ = $(this), menu = getMenu($$); 574 clearTimeout(menu.sfTimer); 575 $$.showSuperfishUl().siblings().hideSuperfishUl(); 576 }, 577 out = function(){ 578 var $$ = $(this), menu = getMenu($$), o = sf.op; 579 clearTimeout(menu.sfTimer); 580 menu.sfTimer=setTimeout(function(){ 581 if ($$.children('.sf-clicked').length == 0){ 582 o.retainPath=($.inArray($$[0],o.$path)>-1);
583 $$.hideSuperfishUl(); 584 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 585 } 586 },o.delay); 587 }, 588 getMenu = function($menu){ 589 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 590 sf.op = sf.o[menu.serial]; 591 return menu; 592 }, 593 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 594 595 return this.each(function() { 596 var s = this.serial = sf.o.length; 597 var o = $.extend({},sf.defaults,op); 598 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels), 599 p = o.$path; 600 for (var l = 0; l < p.length; l++){ 601 p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass); 602 } 603 sf.o[s] = sf.op = o; 604 605 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 606 if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') ); 607 }) 608 .not('.'+c.bcClass) 609 .hideSuperfishUl(); 610 611 var $a = $('a, span.nolink',this); 612 $a.each(function(i){ 613 var $li = $a.eq(i).parents('li'); 614 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 615 }); 616 o.onInit.call(this); 617 618 }).each(function() { 619 var menuClasses = [c.menuClass], 620 addShadow = true; 621 if ($.browser !== undefined){ 622 if ($.browser.msie && $.browser.version < 7){ 623 addShadow = false; 624 } 625 } 626 if (sf.op.dropShadows && addShadow){ 627 menuClasses.push(c.shadowClass); 628 } 629 $(this).addClass(menuClasses.join(' ')); 630 }); 631 }; 632 633 var sf = $.fn.superfish; 634 sf.o = []; 635 sf.op = {}; 636 sf.IE7fix = function(){ 637 var o = sf.op; 638 if ($.browser !== undefined){ 639 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) { 640 this.toggleClass(sf.c.shadowClass+'-off'); 641 } 642 } 643 }; 644 sf.c = { 645 bcClass: 'sf-breadcrumb', 646 menuClass: 'sf-js-enabled', 647 anchorClass: 'sf-with-ul', 648 arrowClass: 'sf-sub-indicator', 649 shadowClass: 'sf-shadow' 650 }; 651 sf.defaults = { 652 hoverClass: 'sfHover', 653 pathClass: 'overideThisToUse', 654 pathLevels: 1, 655 delay: 800, 656 animation: {opacity:'show'}, 657 speed: 'fast', 658 autoArrows: true, 659 dropShadows: true, 660 disableHI: false, // true disables hoverIntent detection 661 onInit: function(){}, // callback functions 662 onBeforeShow: function(){}, 663 onShow: function(){}, 664 onHide: function(){} 665 }; 666 $.fn.extend({ 667 hideSuperfishUl : function(){ 668 var o = sf.op, 669 not = (o.retainPath===true) ? o.$path : ''; 670 o.retainPath = false; 671 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 672 .children('ul').addClass('sf-hidden'); 673 o.onHide.call($ul); 674 return this; 675 }, 676 showSuperfishUl : function(){ 677 var o = sf.op, 678 sh = sf.c.shadowClass+'-off', 679 $ul = this.addClass(o.hoverClass) 680 .children('ul.sf-hidden').hide().removeClass('sf-hidden'); 681 sf.IE7fix.call($ul); 682 o.onBeforeShow.call($ul); 683 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 684 return this; 685 } 686 }); 687})(jQuery);; 688/* 689 * Supersubs v0.4b - jQuery plugin 690 * Copyright (c) 2013 Joel Birch 691 * 692 * Dual licensed under the MIT and GPL licenses: 693 * http://www.opensource.org/licenses/mit-license.php 694 * http://www.gnu.org/licenses/gpl.html 695 * 696 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of 697 * their longest list item children. If you use this, please expect bugs and report them 698 * to the jQuery Google Group with the word 'Superfish' in the subject line. 699 * 700 */ 701/* 702 * This is not the original jQuery Supersubs plugin. 703 * Please refer to the README for more information. 704 */ 705 706(function($){ // $ will refer to jQuery within this closure 707 $.fn.supersubs = function(options){ 708 var opts = $.extend({}, $.fn.supersubs.defaults, options);
709 // return original object to support chaining 710 // Although this is unnecessary due to the way the module uses these plugins. 711 for (var a = 0; a < this.length; a++) { 712 // cache selections 713 var $$ = $(this).eq(a), 714 // support metadata 715 o = $.meta ? $.extend({}, opts, $$.data()) : opts; 716 // Jump one level if it's a "NavBar" 717 if ($$.hasClass('sf-navbar')) { 718 $$ = $$.children('li').children('ul'); 719 } 720 // cache all ul elements 721 var $ULs = $$.find('ul'), 722 // get the font size of menu. 723 // .css('fontSize') returns various results cross-browser, so measure an em dash instead 724 fontsize = $('<li id="menu-fontsize">—</li>'), 725 size = fontsize.attr('style','padding:0;position:absolute;top:-99999em;width:auto;') 726 .appendTo($$)[0].clientWidth; //clientWidth is faster than width() 727 // remove em dash 728 fontsize.remove(); 729 730 // loop through each ul in menu 731 for (var b = 0; b < $ULs.length; b++) { 732 var 733 // cache this ul 734 $ul = $ULs.eq(b); 735 // If a multi-column sub-menu, and only if correctly configured. 736 if (o.megamenu && $ul.hasClass('sf-megamenu') && $ul.find('.sf-megamenu-column').length > 0){ 737 // Look through each column. 738 var $column = $ul.find('div.sf-megamenu-column > ol'), 739 // Overall width. 740 mwWidth = 0; 741 for (var d = 0; d < $column.length; d++){ 742 resize($column.eq(d)); 743 // New column width, in pixels. 744 var colWidth = $column.width(); 745 // Just a trick to convert em unit to px. 746 $column.css({width:colWidth}) 747 // Making column parents the same size. 748 .parents('.sf-megamenu-column').css({width:colWidth}); 749 // Overall width. 750 mwWidth += parseInt(colWidth); 751 } 752 // Resizing the columns container too. 753 $ul.add($ul.find('li.sf-megamenu-wrapper, li.sf-megamenu-wrapper > ol')).css({width:mwWidth}); 754 } 755 else { 756 resize($ul); 757 } 758 } 759 } 760 function resize($ul){ 761 var 762 // get all (li) children of this ul 763 $LIs = $ul.children(), 764 // get all anchor grand-children 765 $As = $LIs.children('a'); 766 // force content to one line and save current float property 767 $LIs.css('white-space','nowrap'); 768 // remove width restrictions and floats so elements remain vertically stacked 769 $ul.add($LIs).add($As).css({float:'none',width:'auto'}); 770 // this ul will now be shrink-wrapped to longest li due to position:absolute 771 // so save its width as ems. 772 var emWidth = $ul.get(0).clientWidth / size; 773 // add more width to ensure lines don't turn over at certain sizes in various browsers 774 emWidth += o.extraWidth; 775 // restrict to at least minWidth and at most maxWidth 776 if (emWidth > o.maxWidth) {emWidth = o.maxWidth;} 777 else if (emWidth < o.minWidth) {emWidth = o.minWidth;} 778 emWidth += 'em'; 779 // set ul to width in ems 780 $ul.css({width:emWidth}); 781 // restore li floats to avoid IE bugs 782 // set li width to full width of this ul 783 // revert white-space to normal 784 $LIs.add($As).css({float:'',width:'',whiteSpace:''}); 785 // update offset position of descendant ul to reflect new width of parent. 786 // set it to 100% in case it isn't already set to this in the CSS 787 for (var c = 0; c < $LIs.length; c++) { 788 var $childUl = $LIs.eq(c).children('ul'); 789 var offsetDirection = $childUl.css('left') !== undefined ? 'left' : 'right'; 790 $childUl.css(offsetDirection,'100%'); 791 } 792 } 793 return this; 794 }; 795 // expose defaults 796 $.fn.supersubs.defaults = { 797 megamenu: true, // define width for multi-column sub-menus and their columns. 798 minWidth: 12, // requires em unit. 799 maxWidth: 27, // requires em unit. 800 extraWidth: 1 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values 801 }; 802})(jQuery); // plugin code ends 803; 804/** 805 * @file 806 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists. 807 */ 808 809(function ($) { 810 Drupal.behaviors.superfish = { 811 attach: function (context, settings) { 812 // Take a look at each list to apply Superfish to. 813 $.each(settings.superfish || {}, function(index, options) { 814 // Process all Superfish lists. 815 $('#superfish-' + options.id, context).once('superfish', function() { 816 var list = $(this); 817 818 // Check if we are to apply the Supersubs plug-in to it. 819 if (options.plugins || false) { 820 if (options.plugins.supersubs || false) { 821 list.supersubs(options.plugins.supersubs); 822 } 823 } 824 825 // Apply Superfish to the list. 826 list.superfish(options.sf); 827 828 // Check if we are to apply any other plug-in to it. 829 if (options.plugins || false) { 830 if (options.plugins.touchscreen || false) { 831 list.sftouchscreen(options.plugins.touchscreen); 832 } 833 if (options.plugins.smallscreen || false) { 834 list.sfsmallscreen(options.plugins.smallscreen); 835 } 836 if (options.plugins.automaticwidth || false) { 837 list.sfautomaticwidth(); 838 } 839 if (options.plugins.supposition || false) { 840 list.supposition(); 841 } 842 if (options.plugins.bgiframe || false) { 843 list.find('ul').bgIframe({opacity:false}); 844 } 845 } 846 }); 847 }); 848 } 849 }; 850})(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.