1/* 2 ä¿®æ£å±¥æ´ 3*/ 4//2017.02.22 IE9,10 å¯¾å¿ Author Yoshida 5//2017.03.16 IE9,10 対å¿åä¿®æ£ Author Yoshida 6//2017.04.21 ä¸å åä¿®æ£ Author Yoshida 7//2017.05.23 demo52,53ã¨ä¸å åä¿®æ£ Author Yoshida 8//2017.08.09 ã¹ããã§ã¡ãã¥ã¼ä¸é層ç®ã§ã¢ã³ã«ã¼ä»ãªã³ã¯ããªã対å¿(#2097) Author Yoshida 9//2017.11.02 ã¿ããã¹ã¯ãªã¼ã³PCã§ãhoverãå¹ããªããªãåé¡ã対å¿(#2672) Author Yoshida 10//2017.11.14 ãã£ã¨ã¿ããã¿ã³ã®æåã®ä¿®æ£(#2769) Author Yoshida 11//2018.07.03 ã¢ã¼ãã«ï¼youtubeï¼IE11 ã®çµã¿åããã§ãyoutubeã®ãã«ã¹ã¯ãªã¼ã³ãæ©è½ããªã対å¿(#4564) Author Yoshida 12//2018.07.04 ã¹ããã¡ãã¥ã¼ã§ã¢ã³ã«ã¼ãªã³ã¯ãã¯ãªãã¯ããéã«ã¡ãã¥ã¼ãéããªãä¸å ·å対å¿(#4562) Author Yoshida 13//2018.07.17 ã¹ããã¡ãã¥ã¼ã§ã¢ã³ã«ã¼ãªã³ã¯ãã¯ãªãã¯ããéã«ã¡ãã¥ã¼ãéããªãä¸å ·å対å¿-SSL(#4562#12) Author Yoshida 14 15/* YM HCD Updates 16 * ------------------------------------------------------------------------------------------------------- 17 * Jan.12, Functions added for YM HCD Versions. 18 */ 19 20// YM HCD Variables 21// ------------------------------------------------------------------------------------------------------- 22 23// Get YMHCD Version 24const ymhcd_indicator = document.querySelector('body').getAttribute('data-ymhcd'); 25const ymhcd_is_enabled = true; 26 27// Global Navigation Events Array 28const globalNavbarEvents = !!ymhcd_is_enabled 29 ? { 30 show: ['mouseenter', 'focusin'], 31 hide: ['mouseleave', 'focusout'], 32 } 33 : { 34 show: ['mouseenter'], 35 hide: ['mouseleave'], 36 }; 37 38var hasTouchEvent; 39 40var ua = navigator.userAgent; //2017.11.02 41var isPC = false; //2017.11.02 42 43var locationAddr = location.href; //2018.07.04 (#4562) 44locationAddr = locationAddr.replace(/#.+$/, ''); 45 46if (locationAddr.search(/^https:/) !== -1) { 47 //2018.07.17 (#4562#12) 48 locationAddr = locationAddr.replace(/^https:\/\//, ''); 49} else { 50 locationAddr = locationAddr.replace(/^http:\/\//, ''); 51} 52 53var domain = locationAddr.replace(/\/(.+$)/, ''); 54locationAddr = locationAddr.replace(domain, ''); 55 56// breakpoint cssã®mediaã¯ã¨ãªã¨åãå¤ã«ããã㨠57var breakpoint_sp = 767; 58var breakpoint_media_sp = '(max-width:' + breakpoint_sp + 'px)'; 59 60//appVersion 2017.02.22 IE9,10 å¯¾å¿ Yoshida 61var appVersion = navigator.appVersion.toLowerCase(); 62 63// Layoutãã§ãã¯ã¯ä¸è¨ã®å¤æ°ä½¿ãã㨠64// ä»ã®ã¨ããPC,SPã®2ãã¿ã¼ã³ã ãä»å¾å¤å®ãããå¯è½æ§ããã®ã§ããããå®ç¾© 65var isLayoutPC; 66var isLayoutSP; 67var isLayoutChange = false; 68 69var viewWidth; 70var contentHeight; 71 72var footerHeight; 73 74// ã«ã«ã¼ã»ã«ã¤ã³ã¹ã¿ã³ã¹ããªãµã¤ãºã®éã«ç ´æ£ãããã 75var swiper_carousel_instance = []; 76 77// 以é使ãã¾ããã¨ã¬ã¡ã³ãã¯ãã£ãã·ã¥ãã¦ãã 78var $window; 79var $html_body; 80var $root; 81var $modal_bg; 82var $rwd_content; 83var $rwd_globalnav; 84var $scroll_button; 85var $search_triger; // æ¤ç´¢ã®Toggleç¨ 86var $search_box; // æ¤ç´¢ã®ãã©ã¼ã 87 88var $product_menu_trigger; 89var $product_menu; 90var $accordion_toggle; 91var $shrink_open; 92var $shrink_close; 93 94var $global_nav; 95var $global_nav_item; 96var $global_nav_item_pageLink; //#4562 97var $global_nav_item_has_child; 98 99var $megamenus; 100 101var $menu_trigger; 102var $submenu_link; 103var $main_header; 104 105var $relation_link; // é¢é£ãªã³ã¯ã®ééç¨ 106 107var $slider_wide; 108var $slider_thunbnail_wrap; 109var $swiper_carousel01; 110 111var $shlink_more_button; 112var $shlink_more_button_news; 113var $shrink_wrapper; 114var $shrink_content; 115var $rwd_shrink_content; 116 117var $load_more_button; 118var load_more_tpl; 119var is_loading; 120 121var $anchor; 122var $global_nav_item_anchor; 123var $swiper_carousel_filelist; 124 125// for slide group 126var $slideGroup; 127 128// Layoutãã§ã㯠129//2017.02.22 IE9,10 å¯¾å¿ Yoshida 130//2017.03.16 IE9,10 対å¿åä¿®æ£ Yoshida 131function checkLayout() { 132 if (appVersion.search(/msie 9\./) !== -1 || appVersion.search(/msie 10\./) !== -1) { 133 isLayoutChange = false; 134 isLayoutSP = false; 135 isLayoutPC = true; 136 } else { 137 if (window.matchMedia(breakpoint_media_sp).matches) { 138 // SP Layout 139 isLayoutChange = isLayoutPC; 140 isLayoutSP = true; 141 isLayoutPC = false;
142 } else { 143 isLayoutChange = isLayoutSP; 144 isLayoutSP = false; 145 isLayoutPC = true; 146 } 147 } 148 //console.log('Layout PC:'+ isLayoutPC); 149 //console.log('Layout SP:'+ isLayoutSP); 150} 151 152// JQuery 153(function ($) { 154 $window = $(window); 155 viewWidth = window.innerWidth; 156 $html_body = $('html,body'); 157 158 hasTouchEvent = 'ontouchstart' in window; 159 is_loading = false; 160 161 $modal_bg = $('#rwd-control-modal-bg'); 162 $rwd_content = $('#rwd-content'); 163 164 contentHeight = $rwd_content.height(); 165 166 $rwd_globalnav = $('#rwd-control-global-nav ul.rwd-global-nav'); 167 $scroll_button = $('#rwd-control-scroll-button'); 168 169 footerHeight = $('.rwd-main-footer').outerHeight(); 170 171 $product_menu_trigger = $('#rwd-control-product-header-menu-trigger'); 172 $product_menu = $('#rwd-control-product-header-menu'); 173 174 $accordion_toggle = $('.rwd-accordion:not(.fix-open) >.rwd-toggle-accordion'); 175 176 $shrink_open = $('#rwd-main-content .rwd-text-shrink-more'); 177 $shrink_close = $('#rwd-main-content .rwd-text-shrink-close'); 178 179 $search_triger = $('#rwd-control-search-trigger, #rwd-control-search-closer'); 180 $search_box = $('#rwd-control-serch-box'); 181 182 $global_nav = $('#rwd-control-global-nav'); 183 // $global_nav_item = $('#rwd-control-global-nav li.rwd-global-nav-item, ul.rwd-global-subnav:not(.rwd-megadrop-menu) li'); 184 $global_nav_item = $('#rwd-control-global-nav li.rwd-global-nav-item'); 185 $global_nav_item_has_child = $('#rwd-control-global-nav li.rwd-global-nav-has-child'); 186 187 $megamenus = $('#rwd-control-global-nav ul.rwd-global-subnav.rwd-megadrop-menu ul.rwd-global-subnav-two'); 188 189 $menu_trigger = $('#rwd-menu-trigger'); 190 $submenu_link = $('#rwd-control-global-nav .rwd-submenu-link'); 191 $main_header = $('#rwd-control-main-header'); 192 193 $slider_wide = $('#rwd-content .rwd-slider-wide .swiper-container'); 194 $slider_thunbnail_wrap = $('#rwd-content .rwd-slider-wide.pagination-tumbnail'); 195 196 $swiper_carousel01 = $('#rwd-content .rwd-slider-carousel01 .swiper-container'); 197 $swiper_carousel_filelist = $('#rwd-content .rwd-filelist-gallery01'); 198 199 $slideGroup = $('#rwd-content .rwd-slide-group'); 200 201 $shlink_more_button = $('#rwd-content .rwd-shrink-more-button'); 202 $shlink_more_button_news = $('#rwd-content .rwd-shrink-more-button-news button'); 203 204 $load_more_button = $('#rwd-content .rwd-load-more-button'); 205 load_more_tpl = []; 206 207 //2017.11.02 208 if (ua.match(/Windows/i) !== -1 || ua.match(/Mac/i) !== -1) { 209 //for PC 210 isPC = true; 211 } 212 213 //2018.07.04 #4562 214 $global_nav_item_pageLink = $("#rwd-control-global-nav a[href^='" + locationAddr + "#'], #rwd-control-global-nav a[href^='#']"); 215 if (locationAddr.indexOf('.html') === -1) { 216 $global_nav_item_pageLink = $("#rwd-control-global-nav a[href^='" + locationAddr + ".index.html#'], #rwd-control-global-nav a[href^='" + locationAddr + "#'], #rwd-control-global-nav a[href^='#']"); 217 } 218 219 //2017.08.09 ã¹ããã§ã¡ãã¥ã¼ä¸é層ç®ã§ã¢ã³ã«ã¼ä»ãªã³ã¯ããªã対å¿(#2097) [href*='#'] -> [href^='#'] 220 $global_nav_item_anchor = $("#rwd-control-global-nav li.rwd-global-nav-item a:not(.rwd-submenu-link)[href^='#']"); 221 222 // ã¿ããããã¤ã¹ãªã #rwd-content ã« .rwd-touch-enable ãã¤ããã¿ããããã¤ã¹ã§hoverå¹ãããããªãé¨åç¨ 223 if (hasTouchEvent) { 224 $rwd_content.addClass('rwd-touch-enable'); 225 226 if (!isPC) { 227 //2017.11.02 228 229 // ã¿ããããã¤ã¹ã®å ´åã¯ç´æ¥aã¿ã°ã®ãªã³ã¯é£ã°ãªãã®ã§ãã¼ã¿å±æ§ã«éé¿ 230 $submenu_link.each(function (index, el) { 231 var $this = $(this); 232 var href = $this.attr('href'); 233 if (href) { 234 $this[0].dataset.href = href; 235 $this.attr('href', 'javascript:void(0);'); 236 } 237 }); 238 } 239 } 240 241 initSliderFileList(); // ãã¡ã¤ã«ãªã¹ãcarousel使 242 checkLayout(); // ã¬ã¤ã¢ã¦ããã§ã㯠PC or SP 243 caluselGenerate(); // ã«ã«ã¼ã»ã«æ§ç¯ 244 sliderlGenerate(); // ã¹ã©ã¤ãã¼æ§ç¯ 245 246 //------------------------------------------------------------------------------------------- 247 // å種ã¤ãã³ãå 容å®ç¾© 248 //------------------------------------------------------------------------------------------- 249 250 // é¢é£ãªã³ã¯ã®éé 251 var menuToggleRelation = function ($target, eventObject) { 252 $target.siblings('.toggle-relation-link').toggleClass('active'); 253 $target.parent('.rwd-relation-link-area').toggleClass('show'); 254 }; 255 256 // æ¤ç´¢ã®Toggle 257 var menuToggleSearch = window.menuToggleSearch = function ($target, eventObject) { 258 /** Add ESC close event for a11y */ 259 if ( !$search_box.hasClass('active') ) { 260 $(document) 261 .on('keydown.modalSearch', function (event) { 262 if (event.key === 'Escape') { 263 menuToggleSearch(); 264 } 265 }) 266 .on('focusin.modalSearch', function (event) { 267 if ($(event.target).closest('#rwd-control-serch-box').length === 0) { 268 $search_box.find('#rwd-control-search-closer').focus(); 269 } 270 }); 271 272 $search_box.on('focusin.modalSearch', function (event) { 273 if ($(event.target).data('first-focus') !== undefined) { 274 $search_box.find('#rwd-control-search-closer').focus(); 275 } else if ($(event.target).data('last-focus') !== undefined) { 276 $search_box.find('input').focus(); 277 } 278 }); 279 280 /** open search modal */ 281 $search_box.addClass('active'); 282 $modal_bg.addClass('active-search'); 283 $search_box.find('input').focus(); 284 } else { 285 $(document).off('keydown.modalSearch focusin.modalSearch'); 286 287 /** close search modal */ 288 $search_box.removeClass('active').off('focusin.modalSearch'); 289 $modal_bg.removeClass('active-search'); 290 $('#rwd-control-search-trigger').focus(); 291 } 292 }; 293 294 // å ¨ã¦ã®ã¡ãã¥ã¼é¢é£ã¯ãã¼ãº 295 var menuCloseAll = function ($target, eventObject) { 296 // SPã°ãã¼ãã«ãã 297 if ($menu_trigger.length > 0 && $search_box.is(':hidden')) { 298 $menu_trigger.removeClass('active'); 299 $main_header.removeClass('show-nav'); 300 $submenu_link.removeClass('open'); 301 $modal_bg.removeClass('active'); 302 } 303 if ($submenu_link.length > 0) { 304 // $global_nav_item_has_child.removeClass('active'); 305 $submenu_link.parent().removeClass('active'); 306 $modal_bg.removeClass('active'); 307 } 308 309 // // ãµã¼ãããã¯ã¹é¢é£ãªã»ãã 310 if ($search_box.length > 0) { 311 $(document).off('keydown.modalSearch focusin.modalSearch'); 312 $search_box.removeClass('active').off('focusin.modalSearch'); 313 $modal_bg.removeClass('active-search'); 314 } 315 // // 製åã¡ãã¥ã¼é¢é£ãªã»ãã 316 if ($product_menu_trigger.length > 0) { 317 $product_menu_trigger.removeClass('active'); 318 $product_menu.removeClass('show'); 319 $modal_bg.removeClass('active-product'); 320 } 321 // for tablet 322 $(".rwd-megamenu-wrapper").each(function() { 323 $(this).removeClass("show"); 324 }); 325 eventObject?.preventDefault(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 326 }; 327 328 // ã°ãããã®anchoré¢é£ã¯ãã¼ãº 329 var menuCloseAnchor = function ($target, eventObject) { 330 var href = $target.attr('href'); 331 var hash = href.includes('#') ? href.substring(href.indexOf('#')) : ""; 332 333 if (!href || href === "#" || $(hash).length === 0) { 334 eventObject.preventDefault(); 335 return; 336 } 337 338 // ã¹ãã/PCã¡ãã¥ã¼ã®ä¸¡æ¹ãéãã 339 if (window.innerWidth <= 768) { 340 closeSubMenuSp(); 341 } else { 342 menuCloseAll(); 343 } 344 345 if (hash) { 346 $anchor = $(hash); 347 $html_body.animate( 348 { 349 scrollTop: $anchor.offset().top, 350 }, 351 0 352 ); 353 } 354 eventObject.preventDefault(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 355 }; 356 357 var menuToggleProduct = function ($target, eventObject) { 358 $product_menu_trigger.toggleClass('active'); 359 $product_menu.toggleClass('show'); 360 $modal_bg.toggleClass('active-product'); 361 }; 362 363 var accordionToggle = function ($target, eventObject) { 364 if ($target.parent('.rwd-accordion').hasClass('second-level')) { 365 if ($target.hasClass('sub-top')) { 366 $target.next().toggleClass('active'); 367 } else if ($target.hasClass('sub-bottom')) { 368 $target.prev().toggleClass('active'); 369 } 370 } 371 $target.toggleClass('active'); 372 $target.parent('.rwd-accordion').toggleClass('open'); 373 }; 374 375 /* -------------------------------------------------------------------------------------- 376 for readmore button on product feature page 377 -------------------------------------------------------------------------------------- */ 378 var shrinkOpen = function ($target, eventObject) { 379 $shrink_wrapper = $target.parents('.rwd-text-shrink-wrapper'); 380 $shrink_wrapper.addClass('show'); 381 }; 382 var shrinkClose = function ($target, eventObject) { 383 $shrink_wrapper = $target.parents('.rwd-text-shrink-wrapper'); 384 $shrink_wrapper.removeClass('show'); 385 }; 386 387 // ã°ãã¼ãã«ããã®ã¢ã³ã¼ãã£ãªã³ã¡ãã¥ã¼ãç»é¢å¤ã«ã¯ã¿åºãå ´åã«ã³ã³ãã³ãã®é«ããèª¿æ´ 388 var heightAdjust = function () {
389 var menu_height = $rwd_globalnav.innerHeight() + $main_header.innerHeight(); 390 if (menu_height > contentHeight) { 391 $rwd_content.height(menu_height); 392 } else { 393 $rwd_content.height('auto'); 394 } 395 // console.log('contentHeight:'+contentHeight +' menu_height:'+ menu_height ); 396 }; 397 398 // SPã®ã¡ãã¥ã¼ãã¿ã³ãã¯ãªãã¯ããéã®ã¤ãã³ãå 容 399 var menuToggle = function ($target, eventObject) { 400 if (isLayoutSP) { 401 $menu_trigger.toggleClass('active'); 402 $main_header.toggleClass('show-nav'); 403 $modal_bg.toggleClass('active'); 404 if (!$menu_trigger.hasClass('active')) { 405 $submenu_link.removeClass('open'); 406 } 407 heightAdjust(); 408 } 409 }; 410 411 // SPã®ãµãã¡ãã¥ã¼ãã¯ãªãã¯ããéã®ã¤ãã³ãå 容 412 var submenuToggle = function ($target, eventObject) { 413 if (isLayoutSP) { 414 $target.toggleClass('open'); 415 eventObject.preventDefault(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 416 417 heightAdjust(); 418 } 419 }; 420 421 // ãã£ã¨è¦ããã¿ã³ãã¯ãªãã¯ããéã®ã¤ãã³ãå 容 422 var shrink_area_toggle = function ($target, eventObject) { 423 $shrink_content = $target.parent().siblings('.rwd-shrink-content'); 424 $shrink_content.slideToggle('slow', 'swing', function () { 425 if ($target.hasClass('content-open')) { 426 $target.removeClass('direction-up').addClass('direction-down').removeClass('content-open'); 427 $inner.text($inner.data('caption-open')); 428 429 $html_body.animate({ 430 scrollTop: $('#' + $target.parent().parent().data('scroll-anchor-id')).offset().top, 431 }); 432 } else { 433 $target.removeClass('direction-down').addClass('direction-up').addClass('content-open'); 434 $inner = $target.find('.rwd-button-inner'); 435 if ($inner.data('caption-open').length === 0) { 436 $inner.data('caption-open', $inner.text()); 437 } 438 $inner.text($inner.data('caption-close')); 439 } 440 }); 441 }; 442 443 /* -- 2019/10 KM ãã¥ã¼ã¹ -- */ 444 // ãã£ã¨è¦ããã¿ã³ãã¯ãªãã¯ããéã®ã¤ãã³ãå 容ï¼ãã¥ã¼ã¹ï¼ 445 var rwd_shrink_area_toggle = function ($button, eventObject) { 446 var $target = $button.parent(); 447 $rwd_shrink_content = $target.parent().siblings('.rwd-news-content'); 448 $rwd_shrink_content.slideToggle('slow', 'swing', function () { 449 if ($target.hasClass('content-open')) { 450 var label = $target.find('button').data('caption-open') || ''; 451 $target.removeClass('direction-up').addClass('direction-down').removeClass('content-open'); 452 $target.find('button').attr('aria-label', label); 453 } else { 454 var label = $target.find('button').data('caption-close') || ''; 455 $target.removeClass('direction-down').addClass('direction-up').addClass('content-open'); 456 $target.find('button').attr('aria-label', label); 457 } 458 }); 459 }; 460 461 // ãã£ã¨è¦ããã¿ã³(ajax)ãã¯ãªãã¯ããéã®ã¤ãã³ãå 容 462 var load_area_toggle = function ($target, eventObject) { 463 if (!is_loading) { 464 is_loading = true; 465 var $content_area; 466 var tpl = $target.data('tpl-file'); 467 var next = $target.data('next-file'); 468 var content_area = $target.data('content-id'); 469 if (!content_area) { 470 return false; 471 } else { 472 $content_area = $('#' + content_area); 473 } 474 475 // 対å¿ãããã³ãã¬ã¼ããèªã¿è¾¼ã¾ãã¦ããªãå ´åã¯ãã³ãã¬ã¼ãèªã¿è¾¼ã 476 if (!load_more_tpl[tpl]) { 477 $.ajax({ 478 type: 'GET', 479 url: tpl, 480 cache: false, 481 timeout: 10000, 482 }).then( 483 function (data) { 484 // ãã³ãã¬ã¼ããã»ãã 485 load_more_tpl[tpl] = data; 486 // jsonèªã¿è¾¼ã¿ 487 _load_next(next, load_more_tpl[tpl], $content_area, $target); 488 }, 489 function (xhr) { 490 console.log('Template Load Error'); 491 is_loading = false;
492 } 493 ); 494 } else { 495 // jsonèªã¿è¾¼ã¿ 496 _load_next(next, load_more_tpl[tpl], $content_area, $target); 497 } 498 } 499 }; 500 501 // 次ã®jsonèªã¿è¾¼ã¿å¦ç 502 function _load_next(next, tpldata, $content_area, $target) { 503 // console.log("loadnext"); 504 $.ajax({ 505 type: 'GET', 506 url: next, 507 cache: false, 508 dataType: 'json', 509 timeout: 10000, 510 }).then( 511 function (data) { 512 var content = ''; 513 // console.log("loaded"); 514 // console.log(data); 515 if (data['next-file']) { 516 $target.data('next-file', data['next-file']); 517 } else { 518 $target.data('next-file', ''); 519 $target.hide(); 520 } 521 $.each(data['items'], function (index, value) { 522 var map = value; 523 // ç½®æç¨ãã¼ã¿ä½æ {{ãã¼}}ãç½®ãæãã 524 $.each(value, function (index2, value2) { 525 map['{{' + index2 + '}}'] = value2; 526 }); 527 // ãã³ãã¬ã¼ãã®å¤æ°ãç½®æ 528 var reg = new RegExp('(' + Object.keys(map).join('|') + ')', 'g'); 529 var result = tpldata.replace(reg, function (match) { 530 return map[match]; 531 }); 532 // ã³ã³ãã³ãã«ç½®æå¾ãã¼ã¿è¿½å 533 content += result; 534 }); 535 $content_area.append(content); 536 is_loading = false; 537 }, 538 function (xhr) { 539 console.log('json Load Error'); 540 is_loading = false; 541 } 542 ); 543 } 544 545 // ããã¾ã§ajaxãã¼ãã¼ 546 547 // ã°ãã¼ãã«ããã§ãµãã¡ãã¥ã¼ããããã®ã¯ã¢ã¼ãã«èæ¯ã表示ãã 548 var globalNavMouseEnter = function ($target, eventObject) { 549 // console.log("enter"); 550 if (isLayoutPC) { 551 // ãµãã¡ãã¥ã¼ããããã®ã®ã¿ã¢ã¼ãã«ã表示 552 if ($target.hasClass('rwd-global-nav-has-child')) { 553 $target.children('.rwd-submenu-link').attr('aria-expanded', 'true'); 554 $target.children('.rwd-megamenu-wrapper').removeAttr('inert'); 555 556 // ã¡ã¬ããããã¯menu-aimã使ç¨ãã¦ããã®ã§å¥å¦ç 557 if ($target.parent('.rwd-megadrop-menu').length === 0) { 558 if (!$target.hasClass('active')) { 559 $target.addClass('active'); 560 } 561 if (!$modal_bg.hasClass('active')) { 562 $modal_bg.addClass('active'); 563 } 564 } 565 } 566 } 567 }; 568 var globalNavMouseLleave = function ($target, eventObject) { 569 // console.log("leave"); 570 if (isLayoutPC) { 571 if ($target.parent('.rwd-megadrop-menu').length === 0) { 572 $target.children('.rwd-submenu-link').attr('aria-expanded', 'false'); 573 if ($target.hasClass('active')) { 574 $target.removeClass('active'); 575 } 576 if ($modal_bg.hasClass('active')) { 577 $modal_bg.removeClass('active'); 578 } 579 } 580 // ã¡ã¬ããããã®é åãé¢è±ããæã«deactivateãå®è¡ãããªã(activeã®å¯¸åã«å®è¡ããã) ãã®ããååã®ã«ã¬ã³ããæ®ã£ã¦ãã¾ãåé¡ã¸ã®å¯¾çã 581 if ($megamenus.length > 0) { 582 $megamenus.removeClass('show').parent().removeClass('active').siblings().removeClass('active'); 583 } 584 } 585 }; 586 587 // ã¿ãã¬ããã§ã¯hoverããªãã®ã§ã¿ããããéã«ãµãã¡ãã¥ã¼ã表示 588 var globalNavTouch = function ($target, eventObject) { 589 $navItem = $target.parent(); 590 // $(this).data("category"); 591 if (isLayoutPC) { 592 if ($navItem.hasClass('active')) { 593 if ($navItem.hasClass('rwd-global-nav-item')) { 594 // $navItem.data('href'); 595 var href = $target.data('href'); 596 if (href) { 597 location.href = href; 598 } else { 599 $submenu_link.parent().removeClass('active'); 600 $modal_bg.removeClass('active'); 601 // 表示çµäºå¾ã¡ã¬ããããè¦ç´ ã®å ´åã¯topä½ç½®ãã¯ãªã¢ 602 if ($navItem.attr('data-submenu-id') !== 'undefined') { 603 submenuId = $navItem.data('submenuId'); 604 $submenu = $('#' + submenuId); 605 $navItem.css('top', ''); 606 } 607 } 608 } 609 } else { 610 // 表示ããåã«ã¡ã¬ããããè¦ç´ ã®å ´åã¯topä½ç½®ãã°ãããã®ä¸ã«åããã 611 if ($navItem.attr('data-submenu-id') !== 'undefined') { 612 submenuId = $navItem.data('submenuId'); 613 $submenu = $('#' + submenuId); 614 megaDropAdjustHeight($submenu); 615 } 616 $navItem.addClass('active'); 617 618 if ($navItem.hasClass('rwd-global-nav-item')) { 619 if (!$modal_bg.hasClass('active')) { 620 $modal_bg.addClass('active'); 621 } 622 } 623 $navItem.siblings('.rwd-global-nav-has-child').removeClass('active'); 624 $navItem.find('.rwd-global-nav-has-child').removeClass('active'); 625 } 626 eventObject.preventDefault(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 627 } 628 }; 629 630 //------------------------------------------------------------------------------------------- 631 // å種ã¤ãã³ãã®å²å½å ±éå 632 //------------------------------------------------------------------------------------------- 633 634 // Touch or Clickã®ã©ã¡ãããµãã¼ããã¦ãããã«ãã£ã¦ã¤ãã³ãç»é²æ¯ãåããã¿ããããã¾ã¾ã¹ã¯ãã¼ã«å¯¾çã¯ããã§è¡ã 635 var bindToggleEvent = function ($target, eventFunc) { 636 if (hasTouchEvent) { 637 $target.on({ 638 touchstart: function () { 639 this.isTouch = true; 640 }, 641 touchmove: function () { 642 this.isTouch = false;
643 }, 644 touchend: function (eventObject) { 645 if (this.isTouch === true) { 646 // eventObject.preventDefault(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 647 eventObject.stopPropagation(); // è¦ç´ ã®ããã©ã«ãåä½ç¡å¹(aã¿ã°ãªã³ã¯ç¡å¹ã«ãããã) 648 649 // console.log($(this)); 650 if ($(this).length > 0) { 651 eventFunc($(this), eventObject); 652 } 653 654 return false; 655 } 656 }, 657 }); 658 659 // if (isPC) { 660 //2017.11.02 661 662 // $target.on({ 663 // mouseover: function (eventObject) { 664 // // console.log($(this)); 665 // if ($(this).length > 0) { 666 // eventFunc($(this), eventObject); 667 // } 668 // }, 669 // }); 670 // } 671 } else { 672 $target.on({ 673 click: function (eventObject) { 674 eventFunc($(this), eventObject); 675 }, 676 }); 677 } 678 }; 679 680 //------------------------------------------------------------------------------------------- 681 // å種ã¤ãã³ãç»é² 682 //------------------------------------------------------------------------------------------- 683 684 bindToggleEvent($modal_bg, menuCloseAll); // ã¡ãã¥ã¼ããã¹ã¦éãã¦ã¢ã¼ãã«è§£é¤ 685 686 bindToggleEvent($search_triger, menuToggleSearch); // Searchãã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 687 688 bindToggleEvent($product_menu_trigger, menuToggleProduct); // ååã¡ãã¥ã¼ãã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 689 690 bindToggleEvent($accordion_toggle, accordionToggle); // ã¢ã³ã¼ãã£ãªã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 691 692 bindToggleEvent($shrink_open, shrinkOpen); // ç¶ããèªããã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 693 694 bindToggleEvent($shrink_close, shrinkClose); // ç¶ããèªãã«å¯¾å¿ããCloseãã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 695 696 bindToggleEvent($shlink_more_button, shrink_area_toggle); // ãã£ã¨è¦ããã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 697 698 /* -- 2019/10 KM ãã¥ã¼ã¹ -- */ 699 bindToggleEvent($shlink_more_button_news, rwd_shrink_area_toggle); // ãã£ã¨è¦ããã¿ã³ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ãï¼ãã¥ã¼ã¹ï¼ 700 701 bindToggleEvent($load_more_button, load_area_toggle); // ãã£ã¨è¦ããã¿ã³(ajax)ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 702 703 // bindToggleEvent($menu_trigger, menuToggle); // SPã¡ãã¥ã¼ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 704 705 // bindToggleEvent($submenu_link, submenuToggle); // SPãµãã¡ãã¥ã¼ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 706 707 bindToggleEvent($('#control-relation-link').find('.rwd-relation-link-title'), menuToggleRelation); 708 709 bindToggleEvent($global_nav_item_anchor, menuCloseAnchor); // anchoræ¼ãããã¢ã¼ãã«è§£é¤ 710 711 bindToggleEvent($global_nav_item_pageLink, menuCloseAnchor); // anchoræ¼ãããã¢ã¼ãã«è§£é¤ 2018.07.04 #4562 712 713 // if (!hasTouchEvent) { 714 // $global_nav_item.on({ 715 // mouseenter: function (eventObject) { 716 // globalNavMouseEnter($(this), eventObject); 717 // }, 718 // mouseleave: function (eventObject) { 719 // globalNavMouseLleave($(this), eventObject); 720 // }, 721 // }); 722 // } else { 723 // bindToggleEvent($submenu_link, globalNavTouch); // SPãµãã¡ãã¥ã¼ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 724 725 // if (isPC) { 726 // //2017.11.02 727 // $global_nav_item.on({ 728 // mouseenter: function (eventObject) { 729 // globalNavMouseEnter($(this), eventObject); 730 // }, 731 // mouseleave: function (eventObject) { 732 // globalNavMouseLleave($(this), eventObject); 733 // }, 734 // }); 735 // } 736 // } 737 738 //ãã¼ã¸TOPã¸æ»ããã¿ã³ã®å¶å¾¡ 739 $window.on('scroll', function () { 740 if ($window.scrollTop() > 10) { 741 if (!$scroll_button.hasClass('show')) { 742 $scroll_button.addClass('show'); 743 } 744 } else { 745 if ($scroll_button.hasClass('show')) { 746 $scroll_button.removeClass('show'); 747 } 748 } 749 }); 750 751 //footerã®æåã§ãã¿ã³ãfadeIn,fadeOutããå¦ç 752 $window.on('scroll resize', function () { 753 if ($window.width() <= 767) { 754 var windowHeight = $window.height(); 755 var documentHeight = $(document).height(); 756 var fadeTrigger = documentHeight - windowHeight - footerHeight; 757 var footerFadeSet = 50; 758 var $footerContent = $('.rwd-fixed-btn'); 759 760 if ($window.scrollTop() > fadeTrigger - footerFadeSet) { 761 $footerContent.fadeOut(300); 762 } else { 763 $footerContent.fadeIn(300); 764 } 765 } 766 }); 767 768 // ã¹ã©ã¤ãã¼æ§ç¯ 769 function sliderlGenerate() { 770 $slider_wide.each(function (index, el) { 771 $this = $(this); 772 var slideItems = $this.find('.swiper-slide'); 773 // ã¹ã©ã¤ãã2æä»¥ä¸ããã°ã¹ã©ã¤ãã¼çæ ãªãå ´åã¯ãã¼ãã¸ã¥ã¢ã«åºå® 774 if (slideItems.length > 1) { 775 var paginationRender = null; 776 // ãµã ãã¤ã«ä»ãã§ããã°ç¾å¨ã®ã¹ã©ã¤ããããµã ãã¤ã«ã®æç»é¢æ°ãçæ 777 if ($this.parent().hasClass('pagination-tumbnail')) { 778 $swiper_container = $this.parent(); 779 sliderCenteringNav($swiper_container); 780 781 var slideThumbnails = []; 782 slideItems.each(function (index, el) { 783 slideThumbnails.push($(this).html()); 784 }); 785 paginationRender = function (index, className) { 786 return '<span class="' + className + '">' + slideThumbnails[index] + '</span>'; 787 }; 788 } 789 // ã¹ã©ã¤ãçæ 790 new Swiper($this, { 791 pagination: $this.find('.swiper-pagination'), 792 paginationBulletRender: paginationRender, 793 slidesPerView: 1, 794 loop: true, 795 autoplay: 5000, 796 speed: 600,
797 nextButton: $this.parent().find('.swiper-button-next'), 798 prevButton: $this.parent().find('.swiper-button-prev'), 799 paginationClickable: true, 800 }); 801 } 802 }); 803 } 804 805 function sliderCenteringNav($swiper_container) { 806 // console.log($swiper_container); 807 // console.log($swiper_container.height()); 808 $button_next = $swiper_container.find('.swiper-button-next'); 809 $button_prev = $swiper_container.find('.swiper-button-prev'); 810 var mt = parseInt($button_next.css('margin-top')); 811 var offset = $button_next.innerHeight() / 2; 812 var position = $swiper_container.height() / 2 - offset + mt; 813 // console.log(offset); 814 // console.log(position); 815 $button_prev.css({ top: `${position}px`, visibility: 'visible' }); 816 $button_next.css({ top: `${position}px`, visibility: 'visible' }); 817 } 818 819 function initSliderFileList() { 820 $.each($swiper_carousel_filelist, function () { 821 sliderDir = $(this).data('dir'); 822 modalGroup = $(this).data('modal-group'); 823 sub_initSliderFileList($(this), sliderDir, modalGroup); 824 }); 825 } 826 827 function sub_initSliderFileList($target, sliderDir, modalGroup) { 828 $slider_filelist_content = $target.find('.swiper-wrapper'); 829 $slider_filelist_content.html(''); 830 // sliderDir = $target.data('dir'); 831 // console.log(sliderDir); 832 var req = new XMLHttpRequest(); // HTTPã§ãã¡ã¤ã«ãèªã¿è¾¼ãããã®XMLHttpRrequestãªãã¸ã§ã¯ããçæ 833 req.open('get', sliderDir + '/list.txt', true); // ã¢ã¯ã»ã¹ãããã¡ã¤ã«ãæå® 834 req.send(null); // HTTPãªã¯ã¨ã¹ãã®çºè¡ 835 836 req.onload = function () { 837 if (req.status === 200) { 838 $target_content = $target.find('.swiper-wrapper'); 839 $target_container = $target.find('.swiper-container'); 840 841 var textLines = req.responseText.split(/\r\n|\r|\n/); 842 $.each(textLines, function () { 843 // 空è¡ã¯ç¡è¦ 844 if (this.length !== 0) { 845 // console.log(this); 846 var image_path = location.pathname + sliderDir + '/' + this; 847 $target_content.append( 848 '<div class="swiper-slide rwd-grid-item"><div><a href="' + image_path + '" class="pickup-item rwd-modal-link" rel="' + modalGroup + '"><figure><img src="' + image_path + '" alt=""></figure></a></div></div>' 849 ); 850 } 851 }); 852 // ã¹ã©ã¤ãçæ 853 caluselInit($target_container); 854 } else { 855 console.log('slider Directroy [' + sliderDir + ']: list.txt not found'); 856 } 857 }; 858 } 859 860 // ã«ã«ã¼ã»ã«æ§ç¯ 861 function caluselGenerate() { 862 // ã«ã«ã¼ã»ã«æ¯ã«å¦ç 863 $swiper_carousel01.each(function () { 864 caluselInit($(this)); 865 }); 866 // console.log(swiper_carousel_instance); 867 } 868 869 function caluselInit($target) { 870 // console.log($target); 871 872 var active_class = 'carousel-active'; 873 var $swiper_wrapper = $target.find('.swiper-wrapper'); 874 var $swiper_container = $swiper_wrapper.parent().parent(); 875 876 var item_count = $swiper_wrapper.find('.swiper-slide').length; 877 878 var carousel_division; 879 880 // ã¯ã©ã¹åã«å¿ããã«ã«ã¼ã»ã«å岿°ãè¨å® 881 if (isLayoutSP) { 882 carousel_division = 2; 883 if ($swiper_wrapper.hasClass('sp-grid1of4')) { 884 carousel_division = 4; 885 } else if ($swiper_wrapper.hasClass('sp-grid4of4')) { 886 carousel_division = 1; 887 888 // 2019/10 KM 889 } else if ($swiper_wrapper.hasClass('sp-grid2ofSpace')) { 890 carousel_division = 2; 891 } else if ($swiper_wrapper.hasClass('sp-grid2ofHarf')) { 892 carousel_division = 2.5; 893 } 894 } else { 895 carousel_division = 6; 896 if ($swiper_wrapper.hasClass('pc-grid1of12')) { 897 carousel_division = 12; 898 // 2019/10 KM 899 } else if ($swiper_wrapper.hasClass('pc-grid3of6')) { 900 carousel_division = 6.5; 901 } else if ($swiper_wrapper.hasClass('pc-grid3of12')) { 902 carousel_division = 4; 903 } else if ($swiper_wrapper.hasClass('pc-grid4of12')) { 904 carousel_division = 3; 905 } else if ($swiper_wrapper.hasClass('pc-grid6ver2of12')) { 906 carousel_division = 3.5; 907 } else if ($swiper_wrapper.hasClass('pc-grid6of12')) { 908 carousel_division = 2; 909 } else if ($swiper_wrapper.hasClass('pc-grid12of12')) { 910 carousel_division = 1; 911 } 912 } 913 914 // ã«ã«ã¼ã»ã«ã®å岿°ããã¢ã¤ãã æ°ãå¤ãå ´å ã¹ã©ã¤ãçæ 915 // 2019/10 KM ã¹ã©ã¤ãã¼ã®åå²è¿½å ã¹ãã¼ã¹æã 916 if (item_count > 4 && $swiper_wrapper.hasClass('sp-grid2ofSpaceWide')) { 917 var instance = new Swiper($target, { 918 pagination: $target.find('.swiper-pagination'), 919 slidesPerView: carousel_division, 920 //ã¹ãã¼ã¹ã空ãã è¦ãæ¹ã夿´ 921 slidesPerView: 4, 922 spaceBetween: 15.25, 923 loop: false, 924 autoplay: 5000, 925 speed: 600,
926 nextButton: $target.parent().find('.swiper-button-next'), 927 prevButton: $target.parent().find('.swiper-button-prev'), 928 paginationClickable: true, 929 breakpoints: { 930 767: { 931 slidesPerView: 1.3, 932 spaceBetween: 17, 933 }, 934 }, 935 }); 936 var instance_item = []; 937 instance_item['instance'] = instance; 938 instance_item['is_gallery'] = false; 939 instance_item['target'] = $target; 940 941 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 942 instance_item['is_gallery'] = true; 943 } 944 945 swiper_carousel_instance.push(instance_item); 946 if (!$swiper_container.hasClass(active_class)) { 947 $swiper_container.addClass(active_class); 948 } 949 } else if (item_count > carousel_division && $swiper_wrapper.hasClass('pc-grid6Space')) { 950 var instance = new Swiper($target, { 951 pagination: $target.find('.swiper-pagination'), 952 slidesPerView: carousel_division, 953 //ã¹ãã¼ã¹ã空ãã è¦ãæ¹ã夿´ 954 spaceBetween: 7, 955 loop: false, 956 nextButton: $target.parent().find('.swiper-button-next'), 957 prevButton: $target.parent().find('.swiper-button-prev'), 958 paginationClickable: true, 959 breakpoints: { 960 767: { 961 slidesPerView: 2.5, 962 spaceBetween: 5, 963 }, 964 }, 965 }); 966 var instance_item = []; 967 instance_item['instance'] = instance; 968 instance_item['is_gallery'] = false; 969 instance_item['target'] = $target; 970 971 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 972 instance_item['is_gallery'] = true; 973 } 974 975 swiper_carousel_instance.push(instance_item); 976 if (!$swiper_container.hasClass(active_class)) { 977 $swiper_container.addClass(active_class); 978 } 979 } else if (item_count > carousel_division && $swiper_wrapper.hasClass('pc-grid4Space')) { 980 var instance = new Swiper($target, { 981 pagination: $target.find('.swiper-pagination'), 982 slidesPerView: carousel_division, 983 //ã¹ãã¼ã¹ã空ãã è¦ãæ¹ã夿´ 984 slidesPerView: 4, 985 spaceBetween: 7, 986 loop: false, 987 nextButton: $target.parent().find('.swiper-button-next'), 988 prevButton: $target.parent().find('.swiper-button-prev'), 989 paginationClickable: true, 990 breakpoints: { 991 767: { 992 slidesPerView: 2.5, 993 spaceBetween: 5, 994 }, 995 }, 996 }); 997 var instance_item = []; 998 instance_item['instance'] = instance; 999 instance_item['is_gallery'] = false; 1000 instance_item['target'] = $target; 1001 1002 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 1003 instance_item['is_gallery'] = true; 1004 } 1005 1006 swiper_carousel_instance.push(instance_item); 1007 if (!$swiper_container.hasClass(active_class)) { 1008 $swiper_container.addClass(active_class); 1009 } 1010 } else if (item_count > 4 && $swiper_wrapper.hasClass('sp-grid2ofSpace')) { 1011 var instance = new Swiper($target, { 1012 pagination: $target.find('.swiper-pagination'), 1013 slidesPerView: carousel_division, 1014 //ã¹ãã¼ã¹ã空ãã 1015 slidesPerView: 4, 1016 spaceBetween: 10, 1017 loop: true, 1018 autoplay: 5000, 1019 speed: 600, 1020 nextButton: $target.parent().find('.swiper-button-next'), 1021 prevButton: $target.parent().find('.swiper-button-prev'), 1022 paginationClickable: true, 1023 breakpoints: { 1024 767: { 1025 slidesPerView: 2, 1026 loop: false, 1027 }, 1028 }, 1029 }); 1030 var instance_item = []; 1031 instance_item['instance'] = instance; 1032 instance_item['is_gallery'] = false;
1033 instance_item['target'] = $target; 1034 1035 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 1036 instance_item['is_gallery'] = true; 1037 } 1038 1039 swiper_carousel_instance.push(instance_item); 1040 if (!$swiper_container.hasClass(active_class)) { 1041 $swiper_container.addClass(active_class); 1042 } 1043 } else if (item_count > carousel_division) { 1044 var instance = new Swiper($target, { 1045 pagination: $target.find('.swiper-pagination'), 1046 slidesPerView: carousel_division, 1047 loop: false, 1048 nextButton: $target.parent().find('.swiper-button-next'), 1049 prevButton: $target.parent().find('.swiper-button-prev'), 1050 paginationClickable: true, 1051 }); 1052 var instance_item = []; 1053 instance_item['instance'] = instance; 1054 instance_item['is_gallery'] = false; 1055 instance_item['target'] = $target; 1056 1057 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 1058 instance_item['is_gallery'] = true; 1059 } 1060 1061 swiper_carousel_instance.push(instance_item); 1062 if (!$swiper_container.hasClass(active_class)) { 1063 $swiper_container.addClass(active_class); 1064 } 1065 } else { 1066 if ($swiper_container.hasClass(active_class)) { 1067 $swiper_container.removeClass(active_class); 1068 } 1069 } 1070 if ($target.parent().hasClass('rwd-filelist-gallery01')) { 1071 var $modal_links = $target.find('a.rwd-modal-link'); 1072 if ($modal_links.length !== 0) { 1073 $modal_links.colorbox({ 1074 opacity: 0.8, 1075 loop: false, 1076 reposition: false, 1077 maxWidth: '90.62500%', 1078 maxHeight: '90%', 1079 }); 1080 } 1081 } 1082 } 1083 1084 // ã«ã«ã¼ã»ã«ç ´æ£ 1085 function caluselDestroy() { 1086 swiper_carousel_instance.forEach(function (val) { 1087 val['instance'].destroy(false, true); 1088 // console.log('destroy'); 1089 }); 1090 swiper_carousel_instance = []; // åç §ãåã 1091 } 1092 1093 // isLayoutChange 1094 1095 // IR FontResize 1096 $root = $(':root'); 1097 $('#rwd-control-font-small').on('click', function () { 1098 $root.css('fontSize', '9.33333px'); 1099 $(this).siblings().removeClass('current'); 1100 $(this).addClass('current'); 1101 }); 1102 1103 $('#rwd-control-font-medium').on('click', function () { 1104 $root.removeAttr('style'); 1105 $(this).siblings().removeClass('current'); 1106 $(this).addClass('current'); 1107 }); 1108 1109 $('#rwd-control-font-large').on('click', function () { 1110 $root.css('fontSize', '13.333px'); 1111 $(this).siblings().removeClass('current'); 1112 $(this).addClass('current'); 1113 }); 1114 1115 var m_count = 0; 1116 // ã¡ã¬ããããè¦ç´ ã®topä½ç½®ãã°ãããã®ä¸ã«åããã 1117 // min-heightã«ã¡ãã¥ã¼å ¨ä½ã®é«ããæããã 1118 function megaDropAdjustHeight($submenu) { 1119 // console.log('megaDropAdjustHeight()'); 1120 1121 var parents = $submenu.parent().prevAll(':not(.rwd-nav-item-toplink)'); 1122 var height = 0; 1123 parents.each(function (index, el) { 1124 height += $(el).innerHeight(); 1125 }); 1126 var parents_all = $submenu.parent().siblings(':not(.rwd-nav-item-toplink)'); 1127 var height_all = 0; 1128 parents_all.each(function (index, el) { 1129 height_all += $(el).innerHeight(); 1130 }); 1131 height_all += $submenu.parent().innerHeight(); 1132 $submenu.css({ 1133 top: -height, 1134 'min-height': height_all, 1135 }); 1136 } 1137 1138 // Mega Drop Menu é åãé¢è±ããæã«deactivateãå®è¡ãããªãã®ã§ååã®ã«ã¬ã³ããæ®ã£ã¦ãã¾ãã®ã§ã°ãããã«mouseenterã¤ãã³ãã追å ãã¦å¾å¦çã 1139 function activateSubmenu(row) { 1140 if (isLayoutPC) { 1141 var $row = $(row); 1142 submenuId = $row.data('submenuId'); 1143 $row.addClass('active'); 1144 if (submenuId) { 1145 $submenu = $('#' + submenuId); 1146 // megaDropAdjustHeight($submenu); 1147 $submenu.addClass('show'); 1148 } 1149 } 1150 } 1151 1152 var $megamenu_default = $('#rwd-control-global-nav .rwd-global-nav-item:not(.nav-direction-left) .rwd-megadrop-menu'); 1153 var $megamenu_left = $('#rwd-control-global-nav .rwd-global-nav-item.nav-direction-left .rwd-megadrop-menu'); 1154 1155 function deactivateSubmenu(row) { 1156 if (isLayoutPC) { 1157 var $row = $(row); 1158 $row.removeClass('active'); 1159 $submenu = $('#' + $row.data('submenuId')); 1160 $submenu.removeClass('show').css('top', '').parent().removeClass('active'); 1161 } 1162 } 1163 1164 viewWidth = window.innerWidth; 1165 // if (!hasTouchEvent || isPC) { 1166 // //2017.11.02 1167 1168 // if ($megamenu_default.length > 0) { 1169 // // console.log("right"); 1170 // $megamenu_default.menuAim({ 1171 // activate: activateSubmenu, 1172 // deactivate: deactivateSubmenu, 1173 // }); 1174 // if ($megamenu_left.length > 0) { 1175 // // console.log("left"); 1176 // $megamenu_left.menuAim({ 1177 // activate: activateSubmenu, 1178 // deactivate: deactivateSubmenu, 1179 // submenuDirection: 'left', 1180 // }); 1181 // } 1182 // } 1183 // } 1184 1185 // for modal 1186 $('a.rwd-modal-link').colorbox({ 1187 opacity: 0.8, 1188 maxWidth: '90.62500%', 1189 maxHeight: '90%', 1190 }); 1191 1192 $('a.rwd-modal-link-inline').colorbox({ 1193 opacity: 0.8, 1194 inline: true, 1195 maxWidth: '90.62500%', 1196 maxHeight: '90%', 1197 }); 1198 1199 $('a.rwd-modal-link-youtube').colorbox({ 1200 iframe: true, 1201 opacity: 0.8, 1202 maxWidth: '90.62500%', 1203 maxHeight: '90%', 1204 // innerWidth: isLayoutPC ? '90.62500%' : 640,
1205 // innerHeight: isLayoutPC ? '100%' :390, 1206 onOpen: function (e) { 1207 var resizeTimer; 1208 var getModalSize = function() { 1209 var width = ($(window).innerWidth() * 90.625 / 100) - (isLayoutPC ? 60 : 0); 1210 var height = width * (9 / 16); 1211 return { width, height }; 1212 }; 1213 const size = getModalSize(); 1214 e.cache.innerWidth = size.width; 1215 e.cache.innerHeight = size.height; 1216 1217 $(window).on('resize.modal', function () { 1218 clearTimeout(resizeTimer); 1219 resizeTimer = setTimeout(function() { 1220 const size = getModalSize(); 1221 $.colorbox.resize({ 1222 innerWidth: size.width, 1223 innerHeight: size.height 1224 }); 1225 setTimeout(() => { 1226 $('#colorbox').css({ overflow: 'visible' }); 1227 }, 500) 1228 }, 250); 1229 }); 1230 }, 1231 onClosed: function () { 1232 $(window).off('resize.modal'); 1233 }, 1234 onComplete: function () { 1235 //#4564 1236 $('.cboxIframe').attr({ 1237 webkitAllowFullScreen: true, 1238 mozallowfullscreen: true, 1239 allowFullScreen: true, 1240 }); 1241 1242 if (document.msFullscreenEnabled) { 1243 document.addEventListener('MSFullscreenChange', function (event) { 1244 if (document.msFullscreenElement === undefined || document.msFullscreenElement === null) { 1245 setTimeout(function () { 1246 $.colorbox.position(0); 1247 setTimeout(function () { 1248 $.colorbox.position(0); 1249 setTimeout(function () { 1250 $.colorbox.position(0); 1251 setTimeout(function () { 1252 $.colorbox.position(0); 1253 setTimeout(function () { 1254 $.colorbox.position(0); 1255 }, 1000); 1256 }, 1000); 1257 }, 1000); 1258 }, 1000); 1259 }, 2000); 1260 } 1261 }); 1262 } 1263 }, 1264 }); 1265 1266 // for Tabs 1267 // newsä¸è¦§ç¨ 1268 $('.rwd-tab-group__tab li span').click(function () { 1269 var $target = $(this).parent(); // ã¿ãã®è¦ç´ 1270 // ã¿ããåãæ¿ãã£ããå¤å® 1271 if (!$target.hasClass('current')) { 1272 var $group__tab = $target.parent(); // ã¿ã 1273 var $tab_wrap = $group__tab.parent().find('.rwd-tab-group__month'); 1274 var $tab_content = $tab_wrap.find(' > ul'); 1275 // å¤ãã«ã¬ã³ãåé¤ 1276 $target.siblings().each(function () { 1277 $(this).removeClass('current'); 1278 }); 1279 $target.addClass('current'); 1280 // ã¿ãã®ã¤ã³ããã¯ã¹ãåå¾ 1281 var index = $group__tab.children().index($(this).parent()); 1282 $tab_content.hide(); 1283 $tab_content.eq(index).show(); 1284 } 1285 }); 1286 // æ¤ç´¢ã¡ãã¥ã¼ç¨ 1287 $('.rwd-tab-group__search dd span').click(function () { 1288 var $target = $(this).parent(); // ã¿ãã®è¦ç´ 1289 // ã¿ããåãæ¿ãã£ããå¤å® 1290 if (!$target.hasClass('current')) { 1291 var $group__tab = $target.parent(); // ã¿ã 1292 var $tab_wrap = $group__tab.parent().find('.rwd-tab-group__collection'); 1293 var $tab_content = $tab_wrap.find(' > ul'); 1294 // å¤ãã«ã¬ã³ãåé¤ 1295 $target.siblings().each(function () { 1296 $(this).removeClass('current'); 1297 }); 1298 $target.addClass('current'); 1299 // ã¿ãã®ã¤ã³ããã¯ã¹ãåå¾ dtã®åãªãã»ãããè¨å® 1300 var index = $group__tab.children().index($(this).parent()) - 1; 1301 $tab_content.hide(); 1302 $tab_content.eq(index).show(); 1303 } 1304 }); 1305 1306 slideResize($slideGroup); 1307
1308 // 対象è¦ç´ ãã¯ãªãã¯ãããå ´åã¯å¯¾è±¡è¦ç´ ã®ã¿é«ã調æ´ããªãµã¤ãºæã«ã¯ãã¹ã¦ã®è¦ç´ ã夿´ãããã®ã§ã»ã¬ã¯ã¿ãªãã¸ã§ã¯ããå¼ã³åºãå´ã§æ¸¡ããã夿´ 1309 function slideResize($target) { 1310 $target.each(function(){ 1311 var currentHeight = 0; 1312 $(this).find('.current + .slide-group-content').each(function () { 1313 currentHeight = $(this).prop('scrollHeight'); 1314 }); 1315 $(this).css('padding-bottom', `${currentHeight}px`); 1316 }) 1317 } 1318 1319 $('.rwd-slide-group > p').click(function () { 1320 if ($(this).hasClass('sp-open')) { 1321 if (window.innerWidth < 768) { 1322 $(this).next().css({'max-height': 0}) 1323 } 1324 $(this).removeClass('sp-open'); 1325 } else { 1326 if (window.innerWidth < 768) { 1327 const height = $(this).next().prop('scrollHeight'); 1328 $(this).next().css({'max-height': height}) 1329 } 1330 $(this).addClass('sp-open'); 1331 } 1332 1333 $(this).parent().find(' > p').each(function () { 1334 $(this).removeClass('current'); 1335 }); 1336 $(this).addClass('current'); 1337 slideResize($(this).parent()); 1338 }); 1339 1340 $('.slide-group-content .sp-close').click(function () { 1341 if (window.innerWidth < 768) { 1342 $(this).parent().parent().prev().toggleClass('sp-open'); 1343 $(this).parent().parent().prev().removeClass('current'); 1344 $(this).parent().parent().css({'max-height': 0}); 1345 } 1346 }); 1347 1348 //ã°ãã¼ãã«ã¡ãã¥ã¼ç¨å¥ã¦ã£ã³ã¢ã¤ã³ã³ç»ååãæ¿ã 1349 $('.rwd-global-subnav-item a').hover(function () { 1350 if (isLayoutPC) { 1351 var $icon_newwin = $(this).find('.rwd-icon-newwin'); 1352 if ($icon_newwin.length !== 0) { 1353 var src = $icon_newwin.attr('src'); 1354 // console.log(src); 1355 if (src.indexOf('_newwin_white') !== -1) { 1356 $icon_newwin.attr('src', src.replace('_newwin_white', '_newwin')); 1357 } else { 1358 $icon_newwin.attr('src', src.replace('_newwin', '_newwin_white')); 1359 } 1360 } 1361 } 1362 }); 1363 1364 /* -------------------------------------------------------------------------------------- 1365 class = rwd-table-type01 1366 -------------------------------------------------------------------------------------- */ 1367 function tableData() { 1368 var index = ''; 1369 var headTxt = ''; 1370 $('.rwd-table-type01').each(function () { 1371 $(this) 1372 .find('thead tr th') 1373 .each(function () { 1374 // theadã®ä½ç½®ãããã¹ããåå¾ 1375 index = $(this).index() - 1; 1376 headTxt = $(this).text(); 1377 1378 // tbodyã®ã»ã«ã«data屿§ã追å 1379 $(this) 1380 .parents('table') 1381 .find('tr') 1382 .each(function () { 1383 $(this).find('td').eq(index).attr('data-th', headTxt); 1384 }); 1385 }); 1386 }); 1387 $('.rwd-table-type01 td').wrapInner('<span></span>'); 1388 } 1389 tableData(); 1390 1391 /* -------------------------------------------------------------------------------------- 1392 class = rwd-table-type02 1393 -------------------------------------------------------------------------------------- */ 1394 var switched = false; 1395 var updateTables = function () { 1396 // console.log('updateTables'); 1397 if (isLayoutSP && !switched) { 1398 switched = true; 1399 $('table.rwd-table-type02').each(function (i, element) { 1400 splitTable($(element)); 1401 }); 1402 return true; 1403 } else if (switched && isLayoutPC) { 1404 switched = false; 1405 $('table.rwd-table-type02').each(function (i, element) { 1406 unsplitTable($(element)); 1407 }); 1408 } 1409 }; 1410 1411 $(window).on("load", updateTables); 1412 1413 function splitTable(original) { 1414 var copy = original.clone(); 1415 copy.find('td:not(:first-child), th:not(:first-child)').css('display', 'none'); 1416 copy.removeClass('rwd-table-type02'); 1417 original.closest('.rwd-table-type02-wrapper').append(copy); 1418 copy.wrap("<div class='rwd-table-pinned' />"); 1419 } 1420 1421 function unsplitTable(original) { 1422 original.closest('.rwd-table-type02-wrapper').find('.rwd-table-pinned').remove(); 1423 original.unwrap(); 1424 } 1425 1426 /* -------------------------------------------------------------------------------------- 1427 for lineup -- 2019/10 KM ã©ã¤ã³ããã -- 1428 -------------------------------------------------------------------------------------- */ 1429 function lineupHover() { 1430 //é¢ããæ 1431 $('.rwd-lineup-area-list-link').on('mouseenter', function () { 1432 var $thisTrigger = $(this).find('.rwd-lineup-area-list-link-text'); 1433 $thisTrigger.css('position', 'relative'); 1434 $thisTrigger.css('transform', 'translateY(0)'); 1435 }); 1436 1437 //hoverããæ 1438 $('.rwd-lineup-area-list-link').on('mouseleave', function () { 1439 var $thisTrigger = $(this).find('.rwd-lineup-area-list-link-text'); 1440 $thisTrigger.css('position', 'absolute'); 1441 $thisTrigger.css('transform', 'translateY(100%)'); 1442 }); 1443 } 1444 1445 //lineupHover(); 1446 1447 /* -------------------------------------------------------------------------------------- 1448 for new model -- 2019/10 TOP ãã¿ã³ -- 1449 -------------------------------------------------------------------------------------- */
1450 function topButtonHover() { 1451 var toggleWidth = -140; 1452 1453 //é¢ããæ 1454 $('.rwd-fixed-btn-list-link').on('mouseenter', function () { 1455 var $thisTrigger = $(this).find('.rwd-fixed-btn-list-text'); 1456 $thisTrigger.css('transform', 'translateX(' + toggleWidth + 'px)'); 1457 }); 1458 1459 //hoverããæ 1460 $('.rwd-fixed-btn-list-link').on('mouseleave', function () { 1461 var $thisTrigger = $(this).find('.rwd-fixed-btn-list-text'); 1462 $thisTrigger.css('transform', 'translateX(' + 0 + 'px)'); 1463 }); 1464 } 1465 1466 topButtonHover(); 1467 1468 if ($('.rwd-fixed-btn-list-link').length) { 1469 $('#rwd-control-scroll-button').addClass('rwd-with-floating-btn'); 1470 } 1471 1472 /* -------------------------------------------------------------------------------------- 1473 for new model -- 2019/10 cassette hover ã¢ãã¡ã¼ã·ã§ã³ -- 1474 -------------------------------------------------------------------------------------- */ 1475 function cassetteButtonHover() { 1476 //é¢ããæ 1477 $('.rwd-menu-grid').on('mouseenter', function () { 1478 var $thisTrigger = $(this).find('.rwd-menu-grid-target'); 1479 $thisTrigger.css('transform', 'translateY(0)'); 1480 }); 1481 1482 //hoverããæ 1483 $('.rwd-menu-grid').on('mouseleave', function () { 1484 var $thisTrigger = $(this).find('.rwd-menu-grid-target'); 1485 $thisTrigger.css('transform', 'translateY(100%)'); 1486 }); 1487 } 1488 1489 //cassetteButtonHover(); 1490 1491 /* -------------------------------------------------------------------------------------- 1492 for swipe btn 1493 -------------------------------------------------------------------------------------- */ 1494 var smpScrollWrap02 = $('.rwd-table-type02-scrollable'); 1495 var smpScrollWrap03 = $('.rwd-table-type03-wrapper'); 1496 1497 //for .rwd-table-type02 1498 if (smpScrollWrap02.length !== 0) { 1499 smpScrollWrap02.append('<p class="rwd-table-btn"><img src="/shared/img/rwd_icon_swipe01.svg" width="34" height="38" alt="ã¹ã¯ã¤ã"></p>'); 1500 smpScrollTab02(); 1501 } 1502 1503 function smpScrollTab02() { 1504 if (isLayoutSP) { 1505 smpScrollWrap02.find('.rwd-table-btn').show(); 1506 1507 smpScrollWrap02.on('scroll', function () { 1508 var obj = $(this).find('.rwd-table-btn'); 1509 var scrollLeft = $(this).scrollLeft(); 1510 if (scrollLeft > 0) { 1511 obj.fadeOut('fast'); 1512 } else { 1513 obj.fadeIn('fast'); 1514 } 1515 }); 1516 } else { 1517 smpScrollWrap02.off('scroll'); 1518 smpScrollWrap02.find('.rwd-table-btn').hide(); 1519 } 1520 } 1521 1522 //for .rwd-table-type03 1523 if (smpScrollWrap03.length !== 0) { 1524 smpScrollWrap03.append('<p class="rwd-table-btn"><img src="/shared/img/rwd_icon_swipe01.svg" width="34" height="38" alt="ã¹ã¯ã¤ã"></p>'); 1525 smpScrollTab03(); 1526 } 1527 1528 function smpScrollTab03() { 1529 if (isLayoutSP) { 1530 smpScrollWrap03.find('.rwd-table-btn').show(); 1531 1532 smpScrollWrap03.on('scroll', function () { 1533 var obj = $(this).find('.rwd-table-btn'); 1534 var scrollLeft = $(this).scrollLeft(); 1535 if (scrollLeft > 0) { 1536 obj.fadeOut('fast'); 1537 } else { 1538 obj.fadeIn('fast'); 1539 } 1540 }); 1541 } else { 1542 smpScrollWrap03.off('scroll'); 1543 smpScrollWrap03.find('.rwd-table-btn').hide(); 1544 } 1545 } 1546 1547 // ãªãµã¤ãºå¦ç 1548 var timer = false; 1549 var viewWidthCurrent = 0; 1550 $(window).on('resize orientationchange', function () { 1551 if (timer !== false) { 1552 clearTimeout(timer); 1553 } 1554 timer = setTimeout(function () { 1555 // fb ãªãµã¤ãº 1556 boxWidth = $('#rwd-control-fb_box').width(); 1557 currentWidth = $('#rwd-control-fb_box .fb-page').attr('data-width'); 1558 if (boxWidth !== currentWidth) { 1559 $('#rwd-control-fb_box .fb-page').attr('data-width', boxWidth); 1560 if (typeof FB !== 'undefined') { 1561 FB.XFBML.parse(document.getElementById('rwd-control-fb_box')); 1562 } 1563 } 1564 1565 // IOS8以éã§ã¯ã¹ã¯ãã¼ã«ã®éã«ãªãµã¤ãºã¤ãã³ããèµ·ããã®ã§å¹ ãå¤ãã£ãæã®ã¿å®è¡ 1566 viewWidthCurrent = window.innerWidth; 1567 if (viewWidth !== viewWidthCurrent) { 1568 // å¹ ãæ´æ° 1569 // console.log("resize"); 1570 viewWidth = viewWidthCurrent; 1571 1572 // Layoutãã§ã㯠1573 checkLayout(); 1574 // ã«ã«ã¼ã»ã«ãªãµã¤ãºå¦ç ã¬ã¤ã¢ã¦ã夿´ããã°ã«ã«ã¼ã»ã«ç ´æ£ãã¦åæ§ç¯ 1575 if (isLayoutChange) { 1576 // console.log('carousel destroy'); 1577 caluselDestroy(); 1578 caluselGenerate(); 1579 } 1580 1581 sliderCenteringNav($slider_thunbnail_wrap); 1582 1583 // SPã¬ã¤ã¢ã¦ãããåãæ¿ãã£ãéã«SPã®ã¡ãã¥ã¼ç¶æ ã¯ãªã¢ PCã®æã«hoverãæ®ã£ã¦ãã¾ãåé¡å¯¾ç 1584 // if ($menu_trigger.length > 0) { 1585 // $menu_trigger.removeClass('active'); 1586 // $main_header.removeClass('show-nav'); 1587 // $submenu_link.removeClass('open'); 1588 // $modal_bg.removeClass('active'); 1589 // $('html').removeClass('is-fixed'); 1590 // } 1591 //ã¿ãããªãµã¤ãº 1592 slideResize($slideGroup); 1593 1594 //ãã¼ãã«ããªãµã¤ãº 1595 updateTables(); 1596 smpScrollTab02(); 1597 smpScrollTab03(); 1598 } 1599 }, 200); // ãªãµã¤ãºããã¦200ããªç§ãã£ããã¤ãã³ãå®è¡ããªãµã¤ãºã®ãã³ã«å®è¡ããã¨éããªãã®ã§ 1600 }); 1601})(jQuery); 1602 1603const globalNavbar = document.querySelector('.rwd-global-nav-kbd .rwd-global-nav'); 1604const dimmer = document.getElementById('rwd-control-modal-bg'); 1605const mediaQuery = window.matchMedia('(min-width: 768px)'); 1606 1607/** add first, last focus detector element to header */ 1608$('.rwd-main-header') 1609 .prepend('<div data-first-focus tabindex="-1"/>') 1610 .append('<div data-last-focus tabindex="-1"/>') 1611const $detectorEl = $('.rwd-main-header').find('[data-first-focus], [data-last-focus]'); 1612 1613/** add height to submenu */ 1614function manageSubmenuHeight(element) { 1615 const wrapper = element.querySelector(".rwd-megamenu-wrapper"); 1616 const minHeight = element.querySelector(".rwd-megamenu-inner").scrollHeight; 1617 const maxHeight = wrapper.getAttribute('data-submenu-max-height') || 0; 1618 const subNavbarHeight = `${Math.max(maxHeight, minHeight)}px`; 1619 element.querySelector(".rwd-megamenu-inner").style.height = subNavbarHeight; 1620 element.querySelectorAll(".rwd-megamenu-content").forEach((item) => { 1621 item.style.height = subNavbarHeight; 1622 }); 1623}
1624/** remove class by class name */ 1625function resetClassInNavbar(className) { 1626 $(globalNavbar).find(`.${className}`).removeClass(className); 1627} 1628/** reset class in submenu*/ 1629function handleOnCloseSubMenu() { 1630 resetClassInNavbar("focus"); 1631 resetClassInNavbar("active"); 1632 resetClassInNavbar("show"); 1633 resetClassInNavbar("open"); 1634 dimmer.classList.remove("active"); 1635 $detectorEl.attr('tabindex', -1); 1636 $(globalNavbar).find('[aria-expanded]').attr('aria-expanded', 'false'); 1637 $(globalNavbar).find('[inert]').removeAttr('inert'); 1638} 1639 1640if (globalNavbar) { 1641 document.querySelectorAll('.rwd-global-nav').forEach((global_navigaiton) => { 1642 const this_navigation = { 1643 items: global_navigaiton.querySelectorAll('.rwd-global-nav-item'), 1644 links: global_navigaiton.querySelectorAll('.rwd-global-nav-item > a'), 1645 }; 1646 1647 const openMegaMenu = function (nav_link) { 1648 /** clear all current actived main nav */ 1649 this_navigation.items.forEach(function (nav_item) { 1650 const megamenu = nav_item.querySelector('.rwd-megamenu-wrapper'); 1651 nav_item.classList.remove('active'); 1652 if (megamenu) { 1653 nav_item.querySelector('.rwd-submenu-link').setAttribute('aria-expanded', 'false'); 1654 megamenu.classList.remove('show'); 1655 } 1656 }); 1657 1658 /** clear all current actived sub menu */ 1659 global_navigaiton.querySelectorAll('.rwd-global-subnav-item.rwd-global-nav-has-child').forEach(function (has_child_item) { 1660 has_child_item.classList.remove('active'); 1661 }); 1662 global_navigaiton.querySelectorAll('.rwd-megamenu-content').forEach(function (megamenu) { 1663 megamenu.classList.remove('show'); 1664 }); 1665 1666 const this_nav_item = {}; 1667 this_nav_item.self = nav_link.closest('.rwd-global-nav-item'); 1668 this_nav_item.mega = this_nav_item.self.querySelector('.rwd-megamenu-wrapper'); 1669 this_nav_item.self.classList.add('active'); 1670 1671 if (!!this_nav_item.mega) { 1672 this_nav_item.has_child_item_first = this_nav_item.mega.querySelector('.rwd-global-nav-has-child'); 1673 1674 nav_link.setAttribute('aria-expanded', 'true'); 1675 this_nav_item.mega.removeAttribute('inert'); 1676 this_nav_item.mega.classList.add('show'); 1677 dimmer.classList.add('active'); 1678 adjustSubnavHeight(); 1679 1680 if (this_nav_item.has_child_item_first) { 1681 this_nav_item.has_child_item_first.classList.add('active'); 1682 this_nav_item.has_child_item_first.querySelector('.rwd-megamenu-content').classList.add('show'); 1683 } 1684 } 1685 1686 /** Add close megamenu by pressing ESC event to document */ 1687 $(document).off('keydown.megamenu').on('keydown.megamenu', function (e) { 1688 if (e.key === 'Escape' && this_nav_item.mega.classList.contains('show')) { 1689 nav_link.focus(); 1690 this_nav_item.mega.setAttribute('inert', ''); 1691 handleOnCloseSubMenu(); 1692 } 1693 }); 1694 1695 /** Add first, last element detector event */ 1696 $detectorEl.attr('tabindex', 0); 1697 $('.rwd-main-header').off('focusin.focusDetector').on('focusin.focusDetector', function (e) { 1698 if ($(e.target).is('[data-first-focus]') || $(e.target).is('[data-last-focus]')) { 1699 this_nav_item.mega.setAttribute('inert', ''); 1700 $detectorEl.attr('tabindex', -1); 1701 handleOnCloseSubMenu(); 1702 } 1703 }); 1704 }; 1705 1706 const openSubMenu = function (child_item) { 1707 const this_child_megamenu = child_item.querySelector('.rwd-megamenu-content'); 1708 const this_parent_item = child_item.closest('.rwd-global-nav-has-child'); 1709 1710 /** clear all current active */ 1711 global_navigaiton.querySelectorAll('.rwd-global-subnav-item.rwd-global-nav-has-child').forEach(function (has_child_item) { 1712 has_child_item.classList.remove('active'); 1713 }); 1714 global_navigaiton.querySelectorAll('.rwd-megamenu-content').forEach(function (megamenu) { 1715 megamenu.classList.remove('show'); 1716 }); 1717 1718 this_parent_item.classList.add('active'); 1719 this_child_megamenu.classList.add('show'); 1720 adjustSubnavHeight(); 1721 }; 1722 1723 /** Open, Close megamenu by Click, Enter */ 1724 this_navigation.links.forEach(function (nav_link) { 1725 $(nav_link).on('click keydown', function (e) { 1726 if (!mediaQuery.matches) return; 1727 1728 const megaMenu = nav_link.parentNode.querySelector('.rwd-megamenu-wrapper'); 1729 if (megaMenu && (e.type === 'click' || (e.type === 'keydown' && e.key === 'Enter'))) { 1730 e.preventDefault(); 1731 1732 if (megaMenu.classList.contains('show')) { 1733 megaMenu.setAttribute('inert', ''); 1734 handleOnCloseSubMenu(); 1735 } else { 1736 openMegaMenu(nav_link); 1737 } 1738 } 1739 }); 1740 }); 1741 1742 /** Open sub menu by Click, Enter */ 1743 global_navigaiton.querySelectorAll('.rwd-global-subnav-item.rwd-global-nav-has-child').forEach(function (child_item) { 1744 const this_child_link = child_item.querySelector('.rwd-submenu-link'); 1745 1746 $(this_child_link).on('click keydown', function (e) { 1747 if (!mediaQuery.matches) return; 1748 1749 if (e.type === 'click' || (e.type === 'keydown' && e.key === 'Enter')) { 1750 e.preventDefault(); 1751 openSubMenu(child_item); 1752 } 1753 }); 1754 }); 1755 }); 1756 1757 /** 1758 * function control in navbar 1759 */ 1760 /** add height to submenu */ 1761 1762 /** get element on focus */ 1763 function getCurrentFocus() { 1764 return globalNavbar.querySelectorAll('.focus'); 1765 } 1766 1767 /** remove focus on element */ 1768 function resetCurrentFocus(isSubmenu = false) { 1769 resetClassInNavbar('focus'); 1770 1771 if (!isSubmenu) { 1772 globalNavbar.querySelectorAll('.rwd-megamenu-wrapper').forEach((e) => { 1773 e.classList.remove('show'); 1774 }); 1775 } 1776 } 1777 1778 /** set focus on main navbar from submenu */ 1779 function gotoCurrentMainNavbar(current) { 1780 resetCurrentFocus(true); 1781 current.closest('li.rwd-global-nav-item').classList.add('focus'); 1782 } 1783 1784 function manageLineupOpen() { 1785 const ele = globalNavbar.querySelector('[data-custom-open="true"]'); 1786 if (ele.classList.contains('focus')) { 1787 if (ele.querySelector('.rwd-megamenu-content')) { 1788 ele.classList.add('active'); 1789 ele.querySelector('.rwd-megamenu-content').classList.add('show'); 1790 } 1791 } 1792 } 1793 1794 /** control focus on main navbar */ 1795 function controlMainNavbar(ele, direction) { 1796 const [current] = getCurrentFocus(); 1797 resetCurrentFocus(); 1798 resetClassInNavbar('active'); 1799 if (direction === 'ArrowRight') { 1800 if (!ele.classList.contains('rwd-sp-utility-nav-item')) { 1801 ele.classList.add('focus'); 1802 } else { 1803 const last = Array.from(globalNavbar.querySelectorAll('li.rwd-global-nav-item:not(.rwd-sp-utility-nav-item)')).pop(); 1804 if (last === current) { 1805 handleOnCloseSubMenu(); 1806 document.querySelectorAll('.rwd-main-content a')[0].focus(); 1807 } 1808 return; 1809 } 1810 } else if (direction === 'ArrowLeft') { 1811 if (!(globalNavbar.firstElementChild === current)) { 1812 ele.classList.add('focus'); 1813 } else { 1814 current.classList.add('focus'); 1815 return; 1816 } 1817 } 1818 } 1819 1820 function controlSubNavbar(direction) { 1821 const [current] = getCurrentFocus(); 1822 if (direction === 'ArrowUp') { 1823 resetCurrentFocus(true); 1824 const previousElement = current.previousElementSibling; 1825 if (current.parentElement.closest('.rwd-global-subnav').firstElementChild === current) { 1826 current.closest('li.rwd-global-nav-item').classList.add('focus'); 1827 } else if (previousElement) { 1828 previousElement.classList.add('focus'); 1829 // show submenu if have it 1830 if (previousElement.classList.contains('rwd-global-nav-has-child')) { 1831 globalNavbar.querySelectorAll('.rwd-megamenu-content').forEach((e) => { 1832 e.classList.remove('show'); 1833 }); 1834 previousElement.querySelector('.rwd-megamenu-content').classList.add('show'); 1835 } else { 1836 globalNavbar.querySelectorAll('.rwd-megamenu-content').forEach((e) => { 1837 e.classList.remove('show'); 1838 }); 1839 } 1840 } 1841 } else if (direction === 'ArrowDown') { 1842 resetCurrentFocus(true); 1843 const nextElement = current.nextElementSibling; 1844 if (current.closest('.rwd-global-subnav').lastElementChild === current) { 1845 current.parentElement.parentElement.nextElementSibling.classList.add('focus'); 1846 } else if (nextElement) { 1847 nextElement.classList.add('focus'); 1848 // show submenu if have it 1849 if (nextElement.classList.contains('rwd-global-nav-has-child')) { 1850 globalNavbar.querySelectorAll('.rwd-megamenu-content').forEach((e) => { 1851 e.classList.remove('show'); 1852 }); 1853 nextElement.querySelector('.rwd-megamenu-content').classList.add('show'); 1854 } 1855 } 1856 } else if (direction === 'ArrowLeft') { 1857 gotoCurrentMainNavbar(current); 1858 } else if (direction === 'ArrowRight') { 1859 if (current.classList.contains('rwd-global-nav-has-child')) { 1860 resetCurrentFocus(true); 1861 current.querySelector('.rwd-global-subnav-card-list').firstElementChild.classList.add('focus'); 1862 } else { 1863 const fixedMenu = current.closest('.rwd-global-nav-item').querySelector('.rwd-megamenu-fixed-content'); 1864 if (fixedMenu) { 1865 resetCurrentFocus(true); 1866 fixedMenu.querySelector('ul.rwd-global-subnav-card-list > li.rwd-global-subnav-card-item')?.classList.add('focus'); 1867 fixedMenu.querySelector('ul.rwd-global-subnav-list > li.rwd-global-subnav-list-item')?.classList.add('focus'); 1868 } else { 1869 gotoCurrentMainNavbar(current); 1870 } 1871 } 1872 } 1873 } 1874 1875 /** control focus on main sub navbar */ 1876 function controlSubNavbarCardList(direction) { 1877 const [current] = getCurrentFocus(); 1878 1879 const fixedMenu = current.closest('.rwd-global-nav-item').querySelector('.rwd-megamenu-fixed-content'); 1880 1881 if (direction === 'ArrowRight') { 1882 resetCurrentFocus(true); 1883 const nextElement = current.nextElementSibling; 1884 if (current.parentElement.lastElementChild === current) { 1885 if (fixedMenu) { 1886 if (current.closest('.rwd-megamenu-inner').querySelector('.rwd-global-subnav > li.rwd-global-subnav-item > a')) { 1887 if (current.closest('.rwd-global-subnav')) { 1888 current.closest('.rwd-global-subnav-item').classList.add('focus'); 1889 } else { 1890 current.closest('.rwd-global-nav-item').querySelector('.rwd-megamenu-close').classList.add('focus'); 1891 } 1892 } else { 1893 current.closest('.rwd-global-nav-item').querySelector('.rwd-megamenu-close').classList.add('focus'); 1894 } 1895 } else { 1896 const item = current.parentElement.closest('.rwd-global-subnav-item'); 1897 if (item) { 1898 if (current.parentElement.nextElementSibling?.classList.contains('rwd-subnav-control')) { 1899 const control = current.parentElement.nextElementSibling; 1900 1901 const totalShow = parseInt(control.getAttribute('data-page-show')); 1902 resetSubnavCardList(current.parentElement, totalShow); 1903 } 1904 } 1905 1906 item.classList.add('focus'); 1907 } 1908 } else { 1909 if (current.parentElement.nextElementSibling?.classList.contains('rwd-subnav-control')) { 1910 const control = current.parentElement.nextElementSibling; 1911 const nextButton = control.querySelector('.next'); 1912 const currentPage = parseInt(control.getAttribute('data-page-current')); 1913 const totalShow = parseInt(control.getAttribute('data-page-show')); 1914 if ([...current.parentNode.children].indexOf(current) === currentPage * (totalShow + 1) - 1) { 1915 nextButton.click(); 1916 } 1917 } 1918 nextElement.classList.add('focus'); 1919 } 1920 } else if (direction === 'ArrowLeft') { 1921 resetCurrentFocus(true); 1922 const previousElement = current.previousElementSibling; 1923 if (current.parentElement.firstElementChild === current) { 1924 if (fixedMenu) { 1925 const SubNavItem = current.querySelector('.rwd-global-subnav > .rwd-global-nav-has-child'); 1926 if (!SubNavItem) { 1927 gotoCurrentMainNavbar(current); 1928 } 1929 } else { 1930 if (current.parentElement.nextElementSibling?.classList.contains('rwd-subnav-control')) { 1931 const control = current.parentElement.nextElementSibling; 1932 1933 const totalShow = parseInt(control.getAttribute('data-page-show')); 1934 resetSubnavCardList(current.parentElement, totalShow); 1935 } 1936 1937 current.parentElement.closest('.rwd-global-subnav-item').classList.add('focus'); 1938 } 1939 } else { 1940 if (current.parentElement.nextElementSibling?.classList.contains('rwd-subnav-control')) { 1941 const control = current.parentElement.nextElementSibling; 1942 const prevButton = control.querySelector('.prev'); 1943 const currentPage = parseInt(control.getAttribute('data-page-current')); 1944 const totalShow = parseInt(control.getAttribute('data-page-show')); 1945 if ([...current.parentNode.children].indexOf(current) === (currentPage - 1) * (totalShow + 1)) { 1946 prevButton.click(); 1947 } 1948 } 1949 previousElement.classList.add('focus'); 1950 } 1951 } else if (direction === 'ArrowUp') { 1952 if (current.parentElement.firstElementChild === current && !current.closest('.rwd-megamenu-inner').querySelector('.rwd-global-subnav > li.rwd-global-subnav-item > a')) { 1953 resetCurrentFocus(true); 1954 current.closest('.rwd-global-nav-item').classList.add('focus'); 1955 } 1956 } 1957 } 1958 1959 /** 1960 * function control in sub navbar 1961 */ 1962 1963 /** create element button */ 1964 function createSubNavButton(direction) { 1965 const control = { 1966 prev: 'æ»ã', 1967 next: '次ã¸', 1968 }; 1969 const button = document.createElement('a'); 1970 button.innerHTML = control[direction]; 1971 button.setAttribute('href', '#'); 1972 button.setAttribute('class', `rwd-subnav-control-button ${direction}`); 1973 return button; 1974 } 1975 1976 /** clear all item position to default*/ 1977 function resetSubnavCardList(ele, total) {
1978 [...ele.children].forEach((item, index) => { 1979 if (index > total) { 1980 item.style.display = 'none'; 1981 } else { 1982 item.style.display = 'block'; 1983 } 1984 }); 1985 1986 if (ele.nextElementSibling?.classList.contains('rwd-subnav-control')) { 1987 ele.nextElementSibling.setAttribute('data-page-current', 1); 1988 ele.nextElementSibling.querySelector('.rwd-subnav-control-button.next').style.display = 'block'; 1989 ele.nextElementSibling.querySelector('.rwd-subnav-control-button.prev').style.display = 'none'; 1990 } 1991 } 1992 1993 /** control sub navbar navigation */ 1994 const subnav = document.querySelectorAll('ul.rwd-global-subnav-card-list'); 1995 1996 if (subnav) { 1997 subnav.forEach((e) => { 1998 const SHOW_ROW = e.getAttribute('data-row-show'); 1999 const SHOW_ITEM_INDEX = SHOW_ROW ? SHOW_ROW * 5 - 2 : 18; 2000 if (e.childElementCount <= SHOW_ITEM_INDEX + 2) return; 2001 resetSubnavCardList(e, SHOW_ITEM_INDEX); 2002 if (e.childElementCount > SHOW_ITEM_INDEX + 2) { 2003 /** create element control subnav */ 2004 const controlElement = document.createElement('div'); 2005 controlElement.setAttribute('class', 'rwd-subnav-control'); 2006 controlElement.setAttribute('data-page-current', 1); 2007 controlElement.setAttribute('data-page-max', Math.ceil(e.childElementCount / SHOW_ITEM_INDEX)); 2008 controlElement.setAttribute('data-page-show', SHOW_ITEM_INDEX); 2009 controlElement.appendChild(createSubNavButton('prev')); 2010 controlElement.appendChild(createSubNavButton('next')); 2011 e.parentNode.insertBefore(controlElement, controlElement.nextSibling); 2012 /** manage subnav */ 2013 const control = e.parentNode.querySelector('.rwd-subnav-control'); 2014 const prevButton = control.querySelector('.prev'); 2015 const nextButton = control.querySelector('.next'); 2016 prevButton.style.display = 'none'; 2017 // 1 0 +18 [0-18] 2018 // 2 19 +18 [19-37] 2019 // 3 38 +18 [38-56] 2020 prevButton.addEventListener('click', () => { 2021 const currentPage = parseInt(control.getAttribute('data-page-current')); 2022 const updatePage = currentPage - 1; 2023 control.setAttribute('data-page-current', updatePage); 2024 if (updatePage === 1) { 2025 nextButton.style.display = 'block'; 2026 prevButton.style.display = 'none'; 2027 } else { 2028 nextButton.style.display = 'block'; 2029 } 2030 [...e.children].forEach((item, index) => { 2031 item.style.display = 'none'; 2032 if (index >= (updatePage - 1) * (SHOW_ITEM_INDEX + 1) && index <= (updatePage - 1) * (SHOW_ITEM_INDEX + 1) + SHOW_ITEM_INDEX) { 2033 item.style.display = 'block'; 2034 } 2035 }); 2036 }); 2037 2038 nextButton.addEventListener('click', () => { 2039 const currentPage = parseInt(control.getAttribute('data-page-current')); 2040 const maxPage = parseInt(control.getAttribute('data-page-max')); 2041 2042 const updatePage = Math.min(currentPage + 1, e.childElementCount); 2043 control.setAttribute('data-page-current', updatePage); 2044 2045 if (updatePage === maxPage) { 2046 nextButton.style.display = 'none'; 2047 prevButton.style.display = 'block'; 2048 } else { 2049 prevButton.style.display = 'block'; 2050 } 2051 [...e.children].forEach((item, index) => { 2052 item.style.display = 'none'; 2053 if (index >= currentPage * (SHOW_ITEM_INDEX + 1) && index <= currentPage * (SHOW_ITEM_INDEX + 1) + SHOW_ITEM_INDEX) { 2054 item.style.display = 'block'; 2055 } 2056 }); 2057 }); 2058 } 2059 }); 2060 } 2061 2062 /** 2063 * EVENT 2064 */ 2065 function findNextTabStop(el) { 2066 var allTabIndex = document.querySelectorAll('input, button, select, textarea, a[href]'); 2067 var list = Array.prototype.filter.call(allTabIndex, function (item) { 2068 return item.tabIndex >= '0'; 2069 }); 2070 var index = list.indexOf(el); 2071 return list[index + 1] || list[0]; 2072 } 2073 2074 function findPreviousTabStop(el) { 2075 var allTabIndex = document.querySelectorAll('input, button, select, textarea, a[href]'); 2076 var list = Array.prototype.filter.call(allTabIndex, function (item) { 2077 return item.tabIndex >= '0'; 2078 }); 2079 var index = list.indexOf(el); 2080 return list[index - 1] || list[0]; 2081 } 2082 2083 // YMHCD: set keyboard event assign inside variables. 2084 const global_nav_keyboard_controler = () => { 2085 /** keyboard control management */ 2086 document.addEventListener('keydown', (e) => { 2087 if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown' || e.key === 'Tab' || e.shiftKey) { 2088 if (e.shiftKey && e.key === 'Tab') { 2089 if (getCurrentFocus()[0] === globalNavbar.children[0]) { 2090 globalNavbar.children[0].firstElementChild.focus(); 2091 resetClassInNavbar('focus'); 2092 return; 2093 } 2094 } 2095 if (e.key === 'Tab' && findNextTabStop(document.activeElement).closest('.rwd-global-nav') !== globalNavbar) { 2096 resetClassInNavbar('focus'); 2097 return; 2098 } else { 2099 if (getCurrentFocus().length === 0 && (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'Tab') && !e.shiftKey) { 2100 globalNavbar.children[0].classList.add('focus'); 2101 globalNavbar.children[0].firstElementChild.focus(); 2102 } else { 2103 const [current] = getCurrentFocus(); 2104 if (!current) return; 2105 e.preventDefault(); 2106 if (current.parentElement === globalNavbar) { 2107 // level 0 nav bar left/right 2108 if (e.key === 'ArrowRight') { 2109 const nextElement = current.nextElementSibling; 2110 controlMainNavbar(nextElement, e.key); 2111 } else if (e.key === 'ArrowLeft') { 2112 const previousElement = current.previousElementSibling; 2113 controlMainNavbar(previousElement, e.key); 2114 } else if (e.key === 'ArrowDown') { 2115 if (current.classList.contains('rwd-global-nav-has-child') && current.querySelector('.rwd-megamenu-wrapper').classList.contains('show')) { 2116 resetCurrentFocus(true); 2117 current.querySelectorAll('a')[1].parentElement.classList.add('focus'); 2118 } 2119 } else if (e.key === 'Tab') { 2120 if (e.shiftKey) { 2121 const previousElement = current.previousElementSibling; 2122 controlMainNavbar(previousElement, 'ArrowLeft'); 2123 } else { 2124 const nextElement = current.nextElementSibling; 2125 controlMainNavbar(nextElement, 'ArrowRight'); 2126 } 2127 } 2128 } else if (current.parentElement.classList.contains('rwd-global-subnav')) { 2129 controlSubNavbar(e.key); 2130 if (e.key === 'Tab') { 2131 if (e.shiftKey) { 2132 controlSubNavbar('ArrowUp'); 2133 } else { 2134 controlSubNavbar('ArrowDown'); 2135 } 2136 } 2137 } else if (current.classList.contains('rwd-megamenu-close')) { 2138 if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowDown') { 2139 resetCurrentFocus(true); 2140 current.closest('li.rwd-global-nav-item').classList.add('focus'); 2141 } else if (e.key === 'ArrowUp') { 2142 resetCurrentFocus(true); 2143 const lastElement = current.previousElementSibling.querySelector('.rwd-global-subnav').lastElementChild; 2144 lastElement.classList.add('focus'); 2145 lastElement.querySelector('.rwd-megamenu-content')?.classList.add('show'); 2146 } else if (e.key === 'Tab') { 2147 resetCurrentFocus(true); 2148 if (e.shiftKey) { 2149 const lastElement = current.previousElementSibling.querySelector('.rwd-global-subnav').lastElementChild; 2150 lastElement.classList.add('focus'); 2151 lastElement.querySelector('.rwd-megamenu-content')?.classList.add('show'); 2152 } else { 2153 current.closest('li.rwd-global-nav-item').classList.add('focus'); 2154 } 2155 } 2156 } else if (current.parentElement.classList.contains('rwd-global-subnav-card-list') || current.parentElement.classList.contains('rwd-global-subnav-list')) { 2157 controlSubNavbarCardList(e.key); 2158 if (e.key === 'Tab') { 2159 if (e.shiftKey) { 2160 controlSubNavbarCardList('ArrowLeft'); 2161 } else { 2162 controlSubNavbarCardList('ArrowRight'); 2163 } 2164 } 2165 } 2166 } 2167 } 2168 } else if (e.key === 'Enter') { 2169 const [current] = getCurrentFocus(); 2170 if (current) { 2171 e.preventDefault(); 2172 const link = current.querySelector('a') || current; 2173 const { href, target } = link.getAttributeNames().reduce((a, b) => { 2174 return { ...a, [b]: link.getAttribute(b) }; 2175 }, {}); 2176 if (!href.startsWith('#')) { 2177 handleOnCloseSubMenu(); 2178 window.open(href, target || '_self'); 2179 } else { 2180 // show submenu if have it 2181 if (current.classList.contains('rwd-global-nav-has-child')) { 2182 const wrapper = current.querySelector('.rwd-megamenu-wrapper'); 2183 if (wrapper) { 2184 if (wrapper.classList.contains('show')) { 2185 dimmer.classList.remove('active'); 2186 wrapper.classList.remove('show'); 2187 } else { 2188 wrapper.classList.add('show'); 2189 dimmer.classList.add('active'); 2190 manageLineupOpen(); 2191 manageSubmenuHeight(current); 2192 } 2193 } 2194 } else if (current.classList.contains('rwd-megamenu-close')) { 2195 handleOnCloseSubMenu(); 2196 } 2197 } 2198 } else if (document.activeElement.id === 'rwd-control-search-trigger') { 2199 e.preventDefault(); 2200 document.activeElement.click(); 2201 } else if (document.activeElement.id === 'rwd-control-search-closer') { 2202 menuToggleSearch(); 2203 } 2204 } else if (e.key === 'Escape') { 2205 if (globalNavbar.querySelector('.rwd-megamenu-wrapper.show')) { 2206 handleOnCloseSubMenu(); 2207 } 2208 } 2209 2210 adjustSubnavHeight() // ãµãã¡ãã¥ã¼ã®é«ãã調æ´ãã (2024/03/25) 2211 }); 2212 }; 2213 2214 // YMHCD: add event with YMHCD condition 2215 if (!ymhcd_is_enabled) { 2216 global_nav_keyboard_controler(); 2217 } 2218 2219 // document.addEventListener('click', () => { 2220 // resetClassInNavbar('focus'); 2221 // }); 2222 2223 document.querySelectorAll('.rwd-global-nav .rwd-megamenu-close').forEach((ele) => { 2224 $(ele).on('click touchend', function (e) { 2225 e.preventDefault(); 2226 ele.closest('.rwd-megamenu-wrapper').setAttribute('inert', ''); 2227 handleOnCloseSubMenu(); 2228 }); 2229 $(ele).on('keydown', function (e) { 2230 if (e.key === 'Enter') { 2231 e.preventDefault(); 2232 ele.closest('.rwd-global-nav-item').querySelector('.rwd-submenu-link').focus(); 2233 ele.closest('.rwd-megamenu-wrapper').setAttribute('inert', ''); 2234 handleOnCloseSubMenu(); 2235 } 2236 }); 2237 }); 2238} 2239// const globalSubnavItem = document.querySelectorAll('.rwd-megamenu-wrapper .rwd-global-subnav.rwd-megadrop-menu .rwd-global-subnav-item'); 2240// globalSubnavItem.forEach((item) => { 2241// globalNavbarEvents.show.forEach((this_event) => { 2242// item.addEventListener(this_event, (event) => { 2243// if (event.target.classList.contains('rwd-nav-item-toplink')) { 2244// const firstItemHasChild = event.target.closest('.rwd-global-subnav').querySelector('.rwd-global-nav-has-child'); 2245// if (firstItemHasChild && !firstItemHasChild.classList.contains('active')) { 2246// firstItemHasChild.classList.add('active'); 2247// firstItemHasChild.querySelector('.rwd-megamenu-content').classList.add('show'); 2248// } 2249// item.classList.add('active'); 2250// } 2251// }); 2252// }); 2253// globalNavbarEvents.hide.forEach((this_event) => { 2254// item.addEventListener(this_event, (event) => { 2255// if (item.classList.contains('rwd-nav-item-toplink')) { 2256// if (item.classList.contains('active')) { 2257// item.classList.remove('active'); 2258// } 2259// } 2260// }); 2261// }); 2262// }); 2263 2264/** sp submenu management */ 2265const menuButton = document.getElementById('rwd-menu-trigger'); 2266const mainNavbar = document.getElementById('rwd-control-main-header'); 2267const submenuLink = mainNavbar.querySelectorAll('.rwd-global-nav .rwd-submenu-link'); 2268const htmlEl = document.querySelector('html'); 2269 2270menuButton && 2271 menuButton.addEventListener('click', function (event) { 2272 if (menuButton.classList.contains('active')) { 2273 menuButton.classList.remove('active'); 2274 mainNavbar.classList.remove('show-nav'); 2275 dimmer.classList.remove('active'); 2276 globalNavbar?.closest('#rwd-content').removeAttribute('style'); 2277 htmlEl.classList.remove('is-fixed'); 2278 } else { 2279 menuButton.classList.add('active'); 2280 mainNavbar.classList.add('show-nav'); 2281 dimmer.classList.add('active'); 2282 htmlEl.classList.add('is-fixed'); 2283 } 2284 }); 2285 2286// SPãµãã¡ãã¥ã¼ãã¯ãªãã¯ãã¿ããããéã®ã¤ãã³ã 2287$(submenuLink).on('click', function () { 2288 if (mediaQuery.matches) return; 2289 event.preventDefault(); 2290 2291 if ($(this).hasClass('open')) { 2292 $(this) 2293 .removeClass('open') 2294 .next().find('.rwd-submenu-link.open').removeClass('open'); 2295 } else { 2296 $(this).addClass('open'); 2297 } 2298}); 2299 2300 2301/** Full width video parallax */ 2302(function () { 2303 var
2303 videoEl = document.querySelectorAll('.rwd-box-full-image.parallax .rwd-video'); 2304 2305 var setVideoSize = function () { 2306 var vdoRatio = 9 / 16; 2307 var winRatio = window.innerHeight / window.innerWidth; 2308 2309 videoEl.forEach(function (el) { 2310 if (winRatio < vdoRatio) { 2311 el.classList.add('is-narrow'); 2312 } else { 2313 el.classList.remove('is-narrow'); 2314 } 2315 }); 2316 }; 2317 2318 if (videoEl.length === 0) { 2319 return; 2320 } 2321 2322 var resizeTimer; 2323 window.addEventListener('resize', function () { 2324 clearTimeout(resizeTimer); 2325 resizeTimer = setTimeout(function () { 2326 setVideoSize(); 2327 }, 300); 2328 }); 2329 setVideoSize(); 2330})(); 2331 2332// document.querySelectorAll('.rwd-global-subnav-item').forEach((item) => { 2333// item.addEventListener('mouseenter', (e) => { 2334// item.classList.add('active'); 2335 2336// const globalSubnav = document.querySelector('.rwd-global-subnav'); 2337// globalSubnav.style.height = 'auto'; 2338 2339// adjustSubnavHeight() // ãµãã¡ãã¥ã¼ã®é«ãã調æ´ãã (2024/03/25) 2340// }); 2341// item.addEventListener('mouseleave', (e) => { 2342// if (item.classList.contains('active')) { 2343// item.classList.remove('active'); 2344// } 2345// }); 2346// }); 2347 2348document.querySelectorAll('.rwd-link-area .link-related').forEach((ele) => { 2349 ele.addEventListener('click', (e) => { 2350 e.preventDefault(); 2351 YMoutJump(ele); 2352 }); 2353}); 2354 2355// ãµãã¡ãã¥ã¼ã®é«ãã調æ´ãã (2024/03/25) 2356function adjustSubnavHeight () { 2357 // console.log('adjustSubnavHeight'); 2358 setTimeout(() => { 2359 const megamenuContent = document.querySelector(".rwd-megamenu-content.show"); 2360 // console.log("ð ~ setTimeout ~ megamenuContent:", megamenuContent); 2361 if (megamenuContent) { 2362 const globalSubnav = megamenuContent.closest(".rwd-global-subnav.rwd-megadrop-menu"); 2363 const megamenuContentComputedStyle = getComputedStyle(megamenuContent); 2364 const hasBackgroundImage = megamenuContentComputedStyle?.backgroundImage !== "none"; 2365 const inner = megamenuContent.closest('.rwd-megamenu-inner'); 2366 const topLinkHeight = 59.45; 2367 if (hasBackgroundImage && window.innerWidth >= 768 ) { 2368 const height = `${670 + topLinkHeight}px` 2369 globalSubnav.style.height = height; 2370 inner.style.height = height; 2371 megamenuContent.style.height = `${670}px`; 2372 } else { 2373 const height = megamenuContent.getBoundingClientRect()?.height + 40 + topLinkHeight; 2374 const globalSubnavHeight = globalSubnav.getBoundingClientRect()?.height; 2375 inner.style.height = height > globalSubnavHeight ? `${height}px` : null; 2376 } 2377 } else { 2378 const megadropMenu = Array.from(document.querySelectorAll(".rwd-global-subnav.rwd-megadrop-menu.rwd-megadrop-menu--lineup")).filter((item)=>item.getBoundingClientRect()?.height > 0)[0]; 2379 // console.log("ð ~ setTimeout ~ megadropMenu:", megadropMenu); 2380 if(!megadropMenu) return 2381 const megadropMenuHeight = megadropMenu.getBoundingClientRect()?.height 2382 const inner = megadropMenu.parentElement 2383 inner.style.height = `${megadropMenuHeight}px`; 2384 } 2385 }, 20); 2386} 2387 2388document.querySelectorAll('.rwd-megamenu-content').forEach((megamenuContent) => { 2389 const globalSubnav = megamenuContent.closest(".rwd-global-subnav.rwd-megadrop-menu"); 2390 const megamenuContentComputedStyle = getComputedStyle(megamenuContent); 2391 const hasBackgroundImage = megamenuContentComputedStyle?.backgroundImage !== "none"; 2392 const inner = megamenuContent.closest('.rwd-megamenu-inner'); 2393 const topLinkHeight = 59.45; 2394 if (hasBackgroundImage && window.innerWidth >= 768 ) { 2395 const height = `${670 + topLinkHeight}px` 2396 globalSubnav.style.height = height; 2397 inner.style.height = height; 2398 megamenuContent.style.height = `${670}px`; 2399 } else { 2400 const megamenuContentHeight = megamenuContent.getBoundingClientRect()?.height; 2401 let height; 2402 if(megamenuContentHeight > 0){ 2403 height = megamenuContent.getBoundingClientRect()?.height + 40 + topLinkHeight; 2404 }else{ 2405 const megadropMenu = Array.from(document.querySelectorAll(".rwd-global-subnav.rwd-megadrop-menu.rwd-megadrop-menu--lineup")).filter((item)=>item.getBoundingClientRect()?.height > 0)[0]; 2406 height = megadropMenu?.getBoundingClientRect()?.height; 2407 } 2408 const globalSubnavHeight = globalSubnav.getBoundingClientRect()?.height; 2409 inner.style.height = height > globalSubnavHeight ? `${height}px` : null; 2410 } 2411}); 2412 2413function closeSubMenuSp() { 2414 if (window.innerWidth <= 768) { 2415 if ($("#rwd-menu-trigger").hasClass("active")) { 2416 $("#rwd-menu-trigger").trigger("click"); 2417 } 2418 const navSP = document.querySelectorAll("#rwd-control-global-nav > ul.rwd-global-nav > .rwd-global-nav-item.rwd-global-nav-has-child .rwd-global-subnav"); 2419 setTimeout(() => { 2420 navSP.forEach((nav) => { 2421 nav.removeAttribute("style"); 2422 }) 2423 }, 400); 2424 } 2425} 2426 2427// close megamenu when orientation and breakpoint change 2428var megamenuTimer; 2429var curMediaQuery = mediaQuery.matches; 2430 2431$(window).on('resize orientationchange', function() { 2432 clearTimeout(megamenuTimer); 2433 megamenuTimer = setTimeout(function() { 2434 if ( 2435 ($('.rwd-main-header.show-nav').length > 0 2436 || $('.rwd-global-nav-item.rwd-global-nav-has-child.active').length > 0) 2437 && curMediaQuery !== mediaQuery.matches 2438 ) { 2439 handleOnCloseSubMenu(); 2440 } 2441 curMediaQuery = mediaQuery.matches; 2442 }, 250); 2443}); 2444 2445$(window).on('orientationchange', closeSubMenuSp) 2446mediaQuery.onchange = () => { 2447 closeSubMenuSp() 2448}; 2449
2450/** a11y renewal 2451------------------------------------------------------------------------------------------ */ 2452(function ($) { 2453 /** 2454 * - Background Color-Type04ï¼æ¿ãèæ¯è²ï¼é» 2455 * - Background Color-Type05ï¼æ¿ãèæ¯è²ï¼ç´º 2456 * - Background Color-Type06ï¼æ¿ãèæ¯è²ï¼ç· 2457 * - H1-Type01ï¼ã¹ã©ã¤ãã¼ 2458 * - H1-Type03ï¼ç»åæ¨ªå¹ 100ï¼ ï¼ã¹ã©ã¤ãã¼ï¼ 2459 * - Key Visual-03ï¼ç»åæ¨ªå¹ 100ï¼ ï¼ã¹ã©ã¤ãã¼ï¼ 2460 * - Card-Type04-02ï¼PC4åå²ã»SPã¹ã©ã¤ãã¼å½¢å¼ï¼1.3åè¡¨ç¤ºï¼ 2461 * - Slider-Type01ï¼ãµã ãã¤ã«ããã»ããã¹ããã 2462 * - Slider-Type02ï¼ãµã ãã¤ã«ãã 2463 * - Slider-Type03ï¼ãµã ãã¤ã«ãªãã»ç¢å°æä½ãªã 2464 */ 2465 function initSplideDefault () { 2466 var $elements = $('#rwd-content .rwd-a11y-splide-default.splide'); 2467 2468 $elements.each(function () { 2469 let customOption = {}; 2470 2471 /** Card-Type04-02ï¼PC4åå²ã»SPã¹ã©ã¤ãã¼å½¢å¼ï¼1.3åè¡¨ç¤ºï¼ */ 2472 if ($(this).data('type') === 'carousel-01') { 2473 customOption = { 2474 perPage: 4, 2475 gap: 15, 2476 arrows: false, 2477 breakpoints: { 2478 768: { 2479 perPage: 1, 2480 padding: { right: '24.55%' }, 2481 }, 2482 } 2483 } 2484 } 2485 2486 const slider = new Splide($(this).get(0), { 2487 type: 'loop', 2488 speed: 800, 2489 arrows: $(this).data('arrows') !== false, 2490 autoplay: true, 2491 interval: 5000, 2492 pauseOnHover: false, 2493 reducedMotion: { 2494 autoplay: 'pause', 2495 }, 2496 i18n: { 2497 first: 'æåã®ã¹ã©ã¤ãã¸ç§»å', 2498 last: 'æå¾ã®ã¹ã©ã¤ãã¸ç§»å', 2499 prev: 'åã®ã¹ã©ã¤ã', 2500 next: '次ã®ã¹ã©ã¤ã', 2501 slideX: 'ã¹ã©ã¤ã%sã¸ç§»å', 2502 play: 'èªååçãéå§', 2503 pause: 'èªååçã忢', 2504 }, 2505 ...customOption 2506 }); 2507 2508 slider.mount(); 2509 }); 2510 } 2511 2512 /** 2513 * - Slider-Type04ï¼ãµã ãã¤ã«ãã 2514 */ 2515 function initSplideWithThumbs () { 2516 const $elements = $('#rwd-content .rwd-a11y-splide-with-thumb'); 2517 $elements.each(function () { 2518 const slider = new Splide($(this).find('.rwd-splide-main.splide').get(0), { 2519 type: 'loop', 2520 speed: 800, 2521 arrows: true, 2522 autoplay: true, 2523 interval: 5000, 2524 pauseOnHover: false, 2525 reducedMotion: { 2526 autoplay: 'pause', 2527 }, 2528 i18n: { 2529 first: 'æåã®ã¹ã©ã¤ãã¸ç§»å', 2530 last: 'æå¾ã®ã¹ã©ã¤ãã¸ç§»å', 2531 prev: 'åã®ã¹ã©ã¤ã', 2532 next: '次ã®ã¹ã©ã¤ã', 2533 slideX: 'ã¹ã©ã¤ã%sã¸ç§»å', 2534 play: 'èªååçãéå§', 2535 pause: 'èªååçã忢', 2536 }, 2537 }); 2538 2539 slider.on('mounted', function () { 2540 $(slider.Components.Pagination.items).each(function (i, e) { 2541 var image = $(slider.Components.Elements.slides[i]).find('img').attr('src');
2542 var imgHtml = '<img src="' + image + '" width="181" height="102" decoding="async" alt="">'; 2543 $(e.button).html(imgHtml) 2544 }) 2545 }); 2546 2547 slider.mount(); 2548 }); 2549 } 2550 2551 /** 2552 * - Tab-Type04ï¼æ¤ç´¢ã¡ãã¥ã¼ï¼èæ¯è²åãæ¿ãï¼ãã¿ãã®ã¿å¯¾å¿åã 2553 */ 2554 function initTabGroupSearch () { 2555 const $tabs = $('.rwd-a11y-tab-group-search'); 2556 2557 $tabs.each(function () { 2558 const $buttons = $(this).find('[role="tab"]'); 2559 const $contents = $(this).parent().find('[role="tabpanel"]'); 2560 const lastTabIndex = $buttons.length - 1; 2561 2562 if (!$buttons.length || !$contents.length) return; 2563 2564 const moveFocus = function (index = 0) { 2565 let nextIndex = index; 2566 2567 if (nextIndex > lastTabIndex) { 2568 nextIndex = 0; 2569 } else if (nextIndex < 0) { 2570 nextIndex = lastTabIndex; 2571 } 2572 2573 $buttons.eq(nextIndex).focus(); 2574 }; 2575 2576 $buttons.not('[aria-selected="true"]').attr('tabindex', -1); 2577 $buttons.on('click', function (e) { 2578 e.preventDefault(); 2579 if ($(this).attr('aria-selected') === 'true') return; 2580 2581 const id = $(this).attr('aria-controls'); 2582 2583 $buttons.attr('aria-selected', 'false').attr('tabindex', -1); 2584 $contents.hide(); 2585 2586 $(this).attr('aria-selected', 'true').attr('tabindex', null); 2587 $contents.filter(`#${id}`).show(); 2588 }) 2589 .on('keydown', function (event) { 2590 const currentIndex = $(this).parent().index(); 2591 switch (event.key) { 2592 case 'ArrowLeft': 2593 moveFocus(currentIndex - 1); 2594 break; 2595 case 'ArrowRight': 2596 moveFocus(currentIndex + 1); 2597 break; 2598 case 'Home': 2599 moveFocus(0); 2600 break; 2601 case 'End': 2602 moveFocus(lastTabIndex); 2603 break; 2604 default: 2605 break; 2606 } 2607 }); 2608 }); 2609 } 2610 2611 function initTabAccordion () { 2612 $('.rwd-slide-group').each(function () { 2613 const $buttons = $(this).find('[role="tab"]'); 2614 const lastTabIndex = $buttons.length - 1; 2615 2616 if (!$buttons.length) return; 2617 2618 const moveFocus = function (index = 0) { 2619 let nextIndex = index; 2620 2621 if (nextIndex > lastTabIndex) { 2622 nextIndex = 0; 2623 } else if (nextIndex < 0) { 2624 nextIndex = lastTabIndex; 2625 } 2626 2627 $buttons.eq(nextIndex).focus(); 2628 }; 2629 2630 $buttons 2631 .on('click', function (e) { 2632 e.preventDefault(); 2633 if ($(this).hasClass('sp-open')) { 2634 if (window.innerWidth < 768) { 2635 $(this).next().css({'max-height': 0}) 2636 } 2637 $(this).removeClass('sp-open'); 2638 } else { 2639 if (window.innerWidth < 768) { 2640 const height = $(this).next().prop('scrollHeight'); 2641 $(this).next().css({'max-height': height}) 2642 } 2643 $(this).addClass('sp-open'); 2644 } 2645 2646 $(this).siblings('[role="tab"]') 2647 .removeClass('current') 2648 .attr('aria-selected', 'false') 2649 .attr('tabindex', -1); 2650 $(this) 2651 .addClass('current') 2652 .attr('aria-selected', 'true') 2653 .attr('tabindex', null); 2654 2655 let currentHeight = 0; 2656 $(this).parent().find('.current + .slide-group-content').each(function () { 2657 currentHeight = $(this).prop('scrollHeight'); 2658 }); 2659 $(this).parent().css('padding-bottom', `${currentHeight}px`); 2660 }) 2661 .on('keydown', function (event) { 2662 const currentIndex = $(this).index(); 2663 let realIndex = Math.floor(currentIndex / 2); 2664 2665 switch (event.key) { 2666 case 'ArrowLeft': 2667 moveFocus(realIndex - 1); 2668 break; 2669 case 'ArrowRight': 2670 moveFocus(realIndex + 1); 2671 break; 2672 case 'Home': 2673 moveFocus(0); 2674 break; 2675 case 'End': 2676 moveFocus(lastTabIndex); 2677 break; 2678 default: 2679 break; 2680 } 2681 }); 2682 }); 2683 } 2684 2685 $(function () { 2686 initSplideDefault(); 2687 initSplideWithThumbs(); 2688 initTabGroupSearch(); 2689 initTabAccordion(); 2690 }); 2691 2692 /** add inert to other elements when cbox open */ 2693 $(document) 2694 .on('cbox_open', function () { 2695 $('#colorbox').siblings().attr('inert', ''); 2696 $('#colorbox').parent().siblings().attr('inert', ''); 2697 }) 2698 .on('cbox_cleanup', function () { 2699 $('#colorbox').siblings().attr('inert', null); 2700 $('#colorbox').parent().siblings().attr('inert', null); 2701 }); 2702})(jQuery);
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.