PageSourceSearch

https://www.arabbarometer.org/wp-content/themes/gridlove/assets/js/sticky-kit.js?ver=2.3.1

js arabbarometer.org collected 2026-09-24 08:58:50 UTC 8,888 bytes, 270 lines download raw bytes

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