PageSourceSearch

https://www.kyotographie.jp/wp2025/wp-content/themes/kg2023/assets2/js/override.js?v=1790912451

js kyotographie.jp collected 2026-10-02 03:42:02 UTC 13,248 bytes, 568 lines download raw bytes

1let deviceTypeName = "";
2
3const _onResize = (callback, timeout = 250) => {
4	let timeoutId = null;
5	let prevWidth = window.innerWidth;
6	let prevHeight = window.innerHeight;
7
8	window.addEventListener('resize', () => {
9	  const currentWidth = window.innerWidth;
10	  const currentHeight = window.innerHeight;
11
12	  if (currentWidth === prevWidth && currentHeight === prevHeight) {
13		return;
14	  }
15
16	  if (timeoutId) {
17		clearTimeout(timeoutId);
18	  }
19
20	  timeoutId = setTimeout(() => {
21		callback();
22		prevWidth = currentWidth;
23		prevHeight = currentHeight;
24	  }, timeout);
25	}, { passive: true });
26};
27
28
29
30function initUpdateGlobalCSSVariables() {
31	const gHeader = document.querySelector(".header");
32
33	const cssVariables = [];
34
35	if (gHeader) {
36		cssVariables.push([
37			"--top-padding",
38			() => {
39				// const headerLogo = document.querySelector(".header .header_logo");
40				const menuBtn = document.querySelector(".header .menuBtn");
41				// const headerLogoHeight = headerLogo ? headerLogo.offsetHeight : 0;
42				const menuBtnHeight = menuBtn ? menuBtn.offsetHeight : 0;
43				// return `${Math.max(headerLogoHeight, menuBtnHeight)}px`;
44				return `${Math.max(0, menuBtnHeight)}px`;
45			},
46		]);
47
48	}
49
50	cssVariables.push([
51		"--w-100vw",
52		() => `${document.documentElement.clientWidth}px`,
53	]);
54
55	const update = () => {
56		cssVariables.forEach(([prop, getValue]) => {
57			root.style.setProperty(prop, getValue());
58		});
59	};
60
61	update();
62	_onResize(update);
63}
64
65// window.MyApp.initUpdateGlobalCSSVariable = initUpdateGlobalCSSVariable;
66
67
68
69
70
71function deviceType(args) {
72  if (typeof args === "undefined") args = {};
73  // type 1:sp 2:tablet 3:pc
74  /*
75		args = {
76				tabletIsPC : boolean,
77				setHtmlDeviceClass : boolean,
78				setHtmlBrowserClass : boolean,
79		}
80
81		*/
82  var ua = navigator.userAgent.toLowerCase();
83  var type = 0;
84
85  var tabletIsPC = args.tabletIsPC || false;
86  var setHtmlDeviceClass = args.setHtmlDeviceClass || false;
87  var setHtmlBrowserClass = args.setHtmlBrowserClass || false;
88
89  var htmlElm = document.querySelector("html");
90
91  if (
92    ua.indexOf("iphone") > 0 ||
93    (ua.indexOf("android") > 0 && ua.indexOf("mobile") > 0)
94  ) {
95    type = 1;
96  } else if (ua.indexOf("android") > 0) {
97    type = tabletIsPC ? 3 : 2;
98  } else if (
99    ua.indexOf("ipad") > -1 ||
100    (ua.indexOf("macintosh") > -1 && "ontouchend" in document)
101  ) {
102    type = tabletIsPC ? 3 : 2;
103  } else {
104    type = 3;
105  }
106
107  switch (type) {
108	case 1:
109	  deviceTypeName = "isSP";
110	  break;
111	case 2:
112	  deviceTypeName = "isTL";
113	  break;
114	case 3:
115	  deviceTypeName = "isPC";
116	  break;
117	default:
118	  deviceTypeName = "isPC";
119	  break;
120  }
121
122  if (setHtmlDeviceClass) {
123    htmlElm.classList.add(deviceTypeName);
124  }
125
126  if (setHtmlBrowserClass) {
127    var browserName = "";
128
129    if (ua.indexOf("safari") > -1 && ua.indexOf("chrome") < 0) {
130      browserName = "isSafari";
131    } else if (ua.indexOf("firefox") > -1) {
132      browserName = "isFF";
133    } else if (ua.indexOf("trident/7") > -1) {
134      browserName = "isIE11 isIE";
135    } else if (ua.indexOf("msie") > -1) {
136      browserName = "isIE";
137    } else if (ua.indexOf("edge") > -1) {
138      browserName = "isEdge";
139    } else if (ua.indexOf("chrome") > -1) {
140      browserName = "isChrome";
141    }
142
143    htmlElm.classList.add(deviceTypeName);
144    htmlElm.classList.add(browserName);
145  }
146
147  return type;
148}
149
150deviceType({
151  tabletIsPC: true,
152  // setHtmlDeviceClass: true,
153  // setHtmlBrowserClass: true,
154});
155
156
157function initFitImageSize(option) {
158
159	// window.addEventListener("load", function () {
160	document.addEventListener("DOMContentLoaded", function () {
161		adjustImages(option);
162	});
163
164
165	if (deviceTypeName == "isPC") {
166		var timeoutId ;
167
168		window.addEventListener("resize", function () {
169			if ( timeoutId ) return ;
170
171			timeoutId = setTimeout( function () {
172				timeoutId = 0 ;
173				adjustImages(option);
174			}, 500 ) ;
175		});
176	}
177
178
179
180
181  function adjustImages(option) {
182
183	// option = {
184	// 	imageWrapper: "target selector value",
185	// 	baseWrapper: "wrapper selector value for pc",
186	// 	baseWrapper_sp: "wrapper selector value for sp",
187	// 	baseWrapper_sp: "wrapper selector value for sp",
188	// 	includeCaption: "",
189	// };
190
191	let imageWrapper = option.imageWrapper;
192	let baseWrapper_pc = option.baseWrapper;
193	let baseWrapper_sp = option.baseWrapper;
194	let adjustWrapper = false;
195	let includeCaption = false;
196	let customMargin = 0;
197
198	if (typeof option.baseWrapper_sp === "undefined") {
199		baseWrapper_sp = baseWrapper_pc;
200	}else{
201		baseWrapper_sp = option.baseWrapper_sp;
202	}
203
204	if (typeof option.adjustWrapper !== "undefined") {
205		adjustWrapper = option.adjustWrapper;
206	}
207
208	if (typeof option.includeCaption !== "undefined") {
209		includeCaption = option.includeCaption;
210	}
211
212	if (typeof option.customMargin !== "undefined") {
213		customMargin = option.customMargin;
214	}
215
216
217	let diffHeight = 0;
218
219
220	let navigationHeight = 0;
221	if(document.querySelector(".header_bottomFix")) {
222		navigationHeight = document.querySelector(".header_bottomFix").offsetHeight;
223	}
224
225    let windowHeight = window.innerHeight;
226
227    const imgBlocks = document.querySelectorAll(imageWrapper);
228
229    imgBlocks.forEach((imgBlock) => {
230
231		let diffHeight = navigationHeight * 2;
232		let adjustTarget;
233
234		const img = imgBlock.querySelector("img");
235
236		if(adjustWrapper == true){
237			adjustTarget = imgBlock;
238			imgBlock.classList.add("fit-image_wrapper");
239			img.classList.add("fit-image_item")
240		}else{
241			adjustTarget = img;
242			img.classList.add("fit-image_self");
243		}
244
245		/*
246			画像 にサイズ指定するだけでいいのか
247			ラッパーにサイズ指定するのか?
248		*/
249
250		if(includeCaption){
251			diffHeight = diffHeight + imgBlock.querySelector(includeCaption).clientHeight;
252		}
253
254		const imgRatio = img.getAttribute("width") / img.getAttribute("height");
255		const maxHeight = windowHeight - diffHeight;
256
257		let maxWidth;
258
259		if (deviceTypeName == "isPC" && document.body.clientWidth > 767) {
260			maxWidth = document.querySelector(baseWrapper_pc).clientWidth;
261		} else {
262			maxWidth = document.querySelector(baseWrapper_sp).clientWidth;
263		}
264
265
266		if (imgRatio >= 1) {
267			let adjustedWidth = Math.min(maxWidth, maxHeight * imgRatio);
268
269			if (adjustedWidth === 0) {
270				adjustedWidth = maxWidth;
271			}
272			adjustTarget.style.width = adjustedWidth + "px";
273			adjustTarget.style.height = adjustedWidth / imgRatio + "px";
274		} else {
275			let adjustedHeight = Math.min(maxHeight, maxWidth / imgRatio);
276			if (adjustedHeight === 0) {
277				adjustedHeight = maxHeight;
278			}
279			adjustTarget.style.height = adjustedHeight + "px";
280			adjustTarget.style.width = adjustedHeight * imgRatio + "px";
281		}
282
283    });
284  }
285}
286
287  // 背景固定
288  function bodyScrollPrevent(flag) {
289    let scrollPosition;
290    const body = document.getElementsByTagName('body')[0];
291    const ua = window.navigator.userAgent.toLowerCase();
292    const isiOS = ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1 || ua.indexOf('macintosh') > -1 && 'ontouchend' in document;
293    const scrollBarWidth = window.innerWidth - document.body.clientWidth;
294    if (flag) {
295      body.style.paddingRight = scrollBarWidth + 'px';
296      if (isiOS) {
297        scrollPosition = -window.pageYOffset;
298        body.style.position = 'fixed';
299        body.style.width = '100%';
300        body.style.top = scrollPosition + 'px';
301      } else {
302        body.style.overflow = 'hidden';
303      }
304    } else if (!flag) {
305      body.style.paddingRight = '';
306      if (isiOS) {
307        scrollPosition = parseInt(body.style.top.replace(/[^0-9]/g, ''));
308        body.style.position = '';
309        body.style.width = '';
310        body.style.top = '';
311        window.scrollTo(0, scrollPosition);
312      } else {
313        body.style.overflow = '';
314      }
315    }
316  }
317
318function initHashModalOpener(){
319	let hash = $(location).prop('hash').substr(1);
320
321	if ($(".js-modal").length) {
322		$('.js-modalBtn').on('click', function () {
323			var modalId = $(this).next('.js-modalCont').attr("data-modal");
324			location.hash = modalId;
325		});
326
327	}
328
329	if($(location).prop('hash') && hash.startsWith("interview-")){
330	}else if(hash == ""){
331		let url = decodeURIComponent(location.href);
332
333		var urlHash = url.split('#');
334		urlHash = urlHash.filter(function(s){return s !== '';});
335		hash = urlHash[1];
336	}
337
338	if ($(".js-modal").length && hash && hash.startsWith("interview-")) {
339
340		if($('[data-modal=' + hash + ']').length){
341				var modalCont;
342				  modalCont = $('[data-modal=' + hash + ']').clone().css("display", "flex");
343				$(".l-modal_container").append(modalCont);
344				$(".js-modal").fadeIn();
345				bodyScrollPrevent(true);
346			}
347
348	}
349	$('.js-modalColsed').on('click', function () {
350		location.hash = '';
351	});
352}
353
354
355function initAssociatedProgramList(){
356
357  // programs一覧 メイソンリー
358//   if ($('.js-programList2').length) {
359
360//     var exhibitionsList = new Macy({
361//       container: '.js-programList2',
362//       // waitForImages: true,
363//       // useOwnImageLoader: true,
364//       margin: {
365//         x: 32,
366//         y: 84
367//       },
368//       columns: 3,
369//       breakAt: {
370//         767: {
371//           columns: 1,
372//           margin: {
373//             y: 80
374//           },
375//         }
376//       }
377//     });
378
379//     exhibitionsList.runOnImageLoad(function () {
380//       exhibitionsList.recalculate(true);
381//     }, true);
382//   }
383
384}
385
386function init2026HomeMv(){
387	var homeMvSlide = new Splide(".homeMv_slider", {
388		type: "fade",
389		rewind: true,
390		speed: 2000,
391		interval: 6000,
392		autoplay: true,
393		pagination: false,
394		arrows: false,
395		pauseOnHover: false,
396	  });
397	  homeMvSlide.on('active', function () {
398		// 2枚目以降
399		homeMvSlide.options = {
400		  interval: 2500,
401		};
402	  });
403
404
405	  homeMvSlide.mount();
406}
407
408function init2025HomeMv_w_Animation(){
409	var homeMvSlide = new Splide(".homeMv_slider", {
410		type: "fade",
411		rewind: true,
412		speed: 2000,
413		interval: 5000,
414		autoplay: true,
415		pagination: false,
416		arrows: false,
417		pauseOnHover: false,
418	  });
419	  homeMvSlide.on('active', function () {
420		// 2枚目以降
421		homeMvSlide.options = {
422		  interval: 4000,
423		};
424	  });
425
426	  homeMvSlide.mount();
427
428
429
430	let svg_wrapper = document.querySelector("#fv_animation");
431	const theme_n_date = document.querySelector(".homeMv_theme_date");
432	const layer_height = svg_wrapper.getBoundingClientRect().height * 0.5;
433
434	theme_n_date.style.setProperty("--height", layer_height + "px");
435
436	const updateSize = () => {
437		let svg_wrapper = document.querySelector("#fv_animation");
438
439		const layer_height = svg_wrapper.getBoundingClientRect().height * 0.5;
440		theme_n_date.style.setProperty("--height", layer_height + "px");
441	}
442
443	_onResize(updateSize, 500);
444
445
446	svg_wrapper.querySelector(".-l6").addEventListener("animationend", function(){
447		// setTimeout for  0.1333s
448		console.log("l6 animationend");
449		setTimeout(() => {
450			theme_n_date.classList.add("--visible");
451		}, 133);
452
453	// });
454
455	// theme_n_date.addEventListener("transitionend", function(){
456		// 0.666666s
457		setTimeout(() => {
458			theme_n_date.classList.remove("--visible");
459			svg_wrapper.classList.remove("--visible");
460			// set opacity 0;
461			homeMvSlide.refresh();
462			setTimeout(() => {
463				document.querySelector(".homeMv_logo").classList.add("--visible");
464				document.querySelector(".homeMv_slider").classList.add("--visible");
465
466			}, 999);
467
468
469		}, 1500);
470
471	});
472
473
474}
475
476
477function initInstagramGallery() {
478	let append_target = document.querySelector(".homeInstagram .splide .splide__list");
479
480
481	  let url = "/kg2023_ig-basic-api/for_wp.php";
482
483	  fetch(url)
484		.then(async (response) => {
485		  if (response.ok) {
486			return response.text();
487		  } else {
488			throw new Error(`Request failed: ${response.status}`);
489			document.querySelector(".homeInstagram").remove();
490		  }
491		})
492		.then(function (contents) {
493		  let received_dom = new DOMParser().parseFromString(
494			contents,
495			"text/html"
496		  );
497
498		  received_dom.querySelectorAll("li").forEach((post) => {
499			append_target.append(post);
500		  });
501
502		})
503		.catch((err) => console.error(err)); // Error: Request failed: 404
504  }
505
506
507function initScaleImage(){
508	document.querySelectorAll("img.--scale").forEach((img) => {
509		if (!img.hasAttribute("width") && !img.hasAttribute("height")) {
510			img.setAttribute("width", img.naturalWidth / 2);
511			img.setAttribute("height", img.naturalHeight / 2);
512		}
513
514	} );
515}
516
517
518
519function initMasonry(){
520	  // 汎用 メイソンリー
521  if ($('.js-masonry').length) {
522
523    var masonryList = new Macy({
524      container: '.js-masonry',
525      // waitForImages: true,
526      // useOwnImageLoader: true,
527      margin: {
528        x: 32,
529        y: 32
530      },
531      columns: 3,
532      breakAt: {
533        767: {
534          columns: 2,
535          margin: {
536            y: 32
537          },
538        }
539      }
540    });
541
542    masonryList.runOnImageLoad(function () {
543      masonryList.recalculate(true);
544    }, true);
545  }
546}
547
548
549function initDetailsOpener() {
550  function openDetailsForHash() {
551    const hash = location.hash;
552    if (!hash) return;
553
554    const target = document.querySelector(hash);
555    if (!target) return;
556
557    const details = target.closest('details') ?? (target.matches('details') ? target : null);
558    if (!details) return;
559
560    details.open = true;
561    requestAnimationFrame(() => target.scrollIntoView());
562  }
563
564  document.addEventListener('DOMContentLoaded', openDetailsForHash);
565  window.addEventListener('hashchange', openDetailsForHash);
566}
567
568initDetailsOpener();

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.