PageSourceSearch

https://adlabs.com.br/wp-content/themes/adlabs/assets/js/bootstrap.offcanvas.js

js adlabs.com.br collected 2026-10-07 18:01:45 UTC 12,969 bytes, 344 lines download raw bytes

vendor: 12,969 bytes, lines 1-344
1(function() {
2  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
3
4  (function($, window) {
5    var Offcanvas, OffcanvasDropdown, OffcanvasTouch, transformCheck;
6    OffcanvasDropdown = (function() {
7      function OffcanvasDropdown(element) {
8        this.element = element;
9        this._clickEvent = bind(this._clickEvent, this);
10        this.element = $(this.element);
11        this.nav = this.element.closest(".nav");
12        this.dropdown = this.element.parent().find(".dropdown-menu");
13        this.element.on('click', this._clickEvent);
14        this.nav.closest('.navbar-offcanvas').on('click', (function(_this) {
15          return function() {
16            if (_this.dropdown.is('.shown')) {
17              return _this.dropdown.removeClass('shown').closest('.active').removeClass('active');
18            }
19          };
20        })(this));
21      }
22
23      OffcanvasDropdown.prototype._clickEvent = function(e) {
24        if (!this.dropdown.hasClass('shown')) {
25          e.preventDefault();
26        }
27        e.stopPropagation();
28        $('.dropdown-toggle').not(this.element).closest('.active').removeClass('active').find('.dropdown-menu').removeClass('shown');
29        this.dropdown.toggleClass("shown");
30        return this.element.parent().toggleClass('active');
31      };
32
33      return OffcanvasDropdown;
34
35    })();
36    OffcanvasTouch = (function() {
37      function OffcanvasTouch(button, element, location, offcanvas) {
38        this.button = button;
39        this.element = element;
40        this.location = location;
41        this.offcanvas = offcanvas;
42        this._getFade = bind(this._getFade, this);
43        this._getCss = bind(this._getCss, this);
44        this._touchEnd = bind(this._touchEnd, this);
45        this._touchMove = bind(this._touchMove, this);
46        this._touchStart = bind(this._touchStart, this);
47        this.endThreshold = 130;
48        this.startThreshold = this.element.hasClass('navbar-offcanvas-right') ? $("body").outerWidth() - 60 : 20;
49        this.maxStartThreshold = this.element.hasClass('navbar-offcanvas-right') ? $("body").outerWidth() - 20 : 60;
50        this.currentX = 0;
51        this.fade = this.element.hasClass('navbar-offcanvas-fade') ? true : false;
52        $(document).on("touchstart", this._touchStart);
53        $(document).on("touchmove", this._touchMove);
54        $(document).on("touchend", this._touchEnd);
55      }
56
57      OffcanvasTouch.prototype._touchStart = function(e) {
58        this.startX = e.originalEvent.touches[0].pageX;
59        if (this.element.is('.in')) {
60          return this.element.height($(window).outerHeight());
61        }
62      };
63
64      OffcanvasTouch.prototype._touchMove = function(e) {
65        var x;
66        if ($(e.target).parents('.navbar-offcanvas').length > 0) {
67          return true;
68        }
69        if (this.startX > this.startThreshold && this.startX < this.maxStartThreshold) {
70          e.preventDefault();
71          x = e.originalEvent.touches[0].pageX - this.startX;
72          x = this.element.hasClass('navbar-offcanvas-right') ? -x : x;
73          if (Math.abs(x) < this.element.outerWidth()) {
74            this.element.css(this._getCss(x));
75            return this.element.css(this._getFade(x));
76          }
77        } else if (this.element.hasClass('in')) {
78          e.preventDefault();
79          x = e.originalEvent.touches[0].pageX + (this.currentX - this.startX);
80          x = this.element.hasClass('navbar-offcanvas-right') ? -x : x;
81          if (Math.abs(x) < this.element.outerWidth()) {
82            this.element.css(this._getCss(x));
83            return this.element.css(this._getFade(x));
84          }
85        }
86      };
87
88      OffcanvasTouch.prototype._touchEnd = function(e) {
89        var end, sendEvents, x;
90        if ($(e.target).parents('.navbar-offcanvas').length > 0) {
91          return true;
92        }
93        sendEvents = false;
94        x = e.originalEvent.changedTouches[0].pageX;
95        if (Math.abs(x) === this.startX) {
96          return;
97        }
98        end = this.element.hasClass('navbar-offcanvas-right') ? Math.abs(x) > (this.endThreshold + 50) : x < (this.endThreshold + 50);
99        if (this.element.hasClass('in') && end) {
100          this.currentX = 0;
101          this.element.removeClass('in').css(this._clearCss());
102          this.button.removeClass('is-open');
103          sendEvents = true;
104        } else if (Math.abs(x - this.startX) > this.endThreshold && this.startX > this.startThreshold && this.startX < this.maxStartThreshold) {
105          this.currentX = this.element.hasClass('navbar-offcanvas-right') ? -this.element.outerWidth() : this.element.outerWidth();
106          this.element.toggleClass('in').css(this._clearCss());
107          this.button.toggleClass('is-open');
108          sendEvents = true;
109        } else {
110          this.element.css(this._clearCss());
111        }
112        return this.offcanvas.bodyOverflow(sendEvents);
113      };
114
115      OffcanvasTouch.prototype._getCss = function(x) {
116        x = this.element.hasClass('navbar-offcanvas-right') ? -x : x;
117        return {
118          "-webkit-transform": "translate3d(" + x + "px, 0px, 0px)",
119          "-webkit-transition-duration": "0s",
120          "-moz-transform": "translate3d(" + x + "px, 0px, 0px)",
121          "-moz-transition": "0s",
122          "-o-transform": "translate3d(" + x + "px, 0px, 0px)",
123          "-o-transition": "0s",
124          "transform": "translate3d(" + x + "px, 0px, 0px)",
125          "transition": "0s"
126        };
127      };
128
129      OffcanvasTouch.prototype._getFade = function(x) {
130        if (this.fade) {
131          return {
132            "opacity": x / this.element.outerWidth()
133          };
134        } else {
135          return {};
136        }
137      };
138
139      OffcanvasTouch.prototype._clearCss = function() {
140        return {
141          "-webkit-transform": "",
142          "-webkit-transition-duration": "",
143          "-moz-transform": "",
144          "-moz-transition": "",
145          "-o-transform": "",
146          "-o-transition": "",
147          "transform": "",
148          "transition": "",
149          "opacity": ""
150        };
151      };
152
153      return OffcanvasTouch;
154
155    })();
156    window.Offcanvas = Offcanvas = (function() {
157      function Offcanvas(element) {
158        var t, target;
159        this.element = element;
160        this.bodyOverflow = bind(this.bodyOverflow, this);
161        this._sendEventsAfter = bind(this._sendEventsAfter, this);
162        this._sendEventsBefore = bind(this._sendEventsBefore, this);
163        this._documentClicked = bind(this._documentClicked, this);
164        this._close = bind(this._close, this);
165        this._open = bind(this._open, this);
166        this._clicked = bind(this._clicked, this);
167        this._navbarHeight = bind(this._navbarHeight, this);
168        target = this.element.attr('data-target') ? this.element.attr('data-target') : false;
169        if (target) {
170          this.target = $(target);
171          if (this.target.length && !this.target.hasClass('js-offcanvas-done')) {
172            this.element.addClass('js-offcanvas-has-events');
173            this.location = this.target.hasClass("navbar-offcanvas-right") ? "right" : "left";
174            this.target.addClass(transform ? "offcanvas-transform js-offcanvas-done" : "offcanvas-position js-offcanvas-done");
175            this.target.data('offcanvas', this);
176            this.element.on("click", this._clicked);
177            this.target.on('transitionend', (function(_this) {
178              return function() {
179                if (_this.target.is(':not(.in)')) {
180                  return _this.target.height('');
181                }
182              };
183            })(this));
184            $(document).on("click", this._documentClicked);
185            if (this.target.hasClass('navbar-offcanvas-touch')) {
186              t = new OffcanvasTouch(this.element, this.target, this.location, this);
187            }
188            this.target.find(".dropdown-toggle").each(function() {
189              var d;
190              return d = new OffcanvasDropdown(this);
191            });
192            this.target.on('offcanvas.toggle', (function(_this) {
193              return function(e) {
194                return _this._clicked(e);
195              };
196            })(this));
197            this.target.on('offcanvas.close', (function(_this) {
198              return function(e) {
199                return _this._close(e);
200              };
201            })(this));
202            this.target.on('offcanvas.open', (function(_this) {
203              return function(e) {
204                return _this._open(e);
205              };
206            })(this));
207          }
208        } else {
209          console.warn('Offcanvas: `data-target` attribute must be present.');
210        }
211      }
212
213      Offcanvas.prototype._navbarHeight = function() {
214        if (this.target.is('.in')) {
215          return this.target.height($(window).outerHeight());
216        }
217      };
218
219      Offcanvas.prototype._clicked = function(e) {
220        e.preventDefault();
221        this._sendEventsBefore();
222        $(".navbar-offcanvas").not(this.target).trigger('offcanvas.close');
223        this.target.toggleClass('in');
224        this.element.toggleClass('is-open');
225        this._navbarHeight();
226        return this.bodyOverflow();
227      };
228
229      Offcanvas.prototype._open = function(e) {
230        e.preventDefault();
231        if (this.target.is('.in')) {
232          return;
233        }
234        this._sendEventsBefore();
235        this.target.addClass('in');
236        this.element.addClass('is-open');
237        this._navbarHeight();
238        return this.bodyOverflow();
239      };
240
241      Offcanvas.prototype._close = function(e) {
242        e.preventDefault();
243        if (this.target.is(':not(.in)')) {
244          return;
245        }
246        this._sendEventsBefore();
247        this.target.removeClass('in');
248        this.element.removeClass('is-open');
249        this._navbarHeight();
250        return this.bodyOverflow();
251      };
252
253      Offcanvas.prototype._documentClicked = function(e) {
254        var clickedEl;
255        clickedEl = $(e.target);
256        if (!clickedEl.hasClass('offcanvas-toggle') && clickedEl.parents('.offcanvas-toggle').length === 0 && clickedEl.parents('.navbar-offcanvas').length === 0 && !clickedEl.hasClass('navbar-offcanvas')) {
257          if (this.target.hasClass('in')) {
258            e.preventDefault();
259            this._sendEventsBefore();
260            this.target.removeClass('in');
261            this.element.removeClass('is-open');
262            this._navbarHeight();
263            return this.bodyOverflow();
264          }
265        }
266      };
267
268      Offcanvas.prototype._sendEventsBefore = function() {
269        if (this.target.hasClass('in')) {
270          return this.target.trigger('hide.bs.offcanvas');
271        } else {
272          return this.target.trigger('show.bs.offcanvas');
273        }
274      };
275
276      Offcanvas.prototype._sendEventsAfter = function() {
277        if (this.target.hasClass('in')) {
278          return this.target.trigger('shown.bs.offcanvas');
279        } else {
280          return this.target.trigger('hidden.bs.offcanvas');
281        }
282      };
283
284      Offcanvas.prototype.bodyOverflow = function(events) {
285        if (events == null) {
286          events = true;
287        }
288        if (this.target.is('.in')) {
289          $('body').addClass('offcanvas-stop-scrolling');
290        } else {
291          $('body').removeClass('offcanvas-stop-scrolling');
292        }
293        if (events) {
294          return this._sendEventsAfter();
295        }
296      };
297
298      return Offcanvas;
299
300    })();
301    transformCheck = (function(_this) {
302      return function() {
303        var asSupport, el, regex, translate3D;
304        el = document.createElement('div');
305        translate3D = "translate3d(0px, 0px, 0px)";
306        regex = /translate3d\(0px, 0px, 0px\)/g;
307        el.style.cssText = "-webkit-transform: " + translate3D + "; -moz-transform: " + translate3D + "; -o-transform: " + translate3D + "; transform: " + translate3D;
308        asSupport = el.style.cssText.match(regex);
309        return _this.transform = asSupport.length != null;
310      };
311    })(this);
312    return $(function() {
313      transformCheck();
314      $('[data-toggle="offcanvas"]').each(function() {
315        var oc;
316        return oc = new Offcanvas($(this));
317      });
318      $(window).on('resize', function() {
319        $('.navbar-offcanvas.in').each(function() {
320          return $(this).height('').removeClass('in');
321        });
322        return $('.offcanvas-toggle').removeClass('is-open');
323      });
324      return $('.offcanvas-toggle').each(function() {
325        return $(this).on('click', function(e) {
326          var el, selector;
327          if (!$(this).hasClass('js-offcanvas-has-events')) {
328            selector = $(this).attr('data-target');
329            el = $(selector);
330            if (el) {
331              el.height('');
332              el.removeClass('in');
333              return $('body').css({
334                overflow: '',
335                position: ''
336              });
337            }
338          }
339        });
340      });
341    });
342  })(window.jQuery, window);
343
344}).call(this);

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.