PageSourceSearch

https://www.bcr.com.ar/themes/custom/base/js/tooit.js?tj9dnt

js bcr.com.ar collected 2026-09-24 20:46:30 UTC 3,087 bytes, 110 lines download raw bytes

1/**
2 * Namespace.
3 */
4var Tooit = Tooit || {
5  helpers: {}
6};
7
8(function($) {
9  /**
10   * Custom Bootstrap breakpoint detector.
11   */
12  Tooit.helpers.bsBreakpoint = function () {
13    var envs = ['xs', 'sm', 'md', 'lg'];
14
15    $el = $('<div>');
16    $el.appendTo($('body'));
17
18    for (var i = envs.length - 1; i >= 0; i--) {
19        var env = envs[i];
20
21        $el.addClass('hidden-'+env);
22        if ($el.is(':hidden')) {
23            $el.remove();
24            return env;
25        }
26    };
27  }
28
29  /**
30   * Execute actions on window resize but with a custom delay.
31   * This should prevent running hard processes multiple times while resizing
32   * since could crash the browser console.
33   */
34  Tooit.helpers.delayedResize = function (fn, ms) {
35    var resizeId;
36    $(window).resize(function () {
37      clearTimeout(resizeId);
38      resizeId = setTimeout(fn, ms);
39    });
40  }
41
42  /**
43   * Adds extra functionality to main menu.
44   */
45  Drupal.behaviors.mainMenuNav = {
46    attach: function (context, settings) {
47      if (context !== document) {
48        return;
49      }
50      
51      // Third level toggle functionality.
52      $(context).find('.yamm .dropdown-menu')
53        .once('main-menu-nav')
54        .each(function (index, element){
55          // Toggle third level icon toggle.
56          $(element).find('.level-3 [data-toggle]').on('click', function(e){
57            $(this).find('i').toggleClass('fa-caret-right fa-caret-down');
58          });
59        });
60      // Setting up the right position for dropdown menu.
61      $(context).find('ul.level-0 > li')
62        .once('main-menu-nav')
63        .each(function (index, element){
64          var $li = $(this);
65          var dropdownWidth = $li.find('.dropdown-menu:first').outerWidth(true);
66          var windowWidth   = window.outerWidth;
67          // Calculate if we need to setup the "right" property.
68          if (($li.offset().left + dropdownWidth) > windowWidth) {
69            $li.find('.dropdown-menu:first').css('right', 0);
70          } else {
71            var rightPosition = windowWidth - ($li.offset().left + dropdownWidth);
72            $li.find('.dropdown-menu:first').css('right', rightPosition);
73          };
74        });
75      
76      function updateHeight() {
77        $('.yamm-content').css(
78          'max-height', Math.max(Drupal.frontend.layout.visibleHeight - 20, 0) + 'px'
79        );
80      }
81      
82      Drupal.frontend.on('resize', function() {
83        updateHeight();
84      });
85      
86      updateHeight();
87    }
88  };
89
90  /**
91   * Menu vertical behavior.
92   */
93  Drupal.behaviors.verticalMenuNav = {
94    attach: function (context, settings) {
95      $(context).find('.com-menu-vertical')
96        .once('vertical-menu-nav')
97        .each(function (index, element){
98          // Toggle third level icon toggle.
99          $(element).find('li.dropdown > a > i.fa').on('click', function(e) {
100            e.preventDefault();
101            $(this).parents('li.dropdown:first').toggleClass('open');
102            $(this).toggleClass('fa-caret-right fa-caret-down');
103          });
104        });
105
106    }
107  };
108
109  return Tooit;
110})(jQuery);

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.