PageSourceSearch

https://www.mitsubishielectric.co.jp/corporate/randd/js/script.js

js mitsubishielectric.co.jp collected 2026-10-02 02:22:54 UTC 11,189 bytes, 335 lines download raw bytes

1let jsonSearch;
2let showPageNo = 0;
3let pickupPageNo = 0;
4
5/* ======================================
6pdf.js
7====================================== */
8pdfLinkSetting = function() {
9	const ua = navigator.userAgent;
10	let mobile = false;
11	if(ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0){
12		mobile = true;
13	} else if(ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0){
14		mobile = true;
15	}
16	if( mobile ) {
17		$('[href*=".pdf#page="]').each(function(){
18            if($(this).attr('href').indexOf('viewer.html') == -1){
19                $(this).attr('href', '/corporate/common/js/lib/pdfjs/web/viewer.html?file=' + $(this).attr('href') + '&zoom=page-fit').attr('target', '_blank');
20            }
21		});
22	}
23}
24/* ======================================
25swiper_mainvisual
26====================================== */
27let bar;
28let speed = 3000;
29let swiperInit = false;
30
31$(window).on('load',function(){
32	$('.slide-img').fadeIn();
33var swiper = new Swiper(".slide-img .swiper-container", {
34	loop: true,
35	speed: 1000,
36	slidesPerView:3,
37	spaceBetween: 40,
38	breakpoints: {
39		767: {
40			spaceBetween: 20,
41		},
42	},
43	autoplay: {
44		disableOnInteraction: true
45	},
46	pagination: {
47		el: ".swiper-pagination",
48		clickable: true,
49		type: "custom",
50		renderCustom: function (swiper, current, total) {
51			return ('0' + current).slice(-2) + ' <span class="progress"><span class="progress-bar"></span></span> ' + ('0' + total).slice(-2);
52		  }
53	},
54	navigation: {
55		nextEl: '.randd-top-next',
56		prevEl: '.randd-top-prev',
57	},
58	on: {
59		init: function () {
60			swiperInit = true;
61		   },
62		slideChangeTransitionStart: function () {
63			if(!swiperInit) return;
64			bar = $('.progress-bar')[0];
65		 bar.style.transitionDuration = '0s',
66		 bar.style.transform = 'scaleX(0)'
67		},
68		slideChangeTransitionEnd: function () {
69			if(!swiperInit) return;
70			bar = $('.progress-bar')[0];
71		 bar.style.transitionDuration = speed + 'ms',
72		 bar.style.transform = 'scaleX(1)'
73		},
74	   }
75});
76	$(".stopbtn").on("click", function() {
77	  var _class = $(this).attr("class");
78	  if(_class == "stopbtn stop"){
79		$(this).addClass("start").removeClass("stop");
80		swiper.autoplay.stop();
81	  }
82	  else {
83		$(this).addClass("stop").removeClass("start"); //
84		swiper.autoplay.start();
85	  }
86	});
87});
88
89
90/* ======================================
91swiper_interview
92====================================== */
93let barInterview;
94let speedInterview = 3000;
95let swiperInitInterview = false;
96
97$(window).on('load',function(){
98	$('.slide-interview').fadeIn();
99	var swiper = new Swiper(".slide-interview .swiper-container", {
100		loop: true,
101		loopAdditionalSlides: 5,
102		speed: 1000,
103		slidesPerView: 1,
104		spaceBetween: 0,
105		centeredSlides: true,
106		autoHeight: false,
107		autoplay: {
108			disableOnInteraction: true
109		},
110		navigation: {
111			nextEl: '.swiper-button-iv-next',
112			prevEl: '.swiper-button-iv-prev',
113		},
114		pagination: {
115			el: ".swiper-pagination-iv",
116			clickable: true,
117			type: "custom",
118			renderCustom: function (swiper, current, total) {
119				return ('0' + current).slice(-2) + ' <span class="progress-iv"><span class="progress-bar-iv"></span></span> ' + ('0' + total).slice(-2);
120			}
121		},
122		on: {
123			init: function () {
124				swiperInitInterview = true;
125			},
126			slideChangeTransitionStartIV: function () {
127					if(!swiperInitInterview) return;
128					barInterview = $('.progress-bar-iv')[0];
129				barInterview.style.transitionDuration = '0s',
130				barInterview.style.transform = 'scaleX(0)'
131			},
132			slideChangeTransitionEndIV: function () {
133					if(!swiperInitInterview) return;
134					barInterview = $('.progress-bar-iv')[0];
135				barInterview.style.transitionDuration = speedInterview + 'ms',
136				barInterview.style.transform = 'scaleX(1)'
137			},
138		}
139	});
140	$(".stopbtn-iv").on("click", function() {
141		var _class = $(this).attr("class");
142		if(_class == "stopbtn-iv stop"){
143			$(this).addClass("start").removeClass("stop");
144			swiper.autoplay.stop();
145		}
146		else {
147			$(this).addClass("stop").removeClass("start"); //
148			swiper.autoplay.start();
149		}
150	});
151});
152
153// 監視対象の要素に対してオブザーバーを設定
154$('.slide-interview').each(function() {
155	observer.observe(this, { attributes: true });
156});
157
158
159/* ======================================
160 urlパラメータ取得用関数
161====================================== */
162
163function getParam(name, url) {
164    if (!url) url = window.location.href;
165    name = name.replace(/[\[\]]/g, "\\$&");
166    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
167        results = regex.exec(url);
168    if (!results) return null;
169    if (!results[2]) return '';
170    return decodeURIComponent(results[2].replace(/\+/g, " "));
171}
172
173/* ======================================
174cookie取得
175getCookieValue
176====================================== */
177// cookieのデータを取得する
178function getCookieValue(key) {
179    const cookies = document.cookie.split(';'); //クッキーを取得して配列化
180    for (let cookie of cookies) {
181        var cookiesArray = cookie.split('=');
181 //配列化したものを「cookie名」と「値」に分ける
182        if (cookiesArray[0].trim() == key.trim()) {//半角スペースを削除する
183            return cookiesArray[1];
184        }
185    }
186    return '';
187}
188
189// cookieのデータを保存する
190function setCookieValue() {
191	document.cookie = 'pickup_page=' + pickupPageNo + ';SameSite=lax';//viewmoreのクリック数を保存
192    document.cookie = 'search_page=' + showPageNo + ';SameSite=lax';//viewmoreのクリック数を保存
193}
194
195/* ======================================
196ページを離脱したときにURLパラメータを付与する
197====================================== */
198window.addEventListener("beforeunload", () => {
199	setCookieValue(); //cookieを保存する
200	history.pushState('', '', '?return=true');//パラメータを付与する
201});
202
203
204//?return=trueパラメータがあるときはcookieを使用して復帰処理をする
205// if (getParam("return")) {
206
207// 	//パラメータ削除
208// 	history.pushState('', '', location.href.replace(location.search, ''));
209
210
211// 	// let no = Number(getCookieValue('search_page'));
212// 	// if(isNaN(no)){
213// 	// 	no = 6
214// 	// }
215
216
217// }
218
219/* ======================================
220pickup
221====================================== */
222const INIT = 3  //初期表示数
223const MORE = 3  //追加表示数
224
225// 初期表示数以降のリスト内容を非表示に
226$(".top-pickup__list .top-pickup__item:nth-child(n+" + (INIT+1) + ")").hide()
227
228// Moreボタンクリックで指定数表示
229$(".view-more--01").on("click",function(){
230	pickupPageNo++;
231    let this_list = $(".top-pickup__list");
232    this_list.find("li:hidden").slice(0,MORE).fadeIn();
233
234    if(this_list.find("li:hidden").length == 0){
235        $(this).fadeOut()
236    }
237});
238if (getParam("return")) {
239	let no = Number(getCookieValue('pickup_page'));
240	let this_list = $(".top-pickup__list");
241    this_list.find("li:hidden").slice(0,MORE*no).show();
242
243	if(this_list.find("li:hidden").length == 0){
244        $(".view-more--01").fadeOut()
245    }
246}
247/* ======================================
248json読み込み(260302コンテンツ棚卸しにつき無効)
249====================================== */
250// $.ajax({
251// 	type: 'GET',
252// 	url: '/corporate/randd/list/js/data.json',
253// 	dataType: 'json',
254// 	cache: false,
255// })
256// 	.then(
257// 		// 取得成功時
258// 		function (data) {
259// 			jsonSearch = data;
260
261// 			$('.view-more--02').click(function () {
262// 				addhtml(jsonSearch);
263// 				return false;
264// 			});
265
266// 			if (getParam("return")) {
267//                 //パラメータ削除
268//                 history.pushState('', '', location.href.replace(location.search, ''));
269
270//                 let no = Number(getCookieValue('search_page'));
271//                 if(isNaN(no)){no = 6}
272
273//                 addhtml(jsonSearch,no);
274//             }
275//             else{
276//                 addhtml(jsonSearch);
277//             };
278// 		},
279// 		function () {
280// 			// エラー発生時
281// 			console.log('JOSNの読み込みに失敗しました。');
282// 		}
283// 	);
284
285// 	// データ書き出し
286// 	function addhtml(data,restore){
287// 		let txt = "";
288// 		let rimit = 6;
289//         if(restore){rimit=restore}
290// 		for (i = showPageNo; i < (showPageNo+rimit); i++) {
291// 			if(!data[i]){
292// 				break;
293// 			}
294// 			// txt += '<li class="search-item layout-cell h-scale h-edge" data-tech="' + data[i].keyword_tech + '" data-lab="' + data[i].keyword_lab + '" data-keyword="' + data[i].data_keyword + '">';
295// 			// txt += '<a href="' + data[i].url + '">';
296// 			// if (data[i].new == "new") {
297// 			// 	txt += '<div class="search-item__thumb h-scale__img edge-img--side"><span class="edge-img__vertical"><img src="' + data[i].thumb + '" alt="' + data[i].title + '"></span><span class="search-item__label"></span></div>';
298// 			// } else {
299// 			// 	txt += '<div class="search-item__thumb h-scale__img edge-img--side"><span class="edge-img__vertical"><img src="' + data[i].thumb + '" alt="' + data[i].title + '"></span></div>';
300// 			// };
301// 			// txt += '<p class="search-item__txt">' + data[i].title + '<p class="search-item__keyword">' + data[i].data_keyword.join(' ') + '</p></a></li>';
302
303//             txt += '<li class="search-item layout-cell" data-tech="' + data[i].keyword_tech + '" data-lab="' + data[i].keyword_lab + '" data-keyword="' + data[i].data_keyword + '">';
304//             if (data[i].blank== "blank") { // blank
305//                 txt += '<a href="' + data[i].url + '" target="' + data[i].blank + '" class="h-scale h-edge">';
306//             }else{
307//                 txt += '<a href="' + data[i].url + '" class="h-scale h-edge">';
308//             }
309//             if (data[i].new == "new") { // new
310//                 txt += '<div class="search-item__thumb h-scale__img edge-img--side"><span class="edge-img__vertical"><img src="' + data[i].thumb + '" alt="' + data[i].title + '" width="590" height="424"></span><span class="search-item__label"></span></div>';
311//             } else {
312//                 txt += '<div class="search-item__thumb h-scale__img edge-img--side"><span class="edge-img__vertical"><img src="' + data[i].thumb + '" alt="' + data[i].title + '" width="590" height="424"></span></div>';
313//             };
314//             if (data[i].pdf== "pdf") { // pdf
315//                 txt += '<p class="search-item__txt">' + data[i].title + '<span class="pdf-icon"></span>
315<p class="search-item__keyword">' + data[i].data_keyword.join(' ') + '</p></a></li>';
316//             }else{
317//                 txt += '<p class="search-item__txt">' + data[i].title + '<p class="search-item__keyword">' + data[i].data_keyword.join(' ') + '</p></a>';
318//             }
319// 			if (data[i].annotation && data[i].annotation.length > 0) { // annotation
320// 				txt += '<div class="annotation">' + data[i].annotation + '</div></li>';
321//             }else{
322//                 txt += '</li>';
323//             }
324// 		}
325// 		showPageNo = i;
326// 		//HTMLに書き出し
327// 		$('.search-list').append(txt);
328
329// 		if(showPageNo >= jsonSearch.length){
330//             $('.view-more').hide();
331//         }else if(showPageNo < jsonSearch.length){
332//         $('.view-more').show();
333//         }
334// 		pdfLinkSetting();
335// 	}

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.