PageSourceSearch

https://www.sjovar.fo/ease/3rdparty/js/Qodio/q.lazyloadator.jquery.js?v=3.20.0.14_0

js sjovar.fo collected 2026-10-03 00:37:25 UTC 3,055 bytes, 94 lines download raw bytes

1/*
2 LazyLoadator jQuery Plugin
3 LazyLoadator is a jQuery-based plugin for lazy loading images.
4 version 1.0, Nov 11th, 2017
5 by Ingi á Steinamørk
6
7 The MIT License (MIT)
8
9 Copyright (c) 2017 QODIO
10
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 SOFTWARE.
28 */
29
30
31var LazyLoadator = typeof LazyLoadator !== 'undefined' ? LazyLoadator : {};
32
33$(function () {
34	LazyLoadator = $.extend({}, {
35		timer:           null,
36		busy:            false,
37		refresh:         function () {}
38	}, typeof LazyLoadator !== 'undefined' ? LazyLoadator : {});
39
40	LazyLoadator.refresh = function () {
41		var $window = $(window);
42		var i = 0;
43		var window_bottom = $window.height();
44
45		$('.lazyloadator').each(function () {
46			i++;
47			var element = this;
48			var $element = $(element);
49			var element_bounding = element.getBoundingClientRect();
50
51			if (
52				(element_bounding.top < (window_bottom + 1000)) 
53				&& 
54				(element_bounding.bottom > -1000) ) {
55
56				// Make sure busy is defined
57				if (typeof $element.data('busy') === 'undefined') {
58					$element.data('busy', false)
59				}
60
61				// If data-src is defined
62				if ($element.attr('data-src')) {
63					if (!$element.data('busy')) {
64						$element.data('busy', true);
65						var image = new Image();
66						image.onload = function () {
67							if ($element.prop('tagName').toLowerCase() === 'img') {
68								$element.attr('src', $element.attr('data-src')).removeAttr('data-src');
69							} else {
70								$element.css('background-image', 'url(\'' + $element.attr('data-src') + '\')').removeAttr('data-src');
71							}
72							$element.removeClass('lazyloadator');
73						};
74						image.src = $element.attr('data-src');
75					}
76
77				// If no data-src is defined
78				} else {
79					$element.removeClass('lazyloadator');
80				}
81			}
82		});
83	};
84
85	$(window).on('scroll resize load ready', function () {
86		if (!LazyLoadator.busy) {
87			LazyLoadator.busy = true;
88			setTimeout(function () {
89				LazyLoadator.busy = false;
90				LazyLoadator.refresh();
91			}, 500);
92		}
93	});
94});

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.