PageSourceSearch

https://aluminium-journal.de/themes/contrib/svg_base_theme_v1/js/countUp.umd.js?tlnqeg

js aluminium-journal.de collected 2026-09-25 07:35:14 UTC 13,454 bytes, 311 lines download raw bytes

vendor: 6,429 bytes, lines 1-137
1(function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.countUp = {}));
5})(this, (function (exports) { 'use strict';
6
7    var __assign = (undefined && undefined.__assign) || function () {
8        __assign = Object.assign || function(t) {
9            for (var s, i = 1, n = arguments.length; i < n; i++) {
10                s = arguments[i];
11                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12                    t[p] = s[p];
13            }
14            return t;
15        };
16        return __assign.apply(this, arguments);
17    };
18    // playground: stackblitz.com/edit/countup-typescript
19    var CountUp = /** @class */ (function () {
20        function CountUp(target, endVal, options) {
21            var _this = this;
22            this.endVal = endVal;
23            this.options = options;
24            this.version = '2.6.0';
25            this.defaults = {
26                startVal: 0,
27                decimalPlaces: 0,
28                duration: 2,
29                useEasing: true,
30                useGrouping: true,
31                useIndianSeparators: false,
32                smartEasingThreshold: 999,
33                smartEasingAmount: 333,
34                separator: ',',
35                decimal: '.',
36                prefix: '',
37                suffix: '',
38                enableScrollSpy: false,
39                scrollSpyDelay: 200,
40                scrollSpyOnce: false,
41            };
42            this.finalEndVal = null; // for smart easing
43            this.useEasing = true;
44            this.countDown = false;
45            this.error = '';
46            this.startVal = 0;
47            this.paused = true;
48            this.once = false;
49            this.count = function (timestamp) {
50                if (!_this.startTime) {
51                    _this.startTime = timestamp;
52                }
53                var progress = timestamp - _this.startTime;
54                _this.remaining = _this.duration - progress;
55                // to ease or not to ease
56                if (_this.useEasing) {
57                    if (_this.countDown) {
58                        _this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration);
59                    }
60                    else {
61                        _this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration);
62                    }
63                }
64                else {
65                    _this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration);
66                }
67                // don't go past endVal since progress can exceed duration in the last frame
68                var wentPast = _this.countDown ? _this.frameVal < _this.endVal : _this.frameVal > _this.endVal;
69                _this.frameVal = wentPast ? _this.endVal : _this.frameVal;
70                // decimal
71                _this.frameVal = Number(_this.frameVal.toFixed(_this.options.decimalPlaces));
72                // format and print value
73                _this.printValue(_this.frameVal);
74                // whether to continue
75                if (progress < _this.duration) {
76                    _this.rAF = requestAnimationFrame(_this.count);
77                }
78                else if (_this.finalEndVal !== null) {
79                    // smart easing
80                    _this.update(_this.finalEndVal);
81                }
82                else {
83                    if (_this.options.onCompleteCallback) {
84                        _this.options.onCompleteCallback();
85                    }
86                }
87            };
88            // default format and easing functions
89            this.formatNumber = function (num) {
90                var neg = (num < 0) ? '-' : '';
91                var result, x1, x2, x3;
92                result = Math.abs(num).toFixed(_this.options.decimalPlaces);
93                result += '';
94                var x = result.split('.');
95                x1 = x[0];
96                x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
97                if (_this.options.useGrouping) {
98                    x3 = '';
99                    var factor = 3, j = 0;
100                    for (var i = 0, len = x1.length; i < len; ++i) {
101                        if (_this.options.useIndianSeparators && i === 4) {
102                            factor = 2;
103                            j = 1;
104                        }
105                        if (i !== 0 && (j % factor) === 0) {
106                            x3 = _this.options.separator + x3;
107                        }
108                        j++;
109                        x3 = x1[len - i - 1] + x3;
110                    }
111                    x1 = x3;
112                }
113                // optional numeral substitution
114                if (_this.options.numerals && _this.options.numerals.length) {
115                    x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
116                    x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
117                }
118                return neg + _this.options.prefix + x1 + x2 + _this.options.suffix;
119            };
120            // t: current time, b: beginning value, c: change in value, d: duration
121            this.easeOutExpo = function (t, b, c, d) {
122                return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
123            };
124            this.options = __assign(__assign({}, this.defaults), options);
125            this.formattingFn = (this.options.formattingFn) ?
126                this.options.formattingFn : this.formatNumber;
127            this.easingFn = (this.options.easingFn) ?
128                this.options.easingFn : this.easeOutExpo;
129            this.startVal = this.validateValue(this.options.startVal);
130            this.frameVal = this.startVal;
131            this.endVal = this.validateValue(endVal);
132            this.options.decimalPlaces = Math.max(this.options.decimalPlaces);
133            this.resetDuration();
134            this.options.separator = String(this.options.separator);
135            this.useEasing = this.options.useEasing;
136            if (this.options.separator === '') {
137                this.options.useGrouping = false;
138            }
139            this.el = (typeof target === 'string') ? document.getElementById(target) : target;
140            if (this.el) {
141                this.printValue(this.startVal);
142            }
143            else {
144                this.error = '[CountUp] target is null or undefined';
145            }
146            // scroll spy
147            if (typeof window !== 'undefined' && this.options.enableScrollSpy) {
148                if (!this.error) {
149                    // set up global array of onscroll functions to handle multiple instances
150                    window['onScrollFns'] = window['onScrollFns'] || [];
151                    window['onScrollFns'].push(function () { return _this.handleScroll(_this); });
152                    window.onscroll = function () {
153                        window['onScrollFns'].forEach(function (fn) { return fn(); });
154                    };
155                    this.handleScroll(this);
156                }
157                else {
158                    console.error(this.error, target);
159                }
160            }
161        }
162        CountUp.prototype.handleScroll = function (self) {
163            if (!self || !window || self.once)
164                return;
165            var bottomOfScroll = window.innerHeight + window.scrollY;
166            var rect = self.el.getBoundingClientRect();
167            var topOfEl = rect.top + window.pageYOffset;
168            var bottomOfEl = rect.top + rect.height + window.pageYOffset;
169            if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
170                // in view
171                self.paused = false;
172                setTimeout(function () { return self.start(); }, self.options.scrollSpyDelay);
173                if (self.options.scrollSpyOnce)
174                    self.once = true;
175            }
176            else if ((window.scrollY > bottomOfEl || topOfEl > bottomOfScroll) &&
177                !self.paused) {
178                // out of view
179                self.reset();
180            }
181        };
182        /**
183         * Smart easing works by breaking the animation into 2 parts, the second part being the
184         * smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
185         * by disabling easing for the first part and enabling it on the second part. It is used if
186         * usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
187         */
188        CountUp.prototype.determineDirectionAndSmartEasing = function () {
189            var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
190            this.countDown = (this.startVal > end);
191            var animateAmount = end - this.startVal;
192            if (Math.abs(animateAmount) > this.options.smartEasingThreshold && this.options.useEasing) {
193                this.finalEndVal = end;
194                var up = (this.countDown) ? 1 : -1;
195                this.endVal = end + (up * this.options.smartEasingAmount);
196                this.duration = this.duration / 2;
197            }
198            else {
199                this.endVal = end;
200                this.finalEndVal = null;
201            }
202            if (this.finalEndVal !== null) {
203                // setting finalEndVal indicates smart easing
204                this.useEasing = false;
205            }
206            else {
207                this.useEasing = this.options.useEasing;
208            }
209        };
210        // start animation
211        CountUp.prototype.start = function (callback) {
212            if (this.error) {
213                return;
214            }
215            if (callback) {
216                this.options.onCompleteCallback = callback;
217            }
218            if (this.duration > 0) {
219                this.determineDirectionAndSmartEasing();
220                this.paused = false;
221                this.rAF = requestAnimationFrame(this.count);
222            }
223            else {
224                this.printValue(this.endVal);
225            }
226        };
227        // pause/resume animation
228        CountUp.prototype.pauseResume = function () {
229            if (!this.paused) {
230                cancelAnimationFrame(this.rAF);
231            }
232            else {
233                this.startTime = null;
234                this.duration = this.remaining;
235                this.startVal = this.frameVal;
236                this.determineDirectionAndSmartEasing();
237                this.rAF = requestAnimationFrame(this.count);
238            }
239            this.paused = !this.paused;
240        };
241        // reset to startVal so animation can be run again
242        CountUp.prototype.reset = function () {
243            cancelAnimationFrame(this.rAF);
244            this.paused = true;
245            this.resetDuration();
246            this.startVal = this.validateValue(this.options.startVal);
247            this.frameVal = this.startVal;
248            this.printValue(this.startVal);
249        };
250        // pass a new endVal and start animation
251        CountUp.prototype.update = function (newEndVal) {
252            cancelAnimationFrame(this.rAF);
253            this.startTime = null;
254            this.endVal = this.validateValue(newEndVal);
255            if (this.endVal === this.frameVal) {
256                return;
257            }
258            this.startVal = this.frameVal;
259            if (this.finalEndVal == null) {
260                this.resetDuration();
261            }
262            this.finalEndVal = null;
263            this.determineDirectionAndSmartEasing();
264            this.rAF = requestAnimationFrame(this.count);
265        };
266        CountUp.prototype.printValue = function (val) {
267            var _a;
268            if (!this.el)
269                return;
270            var result = this.formattingFn(val);
271            if ((_a = this.options.plugin) === null || _a === void 0 ? void 0 : _a.render) {
272                this.options.plugin.render(this.el, result);
273                return;
274            }
275            if (this.el.tagName === 'INPUT') {
276                var input = this.el;
277                input.value = result;
278            }
279            else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') {
280                this.el.textContent = result;
281            }
282            else {
283                this.el.innerHTML = result;
284            }
285        };
286        CountUp.prototype.ensureNumber = function (n) {
287            return (typeof n === 'number' && !isNaN(n));
288        };
289        CountUp.prototype.validateValue = function (value) {
290            var newValue = Number(value);
291            if (!this.ensureNumber(newValue)) {
292                this.error = "[CountUp] invalid start or end value: ".concat(value);
293                return null;
294            }
295            else {
296                return newValue;
297            }
298        };
299        CountUp.prototype.resetDuration = function () {
300            this.startTime = null;
301            this.duration = Number(this.options.duration) * 1000;
302            this.remaining = this.duration;
303        };
304        return CountUp;
305    }());
306
307    exports.CountUp = CountUp;
308
309    Object.defineProperty(exports, '__esModule', { value: true });
310
311}));

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.