PageSourceSearch

https://areeo.ac.ir/assets/798f24e2/js/bootstrap-hover-dropdown.js?v=1789198971

js areeo.ac.ir collected 2026-10-02 03:37:04 UTC 4,698 bytes, 116 lines download raw bytes

vendor: 4,698 bytes, lines 1-116
1;(function ($, window, undefined) {
2    var $allDropdowns = $();
3
4    $.fn.dropdownHover = function (options) {
5        // don't do anything if touch is supported
6        // (plugin causes some issues on mobile)
7        if('ontouchstart' in document) return this; // don't want to affect chaining
8
9        // the element we really care about
10        // is the dropdown-toggle's parent
11        $allDropdowns = $allDropdowns.add(this.parent());
12
13        return this.each(function () {
14            var $this = $(this),
15                $parent = $this.parent(),
16                defaults = {
17                    delay: 500,
18                    hoverDelay: 0,
19                    instantlyCloseOthers: true
20                },
21                data = {
22                    delay: $(this).data('delay'),
23                    hoverDelay: $(this).data('hover-delay'),
24                    instantlyCloseOthers: $(this).data('close-others')
25                },
26                showEvent   = 'show.bs.dropdown',
27                hideEvent   = 'hide.bs.dropdown',
28                // shownEvent  = 'shown.bs.dropdown',
29                // hiddenEvent = 'hidden.bs.dropdown',
30                settings = $.extend(true, {}, defaults, options, data),
31                timeout, timeoutHover;
32
33            $parent.hover(function (event) {
34                // so a neighbor can't open the dropdown
35                if(!$parent.hasClass('open') && !$this.is(event.target)) {
36                    // stop this event, stop executing any code
37                    // in this callback but continue to propagate
38                    return true;
39                }
40
41                openDropdown(event);
42            }, function () {
43                // clear timer for hover event
44                window.clearTimeout(timeoutHover);
45                timeout = window.setTimeout(function () {
46                    $this.attr('aria-expanded', 'false');
47                    $parent.removeClass('open');
48                    $this.trigger(hideEvent);
49                }, settings.delay);
50            });
51
52            // this helps with button groups!
53            $this.hover(function (event) {
54                // this helps prevent a double event from firing.
55                // see https://github.com/CWSpear/bootstrap-hover-dropdown/issues/55
56                if(!$parent.hasClass('open') && !$parent.is(event.target)) {
57                    // stop this event, stop executing any code
58                    // in this callback but continue to propagate
59                    return true;
60                }
61
62                openDropdown(event);
63            });
64
65            // handle submenus
66            $parent.find('.dropdown-submenu').each(function (){
67                var $this = $(this);
68                var subTimeout;
69                $this.hover(function () {
70                    window.clearTimeout(subTimeout);
71                    $this.children('.dropdown-menu').show();
72                    // always close submenu siblings instantly
73                    $this.siblings().children('.dropdown-menu').hide();
74                }, function () {
75                    var $submenu = $this.children('.dropdown-menu');
76                    subTimeout = window.setTimeout(function () {
77                        $submenu.hide();
78                    }, settings.delay);
79                });
80            });
81
82            function openDropdown(event) {
83                // clear dropdown timeout here so it doesnt close before it should
84                window.clearTimeout(timeout);
85                // restart hover timer
86                window.clearTimeout(timeoutHover);
87
88                // delay for hover event.
89                timeoutHover = window.setTimeout(function () {
90                    $allDropdowns.find(':focus').blur();
91
92                    if(settings.instantlyCloseOthers === true)
93                        $allDropdowns.removeClass('open');
94
95                    // clear timer for hover event
96                    window.clearTimeout(timeoutHover);
97                    $this.attr('aria-expanded', 'true');
98                    $parent.addClass('open');
99                    $this.trigger(showEvent);
100                }, settings.hoverDelay);
101            }
102        });
103    };
104    $(document).ready(function () {
105        if($(window).width()>769){
106            // make every link on the dropdown menu clickable
107            $('.navbar .dropdown > a').click(function(){
108                location.href = this.href;
109            });
110        }
111    });
112    $(document).ready(function () {
113        // apply dropdownHover to all elements with the data-hover="dropdown" attribute
114        $('[data-toggle="dropdown"]').dropdownHover();
115    });
116})(jQuery, window);

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.