1/* --------------------------------------------------- 2 * 3 * copyright(c) Creastitch Inc. 4 * project - AICHI STEEL CORPORATION 5 * 6 * ---------------------------------------------------*/ 7 8 9/* --------------------------------------------------- 10 * CONSOLELOG IE BUGFIX 11 * ---------------------------------------------------*/ 12(function(){ 13 if(typeof window.console === 'undefined') window.console = {}; 14 if(typeof window.console.log !== 'function') window.console.log = function (){}; 15})(); 16 17 18/* --------------------------------------------------- 19 * INDEXOF IE BUGFIX 20 * ---------------------------------------------------*/ 21if(!Array.prototype.indexOf){ 22 Array.prototype.indexOf = function(target,index){ 23 if(isNaN(index)) index = 0; 24 for(var i = index; i < target.length; i++){ 25 if(this[i] === target) return i; 26 } 27 return -1; 28 }; 29} 30 31 32/* --------------------------------------------------- 33 * OS & BROWSER & USERAGENT 34 * ------------------------------------------------ */ 35var 36 uaStr = window.navigator.userAgent.toLowerCase(), 37 appVer = window.navigator.appVersion.toLowerCase(), 38 isDevice = false, 39 isIE = false, 40 isIEOld = false, 41 isEdge = false, 42 ieVer = false, 43 isWebkit = false, 44 isFirefox = false, 45 isTouch = false, 46 isOpacity = true, 47 isTransform = true, 48 isTransition = true 49; 50 51var ua = (function(u){ 52 return { 53 Tablet: (u.indexOf('windows') != -1 && u.indexOf('touch') != -1) || u.indexOf('ipad') != -1 || (u.indexOf('android') != -1 && u.indexOf('mobile') == -1) || (u.indexOf('firefox') != -1 && u.indexOf('tablet') != -1) || u.indexOf('kindle') != -1 || u.indexOf('silk') != -1 || u.indexOf('playbook') != -1, 54 Mobile: (u.indexOf('windows') != -1 && u.indexOf('phone') != -1) || u.indexOf('iphone') != -1 || u.indexOf('ipod') != -1 || (u.indexOf('android') != -1 && u.indexOf('mobile') != -1) || (u.indexOf('firefox') != -1 && u.indexOf('mobile') != -1) || u.indexOf('blackberry') != -1, 55 IE: u.indexOf('trident') != -1 || u.indexOf('msie') != -1, 56 Edge: u.indexOf('edge') != -1, 57 Webkit: u.indexOf('chrome') != -1 || u.indexOf('safari') != -1, 58 Firefox: u.indexOf('firefox') != -1 59 }; 60})(uaStr); 61 62 63/* SMARTPHONE 64 * ------------------------------------------------ */ 65if(ua.Tablet || ua.Mobile) isDevice = true; 66if(isDevice){ 67 $('html').addClass('device'); 68}else{ 69 $('html').addClass('no-device'); 70} 71 72 73/* IE 74 * ------------------------------------------------ */ 75if(ua.IE){ 76 isIE = true; 77 var ieAry = /(msie|rv:?)\s?([\d\.]+)/.exec(uaStr); 78 ieVer = (ieAry) ? ieAry[2] : ''; 79 ieVer = Math.floor(ieVer); 80 $('html').addClass('ie'); 81 $('html').addClass('ie' + ieVer); 82 if(ieVer <= 8){ 83 isIEOld = true; 84 $('html').addClass('ieOld'); 85 } 86} 87 88 89/* EDGE 90 * ------------------------------------------------ */ 91if(ua.Edge){ 92 isEdge = true; 93 $('html').addClass('edge'); 94} 95 96 97/* WEBKIT 98 * ------------------------------------------------ */ 99if(ua.Webkit){ 100 isWebkit = true; 101} 102 103 104/* --------------------------------------------------- 105 * GET ROOTPATH 106 * --------------------------------------------------- */ 107var 108 rootURL = '', 109 rootPath = '' 110; 111(function(){ 112 var 113 file = '_assets/js/common/script.js', 114 reg = new RegExp('(^|.*\/)' + file + '$'), 115 script = document.getElementsByTagName('script'), 116 i = script.length 117 ; 118 while(i--){ 119 var src = script[i].src.replace(/\?.*?$/g, ''); 120 var match = src.match(reg); 121 if(match){ 122 rootURL = match[1]; 123 break; 124 } 125 } 126 rootPath = rootURL.slice(rootURL.indexOf(location.hostname) + location.hostname.length); 127//console.log('rootURL:' + rootURL); 128//console.log('rootPath:' + rootPath); 129}()); 130 131 132/* --------------------------------------------------- 133 * LOCATION PARAMETER 134 * ------------------------------------------------ */ 135var pagePrm = new Object; 136var pagePrmLocation = location.search.substring(1).split('&'); 137for(var i=0; pagePrmLocation[i]; i++){ 138 var pagePrmVal = pagePrmLocation[i].split('='); 139 pagePrm[pagePrmVal[0]] = pagePrmVal[1]; 140} 141//console.log(pagePrm); 142// EX: pagePrm.hoge 143 144 145/* ---------------------------------------------------
146 * Load Complete 147 * ------------------------------------------------ */ 148$(window).on('load',function(){ 149 $('.g-body').addClass('is-loaddone'); 150});//END jQuery 151 152 153/* --------------------------------------------------- 154 * Smooth Scroll 155 * ------------------------------------------------ */ 156$(function(){ 157 /* CLICK */ 158 $('a[href^="#"]').on('click', function(){ 159 if($(this).attr('data-scroll') !== 'none'){ 160 if(!$(this).hasClass('js-noScroll')){ 161 var href = $(this).attr('href'); 162 smoothScroll({ 163 href: href, 164 speed: 750, 165 fixed: '.g-header', 166 easing: 'easeOutExpo' 167 }); 168 return false; 169 } 170 } 171 }); 172 173 /* LOAD */ 174 var hash = location.hash; 175 if(hash){ 176 $(window).scrollTop(0, 0); 177 setTimeout(function(){ 178 smoothScroll({ 179 href: hash, 180 speed: 750, 181 fixed: '.g-header', 182 easing: 'easeOutExpo' 183 }); 184 }, 100); 185 } 186}); 187function smoothScroll(e){ 188 var 189 speed = e.speed ? e.speed : 750, 190 easing = e.easing ? e.easing : 'easeOutExpo', 191 target = $(e.href === '#' || e.href === '' ? '#anc-pagetop' : e.href), 192 position = (target.length > 0) ? target.offset().top : 0, 193 posMinus = (e.href === '#anc-pagetop') ? -1 : (e.fixed ? $(e.fixed).outerHeight() : -1) 194 ; 195 if(ua.Mobile){ 196 $('html,body').animate({scrollTop: (position - posMinus - 20)}, speed, easing); 197 }else if(ua.Tablet){ 198 $('html,body').animate({scrollTop: (position - posMinus)}, speed, easing); 199 }else{ 200 $('html,body').animate({scrollTop: (position - posMinus)}, speed, easing); 201 } 202} 203 204 205/* --------------------------------------------------- 206 * Link Invalid 207 * ------------------------------------------------ */ 208$(window).on('load',function(){ 209 $('.js-link__invalid').on('click', function(){ 210 return false; 211 }) 212});//END jQuery 213 214 215/* --------------------------------------------------- 216 * Tel Link 217 * ------------------------------------------------ */ 218if(ua.Mobile){ 219 $(function(){ 220 $('.js-link__tel').each(function(){ 221 var str = $(this).text(); 222 $(this).html($('<a class="e-link">').attr('href', 'tel:' + str.replace(/-/g, '')).append(str + '</a>')); 223 }); 224 });//END jQuery 225} 226 227 228/* --------------------------------------------------- 229 * IMAGE ZOOM @media 230 * ------------------------------------------------ */ 231$(function(){ 232 if(ua.Mobile){ 233 $('.js-zoom').after('<span class="u-zoom-caption">\u753b\u50cf\u3092\u30bf\u30c3\u30d7\u3067\u62e1\u5927\u3057\u3066\u3054\u89a7\u3044\u305f\u3060\u3051\u307e\u3059\uff61</span>') 234 235 $('.js-zoom').each( 236 function(i){ 237 var src = $(this).attr('src'); 238 $(this).wrap($('<a class="u-link-zoom"></a>').attr({href: src, target: '_blank'})); 239 }); 240 } 241});// END jQuery 242 243 244/* --------------------------------------------------- 245 * LINK FORCUS 246 * ------------------------------------------------ */ 247$(function(){ 248 var 249 path = location.href.replace(rootURL, '/').replace(/^\//g, '').replace(/\/$/g, ''), 250 pathArray = path.split('/'), 251 pathLength = pathArray.length, 252 forcusClass = 'is-focusActive' 253 ; 254 path = path + '/'; 255//console.log('path:' + path); 256//console.log('pathArray:' + pathArray); 257//console.log('pathLength:' + pathLength); 258 259 forcusFnc({ 260 element: $('a.js-linkFocus'), 261 parent: true 262 }); 263 forcusFnc({ 264 element: $('a.js-linkFocus--type_match'), 265 parent: true, 266 match: true 267 }); 268 forcusFnc({ 269 element: $('a.js-linkFocus--add_parent'), 270 parent: true 271 }); 272/* 273 forcusFnc({ 274 element: $('a.js-linkFocus--add_parent.js-linkFocus--type_match'), 275 match: true, 276 parent: true 277 }); 278*/ 279 function forcusFnc(data){ 280 var element = data.element; 281 var match = data.match; 282 var parent = data.parent; 283 284 element.each(function(){ 285 var 286 href = $(this).get(0).href, 287 hrefPath = href.slice(href.indexOf(rootURL) + (rootURL.length) - 1).replace(/^\//g, '').replace(/\/$/g, ''), 288 hrefArray = hrefPath.split('/'), 289 hrefLength = hrefArray.length 290 ; 291 hrefPath = hrefPath + '/'; 292//console.log('href:' + href); 293//console.log('hrefPath:' + hrefPath); 294//console.log('hrefArray:' + hrefArray); 295//console.log('hrefLength:' + hrefLength); 296//console.log('parent:' + parent); 297 if(match){ 298 if(path === hrefPath){ 299 classFnc($(this), parent); 300 } 301 }else{ 302//console.log(hrefPath.indexOf('/')); 303 if( 304 (path === hrefPath) || 305 ( 306 hrefPath.indexOf('/') >= 0 && 307 //hrefLength >= pathLength && 308 ( 309 (!hrefArray[0] && !pathArray[0]) || 310 (path.indexOf(hrefPath) >= 0 && hrefArray[0]) 311 ) 312 ) 313 ){ 314//console.log('match:' + hrefArray[hrefLength - 1]); 315//console.log('hrefPath:' + hrefPath); 316//console.log('hrefArray:' + hrefArray); 317//console.log('hrefLength:' + hrefLength); 318 var matchCount = 0; 319 for(var i = 0; i < hrefArray.length; i++){ 320//console.log(pathArray.indexOf(hrefArray[i])); 321 if(pathArray.indexOf(hrefArray[i]) >= 0){ 322 matchCount++; 323 } 324 } 325//console.log('matchCount:' + matchCount); 326 if(pathArray[matchCount - 1] == hrefArray[matchCount - 1]){ 327 classFnc($(this), parent); 328 } 329//console.log(path.indexOf(hrefPath)); 330 } 331 } 332 }); 333 } 334 335 function classFnc(select, parent){ 336 select.addClass(forcusClass); 337 if(parent){ 338 select.parent().addClass(forcusClass); 339 } 340 } //END classFnc 341 342});//END jQuery 343 344 345/* --------------------------------------------------- 346 * RIGHT CLICK PROHIBITION 347 * ------------------------------------------------ */ 348/* 349$(function(){ 350 $('.js-prohibition').on('contextmenu',function(e){
351 return false; 352 }); 353}); 354*/ 355 356 357/* --------------------------------------------------- 358 * GLOBAL MENU - HAMBURGER MENU 359 * ------------------------------------------------ */ 360$(function(){ 361 var 362 $body = $('html'), 363 $gnavItem = $('.js-gnaviItem'), 364 $naviPullDown = $('.js-naviPullDown'), 365 $naviPullDownBase = $('.js-naviBase'), 366 $stateOn = 'is-gnaviPulldown-active', 367 $active = 'is-active' 368 ; 369 370 $gnavItem.on('click',function(){ 371 var 372 $indexButton = $gnavItem.index(this), 373 $gnaviMenuH = $naviPullDown.eq($indexButton).outerHeight(), 374 $gnaviBannerH = $('.g-navi-banner').outerHeight(), 375 $gnaviH = Math.max($gnaviMenuH,$gnaviBannerH) 376 ; 377 378 $('.g-naviPulldown').scrollTop(0); 379 380 if($(this).hasClass($active)){ 381 closeEvents(); 382 $naviPullDown.fadeOut(); 383 $naviPullDownBase.css( 384 'padding-top', + 0 385 ); 386 $body.removeClass('is-gnavi-scroll'); 387 }else{ 388 setTimeout(function(){ 389 naviscrollEvents(); 390 },900); 391 $body.addClass($stateOn); 392 $gnavItem.removeClass($active); 393 $naviPullDown.fadeOut().eq($indexButton).fadeIn(); 394 $naviPullDownBase.css( 395 'padding-top', + $gnaviH + 90 + 'px' 396 ); 397 $(this).addClass($active); 398 //æ¤ç´¢æãããã¼éè¡¨ç¤ºç¨ 399 if($(this).hasClass('js-gnaviItemSearch')){ 400 naviscrollEvents(); 401 $body.addClass('is-gnaviPulldown-search'); 402 $naviPullDownBase.css( 403 'padding-top', + $gnaviMenuH + 90 + 'px' 404 ); 405 }else{ 406 $body.removeClass('is-gnaviPulldown-search'); 407 } 408 } 409 return false; 410 }); 411 412 $('.js-naviButton').on('click',function(){ 413 if($(this).hasClass($active)){ 414 closeEvents(); 415 setTimeout(function(){ 416 $('.g-naviPulldown').scrollTop(0); 417 $('.js-menu__title__button').removeClass($active); 418 },250); 419 $(this).removeClass($active); 420 }else{ 421 $body.addClass($stateOn); 422 $(this).addClass($active); 423 $('.g-menu__inner').hide(); 424 $('.g-menu-child__items').hide(); 425 } 426 }); 427 $('.js-menu__title__button').on('click',function(){ 428 if($(this).parent('.g-menu__title').next('.g-menu__inner').not(':animated').length >= 1){ 429 $(this).toggleClass($active); 430 $(this).parent('.g-menu__title').next('.g-menu__inner').slideToggle(750,'easeOutExpo').toggleClass($active); 431 } 432 }); 433 $('.js-menu__title__buttonSub').on('click',function(){ 434 if($(this).next('.g-menu-child__items').not(':animated').length >= 1){ 435 $(this).toggleClass($active); 436 $(this).next('.g-menu-child__items').slideToggle(750,'easeOutExpo'); 437 } 438 }); 439 440 //ãªãµã¤ãº ãªã»ãã 441 $(window).on('resize',function(){ 442 var 443 $winW = $(window).width() 444 ; 445 446 if(1099 < $winW){ 447 $body.removeClass($stateOn); 448 $gnavItem.removeClass($active); 449 $naviPullDown.hide(); 450 $('.g-menu__inner').css( 451 'display', 'flex' 452 ); 453 $naviPullDownBase.css( 454 'padding-top', + 0 455 ); 456 $body.removeClass('is-gnavi-scroll'); 457 $('.js-naviButton').removeClass($active); 458 } 459// }else if($winW == 1099){ 460//// $body.removeClass($stateOn); 461//// $('.js-naviButton').removeClass($active); 462//// $('.g-naviPulldown').scrollTop(0); 463//// $('.js-menu__title__button').removeClass($active); 464// $('.g-menu__inner').css( 465// 'display', 'none' 466// ); 467 }); 468 469 //ããã¹ã¯ãã¼ã« 470 function naviscrollEvents(){ 471 var 472 $winH = $(window).height(), 473 $naviPullDownBaseH = $naviPullDownBase.outerHeight() 474 ; 475 if($winH <= $naviPullDownBaseH){ 476 $body.addClass('is-gnavi-scroll'); 477 }else{ 478 $body.removeClass('is-gnavi-scroll'); 479 } 480 } 481 482 //éãããã¿ã³ 483 $('.js-close').on('click',function(){ 484 var 485 $winW = $(window).width() 486 ; 487 closeEvents(); 488 $naviPullDown.fadeOut(); 489 $naviPullDownBase.css( 490 'padding-top', + 0 491 ); 492 $body.removeClass('is-gnavi-scroll'); 493 $('.js-naviButton').removeClass($active); 494 $('.g-naviPulldown').scrollTop(0); 495 if($winW <= 1099){ 496 setTimeout(function(){ 497 $('.js-menu__title__button').removeClass($active) 498 $('.g-menu-child__title').removeClass($active); 499 },300); 500 } 501 }); 502 503 //éãã 504 function closeEvents(){ 505 $body.removeClass($stateOn); 506 $gnavItem.removeClass($active); 507 } 508 509});//END jQuery 510 511 512/* --------------------------------------------------- 513 * SCROLL CLASS 514 * ------------------------------------------------ */ 515$(function(){ 516 var 517 select = '.js-scrollClass', 518 onClass = 'is-stateScroll', 519 selectT = [], 520 winT = 0, 521 mgT = 200 522 //timer = false 523 ; 524 setTimeout(function(){ 525 scrollFnc(); 526 }, 500); 527 $(window).on('scroll', function(){ 528 //if(timer !== false) clearTimeout(timer); 529 //timer = setTimeout(function(){ 530 scrollFnc(); 531 //}, 10); 532 }); 533 function scrollFnc(){ 534 winT = $(window).scrollTop(); 535 mgT = ($(window).height() * (3 / 4)); 536 //mgT = ($(window).height() / 2); 537//console.log('winT:' + winT); 538//console.log('mgT:' + mgT); 539 540 $(select).each(function(index){ 541 selectT[index] = $(this).offset().top;
542//console.log('selectT[index]:' + index + ':' + selectT[index]); 543//console.log(index + ':' + $(this).offset().top); 544 545 //if(selectT[index] < winT + $(window).height() - mgT){ 546 if($(this).offset().top < winT + mgT){ 547 //if(selectT[index] < winT + mgT){ 548 $(this).addClass(onClass); 549 } 550 }); 551 } 552});//END jQuery 553 554 555/* --------------------------------------------------- 556 * Page top 557 * ------------------------------------------------ */ 558$(window).on('load scroll',function(){ 559 if ($(this).scrollTop() > 100) { 560 $('.js-pagetop').addClass('is-active'); 561 } else { 562 $('.js-pagetop').removeClass('is-active'); 563 } 564 565 var scrollHeight = $(document).height(); 566 var scrollPosition = $(window).height() + $(window).scrollTop(); 567 var footHeight = $('.g-footer').outerHeight(); 568 569 if(scrollHeight - scrollPosition + 0 <= footHeight){ 570 if(ua.Mobile){ 571 $('.js-pagetop').css({ 572 'position': 'absolute', 573 'top': scrollHeight - 30 - footHeight, 574 'bottom': 'auto' 575 }); 576 }else if(ua.Tablet){ 577 $('.js-pagetop').css({ 578 'position': 'absolute', 579 'top': scrollHeight - 40 - footHeight, 580 'bottom': 'auto' 581 }); 582 }else{ 583 $('.js-pagetop').css({ 584 'position': 'absolute', 585 'top': scrollHeight - 40 - footHeight, 586 'bottom': 'auto' 587 }); 588 } 589 }else{ 590 $('.js-pagetop').css({ 591 'position': 'fixed', 592 'top': 'auto', 593 'bottom': '0' 594 }); 595 } 596 597});// END jQuery 598 599 600/* --------------------------------------------------- 601 * COOKIE CHECK 602 * ------------------------------------------------ */ 603$(function(){ 604 var 605 $cookieName = 'aichi-steel-cookiecheck', 606 $cookieInfo = $('.js-cookie-check'), 607 $active = 'active' 608 ; 609 if($.cookie($cookieName)) { 610 $cookieInfo.remove(); 611 }else{ 612 $cookieInfo.delay(1500).queue(function(next) { 613 $(this).addClass($active); 614 next(); 615 }); 616 } 617 $('.js-cookie-agree').on('click',function(){ 618 $.cookie($cookieName,'on',{ expires: 999, path: "/" }); 619 $cookieInfo.removeClass($active).delay(1000).queue(function(next){ 620 $(this).remove(); 621 next(); 622 }); 623 }); 624}); //END jQuery 625 626 627/* --------------------------------------------------- 628 * Mobile Overflow Scroll - SHADOW 629 * ------------------------------------------------ */ 630if(ua.Mobile){ 631 632 $(window).on('load',function(){ 633 $('.u-intoScroll__shadow').each(function(){ 634 var 635 scrollH = $(this).prev().children('.js-mobileScrollInner').outerHeight() 636 ; 637 $(this).css('height', scrollH); 638 }); 639 640 $('.js-mobileScroll').on('scroll',function(){ 641 var 642 scrollTableWidth = $(this).width(), 643 scrollWidth = $(this).children('.js-mobileScrollInner').width(), 644 scrollPosition = $(this).scrollLeft() 645 ; 646// console.log(scrollTableWidth); 647// console.log(scrollWidth); 648// console.log(scrollPosition); 649 if ((scrollWidth - scrollTableWidth) <= (scrollPosition + 10)) { 650// if ((scrollWidth - scrollPosition) / scrollWidth <= .55) { 651 $(this).parent('.u-intoScroll').addClass('is-none'); 652 }else{ 653 $(this).parent('.u-intoScroll').removeClass('is-none'); 654 } 655 }); 656 }); // END jQuery 657 658} 659 660 661/* --------------------------------------------------- 662 * Mobile Table scroll animation 663 * ------------------------------------------------ */ 664$(window).on('load resize',function(){ 665 var 666 $winW = $(window).width() 667 ; 668 669 if(767 > $winW){ 670 $('.u-table-corner--mobile-scroll').on('touchmove',function(){ 671 $(this).addClass('is-flick-animation-off') 672 }); 673 } 674}); 675 676 677/* --------------------------------------------------- 678 * TAB PANEL 679 * ------------------------------------------------ */ 680$(function (){ 681 $('.js-tabButton').on('click',function(){ 682 var 683 num = $(this).parent().children('li').index(this) 684 ; 685 $('.js-tabButtons').each(function(){ 686 $('>li',this).removeClass('is-activeTab').eq(num).addClass('is-activeTab'); 687 }); 688 $('.u-tabContents').hide().eq(num).show(); 689 }).first().click(); 690 691 $('.js-tabButtonsBottom>li').on('click',function(){ 692 var 693 speed = 750, 694 header = $('.g-header').outerHeight(), 695 href= $(this).attr('data-url'), 696 target = $(href == '#' || href == '' ? 'html' : href), 697 position = target.offset().top 698 ; 699 $('html,body').animate({scrollTop:position - header}, speed, 'easeOutExpo'); 700 return false; 701 }); 702});//END jQuery 703 704 705/* --------------------------------------------------- 706 * ACCORDION PANEL 707 * ------------------------------------------------ */ 708$(function(){ 709 $('.js-accordionButton').on('click',function(){ 710 $(this).next('.js-accordionPanel').stop().slideToggle(750,'easeOutExpo'); 711 $(this).toggleClass('is-active'); 712 }); 713}); // END jQuery 714
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.