PageSourceSearch

https://www.city.suginami.tokyo.jp/shared/js/setting.js

js city.suginami.tokyo.jp collected 2026-09-24 08:56:43 UTC 4,294 bytes, 151 lines download raw bytes

1jQuery.noConflict();
2(function($){
3
4	$.GSET = {};
5
6	//ブレイクポイント(MediaQuery)の設定
7	$.GSET.MODEL = {
8		//ブレイクポイントの名前(要素移動などで使用) : MediaQueryの値
9		pc: '(min-width: 641px)',
10		sp: 'only screen and (max-width : 640px)'
11	};
12
13	//要素移動の設定
14	$.GSET.MOVE_ELEM = [{
15		elem: '.know_intro .know_intro_banner',
16		pc: ['.know_intro .know_intro_main','after'],
17		sp: ['.know_intro .know_intro_main','before']
18	}];
19
20	//PC/スマートフォン切り替えの設定
21	$.GSET.MODEL_CHANGE_CSS = '.mc_css'; //PC表示時に削除するCSS
22	$.GSET.MODEL_CHANGE_CWIDTH = 1280; //PC表示時のコンテンツ幅
23	$.GSET.MODEL_CHANGE_BASE_MODEL = 'pc'; //PC表示のブレイクポイント名
24	$.GSET.MODEL_CHANGE_SP_MODEL = 'sp'; //スマートフォン表示のブレイクポイント名
25
26	// JavaScriptでCookie処理
27	var gdCookie = {
28		setCookie: function (key, value, cookie) {
29			var defaults = ['', '', { expires: 365 }];
30			var options = [key, value, cookie];
31			var c = $.extend(true, {}, defaults, options);
32			var expires = c[2].expires;
33			// var path = c[2].path;
34			var path = '/';
35			var date = new Date();
36			date.setTime(date.getTime() + (expires * 24 * 60 * 60 * 1000));
37			expires = '; expires=' + date.toUTCString(); //協定世界時
38			document.cookie = key + '=' + value + expires + '; path=' + path + ';';
39		},
40		getCookie: function (key) {
41			var nameEQ = key + '=';
42			var decodedCookie = decodeURIComponent(document.cookie);
43			var cookie_array = decodedCookie.split(';');
44			for (var i = 0; i < cookie_array.length; i++) {
45				var c = cookie_array[i].trim();
46				if (c.indexOf(nameEQ) == 0) {
47					return c.substring(nameEQ.length, c.length);
48				}
49			}
50			return '';
51		},
52		removeCookie: function (key, value, cookie) {
53			var date = new Date();
54			date.setTime(0);
55			var path = '/';
56			document.cookie = key + '=; expires=' + date.toUTCString() + '; path=' + path + ';';
57		},
58		clearCookie: function () {
59			var cookies = document.cookie.split(';');
60			for (var i = 0; i < cookies.length; i++) {
61				var cookie = cookies[i];
62				var eqPos = cookie.indexOf('=');
63				var key = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
64				removeCookie(key);
65			}
66		}
67	};
68
69	// Storageが利用可能か
70	function checkStorage(type) {
71		try {
72			var storage = window[type];
73			var storageItem = '__storage__';
74			storage.setItem(storageItem, '__check__');
75			storage.removeItem(storageItem);
76			return true;
77		}
78		catch (e) {
79			return e instanceof DOMException && (e.code === 22 || e.code === 1014 || e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && storage.length !== 0;
80		}
81	}
82	if (checkStorage('localStorage')) {
83		checkStorageResult = true;
84	}
85	else {
86		checkStorageResult = false;
87	}
88	// Cookieが利用可能か
89	var cookieItem = '__cookie__';
90	gdCookie.setCookie(cookieItem, '__check__');
91	if (gdCookie.getCookie(cookieItem)) {
92		gdCookie.removeCookie(cookieItem);
93		checkCookieResult = true;
94	}
95	else {
96		checkCookieResult = false;
97	}
98
99	$.GSTORAGE = {};
100	// localStorage.setItem, localStorage.getItem, localStorage.removeItem, localStorage.clear をCookieに変換する処理
101	$.GSTORAGE.switchStorage = function () {
102		storageAvailable = checkStorageResult;
103		cookieAvailable = checkCookieResult;
104		// Storageが利用可能
105		if (storageAvailable) {
106			return localStorage;
107		}
108		// Storageが利用不可でCookieが利用可能
109		else if (cookieAvailable) {
110			return {
111				// 第一引数:key, 第二引数:value, 第三引数:{expires, path}
112				setItem: function (key, value, cookie) {
113					return gdCookie.setCookie(key, value, cookie);
114				},
115				getItem: function (key) {
116					if (gdCookie.getCookie(key)) {
117						return gdCookie.getCookie(key);
118					}
119					else {
120						return undefined;
121					}
122				},
123				removeItem: function (key, cookie) {
124					return gdCookie.removeCookie(key, cookie);
125				},
126				clear: function () {
127					return gdCookie.clearCookie();
128				}
129			}
130		}
131		// Storage,Cookie利用不可
132		else {
133			return {
134				setItem: function () {
135					return false;
136				},
137				getItem: function () {
138					return false;
139				},
140				removeItem: function () {
141					return false;
142				},
143				clear: function () {
144					return false;
145				}
146			}
147		};
148	}
149
150})(jQuery);
151

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.