1(function ($) { 2 3Drupal.behaviors.textarea = { 4 attach: function (context, settings) { 5 $('.form-textarea-wrapper.resizable', context).once('textarea', function () { 6 var staticOffset = null; 7 var textarea = $(this).addClass('resizable-textarea').find('textarea'); 8 var grippie = $('<div class="grippie"></div>').mousedown(startDrag); 9 10 grippie.insertAfter(textarea); 11 12 function startDrag(e) { 13 staticOffset = textarea.height() - e.pageY; 14 textarea.css('opacity', 0.25); 15 $(document).mousemove(performDrag).mouseup(endDrag); 16 return false; 17 } 18 19 function performDrag(e) { 20 textarea.height(Math.max(32, staticOffset + e.pageY) + 'px'); 21 return false; 22 } 23 24 function endDrag(e) { 25 $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); 26 textarea.css('opacity', 1); 27 } 28 }); 29 } 30}; 31 32})(jQuery); 33; 34/** 35* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ 36* <http://cherne.net/brian/resources/jquery.hoverIntent.html> 37* 38* @param f onMouseOver function || An object with configuration options 39* @param g onMouseOut function || Nothing (use configuration options object) 40* @author Brian Cherne brian(at)cherne(dot)net 41*/ 42(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);; 43/* 44 * sf-Smallscreen v1.0b - Provides small-screen compatibility for the jQuery Superfish plugin. 45 * 46 * Developer's note: 47 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 48 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 49 * 50 * jQuery version: 1.3.x or higher. 51 * 52 * Dual licensed under the MIT and GPL licenses: 53 * http://www.opensource.org/licenses/mit-license.php 54 * http://www.gnu.org/licenses/gpl.html 55 */ 56 57(function($){ 58 $.fn.sfsmallscreen = function(options){ 59 options = $.extend({ 60 mode: 'inactive', 61 breakpoint: 768, 62 useragent: '', 63 title: '', 64 addSelected: true, 65 menuClasses: true, 66 hyperlinkClasses: true, 67 excludeClass_menu: '', 68 excludeClass_hyperlink: '', 69 includeClass_menu: '', 70 includeClass_hyperlink: '' 71 }, options); 72 73 // We need to clean up the menu from anything unnecessary. 74 function refine(menu){ 75 if ($('.sf-megamenu', menu).length > 0){ 76 var refined = menu.clone(); 77 refined.find('div.sf-megamenu-column > ol').each(function(){ 78 $(this).replaceWith('<ul>' + $(this).html() + '</ul>'); 79 }); 80 refined.find('div.sf-megamenu-column').each(function(){ 81 $(this).replaceWith($(this).html()); 82 }).end().find('.sf-megamenu-wrapper > ol').each(function(){ 83 $(this).replaceWith($(this).html()); 84 }).end().find('li.sf-megamenu-wrapper').each(function(){ 85 $(this).replaceWith($(this).html()); 86 }); 87 } else { 88 var refined = menu.clone(); 89 } 90 refined.find('.sf-smallscreen-remove').each(function(){ 91 $(this).replaceWith($(this).html()); 92 }).end().find('.sf-sub-indicator, .sf-description').each(function(){ 93 $(this).remove(); 94 }); 95 return refined; 96 } 97
98 // Currently the only available reaction is converting the menu into a <select> element; 99 // In the next version there will be another reaction that will create a "compact" version of 100 // the menu, using <ul> element hence easy to style with CSS and so on and so forth. 101 function toSelect(menu, level){ 102 var items = ''; 103 $(menu).children('li').each(function(){ 104 var list = $(this); 105 list.children('a, span').each(function(){ 106 var item = $(this), 107 path = item.is('a') ? item.attr('href') : '', 108 itemClone = item.clone(), 109 classes = (options.hyperlinkClasses) ? ((options.excludeClass_hyperlink && itemClone.hasClass(options.excludeClass_hyperlink)) ? itemClone.removeClass(options.excludeClass_hyperlink).attr('class') : itemClone.attr('class')) : '', 110 classes = (options.includeClass_hyperlink && !itemClone.hasClass(options.includeClass_hyperlink)) ? ((options.hyperlinkClasses) ? itemClone.addClass(options.includeClass_hyperlink).attr('class') : options.includeClass_hyperlink) : classes, 111 classes = (classes) ? ' class="' + classes + '"' : '', 112 disable = item.is('span') ? ' disabled="disabled"' : '', 113 subIndicator = 1 < level ? Array(level).join('-') + ' ' : ''; 114 items += '<option value="' + path + '"' + classes + disable + '>' + subIndicator + $.trim(item.text()) +'</option>'; 115 list.find('> ul').each(function(){ 116 items += toSelect(this, level + 1); 117 }); 118 }); 119 }); 120 return items; 121 } 122 123 // Create the new version, hide the original. 124 function convert(menu){ 125 var menuClone = menu.clone(), classes = (options.menuClasses) ? ((options.excludeClass_menu && menuClone.hasClass(options.excludeClass_menu)) ? menuClone.removeClass(options.excludeClass_menu).attr('class') : menuClone.attr('class')) : '', 126 classes = (options.includeClass_menu && !menuClone.hasClass(options.includeClass_menu)) ? ((options.menuClasses) ? menuClone.addClass(options.includeClass_menu).attr('class') : options.includeClass_menu) : classes, 127 classes = (classes) ? ' class="' + classes + '"' : ''; 128 if ($('#' + menu.attr('id') + '-select').length == 0){ 129 var selectList = $('<select' + classes + ' id="' + menu.attr('id') + '-select"/>'), 130 refinedMenu = refine(menu); 131 newMenu = toSelect(refinedMenu, 1); 132 selectList.append('<option>' + options.title + '</option>').append(newMenu).change(function(){ 133 window.location = selectList.val(); 134 }); 135 if (options.addSelected) { 136 selectList.find('.active').attr("selected", !0); 137 } 138 menu.before(selectList).hide(); 139 } 140 } 141 142 // Turn everything back to normal. 143 function turnBack(menu){ 144 var id = '#' + menu.attr('id'); 145 $(id + '-select').remove(); 146 $(id).show(); 147 } 148 149 // Return original object to support chaining. 150 return this.each(function(){ 151 var menu = $(this), 152 mode = options.mode; 153 // The rest is crystal clear, isn't it? :) 154 switch (mode){ 155 case 'always_active' : 156 convert(menu); 157 break; 158 case 'window_width' : 159 if ($(window).width() < options.breakpoint){ 160 convert(menu); 161 } 162 var timer; 163 $(window).resize(function(){ 164 clearTimeout(timer); 165 timer = setTimeout(function(){ 166 if ($(window).width() < options.breakpoint){ 167 convert(menu); 168 } 169 else { 170 turnBack(menu); 171 } 172 }, 100); 173 }); 174 break; 175 case 'useragent_custom' : 176 if (options.useragent != ''){ 177 var ua = RegExp(options.useragent, 'i'); 178 if (navigator.userAgent.match(ua)){ 179 convert(menu); 180 } 181 } 182 break; 183 case 'useragent_predefined' : 184 if (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)){ 185 convert(menu); 186 } 187 break; 188 } 189 }); 190 }; 191})(jQuery);; 192/* 193 * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget. 194 * 195 * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him. 196 * Special thanks to Karl Swedberg for valuable input. 197 * 198 * Dual licensed under the MIT and GPL licenses: 199 * http://www.opensource.org/licenses/mit-license.php 200 * http://www.gnu.org/licenses/gpl.html 201 */ 202/* 203 * This is not the original jQuery Supersubs plugin. 204 * Please refer to the README for more information. 205 */ 206 207(function($){ 208 $.fn.supposition = function(){ 209 var $w = $(window), /*do this once instead of every onBeforeShow call*/ 210 _offset = function(dir) { 211 return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset'] 212 || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft'] 213 || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft']; 214 }, 215 onHide = function(){ 216 this.css({bottom:''}); 217 }, 218 onBeforeShow = function(){ 219 this.each(function(){ 220 var $u = $(this); 221 $u.css('display','block'); 222 var menuWidth = $u.width(), 223 menuParentWidth = $u.closest('li').outerWidth(true), 224 menuParentLeft = $u.closest('li').offset().left, 225 totalRight = $w.width() + _offset('x'), 226 menuRight = $u.offset().left + menuWidth, 227 exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth; 228 if ($u.parents('.sf-js-enabled').hasClass('rtl')) { 229 if (menuParentLeft < exactMenuWidth) { 230 $u.css('left', menuParentWidth + 'px'); 231 $u.css('right', 'auto'); 232 } 233 } 234 else { 235 if (menuRight > totalRight && menuParentLeft > menuWidth) { 236 $u.css('right', menuParentWidth + 'px'); 237 $u.css('left', 'auto'); 238 } 239 } 240 var windowHeight = $w.height(), 241 offsetTop = $u.offset().top, 242 menuParentShadow = ($u.closest('.sf-menu').hasClass('sf-shadow') && $u.css('padding-bottom').length > 0) ? parseInt($u.css('padding-bottom').slice(0,-2)) : 0, 243 menuParentHeight = ($u.closest('.sf-menu').hasClass('sf-vertical')) ? '-' + menuParentShadow : $u.parent().outerHeight(true) - menuParentShadow, 244 menuHeight = $u.height(), 245 baseline = windowHeight + _offset('y'); 246 var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight)); 247 if (expandUp) { 248 $u.css('bottom', menuParentHeight + 'px'); 249 $u.css('top', 'auto'); 250 } 251 $u.css('display','none'); 252 }); 253 }; 254 255 return this.each(function() { 256 var o = $.fn.superfish.o[this.serial]; /* get this menu's options */ 257 258 /* if callbacks already set, store them */ 259 var _onBeforeShow = o.onBeforeShow, 260 _onHide = o.onHide; 261 262 $.extend($.fn.superfish.o[this.serial],{ 263 onBeforeShow: function() { 264 onBeforeShow.call(this); /* fire our Supposition callback */ 265 _onBeforeShow.call(this); /* fire stored callbacks */ 266 }, 267 onHide: function() { 268 onHide.call(this); /* fire our Supposition callback */ 269 _onHide.call(this); /* fire stored callbacks */ 270 } 271 }); 272 }); 273 }; 274})(jQuery);; 275/* 276 * Superfish v1.4.8 - jQuery menu widget 277 * Copyright (c) 2008 Joel Birch 278 * 279 * Dual licensed under the MIT and GPL licenses: 280 * http://www.opensource.org/licenses/mit-license.php 281 * http://www.gnu.org/licenses/gpl.html 282 * 283 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 284 */ 285/* 286 * This is not the original jQuery Supersubs plugin. 287 * Please refer to the README for more information. 288 */ 289 290(function($){ 291 $.fn.superfish = function(op){ 292 var sf = $.fn.superfish, 293 c = sf.c, 294 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 295 over = function(){ 296 var $$ = $(this), menu = getMenu($$); 297 clearTimeout(menu.sfTimer); 298 $$.showSuperfishUl().siblings().hideSuperfishUl(); 299 }, 300 out = function(){ 301 var $$ = $(this), menu = getMenu($$), o = sf.op; 302 clearTimeout(menu.sfTimer); 303 menu.sfTimer=setTimeout(function(){ 304 o.retainPath=($.inArray($$[0],o.$path)>-1);
305 $$.hideSuperfishUl(); 306 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 307 },o.delay); 308 }, 309 getMenu = function($menu){ 310 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 311 sf.op = sf.o[menu.serial]; 312 return menu; 313 }, 314 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 315 316 return this.each(function() { 317 var s = this.serial = sf.o.length; 318 var o = $.extend({},sf.defaults,op); 319 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 320 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 321 .filter('li:has(ul)').removeClass(o.pathClass); 322 }); 323 sf.o[s] = sf.op = o; 324 325 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 326 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 327 }) 328 .not('.'+c.bcClass) 329 .hideSuperfishUl(); 330 331 var $a = $('a',this); 332 $a.each(function(i){ 333 var $li = $a.eq(i).parents('li'); 334 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 335 }); 336 o.onInit.call(this); 337 338 }).each(function() { 339 var menuClasses = [c.menuClass]; 340 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 341 $(this).addClass(menuClasses.join(' ')); 342 }); 343 }; 344 345 var sf = $.fn.superfish; 346 sf.o = []; 347 sf.op = {}; 348 sf.IE7fix = function(){ 349 var o = sf.op; 350 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) 351 this.toggleClass(sf.c.shadowClass+'-off'); 352 }; 353 sf.c = { 354 bcClass: 'sf-breadcrumb', 355 menuClass: 'sf-js-enabled', 356 anchorClass: 'sf-with-ul', 357 arrowClass: 'sf-sub-indicator', 358 shadowClass: 'sf-shadow' 359 }; 360 sf.defaults = { 361 hoverClass: 'sfHover', 362 pathClass: 'overideThisToUse', 363 pathLevels: 1, 364 delay: 800, 365 animation: {opacity:'show'}, 366 speed: 'normal', 367 autoArrows: true, 368 dropShadows: true, 369 disableHI: false, // true disables hoverIntent detection 370 onInit: function(){}, // callback functions 371 onBeforeShow: function(){}, 372 onShow: function(){}, 373 onHide: function(){} 374 }; 375 $.fn.extend({ 376 hideSuperfishUl : function(){ 377 var o = sf.op, 378 not = (o.retainPath===true) ? o.$path : ''; 379 o.retainPath = false; 380 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 381 .find('>ul').addClass('sf-hidden'); 382 o.onHide.call($ul); 383 return this; 384 }, 385 showSuperfishUl : function(){ 386 var o = sf.op, 387 sh = sf.c.shadowClass+'-off', 388 $ul = this.addClass(o.hoverClass) 389 .find('>ul.sf-hidden').hide().removeClass('sf-hidden'); 390 sf.IE7fix.call($ul); 391 o.onBeforeShow.call($ul); 392 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 393 return this; 394 } 395 }); 396})(jQuery);; 397/* 398 * Supersubs v0.2b - jQuery plugin 399 * Copyright (c) 2008 Joel Birch 400 * 401 * Dual licensed under the MIT and GPL licenses: 402 * http://www.opensource.org/licenses/mit-license.php 403 * http://www.gnu.org/licenses/gpl.html 404 * 405 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of 406 * their longest list item children. If you use this, please expect bugs and report them 407 * to the jQuery Google Group with the word 'Superfish' in the subject line. 408 * 409 */ 410/* 411 * This is not the original jQuery Supersubs plugin. 412 * Please refer to the README for more information. 413 */ 414 415(function($){ // $ will refer to jQuery within this closure 416 $.fn.supersubs = function(options){ 417 var opts = $.extend({}, $.fn.supersubs.defaults, options); 418 // return original object to support chaining 419 return this.each(function() { 420 // cache selections 421 var $$ = $(this); 422 // support metadata 423 var o = $.meta ? $.extend({}, opts, $$.data()) : opts; 424 // get the font size of menu. 425 // .css('fontSize') returns various results cross-browser, so measure an em dash instead 426 var fontsize = $('<li id="menu-fontsize">—</li>').css({ 427 'padding' : 0, 428 'position' : 'absolute', 429 'top' : '-99999em', 430 'width' : 'auto' 431 }).appendTo($$).width(); //clientWidth is faster, but was incorrect here 432 // remove em dash 433 $('#menu-fontsize').remove(); 434 435 // Jump on level if it's a "NavBar" 436 if ($$.hasClass('sf-navbar')) { 437 $$ = $('li > ul', $$); 438 } 439 // cache all ul elements
440 $ULs = $$.find('ul:not(.sf-megamenu)'); 441 // loop through each ul in menu 442 $ULs.each(function(i) { 443 // cache this ul 444 var $ul = $ULs.eq(i); 445 // get all (li) children of this ul 446 var $LIs = $ul.children(); 447 // get all anchor grand-children 448 var $As = $LIs.children('a'); 449 // force content to one line and save current float property 450 var liFloat = $LIs.css('white-space','nowrap').css('float'); 451 // remove width restrictions and floats so elements remain vertically stacked 452 var emWidth = $ul.add($LIs).add($As).css({ 453 'float' : 'none', 454 'width' : 'auto' 455 }) 456 // this ul will now be shrink-wrapped to longest li due to position:absolute 457 // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer 458 .end().end()[0].clientWidth / fontsize; 459 // add more width to ensure lines don't turn over at certain sizes in various browsers 460 emWidth += o.extraWidth; 461 // restrict to at least minWidth and at most maxWidth 462 if (emWidth > o.maxWidth) { emWidth = o.maxWidth; } 463 else if (emWidth < o.minWidth) { emWidth = o.minWidth; } 464 emWidth += 'em'; 465 // set ul to width in ems 466 $ul.css('width',emWidth); 467 // restore li floats to avoid IE bugs 468 // set li width to full width of this ul 469 // revert white-space to normal 470 $LIs.css({ 471 'float' : liFloat, 472 'width' : '100%', 473 'white-space' : 'normal' 474 }) 475 // update offset position of descendant ul to reflect new width of parent 476 .each(function(){ 477 var $childUl = $('>ul',this); 478 var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right'; 479 $childUl.css(offsetDirection,emWidth); 480 }); 481 }); 482 }); 483 }; 484 // expose defaults 485 $.fn.supersubs.defaults = { 486 minWidth: 9, // requires em unit. 487 maxWidth: 25, // requires em unit. 488 extraWidth: 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values 489 }; 490})(jQuery); // plugin code ends; 491/** 492 * @file 493 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists. 494 */ 495 496(function ($) { 497 Drupal.behaviors.superfish = { 498 attach: function (context, settings) { 499 // Take a look at each list to apply Superfish to. 500 $.each(settings.superfish || {}, function(index, options) { 501 // Process all Superfish lists. 502 $('#superfish-' + options.id, context).once('superfish', function() { 503 var list = $(this); 504 505 // Check if we are to apply the Supersubs plug-in to it. 506 if (options.plugins || false) { 507 if (options.plugins.supersubs || false) { 508 list.supersubs(options.plugins.supersubs); 509 } 510 } 511 512 // Apply Superfish to the list. 513 list.superfish(options.sf); 514 515 // Check if we are to apply any other plug-in to it. 516 if (options.plugins || false) { 517 if (options.plugins.touchscreen || false) { 518 list.sftouchscreen(options.plugins.touchscreen); 519 } 520 if (options.plugins.smallscreen || false) { 521 list.sfsmallscreen(options.plugins.smallscreen); 522 } 523 if (options.plugins.supposition || false) { 524 list.supposition(); 525 } 526 if (options.plugins.bgiframe || false) { 527 list.find('ul').bgIframe({opacity:false}); 528 } 529 } 530 }); 531 }); 532 } 533 }; 534})(jQuery);; 535/*jslint bitwise: true, eqeqeq: true, immed: true, newcap: true, nomen: false, 536 onevar: false, plusplus: false, regexp: true, undef: true, white: true, indent: 2 537 browser: true */ 538 539/*global jQuery: true Drupal: true window: true ThemeBuilder: true */ 540 541(function ($) { 542 543 /** 544 * Override for the extlink module. 545 * 546 * ThemeBuilder requires the <a> and <span> tags for external links to have 547 * different classes, so they can be targeted separately. 548 */ 549 Drupal.extlink = Drupal.extlink || {}; 550 551 Drupal.behaviors.extlink = Drupal.behaviors.extlink || {}; 552 553 Drupal.behaviors.extlink.attach = function (context, settings) { 554 // Add "-link" to the end of the class name that's applied to both <a> and 555 // <span> tags. We will remove it later before applying it to <span> tags. 556 if (Drupal.settings.extlink && Drupal.settings.extlink.extClass) { 557 Drupal.settings.extlink.extClass = Drupal.settings.extlink.extClass + '-link'; 558 } 559 if ($.isFunction(Drupal.extlink.attach)) { 560 Drupal.extlink.attach(context, settings); 561 } 562 }; 563 564 /** 565 * Overrides method from the extlink module. 566 * 567 * Change the class name for the <span> that comes after external links, 568 * so that it's "ext", not "ext-link". 569 */ 570 Drupal.extlink.applyClassAndSpan = function (links, class_name) { 571 var $links_to_process; 572 if (parseFloat($().jquery) < 1.2) { 573 $links_to_process = $(links).not('[img]'); 574 } 575 else { 576 var links_with_images = $(links).find('img').parents('a'); 577 $links_to_process = $(links).not(links_with_images); 578 } 579 $links_to_process.addClass(class_name); 580 var i; 581 var length = $links_to_process.length; 582 // If we've added "-link" to the end of the class name, remove it for 583 // <span> tags. We want "-link" only at the end of the link class. 584 var span_class = class_name.replace(/-link$/, ''); 585 for (i = 0; i < length; i++) { 586 var $link = $($links_to_process[i]);
587 if ($link.css('display') === 'inline') { 588 $link.after('<span class=' + span_class + '></span>'); 589 } 590 } 591 }; 592 593 /** 594 * Stop the rotation in the Rotating Banner when the ThemeBuilder is open 595 */ 596 Drupal.behaviors.RotatingBannerInThemeBuilder = { 597 attach: function (context) { 598 if ($('body').hasClass('themebuilder')) { 599 $('.rb-slides').each(function () { 600 if ($(this).cycle) { 601 $(this).cycle('stop'); 602 } 603 }); 604 } 605 } 606 }; 607 608 /** 609 * Activate Superfish Pulldown menus 610 */ 611 Drupal.behaviors.GardensFeaturesPulldownMenus = { 612 attach: function (context, settings) { 613 Drupal.behaviors.GardensFeaturesPulldownMenus.settings = { 614 appearance: { 615 gutter: 10, 616 push: 2, 617 overlapOffset: 1.4545 618 } 619 }; 620 621 if (settings) { 622 $.extend(Drupal.behaviors.GardensFeaturesPulldownMenus.settings, settings); 623 } 624 625 if ($().superfish) { 626 $('.content > .menu', '#page .stack-navigation').once('pulldown', function () { 627 var ghi = Drupal.settings.gardens_hoverintent || {enabled: true, sensitivity: 2, interval: 300, timeout: 500}; 628 $(this).superfish({ 629 hoverClass: 'menu-dropdown-hover', 630 delay: 150, 631 dropShadows: false, 632 speed: 300, 633 autoArrows: true,
634 onBeforeShow: Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldown, 635 disableHI: !ghi.enabled, 636 HISensitivity: ghi.sensitivity, 637 HIInterval: ghi.interval, 638 HITimeout: ghi.timeout 639 }); 640 }).addClass('pulldown'); 641 } 642 } 643 }; 644 645 /** 646 * This function is run to adjust the placement of a pulldown. 647 * 648 * @param {DomElement} this 649 * The pulldown (ul) that is currently being shown. 650 */ 651 Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldown = function () { 652 $(this).css({display: 'block', visibility: 'hidden'}); 653 Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldownPlacement($(this)); 654 $(this).css({display: 'none', visibility: 'visible'}); 655 }; 656 657 /** 658 * Progressively increases the width of the pulldown by 33% until 659 * the height of each item is less than the line height 660 * 661 * @param {DomElement} pulldown 662 * The pulldown (ul) to be positioned 663 * @param {DomElement} item 664 * The anchor tag of an item in the list 665 * @param {int} lineHeight 666 * The line height of the item's anchor tag. This is passed in 667 * because it does not need to be calculated more than once 668 * @param {int} safety 669 * A counter to prevent recursive errors. The width of the pulldown 670 * will be adjusted at most 5 times currently. 671 */
672 Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldownWidth = function (pulldown, item, lineHeight, safety) { 673 var width = pulldown.width(); 674 var height = item.height(); 675 var wrapped = ((height - lineHeight) > 2) ? true : false; // Provide a little give with a 2 pixel fudge factor for IE7 676 if (wrapped && (safety < 5)) { 677 pulldown.animate({ 678 width: width * 1.2 679 }, 680 { 681 duration: 0, 682 queue: true, 683 complete: function () { 684 safety += 1; 685 Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldownWidth(pulldown, item, lineHeight, safety); 686 } 687 } 688 ); 689 } 690 }; 691 692 /** 693 * Moves a pulldown left or right, according to its alignment, after its 694 * parent's width has been adjusted 695 * 696 * @param {DomElement} pulldown 697 * The pulldown (ul) to be positioned 698 */ 699 Drupal.behaviors.GardensFeaturesPulldownMenus.adjustPulldownPlacement = function (element) { 700 var pulldown = {}; 701 pulldown.el = element; 702 var isRTL = ($('html').attr('dir') === 'rtl'); 703 704 // Wipe out any previous positioning 705 pulldown.el.removeAttr('style'); 706 707 // Get the depth of the sub menu 708 // 0 is first tier sub menu 709 // 1 is second tier sub menu, etc 710 var depth = pulldown.el.parentsUntil('.pulldown-processed').filter('.menu').length; 711 pulldown.parent = {}; 712 pulldown.parent.el = element.prev('a'); 713 pulldown.parent.css = {
714 lineHeight: Drupal.behaviors.GardensFeaturesPulldownMenus._stripPX(pulldown.parent.el.css('line-height')), 715 padding: { 716 top: Drupal.behaviors.GardensFeaturesPulldownMenus._stripPX(pulldown.parent.el.css('padding-top')) 717 }, 718 margin: { 719 top: Drupal.behaviors.GardensFeaturesPulldownMenus._stripPX(pulldown.parent.el.css('margin-top')) 720 } 721 }; 722 // Only consider pulldowns, not the main menu items 723 // Basic placement without edge detection 724 var root = {}; 725 root.el = pulldown.el.parents('.pulldown-processed li .menu'); 726 if (root.el && (root.el.length > 0)) { 727 pulldown.el.css({ 728 left: root.el.width() 729 }); 730 } 731 // Get the viewport and scroll information 732 var viewport = {}; 733 viewport.width = $(window).width(); // Width of the visible viewport 734 viewport.height = $(window).height(); // Height of the visible viewport 735 viewport.scroll = {}; 736 viewport.scroll.top = $(window).scrollTop(); 737 pulldown.pos = pulldown.el.position(); 738 // pushDir corresponds to the RTL setting 739 var pushDir = (isRTL) ? 'right' : 'left'; 740 // handDir corresponds to which edge of the screen the menus might collide with. It is the opposite 741 // of pushDir. 742 var hangDir = (pushDir === 'right') ? 'left' : 'right'; 743 // Move the pulldown back to its origin if we moved it because of edge correction previously
744 var prevCorrection = Drupal.behaviors.GardensFeaturesPulldownMenus._stripPX(pulldown.el.css(pushDir)); 745 if (prevCorrection < 0) { 746 pulldown.el.css[pushDir] = pulldown.pos[pushDir] = 0; 747 } 748 // Now check for edge collision 749 pulldown.offset = pulldown.el.offset(); 750 if (pulldown.offset) { 751 pulldown.width = pulldown.el.outerWidth(false); 752 pulldown.height = pulldown.el.outerHeight(false); 753 pulldown.edge = {}; 754 pulldown.edge.left = pulldown.offset.left; 755 pulldown.edge.right = pulldown.offset.left + pulldown.width; 756 pulldown.edge.bottom = pulldown.offset.top + pulldown.height; 757 pulldown.hang = {}; 758 pulldown.hang.left = pulldown.edge.left; 759 pulldown.hang.right = viewport.width - pulldown.edge.right; 760 pulldown.hang.bottom = (viewport.height + viewport.scroll.top) - pulldown.edge.bottom - Drupal.behaviors.GardensFeaturesPulldownMenus.settings.appearance.gutter; 761 pulldown.hang.bottomModified = 1; 762 pulldown.correction = {}; 763 pulldown.correction.left = pulldown.pos.left + pulldown.hang.right - Drupal.behaviors.Gardens
763FeaturesPulldownMenus.settings.appearance.gutter; 764 pulldown.correction.right = (depth > 0) ? 765 pulldown.hang.left + pulldown.width - Drupal.behaviors.GardensFeaturesPulldownMenus.settings.appearance.gutter : 766 pulldown.hang.left - Drupal.behaviors.GardensFeaturesPulldownMenus.settings.appearance.gutter; 767 768 // Move the pulldown back onto the screen 769 if (pulldown.hang[hangDir] <= 0) { 770 var leftVal = (pushDir === 'left') ? pulldown.correction.left : 'auto'; 771 var rightVal = (pushDir === 'right') ? pulldown.correction.right : 'auto'; 772 pulldown.el.css( 773 { 774 'left': leftVal, 775 'right': rightVal 776 } 777 ); 778 // Push the pulldown down half a line height if it is a sub-sub menu so that sub menu items aren't completely occluded. 779 if (depth > 0) { 780 var top = (((pulldown.parent.css.lineHeight) / Drupal.behaviors.GardensFeaturesPulldownMenus.settings.appearance.overlapOffset) + (pulldown.parent.css.padding.top) + (pulldown.parent.css.margin.top)); 781 pulldown.el.css('top', top); 782 pulldown.hang.bottomModified = pulldown.hang.bottom - top; 783 } 784 } 785 // Move the pulldown up if it hangs off the bottom 786 if (pulldown.hang.bottom <= 0 || pulldown.hang.bottomModified <= 0) { 787 pulldown.el.css('top', (pulldown.pos.top + pulldown.hang.bottom)); 788 } 789 } 790 }; 791 792 /** 793 * Utility function to remove 'px' from calculated values. The function assumes that 794 * that unit 'value' is pixels. 795 * 796 * @param {String} value 797 * The String containing the CSS value that includes px. 798 * @return {int} 799 * Value stripped of 'px' and casted as a number or NaN if 'px' is not found in the string. 800 */
801 Drupal.behaviors.GardensFeaturesPulldownMenus._stripPX = function (value) { 802 if (value) { 803 var index = value.indexOf('px'); 804 if (index === -1) { 805 return NaN; 806 } 807 else { 808 return Number(value.substring(0, index)); 809 } 810 } 811 else { 812 return NaN; 813 } 814 }; 815 816 /** 817 * Add a "Show/Hide disabled views" toggle link to the Views list on 818 * admin/structure/views, similar to the "Show/Hide row weights" link on 819 * tabledrag tables. 820 */ 821 Drupal.behaviors.GardensFeaturesViewsListFilter = { 822 attach: function (context, settings) { 823 $('body.page-admin-structure-views table.#ctools-export-ui-list-items').once('gardens-features-views-list-filter', function () { 824 var $table = $(this); 825 826 // Remove any prior links created (for when table gets replaced by AJAX) 827 $('.gardens-features-toggle-disabled-wrapper').remove(); 828 829 // Create the toggle link, initialized to reflect that all rows are 830 // currently shown. 831 var $link = $('<a href="#" class="gardens-features-toggle-disabled gardens-features-toggle-disabled-show"></a>') 832 .text(Drupal.t('Hide disabled views')) 833 .click(function () { 834 if ($(this).hasClass('gardens-features-toggle-disabled-show')) { 835 $(this).removeClass('gardens-features-toggle-disabled-show'); 836 $(this).addClass('gardens-features-toggle-disabled-hide'); 837 $('.ctools-export-ui-disabled', $table).hide(); 838 if ($('tbody tr', $table).length === $('.ctools-export-ui-disabled', $table).length) { 839 $('tbody', $table).prepend('<tr class="gardens-features-toggle-disabled-empty odd"><td colspan="5">' + Drupal.t('No enabled views found.') + '</td></tr>'); 840 } 841 $.cookie('Drupal.GardensFeaturesViewsListFilter.showDisabled', 0, {path: Drupal.settings.basePath, expires: 365}); 842 $(this).text(Drupal.t('Show disabled views')); 843 } 844 else { 845 $(this).removeClass('gardens-features-toggle-disabled-hide'); 846 $(this).addClass('gardens-features-toggle-disabled-show'); 847 $('.ctools-export-ui-disabled', $table).show(); 848 $('.gardens-features-toggle-disabled-empty', $table).remove(); 849 $.cookie('Drupal.GardensFeaturesViewsListFilter.showDisabled', 1, {path: Drupal.settings.basePath, expires: 365}); 850 $(this).text(Drupal.t('Hide disabled views')); 851 } 852 return false; 853 }); 854 855 // Add it before the table. 856 $table.before($link.wrap('<div class="gardens-features-toggle-disabled-wrapper"></div>').parent()); 857 858 // Unless there's a cookie for disabled views to be shown, "click" the 859 // link in order to hide them. 860 if ($.cookie('Drupal.GardensFeaturesViewsListFilter.showDisabled') !== '1') { 861 $link.click(); 862 } 863 864 // If the filter form is also active, remove the widget to filter by 865 // enabled/disabled status, to not conflict with the toggle link. 866 $('#ctools-export-ui-list-form .form-item-disabled').hide(); 867 }); 868 } 869 }; 870 871 /** 872 * Open all links to Drupal Gardens "Learn More" pages in a new window. 873 */
874 Drupal.behaviors.GardensFeaturesLearnMoreLinks = { 875 attach: function (context, settings) { 876 $('a[href^="http://www.drupalgardens.com/learnmore/"]', context).attr('target', '_blank'); 877 } 878 }; 879 880 881 /** 882 * Scroll to top of AJAX view on pager click. 883 */ 884 Drupal.behaviors.viewsAjaxScroll = { 885 attach: function (context, settings) { 886 if (typeof Drupal.settings.views !== 'undefined' && 887 typeof Drupal.settings.views.ajax_path !== 'undefined' && 888 typeof Drupal.behaviors.ViewsLoadMore === 'undefined') { 889 // make sure we have AJAX, but not load_more 890 $('.item-list .pager a').not('a.load-more').once('views-ajax-scroll').click(function () 891 { 892 var outer = $(this).parents('.view'); 893 if ($(outer).parents('.pane').length) { 894 // if there is surrounding pane, scroll to top of it 895 outer = $(outer).parents('.pane'); 896 } 897 else if ($(outer).parents('.block').length) { 898 // if there is surrounding block, scroll top top of it 899 outer = $(outer).parents('.block'); 900 } 901 var viewtop = outer.offset().top - $('#toolbar').outerHeight(); 902 $('html, body').animate({scrollTop: viewtop}, 'slow', 'linear'); 903 }); 904 } 905 } 906 }; 907 908 /** 909 * Add dialog behavior to /user links for anonymous users. 910 */ 911 Drupal.behaviors.gardensUserDialog = {}; 912 Drupal.behaviors.gardensUserDialog.attach = function (context, settings) { 913 var useCapture = settings.janrainCapture && settings.janrainCapture.enforce; 914 if (settings.gardensFeatures && settings.gardensFeatures.userIsAnonymous && settings.gardensFeatures.dialogUserEnabled && !useCapture) { 915 // Modify all /user links so that they appear in a popup dialog. 916 var links = $('a[href^="/user"]').once('user-dialog'); 917 var length = links.length; 918 if (links.length === 0) { 919 return; 920 } 921 var i, link, intab; 922 for (i = 0; i < length; i++) { 923 link = links[i]; 924 // Is the link in a tab (e.g. on the user login register or password pages) 925 intab = $(link).parents().filter('ul.tabs'); 926 // Only act on the following types of links: 927 // /user, /user/login, /user/register, /user/password 928 // Ignore links that were already set up correctly on the server side. 929 if (link.href.indexOf('nojs') === -1 && link.href.indexOf('ajax') === -1) { 930 if (link.href.match(/\/user$/)) { 931 if(intab.length == 0) { 932 link.href = '/user/login/ajax'; 933 } 934 else { 935 link.href = '/user/login/nojs'; 936 } 937 $(link).addClass('use-ajax use-dialog'); 938 } 939 else if (link.href.match(/\/user\/(login|register|password)$/)) { 940 if(intab.length == 0) { 941 link.href = link.href.replace(/\/user\/(login|register|password)/, '/user/$1/ajax'); 942 } 943 else { 944 link.href = link.href.replace(/\/user\/(login|register|password)/, '/user/$1/nojs'); 945 } 946 $(link).addClass('use-ajax use-dialog'); 947 } 948 } 949 } 950 // The AJAX and dialog behaviors have already run; rerun them to pick up 951 // newly ajaxified links. 952 Drupal.behaviors.AJAX.attach(context, settings); 953 Drupal.behaviors.dialog.attach(context, settings); 954 } 955 }; 956 957 // Disable the lazyloader: http://drupal.org/node/665128#comment-5301192 958 if (typeof(Drupal.ajax) !== 'undefined') { 959 Drupal.ajax.prototype.commands.xlazyloader = function () {}; 960 } 961}(jQuery)); 962;
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.