PageSourceSearch

https://www.aspca.org/sites/default/files/js/js_0nk1IYkHuUCDy3nmsKsIald8VjyQB5h_DWULbTOoiPk.js

js aspca.org collected 2026-10-01 08:32:26 UTC 18,552 bytes, 472 lines download raw bytes

1/**
2 * @file
3 * Attaches behaviors for the Chosen module.
4 */
5
6(function($) {
7  Drupal.behaviors.chosen = {
8    attach: function(context, settings) {
9      settings.chosen = settings.chosen || Drupal.settings.chosen;
10
11      // Prepare selector and add unwantend selectors.
12      var selector = settings.chosen.selector;
13
14      // Function to prepare all the options together for the chosen() call.
15      var getElementOptions = function (element) {
16        var options = $.extend({}, settings.chosen.options);
17
18        // The width default option is considered the minimum width, so this
19        // must be evaluated for every option.
20        if (settings.chosen.minimum_width > 0) {
21          if ($(element).width() < settings.chosen.minimum_width) {
22            options.width = settings.chosen.minimum_width + 'px';
23          }
24          else {
25            options.width = $(element).width() + 'px';
26          }
27        }
28
29        // Some field widgets have cardinality, so we must respect that.
30        // @see chosen_pre_render_select()
31        if ($(element).attr('multiple') && $(element).data('cardinality')) {
32          options.max_selected_options = $(element).data('cardinality');
33        }
34
35        return options;
36      };
37
38      // Process elements that have opted-in for Chosen.
39      // @todo Remove support for the deprecated chosen-widget class.
40      $('select.chosen-enable, select.chosen-widget', context).once('chosen', function() {
41        options = getElementOptions(this);
42        $(this).chosen(options);
43      });
44
45      $(selector, context)
46        // Disabled on:
47        // - Field UI
48        // - WYSIWYG elements
49        // - Tabledrag weights
50        // - Elements that have opted-out of Chosen
51        // - Elements already processed by Chosen.
52        .not('#field-ui-field-overview-form select, #field-ui-display-overview-form select, .wysiwyg, .draggable select[name$="[weight]"], .draggable select[name$="[position]"], .chosen-disable, .chosen-processed')
53        .filter(function() {
54          // Filter out select widgets that do not meet the minimum number of
55          // options.
56          var minOptions = $(this).attr('multiple') ? settings.chosen.minimum_multiple : settings.chosen.minimum_single;
57          if (!minOptions) {
58            // Zero value means no minimum.
59            return true;
60          }
61          else {
62            return $(this).find('option').length >= minOptions;
63          }
64        })
65        .once('chosen', function() {
66          options = getElementOptions(this);
67          $(this).chosen(options);
68        });
69    }
70  };
71})(jQuery);
72;
73/**
74* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
75* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
76* 
77* @param  f  onMouseOver function || An object with configuration options
78* @param  g  onMouseOut function  || Nothing (use configuration options object)
79* @author    Brian Cherne brian(at)cherne(dot)net
80*/
81(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);;
82/*
83 * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget.
84 *
85 * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him.
86 * Special thanks to Karl Swedberg for valuable input.
87 *
88 * Dual licensed under the MIT and GPL licenses:
89 *  http://www.opensource.org/licenses/mit-license.php
90 *  http://www.gnu.org/licenses/gpl.html
91 */
92/*
93 * This is not the original jQuery Supposition plugin.
94 * Please refer to the README for more information.
95 */
96
97(function($){
98  $.fn.supposition = function(){
99    var $w = $(window), /*do this once instead of every onBeforeShow call*/
100    _offset = function(dir) {
101      return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
102      || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft']
103      || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft'];
104    },
105    onHide = function(){
106      this.css({bottom:''});
107    },
108    onBeforeShow = function(){
109      this.each(function(){
110        var $u = $(this);
111        $u.css('display','block');
112        var $mul = $u.closest('.sf-menu'),
113        level = $u.parents('ul').length,
114        menuWidth = $u.width(),
115        menuParentWidth = $u.closest('li').outerWidth(true),
116        menuParentLeft = $u.closest('li').offset().left,
117        totalRight = $w.width() + _offset('x'),
118        menuRight = $u.offset().left + menuWidth,
119        exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth;
120        if ($u.parents('.sf-js-enabled').hasClass('rtl')) {
121          if (menuParentLeft < exactMenuWidth) {
122            if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){
123              $u.css({left:0,right:'auto'});
124            }
125            else {
126              $u.css({left:menuParentWidth + 'px',right:'auto'});
127            }
128          }
129        }
130        else {
131          if (menuRight > totalRight && menuParentLeft > menuWidth) {
132            if (($mul.hasClass('sf-horizontal') && level == 1) || ($mul.hasClass('sf-navbar') && level == 2)){
133              $u.css({right:0,left:'auto'});
134            }
135            else {
136              $u.css({right:menuParentWidth + 'px',left:'auto'});
137            }
138          }
139        }
140        var windowHeight = $w.height(),
141        offsetTop = $u.offset().top,
142        menuParentShadow = ($mul.hasClass('sf-shadow') && $u.css('padding-bottom').length > 0) ? parseInt($u.css('padding-bottom').slice(0,-2)) : 0,
143        menuParentHeight = ($mul.hasClass('sf-vertical')) ? '-' + menuParentShadow : $u.parent().outerHeight(true) - menuParentShadow,
144        menuHeight = $u.height(),
145        baseline = windowHeight + _offset('y');
146        var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight));
147        if (expandUp) {
148          $u.css({bottom:menuParentHeight + 'px',top:'auto'});
149        }
150        $u.css('display','none');
151      });
152    };
153
154    return this.each(function() {
155      var o = $.fn.superfish.o[this.serial]; /* get this menu's options */
156
157      /* if callbacks already set, store them */
158      var _onBeforeShow = o.onBeforeShow,
159      _onHide = o.onHide;
160
161      $.extend($.fn.superfish.o[this.serial],{
162        onBeforeShow: function() {
163          onBeforeShow.call(this); /* fire our Supposition callback */
164          _onBeforeShow.call(this); /* fire stored callbacks */
165        },
166        onHide: function() {
167          onHide.call(this); /* fire our Supposition callback */
168          _onHide.call(this); /* fire stored callbacks */
169        }
170      });
171    });
172  };
173})(jQuery);;
174/*
175 * Superfish v1.4.8 - jQuery menu widget
176 * Copyright (c) 2008 Joel Birch
177 *
178 * Dual licensed under the MIT and GPL licenses:
179 *  http://www.opensource.org/licenses/mit-license.php
180 *  http://www.gnu.org/licenses/gpl.html
181 *
182 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
183 */
184/*
185 * This is not the original jQuery Superfish plugin.
186 * Please refer to the README for more information.
187 */
188
189(function($){
190  $.fn.superfish = function(op){
191    var sf = $.fn.superfish,
192      c = sf.c,
193      $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
194      over = function(){
195        var $$ = $(this), menu = getMenu($$);
196        clearTimeout(menu.sfTimer);
197        $$.showSuperfishUl().siblings().hideSuperfishUl();
198      },
199      out = function(){
200        var $$ = $(this), menu = getMenu($$), o = sf.op;
201        clearTimeout(menu.sfTimer);
202        menu.sfTimer=setTimeout(function(){
203          if ($$.children('.sf-clicked').length == 0){
204            o.retainPath=($.inArray($$[0],o.$path)>-1);
205            $$.hideSuperfishUl();
206            if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
207          }
208        },o.delay);
209      },
210      getMenu = function($menu){
211        var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
212        sf.op = sf.o[menu.serial];
213        return menu;
214      },
215      addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
216
217    return this.each(function() {
218      var s = this.serial = sf.o.length;
219      var o = $.extend({},sf.defaults,op);
220      o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels),
221      p = o.$path;
222      for (var l = 0; l < p.length; l++){
223        p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);
224      }
225      sf.o[s] = sf.op = o;
226
227      $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
228        if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') );
229      })
230      .not('.'+c.bcClass)
231        .hideSuperfishUl();
232
233      var $a = $('a, span.nolink',this);
234      $a.each(function(i){
235        var $li = $a.eq(i).parents('li');
236        $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
237      });
238      o.onInit.call(this);
239
240    }).each(function() {
241      var menuClasses = [c.menuClass],
242      addShadow = true;
243      if ($.browser !== undefined){
244        if ($.browser.msie && $.browser.version < 7){
245          addShadow = false;
246        }
247      }
248      if (sf.op.dropShadows && addShadow){
249        menuClasses.push(c.shadowClass);
250      }
251      $(this).addClass(menuClasses.join(' '));
252    });
253  };
254
255  var sf = $.fn.superfish;
256  sf.o = [];
257  sf.op = {};
258  sf.IE7fix = function(){
259    var o = sf.op;
260    if ($.browser !== undefined){
261      if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) {
262        this.toggleClass(sf.c.shadowClass+'-off');
263      }
264    }
265  };
266  sf.c = {
267    bcClass: 'sf-breadcrumb',
268    menuClass: 'sf-js-enabled',
269    anchorClass: 'sf-with-ul',
270    arrowClass: 'sf-sub-indicator',
271    shadowClass: 'sf-shadow'
272  };
273  sf.defaults = {
274    hoverClass: 'sfHover',
275    pathClass: 'overideThisToUse',
276    pathLevels: 1,
277    delay: 800,
278    animation: {opacity:'show'},
279    speed: 'fast',
280    autoArrows: true,
281    dropShadows: true,
282    disableHI: false, // true disables hoverIntent detection
283    onInit: function(){}, // callback functions
284    onBeforeShow: function(){},
285    onShow: function(){},
286    onHide: function(){}
287  };
288  $.fn.extend({
289    hideSuperfishUl : function(){
290      var o = sf.op,
291        not = (o.retainPath===true) ? o.$path : '';
292      o.retainPath = false;
293      var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
294          .children('ul').addClass('sf-hidden');
295      o.onHide.call($ul);
296      return this;
297    },
298    showSuperfishUl : function(){
299      var o = sf.op,
300        sh = sf.c.shadowClass+'-off',
301        $ul = this.addClass(o.hoverClass)
302          .children('ul.sf-hidden').hide().removeClass('sf-hidden');
303      sf.IE7fix.call($ul);
304      o.onBeforeShow.call($ul);
305      $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
306      return this;
307    }
308  });
309})(jQuery);;
310/*
311 * Supersubs v0.4b - jQuery plugin
312 * Copyright (c) 2013 Joel Birch
313 *
314 * Dual licensed under the MIT and GPL licenses:
315 *  http://www.opensource.org/licenses/mit-license.php
316 *  http://www.gnu.org/licenses/gpl.html
317 *
318 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
319 * their longest list item children. If you use this, please expect bugs and report them
320 * to the jQuery Google Group with the word 'Superfish' in the subject line.
321 *
322 */
323/*
324 * This is not the original jQuery Supersubs plugin.
325 * Please refer to the README for more information.
326 */
327
328(function($){ // $ will refer to jQuery within this closure
329  $.fn.supersubs = function(options){
330    var opts = $.extend({}, $.fn.supersubs.defaults, options);
331    // return original object to support chaining
332    // Although this is unnecessary due to the way the module uses these plugins.
333    for (var a = 0; a < this.length; a++) {
334      // cache selections
335      var $$ = $(this).eq(a),
336      // support metadata
337      o = $.meta ? $.extend({}, opts, $$.data()) : opts;
338      // Jump one level if it's a "NavBar"
339      if ($$.hasClass('sf-navbar')) {
340        $$ = $$.children('li').children('ul');
341      }
342      // cache all ul elements
343      var $ULs = $$.find('ul'),
344      // get the font size of menu.
345      // .css('fontSize') returns various results cross-browser, so measure an em dash instead
346      fontsize = $('<li id="menu-fontsize">&#8212;</li>'),
347      size = fontsize.attr('style','padding:0;position:absolute;top:-99999em;width:auto;')
348      .appendTo($$)[0].clientWidth; //clientWidth is faster than width()
349      // remove em dash
350      fontsize.remove();
351
352      // loop through each ul in menu
353      for (var b = 0; b < $ULs.length; b++) {
354        var
355        // cache this ul
356        $ul = $ULs.eq(b);
357        // If a multi-column sub-menu, and only if correctly configured.
358        if (o.megamenu && $ul.hasClass('sf-megamenu') && $ul.find('.sf-megamenu-column').length > 0){
359          // Look through each column.
360          var $column = $ul.find('div.sf-megamenu-column > ol'),
361          // Overall width.
362          mwWidth = 0;
363          for (var d = 0; d < $column.length; d++){
364            resize($column.eq(d));
365            // New column width, in pixels.
366            var colWidth = $column.width();
367            // Just a trick to convert em unit to px.
368            $column.css({width:colWidth})
369            // Making column parents the same size.
370            .parents('.sf-megamenu-column').css({width:colWidth});
371            // Overall width.
372            mwWidth += parseInt(colWidth);
373          }
374          // Resizing the columns container too.
375          $ul.add($ul.find('li.sf-megamenu-wrapper, li.sf-megamenu-wrapper > ol')).css({width:mwWidth});
376        }
377        else {
378          resize($ul);
379        }
380      }
381    }
382    function resize($ul){
383      var
384      // get all (li) children of this ul
385      $LIs = $ul.children(),
386      // get all anchor grand-children
387      $As = $LIs.children('a');
388      // force content to one line and save current float property
389      $LIs.css('white-space','nowrap');
390      // remove width restrictions and floats so elements remain vertically stacked
391      $ul.add($LIs).add($As).css({float:'none',width:'auto'});
392      // this ul will now be shrink-wrapped to longest li due to position:absolute
393      // so save its width as ems.
394      var emWidth = $ul.get(0).clientWidth / size;
395      // add more width to ensure lines don't turn over at certain sizes in various browsers
396      emWidth += o.extraWidth;
397      // restrict to at least minWidth and at most maxWidth
398      if (emWidth > o.maxWidth) {emWidth = o.maxWidth;}
399      else if (emWidth < o.minWidth) {emWidth = o.minWidth;}
400      emWidth += 'em';
401      // set ul to width in ems
402      $ul.css({width:emWidth});
403      // restore li floats to avoid IE bugs
404      // set li width to full width of this ul
405      // revert white-space to normal
406      $LIs.add($As).css({float:'',width:'',whiteSpace:''});
407      // update offset position of descendant ul to reflect new width of parent.
408      // set it to 100% in case it isn't already set to this in the CSS
409      for (var c = 0; c < $LIs.length; c++) {
410        var $childUl = $LIs.eq(c).children('ul');
411        var offsetDirection = $childUl.css('left') !== undefined ? 'left' : 'right';
412        $childUl.css(offsetDirection,'100%');
413      }
414    }
415    return this;
416  };
417  // expose defaults
418  $.fn.supersubs.defaults = {
419    megamenu: true, // define width for multi-column sub-menus and their columns.
420    minWidth: 12, // requires em unit.
421    maxWidth: 27, // requires em unit.
422    extraWidth: 1 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
423  };
424})(jQuery); // plugin code ends
425;
426/**
427 * @file
428 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists.
429 */
430
431(function ($) {
432  Drupal.behaviors.superfish = {
433    attach: function (context, settings) {
434      // Take a look at each list to apply Superfish to.
435      $.each(settings.superfish || {}, function(index, options) {
436        // Process all Superfish lists.
437        $('#superfish-' + options.id, context).once('superfish', function() {
438          var list = $(this);
439
440          // Check if we are to apply the Supersubs plug-in to it.
441          if (options.plugins || false) {
442            if (options.plugins.supersubs || false) {
443              list.supersubs(options.plugins.supersubs);
444            }
445          }
446
447          // Apply Superfish to the list.
448          list.superfish(options.sf);
449
450          // Check if we are to apply any other plug-in to it.
451          if (options.plugins || false) {
452            if (options.plugins.touchscreen || false) {
453              list.sftouchscreen(options.plugins.touchscreen);
454            }
455            if (options.plugins.smallscreen || false) {
456              list.sfsmallscreen(options.plugins.smallscreen);
457            }
458            if (options.plugins.automaticwidth || false) {
459              list.sfautomaticwidth();
460            }
461            if (options.plugins.supposition || false) {
462              list.supposition();
463            }
464            if (options.plugins.bgiframe || false) {
465              list.find('ul').bgIframe({opacity:false});
466            }
467          }
468        });
469      });
470    }
471  };
472})(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.