PageSourceSearch

https://symphosize.com/wp-content/themes/cadillac/js/appear.js?ver=1.0

js symphosize.com collected 2026-10-04 22:29:28 UTC 6,275 bytes, 215 lines download raw bytes

vendor: 4,338 bytes, lines 1-148
1/*
2 * jQuery.appear
3 * https://github.com/bas2k/jquery.appear/
4 * http://code.google.com/p/jquery-appear/
5 *
6 * Copyright (c) 2009 Michael Hixson
7 * Copyright (c) 2012 Alexander Brovikov
8 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
9 */
10(function($) {
11    $.fn.appear = function(fn, options) {
12
13        var settings = $.extend({
14
15            //arbitrary data to pass to fn
16            data: undefined,
17
18            //call fn only on the first appear?
19            one: true,
20
21            // X & Y accuracy
22            accX: 0,
23            accY: 0
24
25        }, options);
26
27        return this.each(function() {
28
29            var t = $(this);
30
31            //whether the element is currently visible
32            t.appeared = false;
33
34            if (!fn) {
35
36                //trigger the custom event
37                t.trigger('appear', settings.data);
38                return;
39            }
40
41            var w = $(window);
42
43            //fires the appear event when appropriate
44            var check = function() {
45
46                //is the element hidden?
47                if (!t.is(':visible')) {
48
49                    //it became hidden
50                    t.appeared = false;
51                    return;
52                }
53
54                //is the element inside the visible window?
55                var a = w.scrollLeft();
56                var b = w.scrollTop();
57                var o = t.offset();
58                var x = o.left;
59                var y = o.top;
60
61                var ax = settings.accX;
62                var ay = settings.accY;
63                var th = t.height();
64                var wh = w.height();
65                var tw = t.width();
66                var ww = w.width();
67
68                if (y + th + ay >= b &&
69                    y <= b + wh + ay &&
70                    x + tw + ax >= a &&
71                    x <= a + ww + ax) {
72
73                    //trigger the custom event
74                    if (!t.appeared) t.trigger('appear', settings.data);
75
76                } else {
77
78                    //it scrolled out of view
79                    t.appeared = false;
80                }
81            };
82
83            //create a modified fn with some additional logic
84            var modifiedFn = function() {
85
86                //mark the element as visible
87                t.appeared = true;
88
89                //is this supposed to happen only once?
90                if (settings.one) {
91
92                    //remove the check
93                    w.unbind('scroll', check);
94                    var i = $.inArray(check, $.fn.appear.checks);
95                    if (i >= 0) $.fn.appear.checks.splice(i, 1);
96                }
97
98                //trigger the original fn
99                fn.apply(this, arguments);
100            };
101
102            //bind the modified fn to the element
103            if (settings.one) t.one('appear', settings.data, modifiedFn);
104            else t.bind('appear', settings.data, modifiedFn);
105
106            //check whenever the window scrolls
107            w.scroll(check);
108
109            //check whenever the dom changes
110            $.fn.appear.checks.push(check);
111
112            //check now
113            (check)();
114        });
115    };
116
117    //keep a queue of appearance checks
118    $.extend($.fn.appear, {
119
120        checks: [],
121        timeout: null,
122
123        //process the queue
124        checkAll: function() {
125            var length = $.fn.appear.checks.length;
126            if (length > 0) while (length--) ($.fn.appear.checks[length])();
127        },
128
129        //check the queue asynchronously
130        run: function() {
131            if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
132            $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
133        }
134    });
135
136    //run checks when these methods are called
137    $.each(['append', 'prepend', 'after', 'before', 'attr',
138        'removeAttr', 'addClass', 'removeClass', 'toggleClass',
139        'remove', 'css', 'show', 'hide'], function(i, n) {
140        var old = $.fn[n];
141        if (old) {
142            $.fn[n] = function() {
143                var r = old.apply(this, arguments);
144                $.fn.appear.run();
145                return r;
146            }
147        }
148    });
149
150})(jQuery);
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170(function($) {
171    $.fn.countTo = function(options) {
172        // merge the default plugin settings with the custom options
173        options = $.extend({}, $.fn.countTo.defaults, options || {});
174
175        // how many times to update the value, and how much to increment the value on each update
176        var loops = Math.ceil(options.speed / options.refreshInterval),
177            increment = (options.to - options.from) / loops;
178
179        return $(this).each(function() {
180            var _this = this,
181                loopCount = 0,
182                value = options.from,
183                interval = setInterval(updateTimer, options.refreshInterval);
184
185            function updateTimer() {
186                value += increment;
187                loopCount++;
188                $(_this).html(value.toFixed(options.decimals));
189
190                if (typeof(options.onUpdate) == 'function') {
191                    options.onUpdate.call(_this, value);
192                }
193
194                if (loopCount >= loops) {
195                    clearInterval(interval);
196                    value = options.to;
197
198                    if (typeof(options.onComplete) == 'function') {
199                        options.onComplete.call(_this, value);
200                    }
201                }
202            }
203        });
204    };
205
206    $.fn.countTo.defaults = {
207        from: 0,  // the number the element should start at
208        to: 100,  // the number the element should end at
209        speed: 1000,  // how long it should take to count between the target numbers
210        refreshInterval: 100,  // how often the element should be updated
211        decimals: 0,  // the number of decimal places to show
212        onUpdate: null,  // callback method for every time the element is updated,
213        onComplete: null,  // callback method for when the element finishes updating
214    };
215})(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.