PageSourceSearch

https://munksjo.com/wp-content/themes/uncode/library/js/lib/jquery.counterup.js?ver=1636484219

js munksjo.com collected 2026-10-02 11:12:46 UTC 2,418 bytes, 81 lines download raw bytes

1/*!
2 * jquery.counterup.js 1.0
3 *
4 * Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
5 * Released under the GPL v2 License
6 *
7 * Date: Nov 26, 2013
8 */
9(function($) {
10	"use strict";
11	$.fn.counterUp = function(options) {
12		// Defaults
13		var settings = $.extend({
14			'time': 400,
15			'delay': 10
16		}, options);
17		return this.each(function() {
18			// Store the object
19			var $this = $(this);
20			var $settings = settings;
21			var counterUpper = function() {
22				var nums = [];
23				var divisions = $settings.time / $settings.delay;
24				var numReal = $this.attr('data-val'),
25				num = numReal;
26				var isComma = /[0-9]+,[0-9]+/.test(num);
27				num = num.replace(/,/g, '');
28				var isInt = /^[0-9]+$/.test(num);
29				var isFloat = /^[0-9]+\.[0-9]+$/.test(num);
30				var decimalPlaces = isFloat ? (num.split('.')[1] || []).length : 0;
31				// Generate list of incremental numbers to display
32				for (var i = divisions; i >= 1; i--) {
33					// Preserve as int if input was int
34					var newNum = parseInt(num / divisions * i);
35					// Preserve float if input was float
36					if (isFloat) {
37						newNum = parseFloat(num / divisions * i).toFixed(decimalPlaces);
38					}
39					// Preserve commas if input had commas
40					if (isComma) {
41						while (/(\d+)(\d{3})/.test(newNum.toString())) {
42							newNum = newNum.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2');
43						}
44					}
45					nums.unshift(newNum);
46				}
47				nums.push(numReal);
48				$this.data('counterup-nums', nums);
49				$this.text('0');
50				// Updates the number until we're done
51				var f = function() {
52					if ($this.data('counterup-nums') != null) {
53						$this.text($this.data('counterup-nums').shift());
54						if ($this.data('counterup-nums').length) {
55							setTimeout($this.data('counterup-func'), $settings.delay);
56						} else {
57							delete $this.data('counterup-nums');
58							$this.data('counterup-nums', null);
59							$this.data('counterup-func', null);
60						}
61					}
62				};
63				$this.data('counterup-func', f);
64				// Start the count up
65				setTimeout($this.data('counterup-func'), $settings.delay);
66			};
67			// Perform counts when the element gets into view
68			new Waypoint({
69				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
70				element: this,
71				handler: function() {
72					counterUpper();
73					if (!UNCODE.isUnmodalOpen) {
74						this.destroy();
75					}
76				},
77				offset: '100%'
78			});
79		});
80	};
81})(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.