PageSourceSearch

https://www.palermoschools.org/scripts/G-top-bar-v1-19-12-11.js

js palermoschools.org collected 2026-09-28 23:23:05 UTC 3,380 bytes, 134 lines download raw bytes

1/* ---------- Top Bar G-top-bar-v1-19-10-21 Scripts ---------- */
2
3// Toggles search input field when search icon is clicked
4$('.search-icon').click(function()
5{
6  $('.search-field').fadeToggle();
7});
8
9// Fades out the search field if it is open and translate, the navigation, or schools are clicked
10$('.schools-dropdown > a, .translate-dropdown > a, .main-nav-icon').click(
11  function()
12  {
13    if ($('.search-field').css('display') !== 'none')
14    {
15      $('.search-field').fadeOut();
16    }
17  }
18);
19
20ElementEmptyCheck($('.top-bar-link-gg'));
21
22// Over ten items in a menu makes a new column
23// let dropdownsToWrap = $('.dropdown-wrap');
24// let numberOfItemsInAColumn = 10;
25// let groupCounter = 0;
26
27// $(dropdownsToWrap).each(function(index)
28// {
29//   let anchors = $(this).find('a');
30//   let numberOfItems = $(anchors).length;
31//   if (numberOfItems > numberOfItemsInAColumn)
32//   {
33// numberOfItemsInAColumn = Math.ceil(numberOfItems / 2);
34//   }
35
36//   $(anchors).addClass('menu-' + index);
37//   $(anchors).wrapAll('<div class="row" />');
38
39//   if (numberOfItems > numberOfItemsInAColumn)
40//   {
41// $(this).addClass('too-many-items');
42//   }
43
44//   $(anchors).each(function(index)
45//   {
46// $(this).addClass('group-' + groupCounter);
47
48// if ((index + 1) % numberOfItemsInAColumn === 0 && index !== 0)
49// {
50//   groupCounter++;
51// }
52//   });
53
54//   for (let i = 0; i <= groupCounter; i++)
55//   {
56// if ($(this).hasClass('too-many-items'))
57// {
58//   $('.menu-' + index + '.group-' + i).wrapAll('<div class = "col-12 col-lg-6 px-0 px-md-3" />');
59// }
60
61// else
62// {
63//   $('.menu-' + index + '.group-' + i).wrapAll('<div class = "col-12 px-0 px-md-3" />');
64// }
65//   }
66// });
67
68// Moves the topbar right side links into under-banner-utility when in mobile (< 992)
69let topBarLinks = $('.round-link-container');
70
71function MoveTopBarLinks()
72{
73  try
74  {
75    ElementEmptyCheck($('.round-link-container'), '992');
76
77    if (IsMobile())
78    {
79      $('.under-banner-utility').append($(topBarLinks));
80    }
81
82    else
83    {
84      $('.header > .container > .row').append($(topBarLinks));
85    }
86  }
87  catch (error)
88  {
89    console.log('Top bar links to under banner did not work');
90  }
91}
92
93// Checks if any of the dropdowns go off of the screen to the right and adds a class to them and moves them back on the screen
94let dropdowns = $('.top-bar .dropdown-menu');
95let dropdownOffset;
96let arrowOffset;
97
98function MoveOffscreenDropdowns()
99{
100  $(dropdowns).each(function()
101  {
102    $(this).show();
103    dropdownOffset = $(window).width() - $(this).outerWidth() - 12;
104    arrowOffset = $(this).offset().left;
105    if ($(this).is(':off-right') && !$(this).hasClass('main-nav-dropdown'))
106    {
107      $(this).addClass('went-off-right');
108      $(this).offset({ left: dropdownOffset });
109      $(this).children('i').offset({ left: arrowOffset });
110    }
111
112    else
113    {
114      $(this).removeClass('went-off-right');
115      $(this).css('left', '');
116      $(this).children('i').css('left', '');
117    }
118    $(this).css('display', '');
119  });
120
121  $('.dropdown-menu.main-nav-dropdown').removeClass('went-off-right');
122}
123
124$(document).ready(function()
125{
126  MoveTopBarLinks();
127  MoveOffscreenDropdowns();
128});
129
130$(window).resize(function()
131{
132  MoveTopBarLinks();
133  MoveOffscreenDropdowns();
134});

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.