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