1"use strict"; 2 3document.addEventListener('DOMContentLoaded', function () { 4 // å種åæå颿°ãå¼ã³åºã 5 initializeIllustrationAnimation(); 6 initializeScrollEvents(); 7 initializeServiceList(); 8 initializeNewsFilter(); 9}); 10 11// ã¤ã©ã¹ãã¢ãã¡ã¼ã·ã§ã³ã®åæå 12function initializeIllustrationAnimation() { 13 var illustElm = document.querySelector('.p-topIllust'); 14 handleIllustrationPosition(); // ã¤ã©ã¹ãã®ä½ç½®ãèª¿æ´ 15 handleBackgroundChange(); // èæ¯è²ã®å¤æ´ãå¦ç 16} 17 18// ã¹ã¯ãã¼ã«ã¤ãã³ãã®åæå 19function initializeScrollEvents() { 20 window.addEventListener('scroll', function () { 21 handleIllustrationPosition(); // ã¹ã¯ãã¼ã«æã«ã¤ã©ã¹ãã®ä½ç½®ãèª¿æ´ 22 handleBackgroundChange(); // ã¹ã¯ãã¼ã«æã«èæ¯è²ã®å¤æ´ãå¦ç 23 }); 24} 25 26// ã¤ã©ã¹ãã®ä½ç½®ãåºå®ã¾ãã¯çµ¶å¯¾ä½ç½®ã«å¤æ´ãã 27function handleIllustrationPosition() { 28 var child = document.querySelector('.p-topIllust'); 29 var parent = document.querySelector('.p-topStatement'); 30 var childRect = child.getBoundingClientRect(); 31 var parentRect = parent.getBoundingClientRect(); 32 var childBottomToParentBottom = parentRect.bottom - childRect.bottom; 33 if (!child.classList.contains('p-topIllust--en')) { 34 if (childBottomToParentBottom <= 0) { 35 // 親è¦ç´ ã®ä¸ç«¯ã«éããã絶対ä½ç½®ã«å¤æ´ 36 document.querySelector('.p-topIllust').classList.add('p-topIllust--absolute'); 37 document.querySelector('.p-topIllust').classList.remove('p-topIllust--fixed'); 38 } 39 if (childRect.top > 0) { 40 // ä¸ç«¯ã«éãããåºå®ä½ç½®ã«å¤æ´ 41 document.querySelector('.p-topIllust').classList.add('p-topIllust--fixed'); 42 document.querySelector('.p-topIllust').classList.remove('p-topIllust--absolute'); 43 } 44 } else { 45 document.querySelector('.p-topIllust').classList.add('p-topIllust--absolute'); 46 document.querySelector('.p-topIllust').classList.remove('p-topIllust--fixed'); 47 } 48} 49 50// èæ¯è²ã®å¤æ´ãå¦ç 51function handleBackgroundChange() { 52 var windowCenter = window.scrollY + window.innerHeight / 2; 53 var targetElement = document.querySelector('.p-topService'); 54 var targetTop = targetElement.offsetTop; 55 var targetBottom = targetTop + targetElement.offsetHeight; 56 var isWithinTarget = windowCenter >= targetTop && windowCenter <= targetBottom - 120; 57 58 // è¦ç´ ã®ä¸å¤®ãã¿ã¼ã²ããç¯å²å ã«ãããã©ããã§ã¯ã©ã¹ã追å /åé¤ 59 document.body.classList.toggle('js-changecolor', isWithinTarget); 60 document.querySelector('.p-topService').classList.toggle('js-changecolor', isWithinTarget); 61 if (document.querySelector('.p-topService__serviceList__btn')) { 62 document.querySelector('.p-topService__serviceList__btn').classList.toggle('js-changecolor', isWithinTarget); 63 } 64 if (document.querySelector('.p-topCaseStudy__titleWrap__title')) { 65 document.querySelector('.p-topCaseStudy__titleWrap__title').classList.toggle('js-changecolor', isWithinTarget); 66 } 67 if (document.querySelector('.p-topEnNewsRelease__titleWrap__title')) { 68 document.querySelector('.p-topEnNewsRelease__titleWrap__title').classList.toggle('js-changecolor', isWithinTarget); 69 } 70 if (document.querySelectorAll('.p-topServiceList__item__link').length !== 0) { 71 document.querySelectorAll('.p-topServiceList__item__link').forEach(function (element) { 72 element.classList.toggle('js-changecolor', isWithinTarget); 73 }); 74 } 75 if (document.querySelector('.p-cloudAutomator__content')) { 76 document.querySelector('.p-cloudAutomator__content').classList.toggle('js-changecolor', isWithinTarget); 77 } 78 if (document.querySelector('.p-cloudAutomator__content__link')) { 79 document.querySelector('.p-cloudAutomator__content__link').classList.toggle('js-changecolor', isWithinTarget); 80 } 81} 82 83// ãµã¼ãã¹ãªã¹ãã®åæå 84function initializeServiceList() { 85 var serviceListItems = document.querySelectorAll('.p-topServiceList__item'); 86 var topServiceContent = document.querySelector('.p-topService__serviceList__content'); 87 if (topServiceContent) { 88 // åæè¡¨ç¤ºã®ã³ã³ãã³ããã¯ãã¼ã³ãã¦è¿½å 89 var cloneElement = serviceListItems[0].querySelector('.p-topServiceContent').cloneNode(true); 90 topServiceContent.appendChild(cloneElement); 91 topServiceContent.querySelector('.p-topServiceContent').classList.add('p-topServiceContent--show'); 92 93 // åãµã¼ãã¹ãªã¹ãã¢ã¤ãã ã®ãªã³ã¯ã«ã¤ãã³ããªã¹ãã¼ã追å 94 document.querySelectorAll('.p-topServiceList__item__link').forEach(function (element) { 95 element.addEventListener('mouseover', function () { 96 handleServiceListItemHover(this, topServiceContent); 97 }); 98 element.addEventListener('click', function (event) { 99 handleServiceListItemClick(event, this, topServiceContent); 100 }); 101 }); 102 } 103} 104 105// ãµã¼ãã¹ãªã¹ãã¢ã¤ãã ã®ããã¼æã®å¦ç 106function handleServiceListItemHover(element, topServiceContent) { 107 if (!element.classList.contains('p-topServiceList__item__link--on')) { 108 var _document$querySelect; 109 // æ¢åã®é¸æç¶æ ãè§£é¤ããæ°ãã«é¸æç¶æ ãè¨å® 110 (_document$querySelect = document.querySelector('.p-topServiceList__item__link--on')) === null || _document$querySelect === void 0 || _document$querySelect.classList.remove('p-topServiceList__item__link--on'); 111 element.classList.add('p-topServiceList__item__link--on'); 112 113 // ã³ã³ãã³ããæ´æ° 114 topServiceContent.innerHTML = ''; 115 var cloneElement = element.nextElementSibling.cloneNode(true); 116 topServiceContent.appendChild(cloneElement); 117 topServiceContent.querySelector('.p-topServiceContent').classList.add('p-topServiceContent--show'); 118 } 119} 120 121// ãµã¼ãã¹ãªã¹ãã¢ã¤ãã ã®ã¯ãªãã¯æã®å¦ç 122function handleServiceListItemClick(event, element, topServiceContent) { 123 event.preventDefault(); 124 if (!element.classList.contains('p-topServiceList__item__link--on')) { 125 var _document$querySelect2; 126 // æ¢åã®é¸æç¶æ ãè§£é¤ããæ°ãã«é¸æç¶æ ãè¨å® 127 (_document$querySelect2 = document.querySelector('.p-topServiceList__item__link--on')) === null || _document$querySelect2 === void 0 || _document$querySelect2.classList.remove('p-topServiceList__item__link--on'); 128 element.classList.add('p-topServiceList__item__link--on'); 129 130 // ã³ã³ãã³ããæ´æ° 131 topServiceContent.innerHTML = ''; 132 var cloneElement = element.nextElementSibling.cloneNode(true); 133 topServiceContent.appendChild(cloneElement); 134 topServiceContent.querySelector('.p-topServiceContent').classList.add('p-topServiceContent--show'); 135 } 136
137 // ã¹ãã¼ããã©ã³è¡¨ç¤ºæã®å¦ç 138 if (window.matchMedia('(max-width: 767px)').matches) { 139 element.classList.toggle('p-topServiceList__item__link--open'); 140 element.nextElementSibling.classList.toggle('p-topServiceContent--open'); 141 } 142} 143 144// ãã¥ã¼ã¹ãã£ã«ã¿ã¼ã®åæå 145function initializeNewsFilter() { 146 var newsBtnItems = document.querySelectorAll('.p-newsFilterBtnList__item__btn'); 147 var newsItems = document.querySelectorAll('.p-newsList__item'); 148 newsBtnItems.forEach(function (newsBtnItem) { 149 newsBtnItem.addEventListener('click', function (event) { 150 handleNewsFilterClick(event, newsItems); 151 }); 152 }); 153} 154 155// ãã¥ã¼ã¹ãã£ã«ã¿ã¼ã®ã¯ãªãã¯æã®å¦ç 156function handleNewsFilterClick(event, newsItems) { 157 var thisBtn = event.currentTarget; 158 var thisCategory = thisBtn.getAttribute('data-category'); 159 160 // ç¾å¨é¸æããã¦ãããã£ã«ã¿ãã¿ã³ã®ç¶æ ãè§£é¤ 161 document.querySelectorAll('.p-newsFilterBtnList__item__btn--on').forEach(function (newsBtnOnItem) { 162 newsBtnOnItem.classList.remove('p-newsFilterBtnList__item__btn--on'); 163 }); 164 thisBtn.classList.add('p-newsFilterBtnList__item__btn--on'); 165 166 // ãã¥ã¼ã¹ã¢ã¤ãã ã®è¡¨ç¤ºãæ´æ° 167 newsItems.forEach(function (newsItem) { 168 var isAll = thisCategory === 'all'; 169 newsItem.classList.toggle('p-newsList__item--on', isAll || newsItem.dataset.category === thisCategory); 170 }); 171}
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.