PageSourceSearch

https://weareallsuperhuman.com/wp-content/themes/headway/library/media/js/sticky.js?ver=6.9.4

js weareallsuperhuman.com collected 2026-10-07 20:33:07 UTC 7,405 bytes, 272 lines download raw bytes

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