PageSourceSearch

https://www.topy.co.jp/resources/sw_js/about/counter.js

js topy.co.jp collected 2026-10-02 10:54:15 UTC 2,985 bytes, 92 lines download raw bytes

1/* counter.js */
2$(document).ready( function() {
3	try {
4		var resizeTimer = null;
5		var scrollTimer = null;
6		//var countSet = 0;
7		var cnt = 0;
8		var cntDecimal = [];
9
10
11		function countReset() {
12			if( !SHW.isEdit() ) {
13				var $target = $('.ux_countup_text_num, .ux_countup1_text_num > .column1, .ux_countup2_text_num > .column2, .ux_countup3_text_num > .column3, .ux_countup4_text_num > .column4, .ux_countup5_text_num > .column5').find('.lead-section em, .ircalendar-item em');
14
15				if( $target.length <= 0 ) return;
16				$target.each( function() {
17					var comma = ($(this).text().indexOf(',') >=0);
18					var num = $(this).text().replace(/,/g, '');
19					var decimal = num.lastIndexOf('.') > 0 ? num.lastIndexOf('.') : 0 ;
20					$(this).attr('data-countmax', num);
21					$(this).attr('data-comma', comma);
22					$(this).attr('data-decimal', decimal);
23					$(this).text( (0).toFixed(decimal) );
24				});
25
26				$('body').addClass('countReset');
27				countStart();
28			}
29		}
30
31		function countStart() {
32			if( !SHW.isEdit() && $('body').hasClass('countReset') > 0 ) {
33				var $item = $('.ux_countup_text_num, .ux_countup1_text_num > .column1, .ux_countup2_text_num > .column2, .ux_countup3_text_num > .column3, .ux_countup4_text_num > .column4, .ux_countup5_text_num > .column5').find('.lead-section:not(.disp) em , .ircalendar-item:not(.disp) em');
34
35				$item.each(function() {
36					var tOffset =$(this).closest('.lead-section, .ircalendar-item').offset().top;
37			// 		var startPosition = $(window).scrollTop() + $(window).height() - 120;
38					var startPosition = $(window).scrollTop() + $(window).height() - 30;
39
40					if( tOffset < startPosition ) {
41						$(this).closest('.lead-section , .ircalendar-item').addClass('disp'); 
42						var comma = ($(this).attr('data-comma') == 'true');
43						var end = $(this).attr('data-countmax');
44						var endDecimal = $(this).attr('data-decimal');
45						var digits = (end.lastIndexOf('.') > 0) ? end.length -end.lastIndexOf('.')-1 : 0 ;
46
47						$(this).countTo({
48							from: 0,		// 数字の初期値
49							to: end,		// 数字の最大値
50							speed: 1200,	// カウントアップするスピード
51							formatter: function (value, options) {	// カンマを追加するオプション
52								value = value.toFixed(digits);
53								if( comma ) {
54									value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
55								}
56								return value;
57							}
58						});
59					}
60				});
61			}
62		
63		}
64
65//		$(window).on('load', function() {
66//			countReset();
67//		});
68
69        window.setTimeout( function() {
70			countReset();
71    	},0);
72
73		$(window).on('scroll', function(){
74
75			resizeTimer = setTimeout(function() {
76				countStart();
77
78			}, 200);
79		});
80
81		$(window).on('resize', function() {
82
83			clearTimeout(resizeTimer);
84			resizeTimer = setTimeout(function() {
85				
86			}, 200);
87		});
88
89	} catch(e) {
90		console.assert(false, "Err: "+ e.message +" in counter.js");
91	}
92});

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.