PageSourceSearch

https://cebr.com/wp-content/themes/cebr/js/viewpointchecker.js?ver=7.1.2

js cebr.com collected 2026-10-02 03:29:08 UTC 2,718 bytes, 69 lines download raw bytes

1/*
2    Version 1.3.2
3    The MIT License (MIT)
4
5    Copyright (c) 2014 Dirk Groenen
6
7    Permission is hereby granted, free of charge, to any person obtaining a copy of
8    this software and associated documentation files (the "Software"), to deal in
9    the Software without restriction, including without limitation the rights to
10    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11    the Software, and to permit persons to whom the Software is furnished to do so,
12    subject to the following conditions:
13
14    The above copyright notice and this permission notice shall be included in all
15    copies or substantial portions of the Software.
16*/
17
18(function($){
19    $.fn.viewportChecker = function(useroptions){
20        // Define options and extend with user
21        var options = {
22            classToAdd: 'visible1',
23            offset: 0,
24            callbackFunction: function(elem){}
25        };
26        $.extend(options, useroptions);
27
28        // Cache the given element and height of the browser
29        var $elem = this,
30            windowHeight = $(window).height();
31
32        this.checkElements = function(){
33            // Set some vars to check with
34            var scrollElem = document.scrollingElement ? document.scrollingElement :  ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html');
35                viewportTop = $(scrollElem).scrollTop(),
36                viewportBottom = (viewportTop + windowHeight);
37                
38
39            $elem.each(function(){
40                var $obj = $(this);
41                // If class already exists; quit
42                if ($obj.hasClass(options.classToAdd)){
43                    return;
44                }
45
46                // define the top position of the element and include the offset which makes is appear earlier or later
47                var elemTop = Math.round( $obj.offset().top ) + options.offset,
48                    elemBottom = elemTop + ($obj.height());
49
50                // Add class if in viewport
51                if ((elemTop < viewportBottom) && (elemBottom > viewportTop)){
52                    $obj.addClass(options.classToAdd);
53
54                    // Do the callback function. Callback wil send the jQuery object as parameter
55                    options.callbackFunction($obj);
56                }
57            });
58        };
59
60        // Run checkelements on load and scroll
61        $(window).scroll(this.checkElements);
62        this.checkElements();
63
64        // On resize change the height var
65        $(window).resize(function(e){
66            windowHeight = e.currentTarget.innerHeight;
67        });
68    };
69})(jQuery);

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.