PageSourceSearch

https://www.autoescuelatajo.com/wp-content/themes/woodmart/js/libs/sticky-kit.js

js autoescuelatajo.com collected 2026-10-06 09:32:46 UTC 7,236 bytes, 225 lines download raw bytes

vendor: 4,523 bytes, lines 1-130
1// Generated by CoffeeScript 1.10.0
2
3/**
4@license Sticky-kit v1.1.3 | MIT | Leaf Corcoran 2015 | http://leafo.net
5 */
6
7(function() {
8  var $, win;
9
10  $ = window.jQuery;
11
12  win = $(window);
13
14  $.fn.stick_in_parent = function(opts) {
15    var doc, elm, enable_bottoming, fn, i, inner_scrolling, len, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, sticky_class;
16    if (opts == null) {
17      opts = {};
18    }
19    sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;
20    if (offset_top == null) {
21      offset_top = 0;
22    }
23    if (parent_selector == null) {
24      parent_selector = void 0;
25    }
26    if (inner_scrolling == null) {
27      inner_scrolling = true;
28    }
29    if (sticky_class == null) {
30      sticky_class = "is_stuck";
31    }
32    doc = $(document);
33    if (enable_bottoming == null) {
34      enable_bottoming = true;
35    }
36    outer_width = function(el) {
37      var _el, computed, w;
38      if (window.getComputedStyle) {
39        _el = el[0];
40        computed = window.getComputedStyle(el[0]);
41        w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right"));
42        if (computed.getPropertyValue("box-sizing") !== "border-box") {
43          w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right"));
44        }
45        return w;
46      } else {
47        return el.outerWidth(true);
48      }
49    };
50    fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {
51      var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;
52      if (elm.data("sticky_kit")) {
53        return;
54      }
55      elm.data("sticky_kit", true);
56      last_scroll_height = doc.height();
57      parent = elm.parent();
58      if (parent_selector != null) {
59        parent = parent.closest(parent_selector);
60      }
61      if (!parent.length) {
62        throw "failed to find stick parent";
63      }
64      fixed = false;
65      bottomed = false;
66      spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />");
67      recalc = function() {
68        var border_top, padding_top, restore;
69        if (detached) {
70          return;
71        }
72        last_scroll_height = doc.height();
73        border_top = parseInt(parent.css("border-top-width"), 10);
74        padding_top = parseInt(parent.css("padding-top"), 10);
75        padding_bottom = parseInt(parent.css("padding-bottom"), 10);
76        parent_top = parent.offset().top + border_top + padding_top;
77        parent_height = parent.height();
78        if (fixed) {
79          fixed = false;
80          bottomed = false;
81          elm.css({
82            position: "",
83            top: "",
84            width: "",
85            bottom: ""
86          }).removeClass(sticky_class);
87          restore = true;
88        }
89        top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top;
90        height = elm.outerHeight(true);
91        el_float = elm.css("float");
92        if (restore) {
93          return tick();
94        }
95      };
96      recalc();
97      if (height === parent_height) {
98        return;
99      }
100      last_pos = void 0;
101      offset = offset_top;
102      recalc_counter = recalc_every;
103      tick = function() {
104        var css, delta, recalced, scroll, will_bottom, win_height;
105        if (detached) {
106          return;
107        }
108        recalced = false;
109        if (recalc_counter != null) {
110          recalc_counter -= 1;
111          if (recalc_counter <= 0) {
112            recalc_counter = recalc_every;
113            recalc();
114            recalced = true;
115          }
116        }
117        if (!recalced && doc.height() !== last_scroll_height) {
118          recalc();
119          recalced = true;
120        }
121        scroll = win.scrollTop();
122        if (last_pos != null) {
123          delta = scroll - last_pos;
124        }
125        last_pos = scroll;
126        if (fixed) {
127          if (enable_bottoming) {
128            will_bottom = scroll + height + offset > parent_height + parent_top;
129            if (bottomed && !will_bottom) {
130              bottomed = false;
vendor: 2,713 bytes, lines 131-225
131              elm.css({
132                position: "sticky",
133                bottom: "",
134                top: offset
135              }).trigger("sticky_kit:unbottom");
136            }
137          }
138          if (scroll < top) {
139            fixed = false;
140            offset = offset_top;
141            css = {
142              position: "",
143              width: "",
144              top: ""
145            };
146            elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
147          }
148          if (inner_scrolling) {
149            win_height = win.height();
150            if (height + offset_top > win_height) {
151              if (!bottomed) {
152                offset -= delta;
153                offset = Math.max(win_height - height, offset);
154                offset = Math.min(offset_top, offset);
155                if (fixed) {
156                  elm.css({
157                    top: offset + "px"
158                  });
159                }
160              }
161            }
162          }
163        } else {
164          if (scroll > top) {
165            fixed = true;
166            css = {
167              position: "sticky",
168              top: offset
169            };
170            elm.css(css).addClass(sticky_class);
171            elm.trigger("sticky_kit:stick");
172          }
173        }
174        if (fixed && enable_bottoming) {
175          if (will_bottom == null) {
176            will_bottom = scroll + height + offset > parent_height + parent_top;
177          }
178          if (!bottomed && will_bottom) {
179            bottomed = true;
180            if (parent.css("position") === "static") {
181              parent.css({
182                position: "relative"
183              });
184            }
185          }
186        }
187      };
188      recalc_and_tick = function() {
189        recalc();
190        return tick();
191      };
192      detach = function() {
193        detached = true;
194        win.off("touchmove", tick);
195        win.off("scroll", tick);
196        win.off("resize", recalc_and_tick);
197        $(document.body).off("sticky_kit:recalc", recalc_and_tick);
198        elm.off("sticky_kit:detach", detach);
199        elm.removeData("sticky_kit");
200        elm.css({
201          position: "",
202          bottom: "",
203          top: "",
204          width: ""
205        });
206        parent.position("position", "");
207        if (fixed) {
208          return elm.removeClass(sticky_class);
209        }
210      };
211      win.on("touchmove", tick);
212      win.on("scroll", tick);
213      win.on("resize", recalc_and_tick);
214      $(document.body).on("sticky_kit:recalc", recalc_and_tick);
215      elm.on("sticky_kit:detach", detach);
216      return setTimeout(tick, 0);
217    };
218    for (i = 0, len = this.length; i < len; i++) {
219      elm = this[i];
220      fn($(elm));
221    }
222    return this;
223  };
224
225}).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.