PageSourceSearch

https://mitachi.co.jp/common/js/common.js

js mitachi.co.jp collected 2026-10-04 08:36:42 UTC 3,644 bytes, 131 lines download raw bytes

1$(function(){
2	//コピーライト
3	var myDate = new Date();
4	var myYear = ""+myDate.getFullYear()+"";
5	$('footer .copyYear').html(myYear);
6	
7	
8	//ヘッダーサイト内検索
9	$('header .aboutNav_search .search').on('click',function(){
10		$("#headerSearch").toggleClass('open');
11	});
12});
13
14
15$(window).on("load", function() {
16	//グロナビ
17	$('.hg_menu_btn').on('click',function(){
18		$('nav').slideToggle();
19		$(this).toggleClass('active');
20	});
21	
22	var spMenuWid = $(window).width(); //ブラウザの横幅取得
23	var spMenu = spMenuWid <= 1024; //SP表示のとき
24	if (spMenu) {
25		$('#gnav li.accordion > a').on('click',function(){
26			$(this).next('.in_menu').slideToggle(300);
27			$(this).parent('li').toggleClass('open');
28		});
29		$('footer li.accordion > a').on('click',function(){
30			$(this).next('.in_menu').slideToggle(300);
31			$(this).parent('li').toggleClass('open');
32		});
33	}else{
34		$('#gnav li.accordion > a').on('click',function(){
35			if($(this).parent('li').hasClass('open')){
36				$('.gnav_bg').removeClass('open');
37				$(this).parent('li').removeClass('open');
38				$(this).next('.in_menu').slideUp();
39			}else{
40				$('#gnav li.accordion').removeClass('open');
41				$('#gnav li.accordion .in_menu').slideUp();
42				$('.gnav_bg').addClass('open');
43				$(this).parent('li.accordion').toggleClass('open');
44				$(this).next('.in_menu').slideToggle(300);
45			}
46		});
47	}
48});
49
50(function() {
51
52	// DOM-Elementを取得しておく
53	const cookieConsent = document.querySelector('.cookie-consent');
54	const cookieAgree = document.querySelector('.cookie-agree');
55	const cookieReject = document.querySelector('.cookie-reject');
56
57	// Cookieを拒否した時用のFlag
58	const rejectFlag = sessionStorage.getItem('rejectFlag');
59	console.log({rejectFlag});
60
61	const cookieData = document.cookie;
62	console.log({cookieData});
63
64	// CookieをSetしているかどうかを判定するためのFlag
65	let cookieSetFlag = false;
66
67	// 綺麗に分割するために「'; '」(セミコロン&半角スペース)で区切る!
68	const cookieDataList = cookieData.split('; ');
69	console.log({cookieDataList});
70
71	for (const cookie of cookieDataList) {
72		const cookieSplit = cookie.split('=');
73		console.log({cookieSplit});
74
75		if (cookieSplit[0] === 'robotama-cookie') cookieSetFlag = true;
76		console.log({cookieSetFlag});
77	}
78
79	// Cookieの有効期限(日)をSetする
80	const expire = 31;
81
82	// 1. Yes Cookie-Set-Function => 引数は有効期限(日)
83	function SetCookie(expire){
84		const current = new Date();
85		expire = current.getTime() + expire * 24 * 3600 * 1000;
86
87		// CookieにDataをSetする
88		document.cookie = `robotama-cookie=robotama-read; expire=${expire}`;
89	}
90
91	// 2. Cookieを拒否したときに、Cookieをすべて削除するFunction
92	function DeleteAllCookie(){
93		const maxAgeZero = 'max-age=0';
94
95		for (const cookie of cookieDataList) {
96			const cookieSplit = cookie.split('=');
97
98			document.cookie = `${cookieSplit[0]}=; ${maxAgeZero}`;
99		}
100	}
101
102	// 3. Popup表示のFunction
103	function PopupDisplay(){
104		cookieConsent.classList.add('is-show');
105	}
106
107	if (cookieSetFlag) {
108	} else {
109		if (rejectFlag) {
110		} else {
111			PopupDisplay();
112		}
113	}
114
115	// Cookie同意ボタンにイベントを追加する
116	cookieAgree.addEventListener('click', ()=> {
117		cookieConsent.classList.add('cc-hide2');
118		SetCookie(expire);
119	});
120	
121	// Cookie拒否ボタンにイベントを追加する
122cookieReject.addEventListener('click', ()=> {
123	cookieConsent.classList.add('cc-hide2');
124
125	// Cookie拒否Userは、SessionStorageで管理
126	// Sessionが切れれば、また表示される
127	sessionStorage.setItem('rejectFlag', true);
128	DeleteAllCookie();
129});
130   
131}());

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.