PageSourceSearch

https://www.ibsl.lk/wp-content/themes/educrat/js/jquery.unveil.js?ver=1.1.0

js ibsl.lk collected 2026-09-28 12:42:01 UTC 1,859 bytes, 71 lines download raw bytes

1/**
2 * jQuery Unveil
3 * A very lightweight jQuery plugin to lazy load images
4 * http://luis-almeida.github.com/unveil
5 *
6 * Licensed under the MIT license.
7 * Copyright 2013 Luís Almeida
8 * https://github.com/luis-almeida
9 */
10
11;(function($) {
12  "use strict";
13  $.fn.unveil = function(threshold, callback) {
14
15    var $w = $(window),
16        th = threshold || 0,
17        retina = window.devicePixelRatio > 1,
18        attrib = retina? "data-src-retina" : "data-src",
19        attrsrcset = "data-srcset",
20        attrsizes = "data-sizes",
21        images = this,
22        loaded;
23
24    this.one("unveil", function() {
25      var source = this.getAttribute(attrib);
26      source = source || this.getAttribute("data-src");
27      if (source) {
28        this.setAttribute("src", source);
29
30        var source_srcset = this.getAttribute(attrsrcset);
31        source_srcset = source_srcset || this.getAttribute("data-srcset");
32        if (source_srcset) {
33          this.setAttribute("srcset", source_srcset);
34        }
35
36        var source_sizes = this.getAttribute(attrsizes);
37        source_sizes = source_sizes || this.getAttribute("data-sizes");
38        if (source_sizes) {
39          this.setAttribute("sizes", source_sizes);
40        }
41
42        if (typeof callback === "function") callback.call(this);
43      }
44    });
45
46    function unveil() {
47      var inview = images.filter(function() {
48        var $e = $(this);
49        if ($e.is(":hidden")) return;
50
51        var wt = $w.scrollTop(),
52            wb = wt + $w.height(),
53            et = $e.offset().top,
54            eb = et + $e.height();
55
56        return eb >= wt - th && et <= wb + th;
57      });
58
59      loaded = inview.trigger("unveil");
60      images = images.not(loaded);
61    }
62
63    $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
64
65    unveil();
66
67    return this;
68
69  };
70
71})(window.jQuery || window.Zepto);

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.