1(function ($) { 2 3/** 4 * A progressbar object. Initialized with the given id. Must be inserted into 5 * the DOM afterwards through progressBar.element. 6 * 7 * method is the function which will perform the HTTP request to get the 8 * progress bar state. Either "GET" or "POST". 9 * 10 * e.g. pb = new progressBar('myProgressBar'); 11 * some_element.appendChild(pb.element); 12 */ 13Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 14 var pb = this; 15 this.id = id; 16 this.method = method || 'GET'; 17 this.updateCallback = updateCallback; 18 this.errorCallback = errorCallback; 19 20 // The WAI-ARIA setting aria-live="polite" will announce changes after users 21 // have completed their current activity and not interrupt the screen reader. 22 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 23 this.element.html('<div class="bar"><div class="filled"></div></div>' + 24 '<div class="percentage"></div>' + 25 '<div class="message"> </div>'); 26}; 27 28/** 29 * Set the percentage and status message for the progressbar. 30 */ 31Drupal.progressBar.prototype.setProgress = function (percentage, message) { 32 if (percentage >= 0 && percentage <= 100) { 33 $('div.filled', this.element).css('width', percentage + '%'); 34 $('div.percentage', this.element).html(percentage + '%'); 35 } 36 $('div.message', this.element).html(message); 37 if (this.updateCallback) { 38 this.updateCallback(percentage, message, this); 39 } 40}; 41 42/** 43 * Start monitoring progress via Ajax. 44 */ 45Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 46 this.delay = delay; 47 this.uri = uri; 48 this.sendPing(); 49}; 50 51/** 52 * Stop monitoring progress via Ajax. 53 */ 54Drupal.progressBar.prototype.stopMonitoring = function () { 55 clearTimeout(this.timer); 56 // This allows monitoring to be stopped from within the callback. 57 this.uri = null; 58}; 59 60/** 61 * Request progress data from server. 62 */ 63Drupal.progressBar.prototype.sendPing = function () { 64 if (this.timer) { 65 clearTimeout(this.timer); 66 } 67 if (this.uri) { 68 var pb = this; 69 // When doing a post request, you need non-null data. Otherwise a 70 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 71 $.ajax({ 72 type: this.method, 73 url: this.uri, 74 data: '', 75 dataType: 'json', 76 success: function (progress) { 77 // Display errors. 78 if (progress.status == 0) { 79 pb.displayError(progress.data); 80 return; 81 } 82 // Update display. 83 pb.setProgress(progress.percentage, progress.message); 84 // Schedule next timer. 85 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 86 }, 87 error: function (xmlhttp) { 88 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 89 } 90 }); 91 } 92}; 93 94/** 95 * Display errors on the page. 96 */ 97Drupal.progressBar.prototype.displayError = function (string) { 98 var error = $('<div class="messages error"></div>').html(string); 99 $(this.element).before(error).hide(); 100 101 if (this.errorCallback) { 102 this.errorCallback(this); 103 } 104}; 105 106})(jQuery); 107; 108(function ($) { 109 Drupal.behaviors.qtip = { 110 attach: function (context, settings) { 111 $(function () { 112 var instances = $.parseJSON(settings.instances); 113 var debug = $.parseJSON(settings.qtipDebug); 114 115 $('.qtip-link:not(.qtip-processed)', context).each(function() { // Call .each() so we can access $(this) in the settings/config 116 // Check for a sibling .qtip-tooltip containing the tooltip information, otherwise (for forms) 117 // go to the element's parent and look for .qtip-tooltip container as a sibling of the parent 118 if ($(this, context).next('.qtip-tooltip').length) { 119 var tooltipElement = $(this).next('.qtip-tooltip'); 120 } 121 else { 122 var tooltipElement = $(this).parent().siblings('.qtip-tooltip'); 123 } 124 var tooltip = tooltipElement; 125 126 if (!debug.leaveElement) { 127 // Remove the tooltip element to keep the DOM clean 128 tooltipElement.remove(); 129 } 130 131 var text = tooltip.html(); 132 var title = (tooltip.data('qtip-title') != undefined) ? tooltip.data('qtip-title') + '' : ''; // Concatenate an empty string to make sure that the value being passed as the title is a string, otherwise it will not display 133 var instance = (tooltip.data('qtip-instance') != undefined) ? tooltip.data('qtip-instance') : ''; 134 var settings = (instances[instance] != undefined) ? instances[instance] : ''; 135 136 if (settings) { 137 $(this).qtip(settings); 138 $(this).qtip('option', 'content.text', text); 139 if (title) { 140 $(this).qtip('option', 'content.title', title); 141 } 142 } 143 // If no settings have been passed through, we still want to display a tooltip 144 else { 145 $(this).qtip({ 146 content: { 147 text: text, 148 title: title, 149 } 150 }); 151 } 152 153 // Add instance class to the container to aid in styling 154 $(this).addClass('qtip-instance-' + instance); 155
156 // Add processed class to not process again on AJAX calls. 157 $(this).addClass('qtip-processed'); 158 }); 159 }); 160 } 161 }; 162})(jQuery); 163; 164/* 165 * @file 166 * Integration with the colorbox library/module 167 */ 168 169(function ($) { 170 Drupal.ajax.prototype.commands.colorboxNodeReload = function (ajax, response) { 171 location.reload(); 172 }; 173 174 Drupal.ajax.prototype.commands.colorboxNodeRedirect = function (ajax, response) { 175 window.location.replace(response.data); 176 }; 177 178 Drupal.behaviors.colorboxNode = { 179 // Lets find our class name and change our URL to 180 // our defined menu path to open in a colorbox modal. 181 attach: function (context, settings) { 182 // Make sure colorbox exists. 183 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 184 return; 185 } 186 187 // Mobile detection extracted from the colorbox module. 188 // If the mobile setting is turned on, it will turn off the colorbox modal for mobile devices. 189 if (settings.colorbox.mobiledetect && window.matchMedia) { 190 // Disable Colorbox for small screens. 191 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 192 if (mq.matches) { 193 return; 194 } 195 } 196 197 $('.colorbox-node', context).once('init-colorbox-node-processed', function () { 198 $(this).colorboxNode({'launch': false}); 199 }); 200 201 // When using contextual links and clicking from within the colorbox 202 // we need to close down colorbox when opening the built in overlay. 203 $('ul.contextual-links a', context).once('colorboxNodeContextual').click(function () { 204 $.colorbox.close(); 205 }); 206 } 207 }; 208 209 $.fn.colorboxNodeLaunch = function (settings) { 210 var $this = $(this).clone(); 211 212 // Clear out the rel to prevent any confusion if not using the gallery class. 213 if(!$this.hasClass('colorbox-node-gallery')) { 214 $this.attr('rel', ''); 215 } 216 217 if (!hrefIsSafe(settings.href)) { 218 return; 219 } 220 // Lets extract our width and height giving priority to the data attributes. 221 var innerWidth = $this.data('inner-width'); 222 var innerHeight = $this.data('inner-height'); 223 if (typeof innerWidth != 'undefined' && typeof innerHeight != 'undefined') { 224 var params = $.urlDataParams(innerWidth, innerHeight); 225 } else { 226 var params = $.urlParams(settings.href); 227 } 228 229 // If we did not find a width or height, lets use the default. 230 if (params.innerHeight == undefined) { 231 params.innerHeight = settings.height; 232 } 233 if (params.innerWidth == undefined) { 234 params.innerWidth = settings.width; 235 } 236 237 params.html = '<div id="colorboxNodeLoading"></div>'; 238 params.onComplete = function () { 239 $this.colorboxNodeGroup(); 240 }; 241 params.open = true; 242 243 // Launch our colorbox with the provided settings 244 $this.colorbox($.extend({}, Drupal.settings.colorbox, params)); 245 }; 246 247 // Bind our colorbox node functionality to an anchor 248 $.fn.colorboxNode = function (options) { 249 var $this = this; 250 options = options || {}; 251 252 var settings = { 253 'launch': true, 254 'width': Drupal.settings.colorbox_node.width, 255 'height': Drupal.settings.colorbox_node.height 256 }; 257 258 $.extend(settings, options); 259 260 settings.href = $this.attr('data-href'); 261 if (typeof settings.href == 'undefined' || settings.href == false) { 262 settings.href = $this.attr('href'); 263 } 264 settings.href = Drupal.checkPlain(settings.href).replaceAll('&', '&'); 265 266 // Create an element so we can parse our a URL no matter if its internal or external. 267 var parse = document.createElement('a'); 268 parse.href = settings.href; 269 270 if(!settings.href) { 271 alert(Drupal.t('No url found on element')); 272 } 273 274 // Lets add our colorbox link after the base path if necessary. 275 var base_path = Drupal.settings.basePath; 276 var path_prefix = Drupal.settings.pathPrefix; 277 var pathname = parse.pathname; 278 279 // Lets check to see if the pathname has a forward slash. 280 // This problem happens in IE7/IE8 281 if (pathname.charAt(0) != '/') { 282 pathname = '/' + parse.pathname; 283 } 284 285 // If clean URL's are not turned on, lets check for that. 286 var cleanURLs = $.getParameterByName('q', settings.href); 287 if (base_path != '/') { 288 if (cleanURLs != '') { 289 settings.link = pathname.replace(base_path, base_path + parse.search.replace('?q=', '?q=/' + path_prefix + 'colorbox/')); 290 } else { 291 settings.link = pathname.replace(base_path, base_path + path_prefix + 'colorbox/') + parse.search; 292 } 293 } else { 294 if (cleanURLs != '') { 295 settings.link = base_path + parse.search.replace('?q=', '?q=/' + path_prefix + 'colorbox/'); 296 } else { 297 settings.link = base_path + path_prefix + 'colorbox' + pathname + parse.search; 298 } 299 } 300 301 // Bind Ajax behaviors to the element 302 var element_settings = {}; 303 element_settings.async = true; 304 305 // This removes any loading/progress bar on the clicked link 306 // and displays the colorbox loading screen instead. 307 element_settings.progress = { 'type': 'none' }; 308 // For anchor tags, these will go to the target of the anch
308or rather 309 // than the usual location. 310 if (settings.link) { 311 element_settings.url = settings.link; 312 element_settings.event = 'click'; 313 } 314 315 // Log our click handler to our ajax object 316 var base = Drupal.checkPlain($(this).attr('id')); 317 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 318 319 // Default to auto click for manual call to this function. 320 if (settings.launch) { 321 Drupal.ajax[base].eventResponse(this, 'click'); 322 $(this).colorboxNodeLaunch(settings); 323 } 324 else { 325 $(this).click(function () { 326 $(this).colorboxNodeLaunch(settings); 327 }); 328 } 329 }; 330 331 // Allow for grouping on links to showcase a gallery with left/right arrows. 332 // This function will find the next index of each link on the page by the rel 333 // and manually force a click on the link to call that AJAX and update the 334 // modal window. 335 $.fn.colorboxNodeGroup = function () { 336 // Lets do setup our gallery type of functions. 337 var $this = $(this); 338 var rel = Drupal.checkPlain($this.attr('rel')); 339 if (rel && $this.hasClass('colorbox-node-gallery')) { 340 if ($('a.colorbox-node-gallery[rel="' + rel + '"]:not(#colorbox a[rel="' + rel + '"])').length > 1) { 341 $related = $('a.colorbox-node-gallery[rel="' + rel + '"]:not(#colorbox a[rel="' + rel + '"])'); 342 343 // filter $related array by href, to have mutliple colorbox links to the same target 344 // appear as one item in the gallery only 345 var $related_unique = []; 346 $related.each(function () { 347 $.findHref($related_unique, this.href); 348 if (!$.findHref($related_unique, this.href).length) { 349 $related_unique.push(this); 350 } 351 }); 352 // we have to get the actual used element from the filtered list in order to get it's relative index 353 var current = $.findHref($related_unique, $this.get(0).href); 354 $related = $($related_unique); 355 var idx = $related.index($(current)); 356 var tot = $related.length; 357 358 // Show our gallery buttons 359 $('#cboxPrevious, #cboxNext').show(); 360 $.colorbox.next = function () { 361 index = get_index(1); 362 $related[index].click(); 363 }; 364 $.colorbox.prev = function () { 365 index = get_index(-1); 366 $related[index].click(); 367 }; 368 369 // Setup our current HTML 370 $('#cboxCurrent').html(Drupal.settings.colorbox.current.replace('{current}', idx + 1).replace('{total}', tot)).show(); 371 $('#cboxNext').html(Drupal.settings.colorbox.next).show(); 372 $('#cboxPrevious').html(Drupal.settings.colorbox.previous).show(); 373 374 var prefix = 'colorbox'; 375 // Remove Bindings and re-add 376 // @TODO: There must be a better way? If we don't remove it causes a memory to be exhausted. 377 $(document).unbind('keydown.' + prefix); 378 379 // Add Key Bindings 380 $(document).bind('keydown.' + prefix, function (e) { 381 var key = e.keyCode; 382 if ($related[1] && !e.altKey) { 383 if (key === 37) { 384 e.preventDefault(); 385 $.colorbox.prev(); 386 } else if (key === 39) { 387 e.preventDefault(); 388 $.colorbox.next(); 389 } 390 } 391 }); 392 } 393 394 function get_index(increment) { 395 var max = $related.length; 396 var newIndex = (idx + increment) % max; 397 return (newIndex < 0) ? max + newIndex : newIndex; 398 } 399 400 } 401 }; 402 403 // Find a colorbox link by href in an array 404 $.findHref = function (items, href) { 405 return $.grep(items, function (n, i) { 406 return n.href == href; 407 }); 408 }; 409 410 // Utility function to parse out our width/height from our url params
411 $.urlParams = function (url) { 412 var p = {}, 413 e, 414 a = /\+/g, // Regex for replacing addition symbol with a space 415 r = /([^&=]+)=?([^&]*)/g, 416 d = function (s) { 417 return decodeURIComponent(s.replace(a, ' ')); 418 }, 419 q = url.split('?'); 420 while (e = r.exec(q[1])) { 421 e[1] = d(e[1]); 422 e[2] = d(e[2]); 423 switch (e[2].toLowerCase()) { 424 case 'true': 425 case 'yes': 426 e[2] = true; 427 break; 428 429 case 'false': 430 case 'no': 431 e[2] = false; 432 break; 433 } 434 if (e[1] == 'width') { 435 e[1] = 'innerWidth'; 436 } 437 if (e[1] == 'height') { 438 e[1] = 'innerHeight'; 439 } 440 p[e[1]] = e[2]; 441 } 442 return p; 443 }; 444 445 // Utility function to return our data attributes for width/height 446 $.urlDataParams = function (innerWidth, innerHeight) { 447 return {'innerWidth':innerWidth,'innerHeight':innerHeight}; 448 }; 449 450 $.getParameterByName = function (name, href) { 451 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 452 var regexString = "[\\?&]" + name + "=([^&#]*)"; 453 var regex = new RegExp(regexString); 454 var found = regex.exec(href); 455 if (found == null) { 456 return ""; 457 } 458 else { 459 return decodeURIComponent(found[1].replace(/\+/g, " ")); 460 } 461 }; 462 463 /** 464 * Returns true if the passed-in href string is safe for colorbox_load. 465 * 466 * @param href 467 * The href string to be tested. 468 * 469 * @return 470 * Boolean true if the href is safe. 471 */ 472 function hrefIsSafe(href) { 473 var normalizedUrl = Drupal.absoluteUrl(href); 474 475 // Only local, non-file-system URLs are allowed. 476 if (!Drupal.urlIsLocal(normalizedUrl)) { 477 return false; 478 } 479 480 // Reject uploaded files from the public or private file system. 481 if (normalizedUrl.indexOf(Drupal.settings.colorbox.file_public_path) !== -1 || 482 normalizedUrl.match(/\/system\/files\//) || 483 normalizedUrl.match(/[?|&]q=system\/files\//)) { 484 return false; 485 } 486 487 // All checks passed. 488 return true; 489 } 490})(jQuery); 491; 492/** 493* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ 494* <http://cherne.net/brian/resources/jquery.hoverIntent.html> 495* 496* @param f onMouseOver function || An object with configuration options 497* @param g onMouseOut function || Nothing (use configuration options object) 498* @author Brian Cherne brian(at)cherne(dot)net 499*/ 500(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);; 501/* 502 * sf-AutomaticWidth v1.0b - Automatically adjusts the menu width for the jQuery Superfish plugin. 503 * 504 * Developer's note: 505 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 506 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 507 * 508 * jQuery version: 1.3.x or higher. 509 * 510 * Dual licensed under the MIT and GPL licenses: 511 * http://www.opensource.org/licenses/mit-license.php 512 * http://www.gnu.org/licenses/gpl.html 513 */ 514 515(function($){ 516 $.fn.sfautomaticwidth = function(){ 517 function automaticWidth(menu){ 518 // This plugin is not useful for vertical menus. 519 if (menu.hasClass('sf-horizontal') || menu.hasClass('sf-navbar')){ 520 // Adding a helper class. 521 // Making the main UL as wide as its container. 522 menu.addClass('sf-automatic-width').css('width','100%'); 523 var 524 // We need the inner width of the main UL. 525 menuWidth = menu[0].clientWidth, 526 // Selecting only the first level parents. 527 children = menu.children('li'), 528 // Number of children. 529 childrenNumber = children.length, 530 // Calculating the total width of the children based on their outer width. 531 childrenWidth = 0; 532 for (var a = 0; a < childrenNumber; a++) { 533 // Resetting the children width and getting its outer width then. 534 childrenWidth += children.eq(a).css({width:''}).outerWidth(true); 535 } 536 // Is the menu container wider than the menu? 537 // (It'll be more flexible in later versions.) 538 if (menuWidth > childrenWidth) { 539 var 540 // Calculating how much width should be added to each first level parent. 541 difference = (((menuWidth - childrenWidth) * 100) / menuWidth) / childrenNumber; 542 for (var a = 0; a < childrenNumber; a++){ 543 var 544 child = children.eq(a), 545 // Calculating and applying the new width to the item. 546 autoWidth = (((child[0].clientWidth * 100) / menuWidth) + difference) + '%'; 547 child.css({width:autoWidth}); 548 } 549 }
550 // Reset the widths if the menu became narrower than its children. 551 if (menuWidth < childrenWidth) { 552 for (var a = 0; a < childrenNumber; a++){ 553 children.eq(a).css({width:''}); 554 } 555 } 556 } 557 } 558 // Return original object to support chaining. 559 // Although unnecessary because of the way the module uses these plugins. 560 for (var b = 0; b < this.length; b++) { 561 var menu = $(this).eq(b); 562 automaticWidth(menu); 563 var timer; 564 $(window).resize(function(){ 565 clearTimeout(timer); 566 timer = setTimeout(function(){ 567 automaticWidth(menu); 568 }, 100); 569 }); 570 } 571 return this; 572 }; 573})(jQuery);; 574/* 575 * sf-Smallscreen v1.2b - Provides small-screen compatibility for the jQuery Superfish plugin. 576 * 577 * Developer's note: 578 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 579 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 580 * 581 * jQuery version: 1.3.x or higher. 582 * 583 * Dual licensed under the MIT and GPL licenses: 584 * http://www.opensource.org/licenses/mit-license.php 585 * http://www.gnu.org/licenses/gpl.html 586 */ 587 588(function($){ 589 $.fn.sfsmallscreen = function(options){ 590 options = $.extend({ 591 mode: 'inactive', 592 type: 'accordion', 593 breakpoint: 768, 594 breakpointUnit: 'px', 595 useragent: '', 596 title: '', 597 addSelected: false, 598 menuClasses: false, 599 hyperlinkClasses: false, 600 excludeClass_menu: '', 601 excludeClass_hyperlink: '', 602 includeClass_menu: '', 603 includeClass_hyperlink: '', 604 accordionButton: 1, 605 expandText: 'Expand', 606 collapseText: 'Collapse' 607 }, options); 608 609 // We need to clean up the menu from anything unnecessary. 610 function refine(menu){ 611 var 612 refined = menu.clone(), 613 // Things that should not be in the small-screen menus. 614 rm = refined.find('span.sf-sub-indicator, span.sf-description'), 615 // This is a helper class for those who need to add extra markup that shouldn't exist 616 // in the small-screen versions. 617 rh = refined.find('.sf-smallscreen-remove'), 618 // Mega-menus has to be removed too. 619 mm = refined.find('ul.sf-megamenu'); 620 for (var a = 0; a < rh.length; a++){ 621 rh.eq(a).replaceWith(rh.eq(a).html()); 622 } 623 for (var b = 0; b < rm.length; b++){ 624 rm.eq(b).remove(); 625 } 626 if (mm.length > 0){ 627 mm.removeClass('sf-megamenu'); 628 var ol = refined.find('div.sf-megamenu-column > ol'); 629 for (var o = 0; o < ol.length; o++){ 630 ol.eq(o).replaceWith('<ul>' + ol.eq(o).html() + '</ul>'); 631 } 632 var elements = ['div.sf-megamenu-column','.sf-megamenu-wrapper > ol','li.sf-megamenu-wrapper']; 633 for (var i = 0; i < elements.length; i++){ 634 obj = refined.find(elements[i]); 635 for (var t = 0; t < obj.length; t++){ 636 obj.eq(t).replaceWith(obj.eq(t).html()); 637 } 638 } 639 refined.find('.sf-megamenu-column').removeClass('sf-megamenu-column'); 640 } 641 refined.add(refined.find('*')).css({width:''}); 642 return refined; 643 } 644 645 // Creating <option> elements out of the menu. 646 function toSelect(menu, level){ 647 var 648 items = '', 649 childLI = $(menu).children('li'); 650 for (var a = 0; a < childLI.length; a++){ 651 var list = childLI.eq(a), parent = list.children('a, span'); 652 for (var b = 0; b < parent.length; b++){ 653 var 654 item = parent.eq(b), 655 path = item.is('a') ? item.attr('href') : '', 656 // Class names modification. 657 itemClone = item.clone(), 658 classes = (options.hyperlinkClasses) ? ((options.excludeClass_hyperlink && itemClone.hasClass(options.excludeClass_hyperlink)) ? itemClone.removeClass(options.excludeClass_hyperlink).attr('class') : itemClone.attr('class')) : '', 659 classes = (options.includeClass_hyperlink && !itemClone.hasClass(options.includeClass_hyperlink)) ? ((options.hyperlinkClasses) ? itemClone.addClass(options.includeClass_hyperlink).attr('class') : options.includeClass_hyperlink) : classes; 660 // Retaining the active class if requested. 661 if (options.addSelected && item.hasClass('active')){ 662 classes += ' active'; 663 } 664 // <option> has to be disabled if the item is not a link. 665 disable = item.is('span') || item.attr('href')=='#' ? ' disabled="disabled"' : '', 666 // Crystal clear. 667 subIndicator = 1 < level ? Array(level).join('-') + ' ' : ''; 668 // Preparing the <option> element. 669 items += '<option value="' + path + '" class="' + classes + '"' + disable + '>' + subIndicator + $.trim(item.text()) +'</option>', 670 childUL = list.find('> ul'); 671 // Using the function for the sub-menu of this item. 672 for (var u = 0; u < childUL.length; u++){
673 items += toSelect(childUL.eq(u), level + 1); 674 } 675 } 676 } 677 return items; 678 } 679 680 // Create the new version, hide the original. 681 function convert(menu){ 682 var menuID = menu.attr('id'), 683 // Creating a refined version of the menu. 684 refinedMenu = refine(menu); 685 // Currently the plugin provides two reactions to small screens. 686 // Converting the menu to a <select> element, and converting to an accordion version of the menu. 687 if (options.type == 'accordion'){ 688 var 689 toggleID = menuID + '-toggle', 690 accordionID = menuID + '-accordion'; 691 // Making sure the accordion does not exist. 692 if ($('#' + accordionID).length == 0){ 693 var 694 // Getting the style class. 695 styleClass = menu.attr('class').split(' ').filter(function(item){ 696 return item.indexOf('sf-style-') > -1 ? item : ''; 697 }), 698 // Creating the accordion. 699 accordion = $(refinedMenu).attr('id', accordionID); 700 // Removing unnecessary classes. 701 accordion.removeClass('sf-horizontal sf-vertical sf-navbar sf-shadow sf-js-enabled'); 702 // Adding necessary classes. 703 accordion.addClass('sf-accordion sf-hidden'); 704 // Removing style attributes and any unnecessary class. 705 accordion.children('li').removeAttr('style').removeClass('sfHover'); 706 // Doing the same and making sure all the sub-menus are off-screen (hidden). 707 accordion.find('ul').removeAttr('style').not('.sf-hidden').addClass('sf-hidden'); 708 // Creating the accordion toggle switch. 709 var toggle = '<div class="sf-accordion-toggle ' + styleClass + '"><a href="#" id="' + toggleID + '"><span>' + options.title + '</span></a></div>'; 710 711 // Adding Expand\Collapse buttons if requested. 712 if (options.accordionButton == 2){ 713 var parent = accordion.find('li.menuparent'); 714 for (var i = 0; i < parent.length; i++){ 715 parent.eq(i).prepend('<a href="#" class="sf-accordion-button">' + options.expandText + '</a>'); 716 } 717 } 718 // Inserting the according and hiding the original menu. 719 menu.before(toggle).before(accordion).hide(); 720 721 var 722 accordionElement = $('#' + accordionID), 723 // Deciding what should be used as accordion buttons. 724 buttonElement = (options.accordionButton < 2) ? 'a.menuparent,span.nolink.menuparent' : 'a.sf-accordion-button', 725 button = accordionElement.find(buttonElement); 726 727 // Attaching a click event to the toggle switch. 728 $('#' + toggleID).bind('click', function(e){ 729 // Preventing the click. 730 e.preventDefault(); 731 // Adding the sf-expanded class. 732 $(this).toggleClass('sf-expanded'); 733 734 if (accordionElement.hasClass('sf-expanded')){ 735 // If the accordion is already expanded: 736 // Hiding its expanded sub-menus and then the accordion itself as well. 737 accordionElement.add(accordionElement.find('li.sf-expanded')).removeClass('sf-expanded') 738 .end().find('ul').hide() 739 // This is a bit tricky, it's the same trick that has been in use in the main plugin for sometime. 740 // Basically we'll add a class that keeps the sub-menu off-screen and still visible, 741 // and make it invisible and removing the class one moment before showing or hiding it. 742 // This helps screen reader software access all the menu items. 743 .end().hide().addClass('sf-hidden').show(); 744 // Changing the caption of any existing accordion buttons to 'Expand'. 745 if (options.accordionButton == 2){ 746 accordionElement.find('a.sf-accordion-button').text(options.expandText); 747 } 748 } 749 else { 750 // But if it's collapsed, 751 accordionElement.addClass('sf-expanded').hide().removeClass('sf-hidden').show(); 752 } 753 }); 754 755 // Attaching a click event to the buttons. 756 button.bind('click', function(e){ 757 // Making sure the buttons does not exist already. 758 if ($(this).closest('li').children('ul').length > 0){ 759 e.preventDefault(); 760 // Selecting the parent menu items. 761 var parent = $(this).closest('li'); 762 // Creating and inserting Expand\Collapse buttons to the parent menu items, 763 // of course only if not already happened.
764 if (options.accordionButton == 1 && parent.children('a.menuparent,span.nolink.menuparent').length > 0 && parent.children('ul').children('li.sf-clone-parent').length == 0){ 765 var 766 // Cloning the hyperlink of the parent menu item. 767 cloneLink = parent.children('a.menuparent,span.nolink.menuparent').clone(), 768 // Wrapping the hyerplinks in <li>. 769 cloneLink = $('<li class="sf-clone-parent" />').html(cloneLink); 770 // Adding a helper class and attaching them to the sub-menus. 771 parent.children('ul').addClass('sf-has-clone-parent').prepend(cloneLink); 772 } 773 // Once the button is clicked, collapse the sub-menu if it's expanded. 774 if (parent.hasClass('sf-expanded')){ 775 parent.children('ul').slideUp('fast', function(){ 776 // Doing the accessibility trick after hiding the sub-menu. 777 $(this).closest('li').removeClass('sf-expanded').end().addClass('sf-hidden').show(); 778 }); 779 // Changing the caption of the inserted Collapse link to 'Expand', if any is inserted. 780 if (options.accordionButton == 2 && parent.children('.sf-accordion-button').length > 0){ 781 parent.children('.sf-accordion-button').text(options.expandText); 782 } 783 } 784 // Otherwise, expand the sub-menu. 785 else { 786 // Doing the accessibility trick and then showing the sub-menu. 787 parent.children('ul').hide().removeClass('sf-hidden').slideDown('fast') 788 // Changing the caption of the inserted Expand link to 'Collape', if any is inserted. 789 .end().addClass('sf-expanded').children('a.sf-accordion-button').text(options.collapseText) 790 // Hiding any expanded sub-menu of the same level. 791 .end().siblings('li.sf-expanded').children('ul') 792 .slideUp('fast', function(){ 793 // Doing the accessibility trick after hiding it. 794 $(this).closest('li').removeClass('sf-expanded').end().addClass('sf-hidden').show(); 795 }) 796 // Assuming Expand\Collapse buttons do exist, resetting captions, in those hidden sub-menus. 797 .parent().children('a.sf-accordion-button').text(options.expandText); 798 } 799 } 800 }); 801 } 802 } 803 else { 804 var 805 // Class names modification. 806 menuClone = menu.clone(), classes = (options.menuClasses) ? ((options.excludeClass_menu && menuClone.hasClass(options.excludeClass_menu)) ? menuClone.removeClass(options.excludeClass_menu).attr('class') : menuClone.attr('class')) : '', 807 classes = (options.includeClass_menu && !menuClone.hasClass(options.includeClass_menu)) ? ((options.menuClasses) ? menuClone.addClass(options.includeClass_menu).attr('class') : options.includeClass_menu) : classes, 808 classes = (classes) ? ' class="' + classes + '"' : ''; 809 810 // Making sure the <select> element does not exist already. 811 if ($('#' + menuID + '-select').length == 0){ 812 // Creating the <option> elements. 813 var newMenu = toSelect(refinedMenu, 1), 814 // Creating the <select> element and assigning an ID and class name. 815 selectList = $('<select' + classes + ' id="' + menuID + '-select"/>') 816 // Attaching the title and the items to the <select> element. 817 .html('<option>' + options.title + '</option>' + newMenu) 818 // Attaching an event then. 819 .change(function(){ 820 // Except for the first option that is the menu title and not a real menu item. 821 if ($('option:selected', this).index()){ 822 window.location = selectList.val(); 823 } 824 }); 825 // Applying the addSelected option to it. 826 if (options.addSelected){ 827 selectList.find('.active').attr('selected', !0); 828 } 829 // Finally inserting the <select> element into the document then hiding the original menu. 830 menu.before(selectList).hide(); 831 } 832 } 833 } 834 835 // Turn everything back to normal. 836 function turnBack(menu){ 837 var 838 id = '#' + menu.attr('id'); 839 // Removing the small screen version. 840 $(id + '-' + options.type).remove(); 841 // Removing the accordion toggle switch as well. 842 if (options.type == 'accordion'){ 843 $(id + '-toggle').parent('div').remove(); 844 } 845 // Crystal clear! 846 $(id).show(); 847 } 848
849 // Return original object to support chaining. 850 // Although this is unnecessary because of the way the module uses these plugins. 851 for (var s = 0; s < this.length; s++){ 852 var 853 menu = $(this).eq(s), 854 mode = options.mode; 855 // The rest is crystal clear, isn't it? :) 856 if (mode == 'always_active'){ 857 convert(menu); 858 } 859 else if (mode == 'window_width'){ 860 var breakpoint = (options.breakpointUnit == 'em') ? (options.breakpoint * parseFloat($('body').css('font-size'))) : options.breakpoint, 861 windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 862 timer; 863 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 864 convert(menu); 865 } 866 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 867 convert(menu); 868 } 869 $(window).resize(function(){ 870 clearTimeout(timer); 871 timer = setTimeout(function(){ 872 var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 873 if ((typeof Modernizr === 'undefined' || typeof Modernizr.mq !== 'function') && windowWidth < breakpoint){ 874 convert(menu); 875 } 876 else if (typeof Modernizr !== 'undefined' && typeof Modernizr.mq === 'function' && Modernizr.mq('(max-width:' + (breakpoint - 1) + 'px)')) { 877 convert(menu); 878 } 879 else { 880 turnBack(menu); 881 } 882 }, 50); 883 }); 884 } 885 else if (mode == 'useragent_custom'){ 886 if (options.useragent != ''){ 887 var ua = RegExp(options.useragent, 'i'); 888 if (navigator.userAgent.match(ua)){ 889 convert(menu); 890 } 891 } 892 } 893 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)){ 894 convert(menu); 895 } 896 } 897 return this; 898 } 899})(jQuery); 900; 901/* 902 * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget. 903 * 904 * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him. 905 * Special thanks to Karl Swedberg for valuable input. 906 * 907 * Dual licensed under the MIT and GPL licenses: 908 * http://www.opensource.org/licenses/mit-license.php 909 * http://www.gnu.org/licenses/gpl.html 910 */ 911/* 912 * This is not the original jQuery Supposition plugin. 913 * Please refer to the README for more information. 914 */ 915 916(function($){ 917 $.fn.supposition = function(){ 918 var $w = $(window), /*do this once instead of every onBeforeShow call*/ 919 _offset = function(dir) { 920 return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset'] 921 || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft'] 922 || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft']; 923 }, 924 onHide = function(){ 925 this.css({bottom:''}); 926 }, 927 onBeforeShow = function(){ 928 this.each(function(){ 929 var $u = $(this); 930 $u.css('display','block'); 931 var $mul = $u.closest('.sf-menu'), 932 level = $u.parents('ul').length, 933 menuWidth = $u.width(), 934 menuParentWidth = $u.closest('li').outerWidth(true), 935 menuParentLeft = $u.closest('li').offset().left, 936 totalRight = $w.width() + _offset('x'), 937 menuRight = $u.offset().left + menuWidth, 938 exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth; 939 if ($u.parents('.sf-js-enabled').hasClass('rtl')) { 940 if (menuParentLeft < exactMenuWidth) { 941 if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){ 942 $u.css({left:0,right:'auto'}); 943 } 944 else { 945 $u.css({left:menuParentWidth + 'px',right:'auto'}); 946 } 947 } 948 } 949 else { 950 if (menuRight > totalRight && menuParentLeft > menuWidth) { 951 if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){ 952 $u.css({right:0,left:'auto'}); 953 } 954 else { 955 $u.css({right:menuParentWidth + 'px',left:'auto'}); 956 } 957 } 958 } 959 var windowHeight = $w.height(), 960 offsetTop = $u.offset().top, 961 menuParentShadow = ($mul.hasClass('sf-shadow') && $u.css('padding-bottom').length > 0) ? parseInt($u.css('padding-bottom').slice(0,-2)) : 0, 962 menuParentHeight = ($mul.hasClass('sf-vertical')) ? '-' + menuParentShadow : $u.parent().outerHeight(true) - menuParentShadow, 963 menuHeight = $u.height(), 964 baseline = windowHeight + _offset('y'); 965 var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight)); 966 if (expandUp) { 967 $u.css({bottom:menuParentHeight + 'px',top:'auto'}); 968 } 969 $u.css('display','none'); 970 }); 971 }; 972 973 return this.each(function() { 974 var o = $.fn.superfish.o[this.serial]; /* get this menu's options */ 975 976 /* if callbacks already set, store them */ 977 var _onBeforeShow = o.onBeforeShow, 978 _onHide = o.onHide; 979 980 $.extend($.fn.superfish.o[this.serial],{ 981 onBeforeShow: function() { 982 onBeforeShow.call(this); /* fire our Supposition callback */ 983 _onBeforeShow.call(this); /* fire stored callbacks */ 984 }, 985 onHide: function() { 986 onHide.call(this); /* fire our Supposition callback */ 987 _onHide.call(this); /* fire stored callbacks */ 988 } 989 }); 990 }); 991 }; 992})(jQuery);; 993/* 994 * Superfish v1.4.8 - jQuery menu widget 995 * Copyright (c) 2008 Joel Birch 996 * 997 * Dual licensed under the MIT and GPL licenses: 998 * http://www.opensource.org/licenses/mit-license.php 999 * http://www.gnu.org/licenses/gpl.html 1000 * 1001 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 1002 */ 1003/* 1004 * This is not the original jQuery Superfish plugin. 1005 * Please refer to the README for more information. 1006 */ 1007 1008(function($){ 1009 $.fn.superfish = function(op){ 1010 var sf = $.fn.superfish, 1011 c = sf.c, 1012 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 1013 over = function(){ 1014 var $$ = $(this), menu = getMenu($$); 1015 clearTimeout(menu.sfTimer); 1016 $$.showSuperfishUl().siblings().hideSuperfishUl(); 1017 }, 1018 out = function(){ 1019 var $$ = $(this), menu = getMenu($$), o = sf.op; 1020 clearTimeout(menu.sfTimer); 1021 menu.sfTimer=setTimeout(function(){ 1022 if ($$.children('.sf-clicked').length == 0){ 1023 o.retainPath=($.inArray($$[0],o.$path)>-1);
1024 $$.hideSuperfishUl(); 1025 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 1026 } 1027 },o.delay); 1028 }, 1029 getMenu = function($menu){ 1030 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 1031 sf.op = sf.o[menu.serial]; 1032 return menu; 1033 }, 1034 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 1035 1036 return this.each(function() { 1037 var s = this.serial = sf.o.length; 1038 var o = $.extend({},sf.defaults,op); 1039 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels), 1040 p = o.$path; 1041 for (var l = 0; l < p.length; l++){ 1042 p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass); 1043 } 1044 sf.o[s] = sf.op = o; 1045 1046 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 1047 if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') ); 1048 }) 1049 .not('.'+c.bcClass) 1050 .hideSuperfishUl(); 1051 1052 var $a = $('a, span.nolink',this); 1053 $a.each(function(i){ 1054 var $li = $a.eq(i).parents('li'); 1055 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 1056 }); 1057 o.onInit.call(this); 1058 1059 }).each(function() { 1060 var menuClasses = [c.menuClass], 1061 addShadow = true; 1062 if ($.browser !== undefined){ 1063 if ($.browser.msie && $.browser.version < 7){ 1064 addShadow = false; 1065 } 1066 } 1067 if (sf.op.dropShadows && addShadow){ 1068 menuClasses.push(c.shadowClass); 1069 } 1070 $(this).addClass(menuClasses.join(' ')); 1071 }); 1072 }; 1073 1074 var sf = $.fn.superfish; 1075 sf.o = []; 1076 sf.op = {}; 1077 sf.IE7fix = function(){ 1078 var o = sf.op; 1079 if ($.browser !== undefined){ 1080 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) { 1081 this.toggleClass(sf.c.shadowClass+'-off'); 1082 } 1083 } 1084 }; 1085 sf.c = { 1086 bcClass: 'sf-breadcrumb', 1087 menuClass: 'sf-js-enabled', 1088 anchorClass: 'sf-with-ul', 1089 arrowClass: 'sf-sub-indicator', 1090 shadowClass: 'sf-shadow' 1091 }; 1092 sf.defaults = { 1093 hoverClass: 'sfHover', 1094 pathClass: 'overideThisToUse', 1095 pathLevels: 1, 1096 delay: 800, 1097 animation: {opacity:'show'}, 1098 speed: 'fast', 1099 autoArrows: true, 1100 dropShadows: true, 1101 disableHI: false, // true disables hoverIntent detection 1102 onInit: function(){}, // callback functions 1103 onBeforeShow: function(){}, 1104 onShow: function(){}, 1105 onHide: function(){} 1106 }; 1107 $.fn.extend({ 1108 hideSuperfishUl : function(){ 1109 var o = sf.op, 1110 not = (o.retainPath===true) ? o.$path : ''; 1111 o.retainPath = false; 1112 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 1113 .children('ul').addClass('sf-hidden'); 1114 o.onHide.call($ul); 1115 return this; 1116 }, 1117 showSuperfishUl : function(){ 1118 var o = sf.op, 1119 sh = sf.c.shadowClass+'-off', 1120 $ul = this.addClass(o.hoverClass) 1121 .children('ul.sf-hidden').hide().removeClass('sf-hidden'); 1122 sf.IE7fix.call($ul); 1123 o.onBeforeShow.call($ul); 1124 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 1125 return this; 1126 } 1127 }); 1128})(jQuery);; 1129/* 1130 * Supersubs v0.4b - jQuery plugin 1131 * Copyright (c) 2013 Joel Birch 1132 * 1133 * Dual licensed under the MIT and GPL licenses: 1134 * http://www.opensource.org/licenses/mit-license.php 1135 * http://www.gnu.org/licenses/gpl.html 1136 * 1137 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of 1138 * their longest list item children. If you use this, please expect bugs and report them 1139 * to the jQuery Google Group with the word 'Superfish' in the subject line. 1140 * 1141 */ 1142/* 1143 * This is not the original jQuery Supersubs plugin. 1144 * Please refer to the README for more information. 1145 */ 1146 1147(function($){ // $ will refer to jQuery within this closure 1148 $.fn.supersubs = function(options){ 1149 var opts = $.extend({}, $.fn.supersubs.defaults, options);
1150 // return original object to support chaining 1151 // Although this is unnecessary due to the way the module uses these plugins. 1152 for (var a = 0; a < this.length; a++) { 1153 // cache selections 1154 var $$ = $(this).eq(a), 1155 // support metadata 1156 o = $.meta ? $.extend({}, opts, $$.data()) : opts; 1157 // Jump one level if it's a "NavBar" 1158 if ($$.hasClass('sf-navbar')) { 1159 $$ = $$.children('li').children('ul'); 1160 } 1161 // cache all ul elements 1162 var $ULs = $$.find('ul'), 1163 // get the font size of menu. 1164 // .css('fontSize') returns various results cross-browser, so measure an em dash instead 1165 fontsize = $('<li id="menu-fontsize">—</li>'), 1166 size = fontsize.attr('style','padding:0;position:absolute;top:-99999em;width:auto;') 1167 .appendTo($$)[0].clientWidth; //clientWidth is faster than width() 1168 // remove em dash 1169 fontsize.remove(); 1170 1171 // loop through each ul in menu 1172 for (var b = 0; b < $ULs.length; b++) { 1173 var 1174 // cache this ul 1175 $ul = $ULs.eq(b); 1176 // If a multi-column sub-menu, and only if correctly configured. 1177 if (o.megamenu && $ul.hasClass('sf-megamenu') && $ul.find('.sf-megamenu-column').length > 0){ 1178 // Look through each column. 1179 var $column = $ul.find('div.sf-megamenu-column > ol'), 1180 // Overall width. 1181 mwWidth = 0; 1182 for (var d = 0; d < $column.length; d++){ 1183 resize($column.eq(d)); 1184 // New column width, in pixels. 1185 var colWidth = $column.width(); 1186 // Just a trick to convert em unit to px. 1187 $column.css({width:colWidth}) 1188 // Making column parents the same size. 1189 .parents('.sf-megamenu-column').css({width:colWidth}); 1190 // Overall width. 1191 mwWidth += parseInt(colWidth); 1192 } 1193 // Resizing the columns container too. 1194 $ul.add($ul.find('li.sf-megamenu-wrapper, li.sf-megamenu-wrapper > ol')).css({width:mwWidth}); 1195 } 1196 else { 1197 resize($ul); 1198 } 1199 } 1200 } 1201 function resize($ul){ 1202 var 1203 // get all (li) children of this ul 1204 $LIs = $ul.children(), 1205 // get all anchor grand-children 1206 $As = $LIs.children('a'); 1207 // force content to one line and save current float property 1208 $LIs.css('white-space','nowrap'); 1209 // remove width restrictions and floats so elements remain vertically stacked 1210 $ul.add($LIs).add($As).css({float:'none',width:'auto'}); 1211 // this ul will now be shrink-wrapped to longest li due to position:absolute 1212 // so save its width as ems. 1213 var emWidth = $ul.get(0).clientWidth / size; 1214 // add more width to ensure lines don't turn over at certain sizes in various browsers 1215 emWidth += o.extraWidth; 1216 // restrict to at least minWidth and at most maxWidth 1217 if (emWidth > o.maxWidth) {emWidth = o.maxWidth;} 1218 else if (emWidth < o.minWidth) {emWidth = o.minWidth;} 1219 emWidth += 'em'; 1220 // set ul to width in ems 1221 $ul.css({width:emWidth}); 1222 // restore li floats to avoid IE bugs 1223 // set li width to full width of this ul 1224 // revert white-space to normal 1225 $LIs.add($As).css({float:'',width:'',whiteSpace:''}); 1226 // update offset position of descendant ul to reflect new width of parent. 1227 // set it to 100% in case it isn't already set to this in the CSS 1228 for (var c = 0; c < $LIs.length; c++) { 1229 var $childUl = $LIs.eq(c).children('ul'); 1230 var offsetDirection = $childUl.css('left') !== undefined ? 'left' : 'right'; 1231 $childUl.css(offsetDirection,'100%'); 1232 } 1233 } 1234 return this; 1235 }; 1236 // expose defaults 1237 $.fn.supersubs.defaults = { 1238 megamenu: true, // define width for multi-column sub-menus and their columns. 1239 minWidth: 12, // requires em unit. 1240 maxWidth: 27, // requires em unit. 1241 extraWidth: 1 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values 1242 }; 1243})(jQuery); // plugin code ends 1244; 1245/** 1246 * @file 1247 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists. 1248 */ 1249 1250(function ($) { 1251 Drupal.behaviors.superfish = { 1252 attach: function (context, settings) { 1253 // Take a look at each list to apply Superfish to. 1254 $.each(settings.superfish || {}, function(index, options) { 1255 // Process all Superfish lists. 1256 $('#superfish-' + options.id, context).once('superfish', function() { 1257 var list = $(this); 1258 1259 // Check if we are to apply the Supersubs plug-in to it. 1260 if (options.plugins || false) { 1261 if (options.plugins.supersubs || false) { 1262 list.supersubs(options.plugins.supersubs); 1263 } 1264 } 1265 1266 // Apply Superfish to the list. 1267 list.superfish(options.sf); 1268 1269 // Check if we are to apply any other plug-in to it. 1270 if (options.plugins || false) { 1271 if (options.plugins.touchscreen || false) { 1272 list.sftouchscreen(options.plugins.touchscreen); 1273 } 1274 if (options.plugins.smallscreen || false) { 1275 list.sfsmallscreen(options.plugins.smallscreen); 1276 } 1277 if (options.plugins.automaticwidth || false) { 1278 list.sfautomaticwidth(); 1279 } 1280 if (options.plugins.supposition || false) { 1281 list.supposition(); 1282 } 1283 if (options.plugins.bgiframe || false) { 1284 list.find('ul').bgIframe({opacity:false}); 1285 } 1286 } 1287 }); 1288 }); 1289 } 1290 }; 1291})(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.