PageSourceSearch

https://www.nisshin.com/assets/js/release.js

js nisshin.com collected 2026-10-02 07:34:21 UTC 5,460 bytes, 171 lines download raw bytes

1/*!
2 *  - release.js
3 * @generated Thu Feb 18 2021 15:36:32 GMT+0900 (GMT+09:00)
4 */
5'use strict';
6
7(function ($) {
8	var a = 'is-active';
9	var o = 'is-open';
10	var breakpoint = 768;
11	var arrowPrev = '<button type="button" class="slick-prev"><i class="icon-arrow-s"></i></button>';
12	var arrowNext = '<button type="button" class="slick-next"><i class="icon-arrow-s"></i></button>';
13
14	var localDecision = function localDecision() {
15		var siteName = 'nisshin';
16		var regExp = new RegExp('(test\\.' + siteName + '\\.com|copre\\.jp|localhost|192\\.168\\.0\\.|192\\.168\\.11\\.|192\\.168\\.1\\.)', 'g');
17		return regExp.test(location.hostname);
18	};
19	var localLoading = function localLoading() {
20		// ローカル環境ならincludeをAjaxで読み込む
21		var key = 'inc_';
22		var ajaxArray = [];
23		var ajaxArrayList = [];
24		var i = void 0,
25		    j = void 0;
26		var includeClass = document.querySelectorAll('[class*="' + key + '"]');
27		var includeClassLen = includeClass.length;
28
29		for (i = 0; i < includeClassLen; i++) {
30			var path = includeClass[i].innerHTML.split(' ')[1];
31			ajaxArray.push(path);
32		}
33		var ajaxLen = ajaxArray.length;
34
35		if (ajaxLen > 0) {
36			for (i = 0; i < ajaxLen; i++) {
37				ajaxArrayList[i] = $.ajax({
38					type: 'GET',
39					url: ajaxArray[i] + '.html',
40					dataType: 'html',
41					timeout: 5000
42				});
43			}
44			$.when.apply($, ajaxArrayList).done(function () {
45				for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
46					args[_key] = arguments[_key];
47				}
48
49				var regExp = new RegExp(key);
50
51				for (i = 0; i < args.length; i++) {
52					var result = args[i];
53					var position = $(result[0]).filter(':first').attr('class').split(' ');
54
55					for (j = 0; j < position.length; j++) {
56						if (position[j].match(regExp)) {
57							position = position[j];
58							break;
59						}
60					}
61					$('.' + position).html(result[0]).children().unwrap();
62
63					console.log('Succeeded to read the include file!:', position);
64				}
65				loadDelayScript();
66			});
67		} else {
68			loadDelayScript();
69		}
70	};
71
72	// -------------------------------------------------------------------------------- //
73	// <共通>ファイルサイズ変換
74	var fileSize = function fileSize() {
75		var bytesToSize = function bytesToSize(bytes) {
76			var sizes = ['Bytes', 'KB', 'MB', 'GB'];
77			if (bytes === 0) return '0 Byte';
78			var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
79			var convSize = Math.floor(bytes / Math.pow(1024, i) * Math.pow(10, 1)) / Math.pow(10, 1);
80			// KBのとき、小数点切り捨て
81			if (i === 1) convSize = Math.floor(convSize);
82			return convSize + sizes[i];
83		};
84		$('.js-pdfsize').each(function (idx, ele) {
85			var thisSize = $(ele).text();
86			$(ele).text(bytesToSize(thisSize));
87		});
88	};
89
90	// <ニュース一覧>
91	var releaseSearch = function releaseSearch() {
92		var $map = location.pathname;
93		var latestYtxt = $('.rt_latest_year_month').text();
94		var latestY = latestYtxt.split('.')[0];
95		var latestYtxtMonth = latestYtxt.split('.')[1];
96		if (latestYtxtMonth <= 3) {
97			latestY -= 1;
98		}
99
100		// 年号セレクトボックス生成
101		for (var i = latestY; i >= 2016; i--) {
102			$('.js-selectYear').append('<option value="/release/' + i + '/">' + i + '</<option>');
103		}
104		// 年度選択
105		var $mapY = $map.split('/')[$map.split('/').length - 2];
106		if ($mapY !== 'release') {
107			$('.js-selectYear').find('option').each(function (idx, ele) {
108				if ($(ele).val().indexOf($mapY) !== -1) {
109					$(ele).prop('selected', 'selected');
110				}
111			});
112		}
113
114		// 「すべて」にチェックを入れたらカテゴリーのチェックが消える
115		$('input[value="all"]').on('click', function (e) {
116			if ($(e.currentTarget).prop('checked') === true) {
117				$('input').not('[value="all"]').prop('checked', false).prop('disabled', true);
118			} else {
119				$('input').not('[value="all"]').prop('checked', false).prop('disabled', false);
120			}
121		});
122		// カテゴリーにチェックを入れたら「すべて」のチェックが消える
123		$('input').not('[value="all"]').on('click', function (e) {
124			$('input[value="all"]').prop('checked', false);
125		});
126
127		// クリアボタン
128		$('.js-search-clear').on('click', function (e) {
129			$('input').prop('checked', false).prop('disabled', false);
130			$('.js-selectYear').children('option:first-child').prop('selected', 'selected');
131		});
132
133		// 絞り込み
134		$('.js-search-btn').on('click', function (e) {
135			var $year = $('.c-select').find('option:selected').val();
136			var catArr = [];
137			var $href = void 0;
138			$('.c-input-group').find('input:checked').each(function (idx, ele) {
139				catArr.push($(ele).val());
140			});
141			// 「すべて」の場合はクエリストリングなし
142			if (catArr.indexOf('all') !== -1) {
143				$href = $year;
144			} else {
145				$href = $year + '?category=' + catArr.join('&category=');
146			}
147
148			location.href = $href;
149		});
150	};
151
152	// -------------------------------------------------------------------------------- //
153	var loadDelayScript = function loadDelayScript() {
154		if ($('.js-pdfsize').length) {
155			fileSize();
156		}
157
158		if ($('.js-searchBlock').length) {
159			releaseSearch();
160		}
161
162		// <最新のニュースリリース>のみ「最新の20件を表示しています」を表示
163		if (location.pathname !== '/release/' && location.pathname !== '/release/index.html') {
164			$('.js-release-latestTxt').remove();
165		}
166	};
167
168	$(function () {
169		return localDecision() ? localLoading() : loadDelayScript();
170	});
171})(window.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.