PageSourceSearch

https://www.energyfm.net/js/flexnav/js/jquery.flexnav.js

js energyfm.net collected 2026-10-02 07:03:13 UTC 5,597 bytes, 142 lines download raw bytes

1/*
2	FlexNav.js 1.3.3
3
4	Created by Jason Weaver http://jasonweaver.name
5	Released under http://unlicense.org/
6
7//
8*/
9
10
11(function() {
12  var $;
13
14  $ = jQuery;
15
16  $.fn.flexNav = function(options) {
17    var $nav, $top_nav_items, breakpoint, count, nav_percent, nav_width, resetMenu, resizer, settings, showMenu, toggle_selector, touch_selector;
18    settings = $.extend({
19      'animationSpeed': 250,
20      'transitionOpacity': true,
21      'buttonSelector': '.menu-button',
22      'hoverIntent': false,
23      'hoverIntentTimeout': 150,
24      'calcItemWidths': false,
25      'hover': true
26    }, options);
27    $nav = $(this);
28    $nav.addClass('with-js');
29    if (settings.transitionOpacity === true) {
30      $nav.addClass('opacity');
31    }
32    $nav.find("li").each(function() {
33      if ($(this).has("ul").length) {
34        return $(this).addClass("item-with-ul").find("ul").hide();
35      }
36    });
37    if (settings.calcItemWidths === true) {
38      $top_nav_items = $nav.find('>li');
39      count = $top_nav_items.length;
40      nav_width = 100 / count;
41      nav_percent = nav_width + "%";
42    }
43    if ($nav.data('breakpoint')) {
44      breakpoint = $nav.data('breakpoint');
45    }
46    showMenu = function() {
47      if ($nav.hasClass('lg-screen') === true && settings.hover === true) {
48        if (settings.transitionOpacity === true) {
49          return $(this).find('>ul').addClass('flexnav-show').stop(true, true).animate({
50            height: ["toggle", "swing"],
51            opacity: "toggle"
52          }, settings.animationSpeed);
53        } else {
54          return $(this).find('>ul').addClass('flexnav-show').stop(true, true).animate({
55            height: ["toggle", "swing"]
56          }, settings.animationSpeed);
57        }
58      }
59    };
60    resetMenu = function() {
61      if ($nav.hasClass('lg-screen') === true && $(this).find('>ul').hasClass('flexnav-show') === true && settings.hover === true) {
62        if (settings.transitionOpacity === true) {
63          return $(this).find('>ul').removeClass('flexnav-show').stop(true, true).animate({
64            height: ["toggle", "swing"],
65            opacity: "toggle"
66          }, settings.animationSpeed);
67        } else {
68          return $(this).find('>ul').removeClass('flexnav-show').stop(true, true).animate({
69            height: ["toggle", "swing"]
70          }, settings.animationSpeed);
71        }
72      }
73    };
74    resizer = function() {
75      var selector;
76      if ($(window).width() <= breakpoint) {
77        $nav.removeClass("lg-screen").addClass("sm-screen");
78        if (settings.calcItemWidths === true) {
79          $top_nav_items.css('width', '100%');
80        }
81        selector = settings['buttonSelector'] + ', ' + settings['buttonSelector'] + ' .touch-button';
82        $(selector).removeClass('active');
83        return $('.one-page li a').on('click', function() {
84          return $nav.removeClass('flexnav-show');
85        });
86      } else if ($(window).width() > breakpoint) {
87        $nav.removeClass("sm-screen").addClass("lg-screen");
88        if (settings.calcItemWidths === true) {
89          $top_nav_items.css('width', nav_percent);
90        }
91        $nav.removeClass('flexnav-show').find('.item-with-ul').on();
92        $('.item-with-ul').find('ul').removeClass('flexnav-show');
93        resetMenu();
94        if (settings.hoverIntent === true) {
95          return $('.item-with-ul').hoverIntent({
96            over: showMenu,
97            out: resetMenu,
98            timeout: settings.hoverIntentTimeout
99          });
100        } else if (settings.hoverIntent === false) {
101          return $('.item-with-ul').on('mouseenter', showMenu).on('mouseleave', resetMenu);
102        }
103      }
104    };
105    $(settings['buttonSelector']).data('navEl', $nav);
106    touch_selector = '.item-with-ul, ' + settings['buttonSelector'];
107    $(touch_selector).append('<span class="touch-button"><span class="navicon"></span></span>');
108    toggle_selector = settings['buttonSelector'] + ', ' + settings['buttonSelector'] + ' .touch-button';
109    $(toggle_selector).on('click', function(e) {
110      var $btnParent, $thisNav, bs;
111      $(toggle_selector).toggleClass('active');
112      e.preventDefault();
113      e.stopPropagation();
114      bs = settings['buttonSelector'];
115      $btnParent = $(this).is(bs) ? $(this) : $(this).parent(bs);
116      $thisNav = $btnParent.data('navEl');
117      return $thisNav.toggleClass('flexnav-show');
118    });
119    $('.touch-button').on('click', function(e) {
120      var $sub, $touchButton;
121      $sub = $(this).parent('.item-with-ul').find('>ul');
122      $touchButton = $(this).parent('.item-with-ul').find('>span.touch-button');
123      if ($nav.hasClass('lg-screen') === true) {
124        $(this).parent('.item-with-ul').siblings().find('ul.flexnav-show').removeClass('flexnav-show').hide();
125      }
126      if ($sub.hasClass('flexnav-show') === true) {
127        $sub.removeClass('flexnav-show').slideUp(settings.animationSpeed);
128        return $touchButton.removeClass('active');
129      } else if ($sub.hasClass('flexnav-show') === false) {
130        $sub.addClass('flexnav-show').slideDown(settings.animationSpeed);
131        return $touchButton.addClass('active');
132      }
133    });
134    $nav.find('.item-with-ul *').focus(function() {
135      $(this).parent('.item-with-ul').parent().find(".open").not(this).removeClass("open").hide();
136      return $(this).parent('.item-with-ul').find('>ul').addClass("open").show();
137    });
138    resizer();
139    return $(window).on('resize', resizer);
140  };
141
142}).call(this);

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.