PageSourceSearch

https://www.kubota-credit.co.jp/common/js/common.js

js kubota-credit.co.jp collected 2026-10-05 08:37:41 UTC 17,137 bytes, 748 lines download raw bytes

1// JavaScript Document
2
3$(function () {
4
5	// フェードイン
6	$('.fade').on('inview', function (event, isInView, visiblePartX, visiblePartY) {
7		if (isInView) {
8			$(this).stop().addClass('fadeIn');
9		} else {
10			$(this).stop().removeClass('fadeIn');
11		}
12	});
13
14	// フェードインしながら上へスライド     
15	$('.box1').on('inview', function (event, isInView, visiblePartX, visiblePartY) {
16		if (isInView) {
17			$(this).stop().addClass('mv');
18		}
19		//else {
20		//	$(this).stop().removeClass('mv');
21		//}
22	});
23
24});
25
26// ヘッダー 
27
28function writeHeader() {
29
30	$.ajax({
31		url: "header.html",
32		cache: false, //キャッシュを利用するか
33		async: false, //非同期で読み込むか
34		success: function (html) {
35			document.write(html);
36		}
37	});
38
39}
40// フッター
41
42
43
44
45
46
47
48//クボタ本サイトのcommon.js ここから----------------------------------------------------------
49
50
51
52$(function () {
53	menu_SiteSearch();
54	navListCurrent();
55	pagingCurrent();
56	gNavCurrent();
57	addLinkCurrentFunction('#relationNav', 'current');
58	addLinkCurrentFunction('.site_Grouping', 'current');
59	tabSwitch();
60	menu_SiteSearch_SMP.init();
61	hMenuOpenSmp();//smp
62	remodalAdd();
63	pageTopBtn();
64	accordionSMP();
65	imgReplace();
66
67	$(window).on('load', function () {
68		heroImgWidth();
69		heroOneside();
70		linkImg();
71		remodalSwicth();
72	});
73
74	$(window).on('resize', function () {
75		heroImgWidth();
76		heroOneside();
77	});
78
79	if (!width768check.matches) {//smp
80
81		jquery('.js-slick').slick({
82			dots: true
83			, arrows: false
84			, slidesToShow: 1
85			, slidesToScroll: 1
86			, infinite: true
87			, adaptiveHeight: true
88			, autoplay: true
89			, autoplaySpeed: 4500
90			, speed: 700
91			, pauseOnHover: true
92			, swipe: true
93		});
94
95		remodalCancel.set();
96		accordionSMPadd();
97
98	}
99
100});
101
102
103var currentUrl = location.pathname
104	, firstLayer = currentUrl.split("/")[1]
105	, secoundLayer = currentUrl.split("/")[2]
106	, thirdLayer = currentUrl.split("/")[3]
107	, width768check
108	, width1600check
109	;
110
111// Establishing media check
112width768check = window.matchMedia("(min-width: 768px)");
113width1600check = window.matchMedia("(min-width: 1600px)");
114
115// Add listeners for detecting changes
116width768check.addListener(sp_script);
117
118
119function sp_script(mediaQueryList) {
120	if (mediaQueryList.matches) {//pc
121
122		jquery('.js-slick').slick({
123			dots: true
124			, arrows: true
125			, slidesToShow: 3
126			, slidesToScroll: 3
127			, infinite: true
128			, adaptiveHeight: true
129			, autoplay: true
130			, autoplaySpeed: 4500
131			, speed: 700
132			, pauseOnHover: true
133			, swipe: true
134		});
135
136		hMenuCloseSmp();
137		remodalAdd();
138		remodalCancel.remove();
139		accordionSMPremove();
140		imgReplace();
141
142	} else {//smp
143
144		jquery('.js-slick').slick({
145			dots: true
146			, arrows: false
147			, slidesToShow: 1
148			, slidesToScroll: 1
149			, infinite: true
150			, adaptiveHeight: true
151			, autoplay: true
152			, autoplaySpeed: 4500
153			, speed: 700
154			, pauseOnHover: true
155			, swipe: true
156		});
157
158		remodalCancel.set();
159		accordionSMPadd();
160		imgReplace();
161	}
162}
163
164menu_SiteSearch_SMP = {
165	input: null,
166	button: null,
167
168	init: function () {
169		menu_SiteSearch_SMP.input = $('#siteSearch_Input--smp');
170		menu_SiteSearch_SMP.button = $('#siteSearch_Btn--smp');
171
172		menu_SiteSearch_SMP.input.keydown(function (e) {
173			if (e.keyCode == 13) {
174				menu_SiteSearch_SMP.change();
175			}
176		});
177		menu_SiteSearch_SMP.button.bind('click', this.change);
178	},
179	change: function () {
180		var word = menu_SiteSearch_SMP.input.val();
181		$('#i_search_input').val(word);
182		$('#siteSearch_Btn--pc').click();
183	}
184};
185
186//menu_SiteSearch
187function menu_SiteSearch() {
188	$('.btn_Search > a').on('click', function (e) {
189		e.preventDefault();
190
191		var menu_SiteSearch = $(this)
192			, searchContent = $('#hMenu_Content_search--pc')
193			;
194
195		if (searchContent.hasClass('open')) {
196			$('#site-search').stop().animate({ opacity: '0' }, 700);
197			searchContent.removeClass('open');
198			menu_SiteSearch.removeClass('open');
199			setTimeout(function () {
200				searchContent.stop().slideUp(600);
201			}, 200);
202		} else {
203			searchContent.stop().slideDown(500);
204			searchContent.addClass('open');
205			menu_SiteSearch.addClass('open');
206			setTimeout(function () {
207				$('#site-search').stop().animate({ opacity: '1' }, 700);
208				$('.siteSearch_Input').focus();
209			}, 200);
210		}
211		return false;
212	});
213}
214
215//hMenuOpenSmp(smp)
216function hMenuOpenSmp() {
217	$('#hMenu_Toggle--smp').on('click', function (e) {
218		e.preventDefault();
219
220		var gHeaderMenu = $('.hMenu--smp')
221			, openText = $(this).find('.txt')
222			;
223
224		if (gHeaderMenu.hasClass('open')) {
225			gHeaderMenu.stop().slideUp(500);
226			openText.text('Menu');
227			$(this).removeClass('open');
228			gHeaderMenu.removeClass('open');
229			$(this).find("#icon").removeClass('close');
230			return true;
231		} else {
232			$(this).addClass('open');
233			gHeaderMenu.addClass('open');
234			$(this).find("#icon").addClass('close');
235			openText.text('Close');
236			gHeaderMenu.stop().slideDown(500);
237			return false;
238		}
239
240	});
241}
242
243//hMenuOpenSmp(smp)
244function hMenuCloseSmp() {
245	var gHeaderMenu = $('.hMenu--smp')
246		, openText = $('#hMenu_Toggle--smp').find('.txt')
247		;
248	if (gHeaderMenu.hasClass('open')) {
249		gHeaderMenu.stop().slideUp(500);
250		openText.text('Menu');
251		$('#hMenu_Toggle--smp').removeClass('open');
252		gHeaderMenu.removeClass('open');
253		$('#hMenu_Toggle--smp').find("#icon").removeClass('close');
254		return false;
255	}
256}
257
258//localNav current
259function navListCurrent() {
260	navList = $('#localNav').find('a');
261	navList.each(function () {
262
263		if (firstLayer === 'new') {
264			if ((secoundLayer === 'index.html') || (secoundLayer === '')) {
265				return;
266
267			} else if (thirdLayer.indexOf('themeindex') !== -1) {
268				navTheme = $('#localNav--themeindex').find('li');
269				navTheme.each(function () {
270					var navThemeList = $(this)
271						, navThemeClass = navThemeList.attr('class')
272						, themeNumber = thirdLayer.split("_")[0]
273						;
274
275					if ((thirdLayer.indexOf('themeindex') !== -1) && (navThemeList.hasClass(themeNumber))) {
276						var current = $(this).find('a');
277						navListDetail(current);
278					}
279				});
280
281			} else {
282				$('#localNav--year li').each(function () {
283					var navYearList = $(this)
284						, navYearA = navYearList.find('a')
285						, secoundPass = navYearA.attr('href').split("/")[2]
286						;
287					if (secoundPass === secoundLayer) {
288						var current = $(this).find('a');
289						navListDetail(current);
290					}
291				});
292			}
293
294		} else if (firstLayer === 'ir') {
295			if ((thirdLayer === 'briefnote') || (thirdLayer === 'resume') || (thirdLayer === 'personal')) {
296				var thirdPass = $(this).attr('href').split("/")[3]
297					;
298				if (thirdPass === thirdLayer) {
299					var current = $(this);
300					navListDetail(current);
301				}
302			} else {
303				currentUrl += (currentUrl.slice(-5) !== '.html') ? 'index.html' : '';
304				if ($(this).attr('href') === currentUrl) {
305					var current = $(this);
306					navListDetail(current);
307				}
308			}
309
310		} else if (firstLayer === 'photocontest') {
311			var secoundPass = $(this).attr('href').split("/")[2]
312				;
313			if (secoundPass === secoundLayer) {
314				var current = $(this);
315				navListDetail(current);
316			}
317
318		} else {
319			currentUrl += (currentUrl.slice(-5) !== '.html') ? 'index.html' : '';
320			if ($(this).attr('href') === currentUrl) {
321				var current = $(this);
322				navListDetail(current);
323			}
324		}
325	});
326
327	function navListDetail(target) {
328		var currentParent = target.closest('.layer')
329			, currentParents = target.parents('.layer')
330			, currrentPrev = currentParent.prev('a')
331			, currentLayer = target.parents('.layer2 li')
332			, nextLayer = target.next()
333			;
334
335
336		target.addClass('current');
337		currrentPrev.addClass('currentParent');
338		currentLayer.addClass('currentLayer');
339		currentParents.addClass('open');
340
341
342		if (nextLayer === $('.layer')) {
343			target.next().addClass('nextLayer');
344			target.parents('.layer').addClass('nextLayer');
345		}
346	}
347}
348
349//localNav current
350function pagingCurrent() {
351	paging = $('.pagingNav').find('a');
352	paging.each(function () {
353		var layerPass = $(this).attr('href')
354			;
355
356		if (layerPass === currentUrl) {
357			var current = $(this);
358			pagingDetail(current);
359		} else {
360			currentUrl += (currentUrl.slice(-5) !== '.html') ? 'index.html' : '';
361			if ($(this).attr('href') === currentUrl) {
362				var current = $(this);
363				pagingDetail(current);
364			}
365		}
366	});
367
368	function pagingDetail(target) {
369		var currentParent = target.closest('.layer')
370			;
371
372		target.addClass('current');
373	}
374}
375
376//gNav
377function gNavCurrent() {
378	var Current = -1
379		, Skip = -1
380		, Path = currentUrl.split('/')
381		, Prefix = 'gNav_'
382		, CompWords = ['product', 'rd', 'siryou', 'ir', 'csr', 'kubota-ep', 'new', 'recruit']
383		, SkipWords = ['event'];
384	for (var i in SkipWords) {
385		Skip = $.inArray(SkipWords[i], Path);
386		if (Skip > -1) break;
387	}
388	if (Skip == -1) {
389		for (var n in CompWords) {
390			Current = $.inArray(CompWords[n], Path);
391			if (Current > -1) break;
392		}
393		Current = $.inArray(Path[Current], CompWords);
394	}
395	if (Current > -1) $('.' + Prefix + CompWords[Current]).addClass('current');
396}
397
398//Current Check and Add Function
399function addLinkCurrentFunction(name, addClass) {
400	if ($(name).length) {
401		var tarobj = $(name).find('a'), cpath = location.pathname, tarray = [], carray = [], count = 0, check = false;
402		cpath += (cpath.slice(-5) !== '.html') ? 'index.html' : '';
403		var f = cpath.split("/");
404		tarobj.each(function () {
405			if ($(this).attr('href') === cpath) {
406				$(this).addClass(addClass);
407				check = true;
408			} else {
409				tarray[count] = [];
410				tarray[count] = $(this).attr('href').split("/");
411				count++;
412			}
413		});
414		if (!check) {
415			for (var i = 0; count > i; i++) {
416				carray[i] = 0;
417				for (var j in tarray[i]) {
418					if (tarray[i][j] == f[j]) carray[i] += 1;
419				}
420			}
421			var maxnum = Math.max.apply(null, carray);
422			for (var i in carray) {
423				if (maxnum == carray[i]) {
424					tarobj.eq(i).addClass(addClass);
425				}
426			}
427		}
428	}
429}
430
431
432function tabSwitch() {
433	$('.js-tabSwitch__Wrap').each(function () {
434		$('.js-tabSwitch__Header li').on('click', function (e) {
435			e.preventDefault();
436
437			var num = $(this).parent().children('li').index(this);
438
439			$('.js-tabSwitch').each(function () {
440				$('li', this).removeClass('selected').eq(num).addClass('selected');
441			});
442
443			$('.js-tabSwitch__ContentLi').removeClass('selected');
444			$('.js-tabSwitch__ContentLi').eq(num).addClass('selected');
445
446			$('.js-tabSwitch__Header li').removeClass('selected');
447			$('.js-tabSwitch__Header li').eq(num).addClass('selected');
448
449			return false;
450		});
451	});
452}
453
454
455function accordionSMPremove() {//pc
456	$('.js-accordion__Content').removeClass('open').css({ 'display': 'block' });
457}
458
459function accordionSMPadd() {//smp
460	$('.js-accordion__Content').css({ 'display': 'none' });
461}
462
463//accordionSwitch
464function accordionSMP() {
465
466
467	$('.js-accordion__Wrap').each(function () {
468		$('.js-accordion__Heading').on('click', function () {
469			var clickedHeading = $(this)
470				, openContent = clickedHeading.next('.js-accordion__Content')
471				;
472
473			if (width768check.matches) {
474				return;
475			}
476			if (clickedHeading.hasClass('open')) {
477				$(this).removeClass('open');
478				openContent.stop().slideUp(300);
479				openContent.removeClass('open');
480			} else {
481				$(this).addClass('open');
482				openContent.stop().slideDown(300);
483				openContent.addClass('open');
484			}
485		});
486	});
487}
488
489//heroimg width
490function heroImgWidth() {
491	var innerSwitch = $('body.page--Hero .breadCrumbs, .js-marginLeft')
492		, winWidth = $(window).width()
493		, innerMargin = (winWidth - 1524) / 2
494		;
495
496	$(innerSwitch).each(function () {
497		if (winWidth > 1600) {
498			$(this).css({
499				'margin-left': innerMargin
500			});
501		} else {
502			$(this).css({
503				'margin-left': '0'
504			});
505		}
506	});
507}
508
509//heroimg width
510function heroOneside() {
511	var widthSwitch = $('.hero__Lead--oneSide')
512		, winWidth = $(window).width()
513		, contentMargin = (winWidth - 800) / 2
514		, contentWidth = (contentMargin + 800)
515		;
516
517	$(widthSwitch).each(function () {
518		if (winWidth > 768) {
519			$(this).css({
520				'width': contentWidth
521			});
522		} else {
523			$(this).css({
524				'width': '100%'
525			});
526		}
527	});
528}
529
530//linkicon
531function linkImg() {
532	var linkImgBlank = $('a[target="_blank"]:has(img)')
533		, linkImgPdf = $('a[href$=".pdf"]:has(img)')
534		, linkBlank = $('a[target="_blank"]')
535		, linkPdf = $('a[href$=".pdf"]')
536		, oldStyle = $('body#old_shared').find('#old_main')
537		;
538
539	if (!linkImgPdf.is('icon--Modal , icon_Pdf')) {
540		linkImgPdf.addClass('js-link--None');
541		linkImgBlank.addClass('js-link--None');
542	}
543
544	if (oldStyle.length) {
545		var oldBlank = oldStyle.find(linkBlank)
546			, oldPdf = oldStyle.find(linkPdf)
547			;
548		oldBlank.addClass('js-link--None');
549		oldPdf.addClass('js-link--None');
550	}
551}
552
553
554//画像出し分け
555function imgReplace() {
556	$('.js-imgSwitch').each(function () {
557		var setElm = $(this)
558			, pcName = '_pc'
559			, smpName = '_smp'
560			;
561		if (width768check.matches) {//pc
562			setElm.attr('src', setElm.attr('src').replace(smpName, pcName)).css({ visibility: 'visible' });
563		} else {
564			setElm.attr('src', setElm.attr('src').replace(pcName, smpName)).css({ visibility: 'visible' });
565		}
566	});
567}
568
569//link for pageTop
570function pageTopBtn() {
571	var pageTopBtn = $('#pageTop');
572	pageTopBtn.hide();
573	$(window).on('scroll', function () {
574		if ($(this).scrollTop() > 80) {
575			pageTopBtn.fadeIn();
576		} else {
577			pageTopBtn.fadeOut();
578		}
579
580		var scrollHeight = $(document).height()
581			, scrollPosition = $(window).height() + $(window).scrollTop()
582			, footerHeight = $('#gFooter').innerHeight()
583			, winWidth = $(window).width()
584			, cssPosition
585			, cssBottom
586			, cssMargin
587			;
588
589		if (scrollHeight - scrollPosition <= footerHeight) {
590			if (winWidth < 768) {
591				var cssPosition = 'fixed'
592					, cssBottom = footerHeight
593					, cssMargin = '40px'
594					;
595			} else {
596				var cssPosition = 'fixed'
597					, cssBottom = footerHeight
598					, cssMargin = '20px'
599					;
600			}
601
602		} else {
603			if (winWidth < 768) {
604				var cssPosition = 'fixed'
605					, cssBottom = '40px'
606					, cssMargin = '0'
607					;
608			} else {
609				var cssPosition = 'fixed'
610					, cssBottom = '100px'
611					, cssMargin = '0'
612					;
613			}
614		}
615
616		pageTopBtn.css({
617			'position': cssPosition
618			, 'bottom': cssBottom
619			, 'margin-bottom': cssMargin
620		});
621	});
622	pageTopBtn.click(function (e) {
623		e.preventDefault();
624		$('html,body').stop().animate({
625			scrollTop: 0
626		}, 500);
627		return false;
628	});
629}
630
631
632// remodalのキャンセル用データ属性値を追加
633function remodalAdd() {
634	$('.remodal-toggle').attr('data-remodal-cancel', '');
635}
636
637function remodalSwicth() {
638	$('.remodal--PC').each(function () {
639		var elem = $(this)
640			;
641
642		elem.on('click', function (e) {
643			if (width768check.matches) {//pc
644				e.preventDefault();
645			}
646		});
647	});
648}
649
650// remodalのキャンセル用データ属性値のトグル
651var remodalCancel = (function () {
652	var elem = $('a.icon--Modal')
653		, data_name = 'data-remodal-cancel'
654		;
655
656	function set() {//smp
657		elem.attr(data_name, 'true');
658	}
659
660	function remove() {//pc
661		elem.attr(data_name, '');
662
663	}
664
665	return {
666		set: set
667		, remove: remove
668	}
669})();
670
671
672//クボタ本サイトのcommon.js ここまで----------------------------------------------------------
673
674
675
676$(function () {
677	menu_SiteSearch();
678	navListCurrent();
679	pagingCurrent();
680	gNavCurrent();
681	addLinkCurrentFunction('#relationNav', 'current');
682	addLinkCurrentFunction('.site_Grouping', 'current');
683	tabSwitch();
684	menu_SiteSearch_SMP.init();
685	hMenuOpenSmp();//smp
686	remodalAdd();
687	pageTopBtn();
688	accordionSMP();
689	imgReplace();
690
691	$(window).on('load', function () {
692		heroImgWidth();
693		heroOneside();
694		linkImg();
695		remodalSwicth();
696	});
697
698	$(window).on('resize', function () {
699		heroImgWidth();
700		heroOneside();
701	});
702
703	if (!width768check.matches) {//smp
704
705		$('.js-slick').slick({
706			dots: true
707			, arrows: false
708			, slidesToShow: 1
709			, slidesToScroll: 1
710			, infinite: true
711			, adaptiveHeight: true
712			, autoplay: true
713			, autoplaySpeed: 4500
714			, speed: 700
715			, pauseOnHover: true
716			, swipe: true
717		});
718
719		remodalCancel.set();
720		accordionSMPadd();
721
722	}
723
724});
725
726
727
728//gNav
729function gNavCurrent() {
730	var Current = -1
731		, Skip = -1
732		, Path = currentUrl.split('/')
733		, Prefix = 'gNav_'
734		, CompWords = ['basic', 'company', 'service', 'recruit', 'point']
735		, SkipWords = ['event'];
736	for (var i in SkipWords) {
737		Skip = $.inArray(SkipWords[i], Path);
738		if (Skip > -1) break;
739	}
740	if (Skip == -1) {
741		for (var n in CompWords) {
742			Current = $.inArray(CompWords[n], Path);
743			if (Current > -1) break;
744		}
745		Current = $.inArray(Path[Current], CompWords);
746	}
747	if (Current > -1) $('.' + Prefix + CompWords[Current]).addClass('current');
748}

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.