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