PageSourceSearch

https://conorsfund.org/js/main.js?ts=20230620142212

js conorsfund.org collected 2026-10-04 02:11:34 UTC 41,819 bytes, 1,394 lines download raw bytes

1$(function () {
2	if (document.location.hash) {
3		let anchor = $('div[data-plugin=Blog] a.wb_anchor[name=' + document.location.hash.substring(1) + ']')
4		if (anchor.length) {
5			let offset = anchor.offset();
6			if (offset.top) {
7				window.scrollTo({top: offset.top, behavior: 'instant'})
8			}
9		}
10	}
11})
12
13
14function wb_form_validateForm(formId, values, errors) {
15	var form = $("input[name='wb_form_id'][value='" + formId + "']").parent();
16	if (!form || form.length === 0 || !errors) return;
17
18	form.find("input[name],textarea[name]").css({backgroundColor: ""});
19	var elem;
20	if (errors.required) {
21		for (var i = 0; i < errors.required.length; i++) {
22			var name = errors.required[i];
23			elem = form.find("input[name='" + name + "'],textarea[name='" + name + "'],select[name='" + name + "']");
24			elem.css({backgroundColor: "#ff8c8c"});
25		}
26	}
27
28	if (Object.keys(errors).length) {
29		for (var k in values) {
30			elem = form.find("input[name='" + k + "'][type='radio'],input[name='" + k + "'][type='checkbox'],input[name='" + k + "[]'][type='checkbox']");
31			if (elem.length) {
32				if (!Array.isArray(values[k])) values[k] = [values[k]];
33				elem.each(function (key, item) {
34					if (values[k].indexOf($(item).val()) >= 0) {
35						$(item).attr('checked', true);
36					}
37				})
38
39				continue;
40			}
41
42			elem = form.find("input[name='" + k + "'],textarea[name='" + k + "'],select[name='" + k + "']");
43			if (elem.length) {
44				elem.val(values[k]);
45			}
46		}
47	}
48}
49
50var _isTouchDevice;
51function isTouchDevice() {
52	if (_isTouchDevice === undefined) {
53		_isTouchDevice = ('ontouchstart' in document.documentElement) && (
54			navigator.userAgent.match(/Android/i)
55			|| navigator.userAgent.match(/webOS/i)
56			|| navigator.userAgent.match(/BlackBerry/i)
57			|| navigator.userAgent.match(/Windows Phone/i)
58			|| navigator.userAgent.match(/Opera Mini/i)
59			|| navigator.userAgent.match(/IEMobile/i)
60			|| navigator.userAgent.match(/iPhone/i)
61			|| navigator.userAgent.match(/iPad/i)
62			|| navigator.userAgent.match(/iPod/i)
63			|| navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints > 0
64		);
65	}
66	return _isTouchDevice;
67}
68var _baseUrl;
69function getBaseUrl() {
70	if (_baseUrl === undefined) {
71		_baseUrl = $('base').attr('href');
72	}
73	return _baseUrl;
74}
75function isIOS() {
76	return ('ontouchstart' in document.documentElement) && (
77		navigator.userAgent.match(/iPhone/i)
78		|| navigator.userAgent.match(/iPad/i)
79		|| navigator.userAgent.match(/iPod/i)
80		|| navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints > 0
81	);
82}
83
84function wb_show_alert(message, type) {
85	var prompt = $("<div>")
86		.addClass("alert alert-wb-form alert-" + type)
87		.append(message)
88		.prepend($("<button>").addClass("close")
89			.html("&nbsp;&times;")
90			.on("click", function() { $(this).parent().remove(); })
91		)
92	.appendTo("body");
93	setTimeout(function() { prompt.animate({ opacity: 1, right: 0 }, 250); }, 250);
94}
95
96(function() {
97	var popupInited = false;
98
99	var loader, container, popup,
100		iframe, closeBtn, isVisible;
101
102	var setPopupVisible = function(visible) {
103		isVisible = !!visible;
104		if (isVisible) {
105			container.show();
106			setTimeout(function() { container.addClass('visible'); }, 10);
107		} else {
108			container.removeClass('visible');
109			setTimeout(function() { container.hide(); }, 300);
110		}
111	};
112	
113	window.wb_close_popup = function() {
114		if (iframe && iframe.length) {
115			iframe.attr('src', '');
116			setPopupVisible(false);
117		}
118	};
119
120	window.wb_show_popup = function(url, width, height) {
121		if (!popupInited) {
122			popupInited = true;
123			container = $('<div class="wb-popup-container">');
124			popup = $('<div class="wb-popup">');
125			loader = $('<div class="wb-popup-loader">').hide();
126			$('<div class="ico-spin spinner">').appendTo(loader);
127			var iframeWrapper = $('<div class="wb-iframe-wrapper">');
128			iframe = $('<iframe>');
129			closeBtn = $('<div class="wb-popup-btn-close">');
130			closeBtn.on('click', wb_close_popup);
131			popup.append(loader);
132			popup.append(closeBtn);
133			popup.append(iframeWrapper);
134			iframeWrapper.append(iframe);
135			popup.appendTo(container);
136			container.appendTo('body');
137			$(document).on('keydown', function(e) {
138				if (e.keyCode === 27) { // Esc
139					if (isVisible) wb_close_popup();
140				}
141			});
142			if (isIOS()) {
143				iframeWrapper.attr('style', '-webkit-overflow-scrolling: touch; overflow-y: auto;');
144			}
145		}
146		width = width || 400;
147		height = height || 320;
148		loader.show();
149		popup.css({ width: width + 'px', height: height + 'px' });
150		iframe.on('load', function() {
151			loader.hide();
152		});
153		iframe.attr('src', url);
154		setPopupVisible(true);
155	};
156
157	$(window).on('message', function(e) {
158		var eData = e.originalEvent.data;
159		if (eData && typeof(eData) === 'object' && eData.data && typeof(eData.data) === 'object') {
160			var event = eData.event, data = eData.data;
161			if (event === 'wb_contact_form_sent') {
162				var type = data.type ? data.type : 'success';
163				if (data.state) wb_show_alert(data.state, type);
164				if (type === 'success') {
165					setPopupVisible(false);
166				}
167			}
168			if (event === 'wb_show_popup') {
169				var url = data.url;
170				var width = data.width;
171				var height = data.height;
172				wb_show_popup(url, width, height);
173			}
174		}
175	});
176})();
177
178(function() {
179	var params = [];
180
181	var i, part;
182	var qs_parts = location.search.replace(/^\?/, '').split('&');
183	for (i = 0; i < qs_parts.length; i++) {
184		part = qs_parts[i].split('=');
185		if (part.length === 2) {
186			params[decodeURIComponent(part[0])] = decodeURIComponent(part[1]);
187		}
188	}
189
190	window.wb_get_query_param = function(key) {
191		return (key && (key in params)) ? params[key] : null;
192	};
193})();
194
195$(function() {
196	// fix for forms in Instagram browser
197	if (navigator.userAgent.indexOf('Instagram') > -1) {
198		$('form').each(function() {
199			if (this.method && this.method.toLowerCase() === 'post'
200					&& this.target && this.target === '_blank') {
201				$(this).removeAttr('target');
202			}
203		});
204	}
205	
206	(function() {
207		var extractYoutubeId = function(url) {
208			var id = null;
209			if (/^https?:\/\/.*youtube.*/i.test(url)) {
210				var parts = url.split('?');
211				if (parts.length > 1) {
212					var parts2 = parts[1].split('&');
213					for (var i = 0; i < parts2.length; i++) {
214						var keyVal = parts2[i].split('=');
215						if (keyVal.length > 1) {
216							if (keyVal[0] === 'v' && keyVal[1]) {
217								id = keyVal[1];
218								break;
219							}
220						}
221					}
222				}
223			}
224			else if (/^(?:https?:\/\/|)(www\.)?youtu\.be\/(.+)$/i.test(url)) {
225				id = RegExp.$1;
226			}
227			else if (/(?:^|")(?:https?:\/\/|)(?:www\.)?youtube\.com\/(?:(?:embed\/)|(?:watch\?v=))(.+?)(?:"|$)/i.test(url)) {
228				id = RegExp.$1;
229			}
230			if (id) {
231				id = id.replace(/[^a-zA-Z0-9\_\-]/, '');
232			}
233			return id;
234		};
235
236		$('.wb_video_background').each(function() {
237			var videoContainer = $(this);
238			var isSite = videoContainer.is('.wb_site_video_background');
239			var url = videoContainer.data('video'),
240				start = videoContainer.data('start'),
241				end = videoContainer.data('end');
242
243			if (!start) start = 0;
244			if (!end) end = null;
245
246			if (url) {
247				var youtubeVideoId = extractYoutubeId(url);
248				if (youtubeVideoId) {
249					if (!window.YT) {
250						$.getScript('https://www.youtube.com/iframe_api');
251					}
252					var onAPIReady = window.onYouTubeIframeAPIReady;
253					window.onYouTubeIframeAPIReady = function() {
254						if (typeof(onAPIReady) === 'function') onAPIReady();
255
256						var youtubeElementId = videoContainer.attr('id') + '_youtube_container';
257						var player = $('<div class="wb-youtube-video">' +
258											'<div class="youtube" id="' + youtubeElementId + '"></div>' +
259										'</div>');
260						videoContainer.append(player);
261						var viewportCont = isSite ? $(window) : videoContainer;
262						var lastWidth, lastHeight;
263						var innerCont = null;
264						var inited = false;
265						var resizer = function() {
266							if (!innerCont) innerCont = player.children('iframe.youtube');
267							if (!innerCont.length) return;
268
269							var w = viewportCont.width(),
270								h = viewportCont.height();
271							if (lastWidth === w && lastHeight === h)
272								return;
273							lastWidth = w; lastHeight = h;
274							if (w / h > 16/9) {
275								youtube.setSize(w, w / 16*9);
276								innerCont.css('left', 0);
277							} else {
278								youtube.setSize(h / 9*16, h);
279								innerCont.css('left', -(innerCont.outerWidth() - w) / 2);
280							}
281						};
282						var onfocus = function() {
283							if (youtube.getPlayerState() !== YT.PlayerState.PLAYING)
284								youtube.playVideo();
285						}
286						$(window).on('resize', resizer);
287						$(window).on('focus', onfocus);
288
289						var initVideo = function(reload) {
290							player.addClass('visible');
291							clearInterval(timer);
292							timer = setInterval(function() {
293								youtube.seekTo(start);
294								if (youtube.getPlayerState() !== YT.PlayerState.PLAYING)
295									youtube.playVideo();
296							}, ((end ? end : youtube.getDuration() - 0.5) - start) * 1000);
297							if (reload) {
298								youtube.seekTo(start);
299								if (youtube.getPlayerState() !== YT.PlayerState.PLAYING)
300									youtube.playVideo();
301							}
302						};
303
304						var timer;
305						var youtube = new YT.Player(youtubeElementId, {
306							events: {
307								playerVars: {
308									autoplay: 0,
309									autohide: 1,
310									modestbranding: 0,
311									rel: 0,
312									showinfo: 0,
313									controls: 0,
314									disablekb: 1,
315									enablejsapi: 0,
316									iv_load_policy: 3
317								},
318								onReady: function() {
319									youtube.loadVideoById({
320										videoId: youtubeVideoId,
321										startSeconds: start
322									});
323									youtube.mute();
324									resizer();
325								},
326								onStateChange: function(e) {
327									if (e.data === YT.PlayerState.PLAYING) {
328										if (!inited) {
329											initVideo();
330											inited = true;
331										}
332									} else if (e.data === YT.PlayerState.ENDED) {
333										initVideo(true);
334									}
335								}
336							}
337						});
338					};
339				}
340				else {
341					var video = $('<video class="wb-video" muted playsinline>');
342					var loaded = false;
343					var ratio;
344					var lastWidth, lastHeight;
345					videoContainer.append(video);
346
347					var resizer = function() {
348						if (!ratio) return;
349						var ew = videoContainer.width();
350						var eh = videoContainer.height();
351						if (lastWidth && lastWidth === ew && lastHeight && lastHeight === eh)
352							return;
353						lastWidth = ew; lastHeight = eh;
354						var er = ew / eh;
355						var nw = 0, nh = 0, nl = 0, nt = 0;
356						if (ratio > er) {
357							nh = eh;
358							nw = nh * ratio;
359							nl = (nw - ew) / 2;
360						} else if (ratio < eh) {
361							nw = ew;
362							nh = nw / ratio;
363							nt = (nh - eh) / 2;
364						} else {
365							nw = ew;
366							nh = eh;
367						}
368						video.css({width: nw, height: nh, left: -nl, top: -nt});
369					};
370					$(window).on('resize', resizer);
371
372					video.get(0).autoplay = true;
373					video.on('loadeddata', function() {
374						if (loaded) return;
375						loaded = true;
376						setInterval(function() {
377							video.get(0).currentTime = start;
378							if (video.get(0).paused) video.get(0).play();
379						}, ((end ? end : video.get(0).duration) - start) * 1000);
380						video.get(0).currentTime = start;
381						video.get(0).play();
382						video.addClass('visible');
383						ratio = (video.width() / video.height());
384						resizer();
385					});
386					video.get(0).src = url;
387				}
388			}
389		});
390	})();
391
392	var currLang = (('currLang' in window) && window.currLang) ? window.currLang : null;
393	var useTrailingSlashes = (!('useTrailingSlashes' in window) || window.useTrailingSlashes);
394	var disableRightClick = (('disableRightClick' in window) && window.disableRightClick);
395
396	var isPopupMode = (parseInt(wb_get_query_param('wbPopupMode')) === 1);
397	var openPopupPageUrl = (('openPopupPageUrl' in window) && window.openPopupPageUrl);
398	var openPopupPageWidth = (('openPopupPageWidth' in window) && window.openPopupPageWidth);
399	var openPopupPageHeight = (('openPopupPageHeight' in window) && window.openPopupPageHeight);
400
401	var href = wb_get_query_param('wbPopupOpen');
402	if (href) {
403		var baseUrl = $('head base').attr('href');
404		if (/^wb_popup:([^;]*);/.test(href)) {
405			var url = RegExp.$1, w, h;
406			var parts = href.split(';');
407			for (var i = 0; i < parts.length; i++) {
408				var pp = parts[i].split('=');
409				if (pp.length !== 2 || !parseInt(pp[1])) continue;
410				if (pp[0] === 'w') w = parseInt(pp[1]);
411				else if (pp[0] === 'h') h = parseInt(pp[1]);
412			}
413			if (!/^https?:\/\//.test(url)) {
414				url = baseUrl + url;
415			}
416
417			if (!isPopupMode) {
418				wb_show_popup(url, w, h);
419			} else if (window !== window.parent && window.parent.postMessage) {
420				window.parent.postMessage({event: 'wb_show_popup', data: {url: url, width: w, height: h}});
421			}
422		}
423	}
424
425	if (disableRightClick) {
426		$(document).on('contextmenu', function(e) { e.preventDefault(); });
427	}
428	
429	var comboBoxes = $('.wb-combobox-controll');
430	if (comboBoxes.length) {
431		comboBoxes.each(function() {
432			var thisCombo = $(this);
433			var clickFunc = function() {
434				var input = thisCombo.find('input');
435				var menu = thisCombo.find('.dropdown-menu');
436
437				var w = input.outerWidth();
438				var mw = menu.width();
439				var mh = menu.height();
440				var ew = thisCombo.parent().outerWidth();
441				var eh = thisCombo.parent().outerHeight();
442				var wW = $(document.body).outerWidth();
443				var wH = $(document.body).outerHeight();
444
445				var offset = thisCombo.parent().offset();
446
447				if (mw < ew) menu.width(ew);
448
449				let margin = -w;
450				if (document.dir === 'rtl') {
451					if (mw > offset.left + ew) margin -= mw - ew;
452				} else {
453					if (offset.left + mw > wW) margin -= mw - ew;
454				}
455
456				let css = {};
457				css[document.dir === 'rtl' ? 'marginRight' : 'marginLeft'] = margin + 'px';
458				menu.css( css );
459
460				if (offset.top + eh + mh > wH) menu.css( {top: 'initial', 'bottom': '100%' } );
461				if (offset.top - mh < 0) menu.css( {top: '100%', 'bottom': 'initial' } );
462
463				thisCombo.find('.btn-group').toggleClass('open');
464			};
465			$(this).find('input').bind('click', clickFunc);
466			$(this).find('.dropdown-toggle').bind('click', clickFunc);
467		});
468		
469		$(document).bind('click', function(e) {
470			var t = $(e.target);
471			if (!t.is('.wb-combobox-controll')) {
472				t = t.parents('.wb-combobox-controll');
473				$.each($('.wb-combobox-controll'), function() {
474					if (t.get(0) !== $(this).get(0)) {
475						$(this).find('.btn-group').removeClass('open');
476					}
477				});
478			}
479		});
480	}
481	if (currLang) {
482		$('.lang-selector').each(function() {
483			var thisElem = $(this);
484			var type = thisElem.attr('data-type');
485			if (type === 'flags') {
486				thisElem.find('a[data-lang="' + currLang + '"]').addClass('active');
487			} else if (type === 'select') {
488				var actLi = thisElem.find('li[data-lang="' + currLang + '"]');
489				actLi.addClass('active');
490				thisElem.find('input').val(actLi.find('a').html());
491			}
492		});
493	}
494	$('.btn-group.dropdown').each(function() {
495		var ddh = $(this).height();
496		var ddm = $(this).children('.dropdown-menu');
497		ddm.addClass('open');
498		var ddmh = ddm.height();
499		ddm.removeClass('open');
500		var ddt = $(this).offset().top;
501		var dh = $(document).height();
502		if (ddt + ddh + ddmh + 2 >
502= dh) {
503			$(this).removeClass('dropdown').addClass('dropup');
504		}
505	});
506
507	/** @type SpMenu[] */
508	var menuList = [];
509	/** @type SpMenuItem|null */
510	var lastOpenMi = null;
511	/** @param {SpMenu} ignoreMenu */
512	var closeMenus = function(ignoreMenu) {
513		for (var i = 0; i < menuList.length; i++) {
514			var menu = menuList[i];
515			if (ignoreMenu && menu.menuId === ignoreMenu.menuId) continue;
516			menu.closeAll();
517		}
518	};
519
520	$('body').on('touchstart', function(e) {
521		var ignoreMenu = SpMenu.lookupMenu($(e.target).closest('.wb-menu,.wb-menu-det'));
522		closeMenus(ignoreMenu);
523	});
524
525	/**
526	 * @param {JQuery} elem
527	 * @param {SpMenu} parent
528	 */
529	var SpMenuItem = function(elem, parent) {
530		this.elem = elem;
531		this.parent = parent;
532		this.subMenu = (elem.children('ul').length > 0)
533			? new SpMenu(elem, this)
534			: null;
535		var isOver = false;
536		this.isHover = function() { return isOver; };
537		this.isActive = function() { return elem.is('.active'); };
538		var linkElem = this.elem.children('a');
539		var href = linkElem.attr('href');
540		var clearAnchor = function(url) {
541			var anchorPos = url.indexOf('#');
542			return anchorPos > -1 ? url.substring(0, url.indexOf('#')) : url;
543		};
544		var itemOnCurrPage;
545		this.isAnchor = function(onCurrentPage) {
546			if (href.indexOf('#') > -1) {
547				if (onCurrentPage !== undefined) {
548					if (itemOnCurrPage === undefined) {
549						var baseUrl = getBaseUrl();
550						var currUrl = clearAnchor(location.href);
551						var currUri = currUrl.replace(baseUrl, '');
552						var itemUri = href.replace(baseUrl, '');
553						itemOnCurrPage = (clearAnchor(itemUri) === currUri);
554					}
555					return itemOnCurrPage === !!onCurrentPage;
556				}
557				return true;
558			}
559			return false;
560		};
561		this.getText = function() { return linkElem.text(); }
562		var _hto = 0;
563		this.setHover = function(over) {
564			this.cancelHoverTimeout();
565			if (isOver == over) return;
566			isOver = over;
567			if (over) {
568				elem.addClass('over');
569				if (isTouchDevice()) {
570					// remove 'over' state from sibling items manually
571					// because for touch devices mouseout is not called.
572					var pItems = this.parent.getItems();
573					for (var i=0; i < pItems.length; i++) {
574						var item = pItems[i];
575						if (item === this) continue;
576						if (item.isHover()) item.setHover(false);
577					}
578				}
579			} else {
580				elem.removeClass('over');
581			}
582			if (this.subMenu) this.subMenu.triggerHover(over);
583			if (this.parent && this.parent.isVertical() && this.parent.parent) {
584				this.parent.parent.cancelHoverTimeout();
585				if (!this.parent.isHover()) this.parent.parent.setHover(over);
586			}
587		};
588		this.setHoverTimeout = function(over) {
589			this.cancelHoverTimeout();
590			var self = this;
591			_hto = setTimeout(function() { self.setHover(over); }, 20);
592		};
593		this.cancelHoverTimeout = function() {
594			if (_hto) clearTimeout(_hto);
595		};
596	};
597	/**
598	 * 
599	 * @param {JQuery} elem
600	 * @param {SpMenuItem|null} parent
601	 */
602	var SpMenu = function(elem, parent) {
603		this.menuId = (parent && parent.parent) ? parent.parent.menuId : elem[0].id;
604		this.parent = parent;
605		SpMenu.markMenu(elem, this.menuId);
606		var menuElem = elem.children('ul');
607		var isVertical = menuElem.is('.vmenu');
608		/** @type SpMenuItem[] */
609		var items = [];
610		var rawItem = menuElem.children('li');
611		for (var i = 0, c = rawItem.length; i < c; i++) {
612			var el = rawItem.eq(i);
613			el.data('spMi', i);
614			items.push(new SpMenuItem(el, this));
615		}
616
617		var fallbackActiveItem = null;
618		var currentPageItems = menuElem.find("li.wb_this_page_menu_item");
619		var anchorItemMap = {};
620		currentPageItems.each(function() {
621			var item = $(this);
622			if( !fallbackActiveItem )
623				fallbackActiveItem = item;
624			var anchor = item.data("anchor") || "";
625			if( !anchorItemMap.hasOwnProperty(anchor) ) {
626				anchorItemMap[anchor] = item;
627				anchorItemMap[encodeURIComponent(anchor)] = item;
628				anchorItemMap[encodeURIComponent(anchor).replace(/%20/g, '+')] = item;
629			}
630		});
631
632		/** @type JQuery|null */
633		var _wrapperElem = null;
634		var _wrapper = false;
635		this.isWrapper = function() { return this._wrapper ? true : false; };
636		/**
637		 * @param {boolean} wrapper
638		 * @param {SpMenuItem} mi
639		 */
640		this.setWrapper = function(wrapper, mi) {
641			if (_wrapper == wrapper) return;
642			_wrapper = wrapper;
643			if (wrapper) {
644				if (!_wrapperElem) {
645					_wrapperElem = $('<div>')
646						.addClass('vmenu wb-menu-det')
647						.attr({id: this.menuId + '-det'})
648						.css({
649							position: 'absolute',
650							zIndex: 9999,
651							top: -20,
652							left: -20,
653							width: 1
654						})
655						.appendTo(document.body);
656					SpMenu.markMenu(_wrapperElem, this.menuId);
657				}
658				var pos = mi.elem.offset();
659				var width = mi.elem.outerWidth();
660				_wrapperElem.css({
661					left: pos.left + width - 1,
662					top: pos.top
663				});
664				_wrapperElem.append(menuElem);
665			} else {
666				elem.append(menuElem);
667			}
668		};
669		this.triggerHover = function(over, mi) {
670			if (!over) this.setWrapper(false, mi);
671		};
672		
673		this.isVertical = function() {
674			if (!this.parent) {
675				return isVertical;
676			} else if (this.parent.parent) {
677				return this.parent.parent.isVertical();
678			}
679			return false;
680		};
681
682		var _openLeft = false;
683		this.isOpenLeft = function() { return _openLeft; };
684		this.setOpenLeft = function(openLeft) {
685			if (_openLeft == openLeft) return;
686			_openLeft = openLeft;
687			if (openLeft) menuElem.addClass('open-left');
688			else menuElem.removeClass('open-left');
689		};
690
691		this.getLeft = function() { return menuElem.offset().left; };
692		this.getWidth = function() { return menuElem.outerWidth(true); };
693
694		var isExpanded = function() { return elem.is('.collapse-expanded'); };
695
696		var open = function() {
697			elem.addClass('collapse-expanded');
698			updateMenuPosition();
699			if (isLanding) onResize();
700		};
701		var close = function() {
702			elem.removeClass('collapse-expanded');
703		};
704
705		this.clearOpenLeft = function() {
706			this.setOpenLeft(false);
707			for (var i = 0; i < items.length; i++) {
708				if (items[i].subMenu) items[i].subMenu.clearOpenLeft();
709			}
710		};
711		this.closeAll = function() {
712			for (var i = 0; i < items.length; i++) {
713				var mi = items[i];
714				mi.setHover(false);
715				if (mi.subMenu) mi.subMenu.closeAll();
716			}
717		};
718		this.getItems = function() {
719			return items;
720		};
721
722		this.updateActiveItems = function(anchorsAbove, anchorsBelow) {
723			if( currentPageItems.length < 2 ) {
724				currentPageItems.addClass("active");
725			}
726			else {
727				currentPageItems.removeClass("active");
728				var searchFunc = function(anchorList) {
729					for( var i = 0, il = anchorList.length; i < il; i++ ) {
730						var anchor = anchorList[i];
731						if( !anchorItemMap.hasOwnProperty(anchor.name) )
732							continue;
733						anchorItemMap[anchor.name].addClass("active");
734						return true;
735					}
736					return false;
737				};
738				if( !searchFunc(anchorsAbove) )
739					if( !searchFunc(anchorsBelow) ) // Fallback if there are no menu items pointing to an anchor above current window scroll position (including menu item without anchor).
740						fallbackActiveItem.addClass("active"); // Fallback when menu has only invalid items pointing to non-existing anchors.
741			}
742		};
743
744		var isHover = false;
745		this.isHover = function() {
746			return isHover;
747		};
748
749		/**
750		 * @param {SpMenuItem} mi
751		 * @param {boolean} over
752		 */
753		var onHover = function(mi, over) {
754			if (over) {
755				mi.setHover(true);
756				lastOpenMi = mi;
757				
758				if (isExpanded()) {
759					mi.parent.clearOpenLeft();
760				}
761				else if (mi.subMenu) {
762					var subLeft = mi.subMenu.getLeft();
763					if (isVertical && mi.parent.isOpenLeft()) {
764						mi.subMenu.setOpenLeft(true);
765					}
766					else {
767						var ww = $(window).width();
768						var miParentLeft = mi.parent.getLeft();
769						var offset = (mi.parent && mi.parent.parent) ? mi.elem.width() : 0;
770						var sw = mi.subMenu.getWidth();
771						var miLeft = mi.elem.position().left;
772						mi.subMenu.setOpenLeft(miParentLeft + miLeft + offset + sw > ww);
773					}
774					mi.subMenu.setWrapper(isVertical, mi);
775				}
776			}
777			else {
778				mi.setHoverTimeout(false);
779			}
780		};
781
782		var onClick = function(mi) {
783			if (mi.isAnchor(true)) {
784				setTimeout(function() {
785					close();
786				}, 100);
787			}
788		};
789
790		var self = this;
791		/**
792		 * 
793		 * @param {SpMenuItem} mi
794		 * @param {JQueryEventObject} e
795		 */
796		var onHoverToggle = function(mi, e) {
797			var isOver = mi.isHover() || (isExpanded() && mi.isActive());
798
799			closeMenus(self);
800			var parentMatch = false;
801			var mip = mi;
802			while (true) {
803				if (mip === lastOpenMi) {
804					parentMatch = true;
805					break;
806				} else if (mip.parent) {
807					mip = mip.parent;
808				} else {
809					break;
810				}
811			}
812			if (lastOpenMi && !mi.parent && !parentMatch) {
813				lastOpenMi.setHoverTimeout(false);
814			}
815			if (!isOver && mi.subMenu) {
816				e.stopImmediatePropagation();
817				e.preventDefault();
818			}
819			onHover(mi, !isOver);
820		};
821
822		/** @returns SpMenu|null */
823		var inferMi = function(miElem) {
824			var idx = miElem.data('spMi');
825			if (typeof idx !== 'number' && typeof idx !== 'string') return null;
826			if (idx < 0 || idx >= items.length) return null;
827			return items[idx];
828		};
829
830		var ignoreHover = null;
831		menuElem
832			.on('mouseenter', function() {
833				if (!self.parent) return;
834				isHover = true;
835			})
836			.on('mouseleave', function() {
837				if (!self.parent) return;
838				isHover = false;
839				var hasHoverChild = false;
840				for (var i=0; i < items.length; i++) {
841					var item = items[i];
842					if (item.isHover()) {
843						hasHoverChild = true;
844						break;
845					}
846				}
847				if (!hasHoverChild) {
848					self.parent.setHover(false);
849				}
850			})
851			.on('click', '> li', function() {
852				var mi = inferMi($(this));
853				onClick(mi);
854			})
855			.on('mouseover', '> li', function() {
856				if (ignoreHover) return;
857				var mi = inferMi($(this));
858				if (!mi) return;
859				onHover(mi, true);
860			})
861			.on('mouseout', '> li', function() {
862				if (ignoreHover) return;
863				var mi = inferMi($(this));
864				if (!mi) return;
865				onHover(mi, false);
866			})
867			.on('touchstart', '> li > a', function(e) {
868				if (ignoreHover) clearTimeout(ignoreHover);
869				ignoreHover = setTimeout(function() { ignoreHover = null; }, 2000);
870				var mi = inferMi($(this).parent());
871				if (!mi) return;
872				onHoverToggle(mi, e);
873			});
874		if (!parent) SpMenu.registerMenu(this);
875	};
876	/** @type {[menuId: string]: SpMenu} */
877	var menuIdx = {};
878	/** @param {SpMenu} menu */
879	SpMenu.registerMenu = function(menu) {
880		menuList.push(menu);
881		menuIdx[menu.menuId] = menu;
882	};
883	SpMenu.markMenu = function(elem, menuId) {
884		elem.data('spMenu', menuId);
885	};
886	/**
887	 * @param {JQuery} elem
888	 * @returns {SpMenu|null}
889	 */
890	SpMenu.lookupMenu = function(elem) {
891		var menuId = elem.data('spMenu');
892		return (menuId in menuIdx) ? menuIdx[menuId] : null;
893	};
894
895	// Observe scrolling and body size change to correctly update active menu items with anchors.
896	SpMenu.updateActiveItems = function() {
897		var anchorsAbove = [], anchorsBelow = [];
898		anchorsAbove.push({name: "", delta: $(window).scrollTop()});
899		$("a.wb_anchor").each(function() {
900			var $this = $(this);
901			var anchor = $this.attr("name");
902			var offset = Math.round(this.getBoundingClientRect().top);
903			if( offset <= 3 )
904				anchorsAbove.push({name: anchor, delta: -offset});
905			else
906				anchorsBelow.push({name: anchor, delta: offset});
907		});
908		var sortFunc = function(a, b) {
909			if (a.delta === b.delta) {
910				if (a.name === "") return -1;
911				if (b.name === "") return 1;
912				return 0;
913			}
914			return (a.delta < b.delta) ? -1 : 1;
915		};
916		anchorsAbove.sort(sortFunc);
917		anchorsBelow.sort(sortFunc);
918		for( var i = 0, il = menuList.length; i < il; i++ )
919			menuList[i].updateActiveItems(anchorsAbove, anchorsBelow);
920	};
921	$(window).on("scroll orientationchange", SpMenu.updateActiveItems);
922	if( "ResizeObserver" in window ) {
923		(new ResizeObserver(SpMenu.updateActiveItems)).observe(document.body);
924	}
925	else {
926		var lastBodyHeight = null;
927		setInterval(function() {
928			if( document.body.clientHeight !== lastBodyHeight ) {
929				lastBodyHeight = document.body.clientHeight;
930				SpMenu.updateActiveItems();
931			}
932		}, 500);
933	}
934	setTimeout(SpMenu.updateActiveItems, 0);
935
936	$('.wb-menu').each(function() { new SpMenu($(this), null); });
937
938	$('.wb-menu-mobile').each(function() {
939		var elem = $(this);
940		var btn = elem.children('.btn-collapser').eq(0);
941		var isHeaderFixed = (elem.parents('.wb_header_fixed').length > 0);
942
943		var onResize = function() {
944			var ul = elem.children('ul');
945			ul.css('max-height', ($(window).scrollTop() - ul.offset().top + $(window).height() - 20) + 'px');
946		};
947		
948		var updateMenuPosition = function() {
949			var box = elem[0].getBoundingClientRect();
950			elem.children('ul:not(.vmenu)').css({
951				top: box.bottom, // (btn.offset().top + btn.outerHeight() - $(window).scrollTop()) + 'px'
952				'max-height': 'calc(98vh - ' + box.bottom + 'px)'
953			});
954		};
955		
956		btn.on('click', function(e) {
957			if (elem.hasClass('collapse-expanded')) {
958				elem.removeClass('collapse-expanded');
959			} else {
960				elem.addClass('collapse-expanded');
961				updateMenuPosition();
962				if (isHeaderFixed) onResize();
963			}
964		});
965		$(document).on('click', function(e) {
966			if (!$(e.target).is('#' + elem.attr('id') + ', #' + elem.attr('id') + ' *')) {
967				if (elem.hasClass('collapse-expanded')) {
968					elem.removeClass('collapse-expanded');
969				}
970				e.stopPropagation();
971			}
972		});
973
974		$(window)
975			.on("resize orientationchange", function() {
976				if (elem.hasClass('collapse-expanded')) {
977					elem.removeClass('collapse-expanded');
978				}
979				updateMenuPosition();
980				if( isHeaderFixed )
981					onResize();
982			})
983			.scroll(function() { updateMenuPosition(); });
984		
985		if( isHeaderFixed ) {
986			elem.find('li').on('click', function() {
987				elem.removeClass('collapse-expanded');
988			});
989		}
990	});
991
992	(function() {
993		if (!(typeof window.IntersectionObserver === 'function')) return;
994		var observer = new IntersectionObserver(function(entries) {
995			for (var i = 0, c = entries.length; i < c; i++) {
996				if (!entries[i].isIntersecting) continue;
997				var elem = $(entries[i].target);
998				if (elem.data('wbAnimEntry')) continue;
999				(function(elem) {
1000					var time = elem.attr('data-wb-anim-entry-time') * 1.0;
1001					var delay = elem.attr('data-wb-anim-entry-delay') * 1.0;
1002					elem.removeAttr('data-wb-anim-entry-time');
1003					elem.removeAttr('data-wb-anim-entry-delay');
1004					var funcStart = function() {
1005						elem.data('wbAnimEntry', '1')
1006							.addClass('wb-anim-entry-on')
1007							.removeClass('wb-anim-entry');
1008					};
1009					if (delay) setTimeout(funcStart, delay * 1000); else funcStart();
1010					if (time && !elem.hasClass('loop')) {
1011						setTimeout(
1012								function() { elem.removeClass('wb-anim-entry-on'); },
1013								(delay * 1000 + time * 1000) + 40);
1014					}
1015				})(elem);
1016			}
1017		}, {});
1018		$('.wb-anim-entry').each(function() { observer.observe(this); });
1019	})();
1020
1021	(function() {
1022		var $sticky = $(".wb-sticky");
1023		if( $sticky.length ) {
1024			var $anchors = $(".wb_anchor");
1025			var html = $('html').get(0);
1026			var $root = $(".root");
1027			var watcher = 0, retry = 0, lastSize;
1028			var stickyUpdateCalled = false;
1029			var stickyUpdate = function() {
1030				var clientWidth = html.clientWidth;
1031				var clientHeight = html.clientHeight;
1032
1033				let padding = {paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0};
1034				$sticky.each(function() {
1035					var $this = $(this);
1036					var hAlign = $this.data("hAlign"), vAlign = $this.data("vAlign");
1037					if( !hAlign || !vAlign )
1038						return;
1039					var rect = this.getBoundingClientRect(), v;
1040					var margin = {
1041						top: ((v = parseFloat($sticky.css('margin-top'))) && !isNaN(v)) ? v : 0,
1042						bottom: ((v = parseFloat($sticky.css('margin-bottom'))) && !isNaN(v)) ? v : 0,
1043						left: ((v = parseFloat($sticky.css('margin-left'))) && !isNaN(v)) ? v : 0,
1044						right: ((v = parseFloat($sticky.css('margin-right'))) && !isNaN(v)) ? v : 0
1045					};
1046					if( (rect.top - margin.top) <= 0 && (Math.round(rect.bottom) + margin.bottom) >= clientHeight ) {
1047						if( hAlign === "left" )
1048							padding.paddingLeft = Math.max(padding.paddingLeft, Math.round(rect.right));
1049						else if( hAlign === "right" )
1050							padding.paddingRight = Math.max(padding.paddingRight, Math.round(clientWidth - rect.left));
1051					}
1052					else if( (rect.left - margin.left) <= 0 && (Math.round(rect.right) + margin.right) >= clientWidth ) {
1053						if( vAlign === "top" )
1054							padding.paddingTop = Math.max(padding.paddingTop, Math.round(rect.bottom));
1055						else if( vAlign === "bottom" )
1056							padding.paddingBottom = Math.max(padding.paddingBottom, Math.round(clientHeight - rect.top));
1057					}
1058				});
1059
1060				$anchors.css({position: "relative", top: -padding.paddingTop});
1061				$root.css(padding);
1062				if (!stickyUpdateCalled) $root.addClass('root-padding-fixed');
1063				stickyUpdateCalled = true;
1064				return clientWidth + "," + clientHeight;
1065			};
1066			var animationWatcherFunc = function() {
1067				var size = stickyUpdate();
1068				if( size !== lastSize ) {
1069					retry = 0;
1070					watcher = requestAnimationFrame(animationWatcherFunc);
1071				}
1072				else if( ++retry <= 2 )
1073					watcher = requestAnimationFrame(animationWatcherFunc);
1074				else
1075					watcher = 0;
1076				lastSize = size;
1077			};
1078			var stickyUpdateCallback = function() {
1079				if( watcher )
1080					cancelAnimationFrame(watcher);
1081				lastSize = "";
1082				retry = 0;
1083				watcher = requestAnimationFrame(animationWatcherFunc);
1084			};
1085
1086			$(window).on("resize orientationchange", stickyUpdateCallback);
1087			stickyUpdateCallback();
1088			lastSize = stickyUpdate();
1089		}
1090	})();
1091
1092	(function() {
1093		var header = null, main = null, footer = null;
1094		$("#wb_root").children().each(function() {
1095			var $this = $(this);
1096			var id = "" + $this.attr("id");
1097			if( /^wb_header/.test(id) )
1098				header = $this;
1099			if( /^wb_main/.test(id) )
1100				main = $this;
1101			if( /^wb_footer/.test(id) )
1102				footer = $this;
1103		});
1104
1105		var updateMainBlockHeight = function() {
1106			if (!isPopupMode && (!main || !header || !footer)) return;
1107			var mainMargins = main.outerHeight(true) - main.outerHeight(false);
1108			var minMainBlockHeight = window.innerHeight - mainMargins;
1109			if (!isPopupMode) {
1110				var headerHeight = header.hasClass('wb_header_fixed') ? 0 : header.outerHeight(true);
1111				minMainBlockHeight = minMainBlockHeight - headerHeight - footer.outerHeight(true);
1112			}
1113			var mainBlockHeight = parseInt(main.get(0).style.height);
1114			if (!mainBlockHeight) mainBlockHeight = 0;
1115			main.css('min-height', Math.max(minMainBlockHeight, mainBlockHeight) + 'px');
1116		};
1117		$(window).on('resize', updateMainBlockHeight);
1118		$(window).on('load', updateMainBlockHeight)
1119		updateMainBlockHeight();
1120		setTimeout(function() { updateMainBlockHeight(); }, 100);
1121		setTimeout(function() { updateMainBlockHeight(); }, 300);
1122		setTimeout(function() { updateMainBlockHeight(); }, 1000);
1123	})();
1124
1125	$(window).trigger('hashchange');
1126
1127	$(document).on('mousedown', '.ecwid a', function() {
1128		var href = $(this).attr('href');
1129		if (href && href.indexOf('#!') === 0) {
1130			var url = decodeURIComponent(location.pathname) + href;
1131			$(this).attr('href', url);
1132		}
1133	});
1134	
1135	(function() {
1136		$('.wb_anchor').each(function() {
1137			try {
1138				var anchor = $(this);
1139				var target = $('[href="#' + this.name + '"]');
1140				if (!target.length)
1141					target = $('[href="#' + decodeURIComponent(this.name) + '"]');
1142				if (!target.length)
1143					target = $('[href="#' + encodeURIComponent(this.name) + '"]');
1144				if (target.length) {
1145					target.each(function() {
1146						$(this).on('click', function() {
1147							$(window).scrollTop(anchor.offset().top);
1148						});
1149					});
1150				}
1151			} catch (e) {}
1152		});
1153	})();
1154	
1155	(function() {
1156		var recaptchaList = $('.wb_form_captcha');
1157		var defaultRecaptchaWidth = 304;
1158		if (recaptchaList.length) {
1159			var resizeCaptcha = function() {
1160				recaptchaList.each(function() {
1161					var recaptcha = $(this);
1162					if (recaptcha.is(':visible')) {
1163						var form = recaptcha.parents('.wb_form');
1164						var fw = form.outerWidth();
1165						var scale = Math.min(fw / defaultRecaptchaWidth, 1);
1166						var scaleCss = 'scale(' + scale + ')';
1167						if (scale > 0) {
1168							recaptcha.css({
1169								'transform': scaleCss,
1170								'-o-transform': scaleCss,
1171								'-ms-transform': scaleCss,
1172								'-moz-transform': scaleCss,
1173								'-webkit-transform': scaleCss,
1174								'max-width': (fw * scale) + 'px'
1175							});
1176						}
1177					}
1178				});
1179			};
1180			$(window).on('resize', resizeCaptcha);
1181			setTimeout(function() {
1182				resizeCaptcha();
1183			}, 500);
1184		}
1185	})();
1186
1187	(function() {
1188		var updatePositionFixed = function() {
1189			if (isTouchDevice()) {
1190				if (isIOS() && !window.MSStream) {
1191					$('body').addClass('wb_no_bg_fixed');
1192				}
1193				var pageCssSheet, sheet;
1194				for (var i = 0; i < document.styleSheets.length; i++) {
1195					sheet = document.styleSheets[i];
1196					if (sheet.ownerNode && sheet.ownerNode.getAttribute('id') === 'wb-page-stylesheet') {
1197						pageCssSheet = sheet; break;
1198					}
1199				}
1200				if (!pageCssSheet) return;
1201				
1202				var rules = (!pageCssSheet.href || pageCssSheet.href.indexOf(location.origin) > -1)
1203						? (pageCssSheet.cssRules || pageCssSheet.rules) : [];
1204				if (!rules) return;
1205				
1206				var fixedBgCss;
1207				for (i = 0; i < rules.length; i++) {
1208					if (rules[i].selectorText === 'body.site::before') {
1209						if (/\bfixed\b/i.test(rules[i].cssText)) {
1210							fixedBgCss = rules[i].cssText;
1211							pageCssSheet.deleteRule(i);
1212							break;
1213						}
1214					}
1215				}
1216				if (fixedBgCss) {
1217					var css = fixedBgCss.match(/\{(.+)\}/)[1].replace(/\bfixed\b/i, 'scroll');
1218					css += ' position: fixed';
1219					$('<div class="wb_fixed_bg_hack">').prependTo('body');
1220					pageCssSheet.addRule('.wb_fixed_bg_hack', css);
1221				}
1222			}
1223		};
1224		updatePositionFixed();
1225	})();
1226
1227	(function() {
1228		var baseUrl = $('head base').attr('href');
1229		var convertLinks = function(link) {
1230			$(link || 'a[data-popup-processed!="true"]').each(function() {
1231				var a = $(this);
1232				var href = a.attr('href');
1233				if (/^wb_popup:([^;]*);/.test(href)) {
1234					var url = RegExp.$1, w, h;
1235					var parts = href.split(';');
1236					for (var i = 0; i < parts.length; i++) {
1237						var pp = parts[i].split('=');
1238						if (pp.length !== 2 || !parseInt(pp[1])) continue;
1239						if (pp[0] === 'w') w = parseInt(pp[1]);
1240						else if (pp[0] === 'h') h = parseInt(pp[1]);
1241					}
1242					if (!/^https?:\/\//.test(url)) {
1243						url = baseUrl + url;
1244					}
1245
1246					(function(url, w, h) {
1247						var func = function(e) {
1248							e.stopImmediatePropagation();
1249							e.preventDefault();
1250
1251							if (!isPopupMode) {
1252								wb_show_popup(url, w, h);
1253							} else if (window !== window.parent && window.parent.postMessage) {
1254								window.parent.postMessage({event: 'wb_show_popup', data: {url: url, width: w, height: h}});
1255							}
1256						};
1257						a.data("wbpopfunc", func).on('click', func);
1258					})(url, w, h);
1259					a.attr('data-popup-url', a.attr('href'));
1260					a.attr('href', 'javascript:void(0)');
1261					a.removeAttr('target');
1262					a.attr('data-is-popup', 'true');
1263				}
1264				else if (isPopupMode) {
1265					var target = a.attr('target');
1266					if (!target || target === '_self') {
1267						a.attr('target', '_parent');
1268					}
1269				}
1270				a.attr('data-popup-processed', 'true');
1271			});
1272		};
1273		convertLinks();
1274		setTimeout(convertLinks, 100);
1275		if (window.wbmodGalleryLib) {
1276			setTimeout(function() {
1277				var galleryList = window.wbmodGalleryLib.getGalleryLibList();
1278				for (var i=0; i < galleryList.length; i++) {
1279					galleryList[i].onImageDisplayed = function() {
1280						convertLinks();
1281					};
1282				}
1283			}, 500);
1284		}
1285		
1286		if (openPopupPageUrl && !isPopupMode) {
1287			setTimeout(function() {
1288				wb_show_popup(openPopupPageUrl, openPopupPageWidth, openPopupPageHeight);
1289			}, 1000);
1290		}
1291
1292		window.initLink = function(link) {
1293			var $link = $(link);
1294			var func = $link.data("wbpopfunc");
1295			if( func )
1296				$link.off("click", func); // make sure that event is no longer listened since store gallery reuses same link element
1297			$link.removeAttr("data-popup-processed").removeAttr("data-is-popup");
1298			convertLinks(link);
1299		};
1300	})();
1301
1302	(function() {
1303		$("[data-enlarge-src]").css("cursor", "pointer").on("click touchstart touchend touchmove", function(e) {
1304			var $this = $(this);
1305			if (e.type === "touchstart") {
1306				$this.data("pswpDisabled", false);
1307			} else if (e.type === "touchmove") {
1308				$this.data("pswpDisabled", true);
1309			}
1310			if ((e.type === "click" || e.type === "touchend") && !$(this).data("pswpDisabled")) {
1311				if ($this.data("clicked")) return;
1312				$this.data("clicked", true);
1313				var img = new Image();
1314				img.onload = function() {
1315					(new PhotoSwipe($('body > .pswp').get(0), PhotoSwipeUI_Default, [{
1316						src: this.src,
1317						w: this.width,
1318						h: this.height,
1319						msrc: this.src
1320					}], { index: 0 })).init();
1321					$this.data("clicked", false);
1322				};
1323				img.src = $this.attr("data-enlarge-src");
1324			}
1325		});
1326	})();
1327
1328	(function() {
1329		var ignoreTags = ["A", "FORM", "INPUT", "SELECT", "TEXTAREA"];
1330		$(".wb-layout-link").each(function() {
1331			var $link = $(this);
1332			$link.parent().children(".wb_content").on("click", function(e) {
1333				for( var target = e.target; target && target !== this; target = target.parentNode ) {
1334					if( ignoreTags.indexOf(target.tagName) >= 0 || /wb-prevent-layout-click/.test(target.getAttribute("class") || "") )
1335						return;
1336				}
1337				// $link.click();
1338				e.stopImmediatePropagation();
1339				e.preventDefault();
1340				var href = $link.attr("href");
1341				if( href.indexOf(":") < 0 ) {
1342					var baseUrl = $("base").attr("href");
1343					href = baseUrl + href;
1344				}
1345				if( href === "javascript:void(0)" )
1346					$link.click();
1347				else if( $link.attr("target") === "_blank" || (e.type === "click" && (e.button === 1 || e.ctrlKey)) || ("wbPreview" in window && window.wbPreview && window.location.protocol === "https:" && /http:/.test(href)) )
1348					window.open(href, void 0, "noopener");
1349				else
1350					window.location.href = href;
1351			});
1352		});
1353	})();
1354
1355	(function() {
1356		if ((typeof window.IntersectionObserver === 'function')) {
1357			var observer = new IntersectionObserver(function(entries) {
1358				for (var i = 0, c = entries.length; i < c; i++) {
1359					if (!entries[i].isIntersecting) continue;
1360					/** @type {HTMLElement} */
1361					var elem = entries[i].target;
1362					var src = elem.getAttribute('data-src');
1363					if (src) {
1364						elem.removeAttribute('data-defer-load');
1365						elem.removeAttribute('data-src');
1366						elem.src = src;
1367					}
1368				}
1369			}, {});
1370			$('[data-defer-load]').each(function() { observer.observe(this); });
1371		} else {
1372			$('[data-defer-load]').each(function() {
1373				/** @type {HTMLElement} */
1374				var elem = this;
1375				var src = elem.getAttribute('data-src');
1376				if (src) {
1377					elem.removeAttribute('data-defer-load');
1378					elem.removeAttribute('data-src');
1379					elem.src = src;
1380				}
1381			});
1382		}
1383	})();
1384
1385	(function() {
1386		// Apply smooth scrolling with the delay.
1387		// This is because if the page is opened with an anchor,
1388		// then it starts scrolling with a big delay, waiting
1389		// for the page to completely load.
1390		setTimeout(function() {
1391			$('html').css('scroll-behavior', 'smooth');
1392		}, 500);
1393	})();
1394});

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.