PageSourceSearch

https://www.myparkingsign.com/js/ui-ss-menu-2.0.js?v=2026-38

js myparkingsign.com collected 2026-09-24 23:06:44 UTC 14,091 bytes, 331 lines download raw bytes

1//for hover set time out
2(function($) {
3    'use strict';
4    var oldHover = $.fn.hover,
5        newHover = function(handlerIn, handlerOut, delay) {
6            return this.each(function() {
7                var timeout, handler = function(el, fn, e) {
8                    if (timeout) {
9                        timeout = window.clearTimeout(timeout);
10                    } else {
11                        timeout = window.setTimeout(function() {
12                            timeout = undefined;
13                            fn.call(el, e);
14                        }, delay);
15                    }
16                };
17                $(this).on('mouseenter mouseleave', function(e) {
18                    handler(this, e.type === 'mouseenter' ? handlerIn : handlerOut, e);
19                });
20            });
21        };
22    $.fn.hover = function(
23        /* arguments */
24    ) {
25        var args = Array.prototype.slice.call(arguments);
26        if (args.length === 3 && typeof args[2] === 'number') {
27            return newHover.apply(this, args);
28        } else if (args.length === 2 && typeof args[1] === 'number') {
29            return newHover.call(this, args[0], args[0], args[1]);
30        }
31        return oldHover.apply(this, args);
32    };
33})(window.jQuery);
34
35
36
37//for menu hover 
38$(function() {
39    $('.menu > li').hover(function() {
40        clearTimeout($.data(this, 'timer'));
41        if ($(this).children("ul").length > 0) {
42            $(this).addClass("selected");
43            $(this).find('>.MMClick').attr('aria-expanded', 'true');
44            $(this).find('.mega_menu').attr('aria-hidden', 'true');
45            if ($("ul.menu").outerWidth() - $("ul.menu > li.selected").position().left < $("ul.menu > li.selected ul.mega_menu").outerWidth()) {
46                if ($(this).parents("ul").hasClass("hasResponsive-menu")) {
47                    var rightPostion = ($("ul.menu").outerWidth() - $("ul.menu > li.selected").position().left) - $("ul.menu > li.selected ul.mega_menu").outerWidth();
48                    $("ul.mega_menu").css({
49                        "left": rightPostion
50                    });
51                }
52
53            } else {
54                $("ul.mega_menu").css({
55                    "left": 0
56                });
57            }
58
59        }
60        $('> ul', this).stop(true, true).slideDown(300);
61    }, function() {
62        $(this).find("> ul").slideUp(0);
63        $(this).removeClass("selected");
64        $(this).find('>.MMClick').attr('aria-expanded', 'false');
65        $(this).find('.mega_menu').attr('aria-hidden', 'false');
66        $(this).find("> ul").css({
67            'display': 'none'
68        });
69    }, 250);
70    //$('.menu.menu-has-arrow > li > a').each(function() {
71    //    if ($(this).parent('li').children('ul').length > 0) {
72    //        $(this).addClass("menu-arrow");
73    //    }
74    //});
75});
76$(document).ready(function() {
77    //for tabindex and arrow key
78    $('.menu').setup_navigation();
79    //for hover and focus menu image change
80    $('.mega_menu ul li a[data-image]').each(function(idx, ele) {
81        $(ele).hover(function() {
82            var ImgPath = $(this).data("image");
83            var ImgLink = $(this).attr('href');
84            var Imgtitle = $(this).attr('title');
85            if (ImgPath !== "") {
86                $(this).parents('li').find(".dd-show-img").attr("src", ImgPath).parent('a').attr("href", ImgLink).attr("title", Imgtitle);
87            }
88        });
89        $(ele).focus(function() {
90            var ImgPath = $(this).data("image");
91            var ImgLink = $(this).attr('href');
92            var Imgtitle = $(this).attr('title');
93            if (ImgPath !== "") {
94                $(this).parents('li').find(".dd-show-img").attr("src", ImgPath).parent('a').attr("href", ImgLink).attr("title", Imgtitle);
95            }
96        });
97    });
98});
99/*
100$(function(){
101    $('.nav').setup_navigation();
102});
103*/
104$(document).ready(function() {
105    $('.menu').setup_navigation();
106});
107/*
108$(function(){
109    $('.nav').setup_navigation();
110});
111*/
112var keyCodeMap = {
113    48: "0",
114    49: "1",
115    50: "2",
116    51: "3",
117    52: "4",
118    53: "5",
119    54: "6",
120    55: "7",
121    56: "8",
122    57: "9",
123    59: ";",
124    65: "a",
125    66: "b",
126    67: "c",
127    68: "d",
128    69: "e",
129    70: "f",
130    71: "g",
131    72: "h",
132    73: "i",
133    74: "j",
134    75: "k",
135    76: "l",
136    77: "m",
137    78: "n",
138    79: "o",
139    80: "p",
140    81: "q",
141    82: "r",
142    83: "s",
143    84: "t",
144    85: "u",
145    86: "v",
146    87: "w",
147    88: "x",
148    89: "y",
149    90: "z",
150    96: "0",
151    97: "1",
152    98: "2",
153    99: "3",
154    100: "4",
155    101: "5",
156    102: "6",
157    103: "7",
158    104: "8",
159    105: "9"
160};
161$.fn.setup_navigation = function(settings) {
162    settings = jQuery.extend({
163        menuHoverClass: 'menu-dropdown',
164    }, settings);
165    // Add ARIA role to menubar and menu items
166    $(this).attr('role', 'menubar').find('li').attr('role', 'menuitem');
167    var top_level_links = $(this).find('> li > a');
168    $(top_level_links).next('ul').attr('data-test', 'true').attr({
169        'aria-hidden': 'true',
170        'role': 'menu'
171    }).find('a').attr('tabIndex', -1);
172    // Adding aria-haspopup for appropriate items
173    $(top_level_links).each(function() {
174        if ($(this).next('ul').length > 0) $(this).parent('li').attr('aria-haspopup', 'true');
175    });
176    $(top_level_links).hover(function() {
177        $(this).closest('ul').attr('aria-hidden', 'false').find('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
178        $(this).next('ul').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0);
179    });
180    $(top_level_links).focus(function() {
181        $(this).closest('ul').find('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
182        $(this).parent("li").find(">ul").attr('aria-hidden', 'false').addClass(settings.menuHoverClass).find('a').attr('tabIndex', 0);
183    });
184    // Bind arrow keys for navigation
185    $(top_level_links).keydown(function(e) {
186        if (e.keyCode == 37) { //left arrow key
187            e.preventDefault();
188            if ($(this).parent('li').prev('li').length === 0) {
189                $(this).parents('ul').find('> li').last().find('a').first().focus();
190            } else {
191                $(this).parent('li').prev('li').find('a').first().focus();
192            }
193        } else if (e.keyCode == 38) { // up arrow key
194            e.preventDefault();
195            if ($(this).parent('li').find('ul').length > 0) {
196                $(this).parent('li').find('>ul').attr('aria-hidden', 'false')
197                    //.addClass(settings.menuHoverClass)
198                    .find('a').attr('tabIndex', 0).last().focus();
199            }
200        } else if (e.keyCode == 39) { //right arrow key
201            e.preventDefault();
202            // This is the last item
203            if ($(this).parent('li').next('li').length === 0) {
204                $(this).parents('ul').find('> li').first().find('a').first().focus();
205            } else {
206                $(this).parent('li').next('li').find('a').first().focus();
207            }
208        } else if (e.keyCode == 40) { //down arrow key
209            e.preventDefault();
210            if ($(this).parent('li').find('ul').length > 0) {
211                $(this).parent('li').find('> ul').attr('aria-hidden', 'false')
212                    // .addClass(settings.menuHoverClass)
213                    .find('a').attr('tabIndex', 0).first().focus();
214            }
215        } else if (e.keyCode == 13 || e.keyCode == 32) {
216            // If submenu is hidden, open it
217            e.preventDefault();
218            $(this).parent('li').find('ul[aria-hidden=true]').attr('aria-hidden', 'false').addClass(settings.menuHoverClass).find('a').attr('tabIndex', 0).first().focus();
219        } else if (e.keyCode == 27) {
220            e.preventDefault();
221            $('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
222        } else {
223            $(this).parent('li').find('ul[aria-hidden=false] a').each(function() {
224                if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) {
225                    $(this).focus();
226                    return false;
227                }
228            });
229        }
230    });
231    var links = $(top_level_links).parent('li').find('ul').find('a');
232    $(links).keydown(function(e) {
233        var FocusIndex = $(this).parent("li").index() + 1;
234        if (e.keyCode == 38) { //up arrow key
235            e.preventDefault();
236            // This is the first item
237            if ($(this).parent('li').prev('li').length === 0) {
238                if ($(this).parents("ul").prev("ul").length > 0) {
239                    $(this).parents('ul').prev('ul').find('a').attr('tabIndex', 0).last().focus();
240                } else {
241                    $(this).parents('ul').parents('li').find('a').first().focus();
242                }
243            } else if ($(this).parent('li').prev('li').find("a").length === 0) {
244                if ($(this).parent('li').prev('li').is(':first-child')) {
245                    if ($(this).parent('li').parent("ul").prev("ul").length === 0) {
246                        //console.log('first element');
247                        $(this).parents('ul').parents('li').find('a').first().focus();
248                    } else {
249                        //$(this).parent('li').parent('ul').prev("ul").parents("li").find('a').last().focus();
250                        $(this).parents('ul').prev('ul').find('a').attr('tabIndex', 0).last().focus();
251                    }
252                    //$(this).parent('li').parent('ul').parent('li').find('a').first().focus();
253                } else {
254                    //console.log('not first element');
255                    $(this).parent('li').prev('li').prev("li").find('a').first().focus();
256                }
257            } else {
258                $(this).parent('li').prev('li').find('a').first().focus();
259            }
260        } else if (e.keyCode == 40) { //down arrow key
261            e.preventDefault();
262            if ($(this).parent('li').find('> ul').length > 0) {
263                $(this).parent('li').find('> ul').find('a').first().focus();
264            } else if ($(this).parent('li').next('li').length === 0) {
265                if ($(this).parents("ul").next("ul").length > 0) {
266                    $(this).parents('ul').next('ul').find('a').attr('tabIndex', 0).first().focus();
267                } else {
268                    $(this).parents('ul').parents('li').find('a').first().focus();
269                }
270            } else if ($(this).parent('li').next('li').find("a").length === 0) {
271                $(this).parent('li').next('li').next("li").first().find('a').first().focus();
272            } else {
273                $(this).parent('li').next('li').find('a').first().focus();
274            }
275        } else if (e.keyCode == 39) { //right arrow key
276            e.preventDefault();
277            if ($(this).parents('ul').next('ul').length > 0) {
278                if ($(this).parents("ul").next("ul").find("li").length >= FocusIndex) {
279                    $(this).parents('ul').next('ul').find('li:nth-child(' + FocusIndex + ')').find('a').first().focus();
280                } else {
281                    $(this).parents('ul').next('ul').find('> li').first().find('a').first().focus();
282                }
283            }
284        } else if (e.keyCode == 37) { //left arrow key
285            e.preventDefault();
286            if ($(this).parents('ul').prev('ul').length > 0) {
287                if ($(this).parents("ul").prev("ul").find("li").length >= FocusIndex) {
288                    $(this).parents('ul').prev('ul').find('li:nth-child(' + FocusIndex + ')').find('a').last().focus();
289                } else {
290                    $(this).parents('ul').prev('ul').find('> li').last().find('a').last().focus();
291                }
292            }
293        } else if (e.keyCode == 27 || e.keyCode == 37) { //escape and down arrow  key
294            e.preventDefault();
295            $(this).parents('ul').first().prev('a').focus().parents('ul').first().find('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
296        } else if (e.keyCode == 32) { // space key
297            e.preventDefault();
298            window.location = $(this).attr('href');
299        } else {
300            var found = false;
301            $(this).parent('li').nextAll('li').find('a').each(function() {
302                if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) {
303                    $(this).focus();
304                    found = true;
305                    return false;
306                }
307            });
308            if (!found) {
309                $(this).parent('li').prevAll('li').find('a').each(function() {
310                    if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) {
311                        $(this).focus();
312                        return false;
313                    }
314                });
315            }
316        }
317    });
318    // Hide menu if click or focus occurs outside of navigation
319    $(this).find('a').last().keydown(function(e) {
320        if (e.keyCode == 9) { //tab key
321            // If the user tabs out of the navigation hide all menus
322            $('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
323        }
324    });
325    $(document).click(function() {
326        $('.' + settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex', -1);
327    });
328    $(this).click(function(e) {
329        e.stopPropagation();
330    });
331};

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.