PageSourceSearch

https://blog.fnp.ae/wp-content/themes/FNPBLOG/js/jquery.sticky-kit.js?ver=2.8.4

js fnp.ae collected 2026-10-02 07:11:12 UTC 8,813 bytes, 263 lines download raw bytes

vendor: 8,813 bytes, lines 1-263
1// Generated by CoffeeScript 1.9.2
2
3/**
4@license Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
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, 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      if (spacer) {
68        spacer.css('position', elm.css('position'));
69      }
70      recalc = function() {
71        var border_top, padding_top, restore;
72        if (detached) {
73          return;
74        }
75        last_scroll_height = doc.height();
76        border_top = parseInt(parent.css("border-top-width"), 10);
77        padding_top = parseInt(parent.css("padding-top"), 10);
78        padding_bottom = parseInt(parent.css("padding-bottom"), 10);
79        parent_top = parent.offset().top + border_top + padding_top;
80        parent_height = parent.height();
81        if (fixed) {
82          fixed = false;
83          bottomed = false;
84          if (manual_spacer == null) {
85            elm.insertAfter(spacer);
86            spacer.detach();
87          }
88          elm.css({
89            position: "",
90            width: "",
91            bottom: ""
92          }).removeClass(sticky_class);
93          restore = true;
94        }
95        top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top;
96        height = elm.outerHeight(true);
97        el_float = elm.css("float");
98        if (spacer) {
99          spacer.css({
100            width: outer_width(elm),
101            height: height,
102            display: elm.css("display"),
103            "vertical-align": elm.css("vertical-align"),
104            "float": el_float
105          });
106        }
107        if (restore) {
108          return tick();
109        }
110      };
111      recalc();
112      if (height === parent_height) {
113        return;
114      }
115      last_pos = void 0;
116      offset = offset_top;
117      recalc_counter = recalc_every;
118      tick = function() {
119        var css, delta, recalced, scroll, will_bottom, win_height;
120        if (detached) {
121          return;
122        }
123        recalced = false;
124        if (recalc_counter != null) {
125          recalc_counter -= 1;
126          if (recalc_counter <= 0) {
127            recalc_counter = recalc_every;
128            recalc();
129            recalced = true;
130          }
131        }
132        if (!recalced && doc.height() !== last_scroll_height) {
133          recalc();
134          recalced = true;
135        }
136        scroll = win.scrollTop();
137        if (last_pos != null) {
138          delta = scroll - last_pos;
139        }
140        last_pos = scroll;
141        if (fixed) {
142          if (enable_bottoming) {
143            will_bottom = scroll + height + offset > parent_height + parent_top;
144            if (bottomed && !will_bottom) {
145              bottomed = false;
146              elm.css({
147                position: "fixed",
148                bottom: "",
149                top: ""
150              }).trigger("sticky_kit:unbottom");
151            }
152          }
153          if (scroll < top) {
154            fixed = false;
155            offset = offset_top;
156            if (manual_spacer == null) {
157              if (el_float === "left" || el_float === "right") {
158                elm.insertAfter(spacer);
159              }
160              spacer.detach();
161            }
162            css = {
163              position: "",
164              width: "",
165            };
166            elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
167          }
168          if (inner_scrolling) {
169            win_height = win.height();
170            if (height + offset_top > win_height) {
171              if (!bottomed) {
172                offset -= delta;
173                offset = Math.max(win_height - height, offset);
174                offset = Math.min(offset_top, offset);
175
176              }
177            }
178          }
179        } else {
180          if (scroll > top) {
181            fixed = true;
182            css = {
183              position: "fixed",
184          
185            };
186            css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px";
187            elm.css(css).addClass(sticky_class);
188            if (manual_spacer == null) {
189              elm.after(spacer);
190              if (el_float === "left" || el_float === "right") {
191                spacer.append(elm);
192              }
193            }
194            elm.trigger("sticky_kit:stick");
195          }
196        }
197        if (fixed && enable_bottoming) {
198          if (will_bottom == null) {
199            will_bottom = scroll + height + offset > parent_height + parent_top;
200          }
201          if (!bottomed && will_bottom) {
202            bottomed = true;
203            if (parent.css("position") === "static") {
204              parent.css({
205                position: "relative"
206              });
207            }
208            return elm.css({
209              position: "absolute",
210              bottom: padding_bottom,
211              top: "auto"
212            }).trigger("sticky_kit:bottom");
213          }
214        }
215      };
216      recalc_and_tick = function() {
217        if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement)
218          return;
219
220
221        recalc();
222        return tick();
223      };
224      detach = function() {
225        detached = true;
226        win.off("touchmove", tick);
227        win.off("scroll", tick);
228        win.off("resize", recalc_and_tick);
229        $(document.body).off("sticky_kit:recalc", recalc_and_tick);
230        elm.off("sticky_kit:detach", detach);
231        elm.removeData("sticky_kit");
232        elm.css({
233          position: "",
234          bottom: "",
235          width: ""
236        });
237        parent.position("position", "");
238        if (fixed) {
239          if (manual_spacer == null) {
240            if (el_float === "left" || el_float === "right") {
241              elm.insertAfter(spacer);
242            }
243            spacer.remove();
244          }
245          return elm.removeClass(sticky_class);
246        }
247      };
248
249      win.on("touchmove", tick);
250      win.on("scroll", tick);
251      win.on("resize", recalc_and_tick);
252      $(document.body).on("sticky_kit:recalc", recalc_and_tick);
253      elm.on("sticky_kit:detach", detach);
254      return setTimeout(tick, 0);
255    };
256    for (i = 0, len = this.length; i < len; i++) {
257      elm = this[i];
258      fn($(elm));
259    }
260    return this;
261  };
262
263}).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.