PageSourceSearch

https://siai.org/themes/custom/bootstrap_subtheme/js/global.js?v=1.4&tm4n3p

js siai.org collected 2026-10-05 22:00:07 UTC 10,923 bytes, 406 lines download raw bytes

1/**
2 * @file
3 * Global utilities.
4 *
5 */
6(function ($, Drupal) {
7  'use strict';
8
9  $(document).ready(function () {
10    $('#toolbar-administration').insertBefore('#navbar-top');
11    $('.gin-secondary-toolbar').insertAfter('#toolbar-administration');
12    $('#toolbar-administration').css('position', 'static').css('margin', '0');
13    $('#toolbar-item-administration-tray').css('box-shadow', 'none');
14    $('#gin-toolbar-bar').css('position', 'relative');
15
16    $(".tree-menu > li").click(function (e) {
17      // Check if this li has child items
18      if ($(this).find(".child-items").length > 0) {
19        e.stopPropagation();
20
21        // If this li already has 'active', remove it
22        if ($(this).hasClass("active")) {
23          $(this).removeClass("active");
24        } else {
25          // Remove 'active' from all other li
26          $(".tree-menu > li").removeClass("active");
27          // Add 'active' to this one
28          $(this).addClass("active");
29        }
30      }
31    });
32
33    $('.gsb-banner-slider').slick({
34      autoplay: true,
35      dots: true,
36      nav: false,
37      infinite: true,
38      speed: 500,
39      slidesToShow: 1
40    });
41
42    $('.square-box-slider .vertical-block-slider .view-content.row').slick({
43      slidesToShow: 4,
44      slidesToScroll: 1,
45      arrows: true,
46      dots: false,
47      speed: 300,
48      infinite: true,
49      autoplaySpeed: 5000,
50      autoplay: true,
51      infinite: true,
52      responsive: [
53        {
54          breakpoint: 991,
55          settings: {
56            arrows: false,
57            dots: true,
58            slidesToShow: 3,
59          }
60        },
61        {
62          breakpoint: 767,
63          settings: {
64            slidesToShow: 1,
65            arrows: false,
66            dots: true,
67          }
68        }
69      ]
70    });
71
72    $('.square-box-slider .field__items').slick({
73      slidesToShow: 4,
74      slidesToScroll: 1,
75      arrows: true,
76      dots: false,
77      speed: 300,
78      infinite: true,
79      autoplaySpeed: 5000,
80      autoplay: true,
81      infinite: true,
82      responsive: [
83        {
84          breakpoint: 991,
85          settings: {
86            arrows: false,
87            dots: true,
88            slidesToShow: 3,
89          }
90        },
91        {
92          breakpoint: 767,
93          settings: {
94            slidesToShow: 1,
95            arrows: false,
96            dots: true,
97          }
98        }
99      ]
100    });
101
102    $('.news-detail-slider .view-content.row').slick({
103      slidesToShow: 3,
104      slidesToScroll: 1,
105      arrows: true,
106      dots: false,
107      speed: 300,
108      infinite: true,
109      autoplaySpeed: 5000,
110      autoplay: true,
111      infinite: true,
112      responsive: [
113        {
114          breakpoint: 767,
115          settings: {
116            slidesToShow: 1,
117            arrows: false,
118            dots: true,
119          }
120        }
121      ]
122    });
123
124    $('.node--type-ottkr .view-ott-carousel .view-content.row').slick({
125      slidesToShow: 4,
126      slidesToScroll: 1,
127      arrows: true,
128      dots: false,
129      speed: 300,
130      infinite: true,
131      autoplaySpeed: 5000,
132      autoplay: true,
133      infinite: true,
134      responsive: [
135        {
136          breakpoint: 991,
137          settings: {
138            arrows: false,
139            dots: true,
140            slidesToShow: 3,
141          }
142        },
143        {
144          breakpoint: 767,
145          settings: {
146            slidesToShow: 1,
147            arrows: false,
148            dots: true,
149          }
150        }
151      ]
152    });
153
154    $('.node--type-ott-ranking .view-ott-carousel .view-content.row').slick({
155      slidesToShow: 4,
156      slidesToScroll: 1,
157      arrows: true,
158      dots: false,
159      speed: 300,
160      infinite: true,
161      autoplaySpeed: 5000,
162      autoplay: true,
163      infinite: true,
164      responsive: [
165        {
166          breakpoint: 991,
167          settings: {
168            arrows: false,
169            dots: true,
170            slidesToShow: 3,
171          }
172        },
173        {
174          breakpoint: 767,
175          settings: {
176            slidesToShow: 1,
177            arrows: false,
178            dots: true,
179          }
180        }
181      ]
182    });
183
184    $('.path-taxonomy .region-ad-banner-slider .field__items').slick({
185      slidesToShow: 4,
186      slidesToScroll: 1,
187      arrows: true,
188      dots: false,
189      speed: 300,
190      infinite: true,
191      autoplaySpeed: 5000,
192      autoplay: true,
193      infinite: true,
194      responsive: [
195        {
196          breakpoint: 991,
197          settings: {
198            arrows: false,
199            dots: true,
200            slidesToShow: 3,
201          }
202        },
203        {
204          breakpoint: 767,
205          settings: {
206            slidesToShow: 1,
207            arrows: false,
208            dots: true,
209          }
210        }
211      ]
212    });
213
214    $('.full-width-image-carousel .block-content-slider_block .field--type-entity-reference-revisions').slick({
215      slidesToShow: 4,
216      slidesToScroll: 1,
217      arrows: true,
218      dots: false,
219      speed: 300,
220      infinite: true,
221      autoplaySpeed: 5000,
222      autoplay: true,
223      infinite: true,
224      responsive: [
225        {
226          breakpoint: 991,
227          settings: {
228            arrows: false,
229            dots: true,
230            slidesToShow: 3,
231          }
232        },
233        {
234          breakpoint: 767,
235          settings: {
236            slidesToShow: 1,
237            arrows: false,
238            dots: true,
239          }
240        }
241      ]
242    });
243
244    $('.gsb-siai-main .navbar-toggler').on('click', function (e) {
245      e.preventDefault();
246
247      $('.gsb-siai-main #block-bootstrap-subtheme-gsbheadermenu').slideToggle(); // use the correct ID here
248      $('.gsb-siai-main #block-bootstrap-subtheme-siaiglobalmenu').slideToggle(); // use the correct ID here
249      $('.gsb-siai-main #block-bootstrap-subtheme-chinasiaimenu').slideToggle(); // use the correct ID here
250    });
251
252    $('.siai-main .navbar-toggler').on('click', function (e) {
253      e.preventDefault();
254      $('.siai-main #block-bootstrap-subtheme-siaiglobalmenu').slideToggle(); // use the correct ID here
255    });
256
257    $('.signal-economy-main .navbar-toggler').on('click', function (e) {
258      e.preventDefault();
259      $('.signal-economy-main #block-bootstrap-subtheme-signaleconomymenu').slideToggle(); // use the correct ID here
260    });
261
262    $('.media-books.with-slider .view-content.row').slick({
263      slidesToShow: 4,
264      slidesToScroll: 1,
265      arrows: true,
266      dots: false,
267      speed: 300,
268      infinite: true,
269      responsive: [
270        {
271          breakpoint: 991,
272          settings: {
273            arrows: false,
274            dots: true,
275            slidesToShow: 3,
276          }
277        },
278        {
279          breakpoint: 767,
280          settings: {
281            slidesToShow: 1,
282            arrows: false,
283            dots: true,
284          }
285        }
286      ]
287    });
288
289    $(".main-header-top .search-toggle-btn").click(function () {
290      $(".main-header-top .search-wrapper").slideToggle();
291    });
292
293    /* Sticky header */
294    function scrollNavigation() {
295      function e() {
296        $(".main-header-top").removeClass("is-visible").addClass("is-hidden")
297        $("header .gva-search-region.show .search-content").removeClass("is-visible").addClass("is-hidden")
298      }
299
300      function t() {
301        $(".main-header-top").removeClass("is-hidden").addClass("is-visible")
302        $("header .gva-search-region.show .search-content").removeClass("is-hidden").addClass("is-visible")
303      }
304      var o = 0;
305      $(window).scroll(function () {
306        var l = $(this).scrollTop();
307        l > 0 && l < $(document).height() - $(window).height() && (l > o ? window.setTimeout(e, 300) : window.setTimeout(t, 300), o = l)
308      })
309    }
310
311    scrollNavigation();
312
313    $(window).scroll(function () {
314      var scroll = $(window).scrollTop();
315
316      if (scroll >= 140) {
317        $(".main-header-top").addClass("stuck");
318      } else {
319        $(".main-header-top").removeClass("stuck");
320      }
321    });
322
323    if ($(window).width() <= 1199) {
324      var domain = window.location.hostname;
325
326      var $menu = $('.navbar-dark nav ul').first();
327      $menu.addClass('slimmenu');
328
329      $menu.find('li').has('ul.dropdown-menu').each(function () {
330        $(this).children('a').after('<span class="dropdown-toggle"></span>');
331      });
332
333      if (domain == 'kr.giai.org' || domain == 'giai.org' || domain == 'economy.ac' || domain == 'signal.economy.ac' || domain == 'edutimes.com' || domain == 'mbaranking.com' || domain == 'ottranking.com' || domain == 'mdsa.giai.org') {
334        $menu.addClass('gloabal-mobile-menu');
335      }
336    }
337
338    // Initially hide all submenus
339    $(".slimmenu .dropdown-menu").hide();
340
341    // Toggle submenu on span.dropdown-toggle click
342    $(".slimmenu .dropdown > span.dropdown-toggle").on("click", function (e) {
343      e.preventDefault();
344
345      const $parentLi = $(this).closest("li");
346      const $submenu = $parentLi.children("ul.dropdown-menu");
347
348      // Close all other submenus
349      $(".slimmenu .dropdown").not($parentLi).each(function () {
350        $(this).removeClass("open");
351        $(this).children("ul.dropdown-menu").slideUp();
352        $(this).find(".dropdown-toggle").removeClass("active");
353      });
354
355      // Toggle current submenu
356      $submenu.slideToggle(200);
357      $parentLi.toggleClass("open");
358      $(this).toggleClass("active");
359    });
360  });
361
362  /*Mobile*/
363  document.addEventListener("DOMContentLoaded", function () {
364    const toggles = document.querySelectorAll(".slimmenu .dropdown-toggle");
365
366    toggles.forEach(toggle => {
367      toggle.addEventListener("click", function (e) {
368        e.preventDefault();
369
370        const parentLi = toggle.closest("li");
371        const submenu = parentLi.querySelector(".slimmenu ul.menu");
372
373        // Close all sibling submenus and remove 'active' class from sibling toggles
374        const siblingLis = Array.from(parentLi.parentElement.children).filter(
375          li => li !== parentLi
376        );
377        siblingLis.forEach(sibling => {
378          const siblingSubmenu = sibling.querySelector(".slimmenu ul.menu");
379          const siblingToggle = sibling.querySelector(".dropdown-toggle");
380          if (siblingSubmenu) {
381            siblingSubmenu.style.display = "none";
382            sibling.classList.remove("open");
383          }
384          if (siblingToggle) {
385            siblingToggle.classList.remove("active");
386          }
387        });
388
389        // Toggle current submenu
390        if (submenu) {
391          const isOpen = submenu.style.display === "block";
392          submenu.style.display = isOpen ? "none" : "block";
393          parentLi.classList.toggle("open", !isOpen);
394
395          // Toggle 'active' class on the clicked toggle
396          toggle.classList.toggle("active", !isOpen);
397        }
398      });
399    });
400
401    // Optionally hide all submenus on load
402    document.querySelectorAll(".slimmenu ul.menu").forEach(menu => {
403      menu.style.display = "none";
404    });
405  });
406})(jQuery, Drupal);

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.