1/** 2 * æ±ãªãµã¤ã PCã¡ãã¥ã¼ã¢ã¯ãã£ã表示 3 * SSIã§èªã¿è¾¼ã¾ããå ±éãããã¼ã®ã¡ãã¥ã¼é ç®ãç¾å¨ã®ãã¼ã¸ã«å¿ãã¦ã¢ã¯ãã£ã表示 4 * @version 1.0.0 5 */ 6 7(function() { 8 'use strict'; 9 10 // ãã¼ã¸èªã¿è¾¼ã¿å®äºå¾ã«å®è¡ 11 document.addEventListener('DOMContentLoaded', function() { 12 13 // ç¾å¨ã®URLãã¹ãåå¾ 14 const currentPath = location.pathname; 15 16 // PCã¡ãã¥ã¼ã®ã¢ã¯ãã£ã表示 17 function setActiveMenuPC() { 18 // ã¡ã¤ã³ããã²ã¼ã·ã§ã³ã®ãªã³ã¯ãåå¾ 19 const navLinks = document.querySelectorAll('.p-headerPC__navText a, .p-headerPC__dropDownNavItem a, a.p-headerPC__navText'); 20 21 navLinks.forEach(link => { 22 const href = link.getAttribute('href'); 23 24 // ç¾å¨ã®ãã¹ã¨ä¸è´ããããã§ã㯠25 if (href && isCurrentPage(href, currentPath)) { 26 // ãªã³ã¯èªä½ã«activeã¯ã©ã¹ã追å 27 link.classList.add('active'); 28 29 // 親è¦ç´ ã«ãactiveã¯ã©ã¹ã追å ï¼ã¡ã¤ã³ããé ç®ï¼ 30 const parentNavItem = link.closest('.p-headerPC__navItem'); 31 if (parentNavItem) { 32 parentNavItem.classList.add('active'); 33 } 34 35 // ãããããã¦ã³å ã®ã¢ã¤ãã ã®å ´å 36 const dropDownItem = link.closest('.p-headerPC__dropDownNavItem'); 37 if (dropDownItem) { 38 dropDownItem.classList.add('active'); 39 40 // ãããããã¦ã³ã¡ãã¥ã¼ã®è¦ªããã²ã¼ã·ã§ã³é ç®ãã¢ã¯ãã£ãã« 41 const parentDropDown = dropDownItem.closest('.p-headerPC__dropDownNav'); 42 if (parentDropDown) { 43 const parentNavOfDropDown = parentDropDown.closest('.p-headerPC__navItem'); 44 if (parentNavOfDropDown) { 45 parentNavOfDropDown.classList.add('active-parent'); 46 } 47 } 48 } 49 } 50 }); 51 } 52 53 // URLãããã³ã°é¢æ°ï¼é層æ§é ã«å¯¾å¿ï¼ 54 function isCurrentPage(linkHref, currentPath) { 55 // /product/casestudy ã®å ´åã¯éã¢ã¯ãã£ãå 56 if (currentPath.includes('/product/casestudy')) { 57 return false; 58 } 59 60 // å®å ¨ä¸è´ 61 if (linkHref === currentPath) { 62 return true; 63 } 64 65 // æ«å°¾ã®ã¹ã©ãã·ã¥ãæ£è¦å 66 const linkPathClean = linkHref.replace(/\/$/, ''); 67 const currentPathClean = currentPath.replace(/\/$/, ''); 68 69 // å®å ¨ä¸è´ï¼ã¹ã©ãã·ã¥æ£è¦åå¾ï¼ 70 if (linkPathClean === currentPathClean) { 71 return true; 72 } 73 74 // ã»ã¯ã·ã§ã³ãã¨ã®ãããã³ã°ã«ã¼ã« 75 const sectionRules = { 76 // ååãæ¢ã 77 '/product/': { 78 patterns: ['/product/search/', '/product/favorite'],
79 subPaths: [ 80 '/product/search/floor_result', 81 '/product/search/carpet_result', 82 '/product/search/wall_result', 83 '/product/search/curtain_result', 84 '/product/search/baseboard_result', 85 '/product/search/adhesive_result' 86 ] 87 }, 88 // ã·ã§ã¼ã«ã¼ã 89 '/showroom/': { 90 patterns: ['/showroom/'], 91 locations: [ 92 '/showroom/tokyo.html', 93 '/showroom/osaka.html', 94 '/showroom/nagoya.html', 95 '/showroom/sapporo.html', 96 '/showroom/fukuoka.html', 97 '/showroom/okayama.html', 98 '/showroom/takamatsu.html' 99 ] 100 }, 101 // ãã¸ã¿ã«ã«ã¿ãã° 102 '/digital_catalog/': { 103 patterns: ['/digital_catalog/'], 104 tabs: ['?tab=floor', '?tab=carpet', '?tab=wall', '?tab=curtain', '?tab=baseboard'] 105 }, 106 // 伿¥ã»IRã»æ¡ç¨ 107 '/company/': { 108 patterns: ['/company/'], 109 pages: [ 110 '/company/president_speech.html', 111 '/company/philosophy.html', 112 '/company/company_outline.html', 113 '/company/toli_history.html', 114 '/company/charter.html', 115 '/company/eigyousho.html' 116 ] 117 }, 118 '/ir/': { 119 patterns: ['/ir/', '/ir_en/'], 120 sections: [ 121 '/ir/message/', 122 '/ir/plan/', 123 '/ir/walking/', 124 '/ir/strength/', 125 '/ir/business/', 126 '/ir/governance/' 127 ] 128 }, 129 // ãµã¹ããããªã㣠130 '/sustainability/': { 131 patterns: ['/sustainability/'] 132 }, 133 // è²©å£²åº 134 '/shop/': { 135 patterns: ['/shop/'], 136 subPaths: [ 137 '/shop/list', 138 '/shop/detail', 139 '/shop/list.html', 140 '/shop/detail.html' 141 ] 142 }, 143 // ã¡ã³ãã¼ 144 '/member/': { 145 patterns: ['/member/'], 146 pages: ['/member/login', '/member/logout', '/member/faq'] 147 } 148 }; 149 150 // ã»ã¯ã·ã§ã³ã«ã¼ã«ã«åºã¥ãã¦ãããã³ã° 151 for (const [sectionPath, rules] of Object.entries(sectionRules)) { 152 // ã¡ã¤ã³ã»ã¯ã·ã§ã³ã®ãã¿ã¼ã³ãããã³ã° 153 if (rules.patterns) { 154 for (const pattern of rules.patterns) { 155 // ãªã³ã¯ããã®ãã¿ã¼ã³ã«è©²å½ããç¾å¨ã®ãã¼ã¸ãã»ã¯ã·ã§ã³å ã«ããå ´å 156 if (linkHref.includes(pattern) && currentPath.startsWith(sectionPath)) { 157 return true; 158 } 159 } 160 } 161 162 // ãµããã¼ã¸ã®è©³ç´°ãããã³ã° 163 if (currentPath.startsWith(sectionPath)) { 164 // ç¾å¨ã®ãã¼ã¸ãã»ã¯ã·ã§ã³å ã®ç¹å®ãã¼ã¸ã®å ´å 165 if (rules.subPaths && rules.subPaths.includes(currentPath)) { 166 if (linkHref.includes(sectionPath)) { 167 return true; 168 } 169 } 170 if (rules.locations && rules.locations.includes(currentPath)) { 171 if (linkHref.includes(sectionPath)) { 172 return true; 173 } 174 } 175 if (rules.pages && rules.pages.includes(currentPath)) { 176 if (linkHref.includes(sectionPath)) { 177 return true; 178 } 179 } 180 if (rules.sections && rules.sections.some(section => currentPath.startsWith(section))) { 181 if (linkHref.includes(sectionPath)) { 182 return true; 183 } 184 } 185 } 186 } 187 188 return false; 189 } 190 191 // ãããã°ã¢ã¼ãï¼éçºæã®ã¿ä½¿ç¨ï¼ 192 // function debugMode() { 193 // console.log('Current Path:', currentPath); 194 // const activeElements = document.querySelectorAll('.active, .active-parent'); 195 // console.log('Active Elements:', activeElements); 196 // 197 // // 販売åºãªã³ã¯ã®è©³ç´°ãããã° 198 // const shopLinks = document.querySelectorAll('a[href="/shop/"]'); 199 // console.log('Shop Links Found:', shopLinks); 200 // shopLinks.forEach((link, index) => { 201 // console.log(`Shop Link ${index}:`, link.getAttribute('href'), 'Match Result:', isCurrentPage(link.getAttribute('href'), currentPath)); 202 // }); 203 // } 204 205 // å®è¡ 206 setActiveMenuPC(); 207 208 // ãããã°ã¢ã¼ãï¼å¿ è¦ã«å¿ãã¦ã³ã¡ã³ãã¢ã¦ãï¼ 209 // debugMode(); 210 }); 211})(); 212 213 214 // Redirect and link fix for /saiyou -> / 215 $(function(){ 216 var RECRUIT_ROOT = 'https://recruit.toli.co.jp/'; 217 var RECRUIT_CAREER_SRC = 'https://recruit.toli.co.jp/recruit/index.html?career'; 218 var RECRUIT_CAREER_DST = 'https://recruit.toli.co.jp/recruit/career/index.html'; 219 try { 220 var hrefNow = window.location.href.replace(/\/+$/,'/'); 221 if (hrefNow === 'https://recruit.toli.co.jp/saiyou' || hrefNow === 'https://recruit.toli.co.jp/saiyou/') { 222 if (hrefNow !== RECRUIT_ROOT) { 223 window.location.replace(RECRUIT_ROOT); 224 return; 225 } 226 } 227 // Direct visit redirect for career query mapping 228 if (window.location.href === RECRUIT_CAREER_SRC) { 229 window.location.replace(RECRUIT_CAREER_DST); 230 return; 231 } 232 } catch(e) {} 233 234 $('a[href]').each(function(){
235 try { 236 var href = $(this).attr('href'); 237 if (!href) return; 238 // Case 1: relative path '/saiyou' or '/saiyou/' -> absolute RECRUIT_ROOT 239 if (href === '/saiyou' || href === '/saiyou/') { 240 $(this).attr('href', RECRUIT_ROOT); 241 return; 242 } 243 // Case 1b: relative recruit career query -> absolute new career URL 244 if (href === '/recruit/index.html?career') { 245 $(this).attr('href', RECRUIT_CAREER_DST); 246 return; 247 } 248 // Case 2: absolute link to recruit domain with /saiyou path -> RECRUIT_ROOT 249 if (/^https?:\/\/recruit\.toli\.co\.jp(\/saiyou\/?|$)/i.test(href)) { 250 // if it's exactly /saiyou or /saiyou/ or has only that path 251 var tmp = document.createElement('a'); tmp.href = href; 252 var p = tmp.pathname.replace(/\/+$/,'/'); 253 if (p === '/saiyou/' || p === '/saiyou') { 254 $(this).attr('href', RECRUIT_ROOT); 255 return; 256 } 257 } 258 // Case 3: absolute link exactly matching old career URL -> new career URL 259 if (href === RECRUIT_CAREER_SRC) { 260 $(this).attr('href', RECRUIT_CAREER_DST); 261 return; 262 } 263 } catch(e) {} 264 }); 265 });
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.