PageSourceSearch

https://www.ignet.gov/sites/all/libraries/superfish/supposition.js?tbqtfq

js ignet.gov collected 2026-10-02 05:29:43 UTC 3,290 bytes, 83 lines download raw bytes

1/*
2 * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget.
3 *
4 * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him.
5 * Special thanks to Karl Swedberg for valuable input.
6 *
7 * Dual licensed under the MIT and GPL licenses:
8 *  http://www.opensource.org/licenses/mit-license.php
9 *  http://www.gnu.org/licenses/gpl.html
10 */
11/*
12 * This is not the original jQuery Supersubs plugin.
13 * Please refer to the README for more information.
14 */
15
16(function($){
17  $.fn.supposition = function(){
18    var $w = $(window), /*do this once instead of every onBeforeShow call*/
19    _offset = function(dir) {
20      return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
21      || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft']
22      || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft'];
23    },
24    onHide = function(){
25      this.css({bottom:''});
26    },
27    onBeforeShow = function(){
28      this.each(function(){
29        var $u = $(this);
30        $u.css('display','block');
31        var menuWidth = $u.width(),
32        menuParentWidth = $u.closest('li').outerWidth(true),
33        menuParentLeft = $u.closest('li').offset().left,
34        totalRight = $w.width() + _offset('x'),
35        menuRight = $u.offset().left + menuWidth,
36        exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth;  
37        if ($u.parents('.sf-js-enabled').hasClass('rtl')) {
38          if (menuParentLeft < exactMenuWidth) {
39            $u.css('left', menuParentWidth + 'px');
40            $u.css('right', 'auto');
41          }
42        }
43        else {
44          if (menuRight > totalRight && menuParentLeft > menuWidth) {
45            $u.css('right', menuParentWidth + 'px');
46            $u.css('left', 'auto');
47          }
48        }
49        var windowHeight = $w.height(),
50        offsetTop = $u.offset().top,
51        menuParentShadow = ($u.closest('.sf-menu').hasClass('sf-shadow') && $u.css('padding-bottom').length > 0) ? parseInt($u.css('padding-bottom').slice(0,-2)) : 0,
52        menuParentHeight = ($u.closest('.sf-menu').hasClass('sf-vertical')) ? '-' + menuParentShadow : $u.parent().outerHeight(true) - menuParentShadow,
53        menuHeight = $u.height(),
54        baseline = windowHeight + _offset('y');
55        var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight));
56        if (expandUp) {
57          $u.css('bottom', menuParentHeight + 'px');
58          $u.css('top', 'auto');
59        }
60        $u.css('display','none');
61      });
62    };
63
64    return this.each(function() {
65      var o = $.fn.superfish.o[this.serial]; /* get this menu's options */
66
67      /* if callbacks already set, store them */
68      var _onBeforeShow = o.onBeforeShow,
69      _onHide = o.onHide;
70
71      $.extend($.fn.superfish.o[this.serial],{
72        onBeforeShow: function() {
73          onBeforeShow.call(this); /* fire our Supposition callback */
74          _onBeforeShow.call(this); /* fire stored callbacks */
75        },
76        onHide: function() {
77          onHide.call(this); /* fire our Supposition callback */
78          _onHide.call(this); /* fire stored callbacks */
79        }
80      });
81    });
82  };
83})(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.