1/** 2 * _pc-main.js 3 * 4 * __ æçµæ´æ°ï¼ 2024å¹´8æ7æ¥ __ 5 * 6 * ## ãã®ãã¡ã¤ã«ã®é©ç¨ç¯å²ï¼ 7 * 8 * - ãã®JavaScriptãã¡ã¤ã«ã¯ãPCãµã¤ããããèªã¿è¾¼ã¿ã¾ãã 9 * - ã¹ãããµã¤ãããã¯èªã¿è¾¼ã¿ã¾ããã 10 * 11 * - ãã®JavaScriptãã¡ã¤ã«ã¯ãã³ã¼ãã¬ã¼ããµã¤ãã®ããã¹ã¦ã®ãã¼ã¸ãããå ±éãã¦èªã¿è¾¼ã¿ã¾ãã 12 * 13 * 14 * ## ãã®ãã¡ã¤ã«ã®ç¨éï¼ 15 * 16 * - ãã®ãã¡ã¤ã«ã¯ãPCãµã¤ããã§ã®ã¿å©ç¨ããããªãã¸ã§ã¯ãããã¿ãã¬ããã¡ãã¥ã¼ã®ãããªæ©è½ãã©ã¤ãã©ãªãå«ãããã¨ãæ³å®ãã¦ãã¾ãã 17 * 18 */ 19 20/** 21 * ãããã¼ã«ããããã²ã¼ã·ã§ã³ã¨ãããããã¦ã³ã¡ãã¥ã¼ã®å¦ç 22 */ 23(function($, document) { 24 25 var mainDomain = "/" + "/ww" + "w.ots" + "uka-shok" + "ai.co.jp"; 26 var mainMyPageDomain = "/" + "/mypag" + "e.otsuk" + "a-shok" + "ai.co.jp"; 27 var headerGlobalDropdownMenuPath = "/common-s/parts/global-megamenu.js"; 28 var headerLocalDropdownMenuPath = "/common-s/parts/global-navi.js"; 29 var $keyIcon = $('<img src="/common-cs-mypage/img/sp-cs-mypage-bg-login-before-rock-icon.png" alt="ã¢ã¯ã»ã¹å¶é" class="icon-keymark">'); 30 var linkExternal = false; 31 var dropdownOpenDelay = 150; // ã°ãã¼ãã«ããã®ãããããã¦ã³ã¡ãã¥ã¼ãéãã¾ã§ã®æéï¼é å»¶ï¼ 32 33 var utility = document.OBSJL.utility; 34 var device = utility.getDevice; 35 36 if (document.OTS.ENV.englishFlg) return; 37 38 /** 39 * ãã¹ãããµã¤ãç°å¢ãåå¾ 40 * @param {string} [domain] æ¤è¨¼ãããã¡ã¤ã³ï¼æå®ããªãå ´åã¯ç¾å¨éãã¦ãããã¼ã¸ã®ãã¡ã¤ã³ï¼ 41 * @returns {{isPublic:boolean,site:string,devType:string}} 42 * isPublic ... å ¬éãã©ãã 43 * 44 * site ... ãªãã®ãµã¤ãã 45 * corp ... ã³ã¼ãã¬ã¼ã 46 * mypage ... ãã¤ãã¼ã¸ 47 * mypage-faq ... ãã¤ãã¼ã¸FAQ 48 * search ... ãµã¤ãå æ¤ç´¢ 49 * unknown ... 䏿 50 * 51 * devType ... æ¤è¨¼ã®ç¨®é¡ 52 * noren ... NORENããé ä¿¡ãããé常ã®ç°å¢ 53 * circumscription ... 夿¥ç°å¢ 54 * preview ... å ¬éã¨åçã®ç°å¢ 55 * obs ... OBSãã¹ãç°å¢ 56 */ 57 var getSiteEnv = function(domain) { 58 if (typeof domain !== "string") domain = utility.server.domain(); 59 60 var corpMatch = domain.match(/^(www|(pre2-s1|devn1-www2)\.web|dev-www|otsk(-new)?)\./); 61 var mypageMatch = domain.match(/^(dev-mypage3?|mypage|cmp-(web|extweb)-tv|otsk-mypage)\./); 62 var mypageFaqMatch = domain.match(/^(faq\.mypage|otsuka-faq-cmp--tst1?\.custhelp|otsk-faq-mypage)\./); 63 var searchMatch = domain.match(/^((otsk-)?search)\./); 64 65 // å ¬éãã©ãã 66 var isPublic = corpMatch && corpMatch[1] === "www" || 67 mypageMatch && mypageMatch[1] === "mypage" || 68 mypageFaqMatch && mypageFaqMatch[1] === "faq.mypage" || 69 searchMatch && searchMatch[1] === "search" ? true : false; 70 71 // ãªãã®ãµã¤ãã 72 var site = corpMatch ? "corp" : 73 mypageMatch ? "mypage" : 74 mypageFaqMatch ? "mypage-faq" : 75 searchMatch ? "search" : "unknown"; 76 77 // æ¤è¨¼ã®ç¨®é¡ 78 var devType = "unknown"; 79 if (corpMatch) { 80 if (corpMatch[1].match(/^pre2-s1/)) { 81 devType = "noren"; 82 } else if (corpMatch[1].match(/^devn1-(www|sp)2/)) { 83 devType = "circumscription"; 84 } else if (corpMatch[1].match(/^dev-(www|sp)/)) { 85 devType = "preview"; 86 } else if (corpMatch[1].match(/^otsk/)) { 87 devType = "obs"; 88 } 89 } else if (mypageMatch) { 90 if (mypageMatch[1] === "dev-mypage3" || mypageMatch[1] === "cmp-extweb-tv" || 91 mypageMatch[1].match(/^otsuka-faq-cmp--tst\./)) { 92 devType = "circumscription"; 93 } else if (mypageMatch[1] === "dev-mypage" || mypageMatch[1].match(/^otsuka-faq-cmp--tst1\./)) { 94 devType = "preview"; 95 } else if (mypageMatch[1].match(/^otsk/)) { 96 devType = "obs"; 97 } 98 } else if (searchMatch && searchMatch[1].match(/^otsk/)) { 99 devType = "obs"; 100 } 101 102 return { 103 isPublic : isPublic, 104 site : site, 105 devType : devType 106 }; 107 }; 108 109 /** 110 * å ¬éç°å¢ãã¡ã¤ã³ãæ¤è¨¼ç°å¢ã«ç½®æ 111 * @param {string}
111 domain ç½®æããå¯¾è±¡ã®æåå 112 * @param {"corp"|"mypage"} site ãªãã®ãµã¤ãã 113 * @param {boolean} isCircumscription 夿¥ãã©ãã 114 * @returns 115 */ 116 var toDevDomain = function(domain, site, isCircumscription) { 117 if (site === "corp") { 118 return domain.replace("www.", isCircumscription ? "devn1-www2.web." : "dev-www."); 119 } else if (site === "mypage") { 120 domain = domain.replace("mypage.", isCircumscription ? "dev-mypage3." : "dev-mypage."); 121 return isCircumscription ? domain + ":8002" : domain; 122 } 123 return domain; 124 }; 125 126 var locEnv = getSiteEnv(); 127 128 // ãããããã¦ã³ã¡ãã¥ã¼ã®èªã¿è¾¼ãç°å¢ã®è¨å® 129 if (locEnv.site !== "corp" && locEnv.devType !== "obs") { 130 linkExternal = true; 131 132 if (locEnv.isPublic) { 133 headerGlobalDropdownMenuPath = mainDomain + headerGlobalDropdownMenuPath; 134 headerLocalDropdownMenuPath = mainDomain + headerLocalDropdownMenuPath; 135 } else { 136 headerGlobalDropdownMenuPath = toDevDomain(mainDomain, "corp", locEnv.devType === "circumscription") + headerGlobalDropdownMenuPath; 137 headerLocalDropdownMenuPath = toDevDomain(mainDomain, "corp", locEnv.devType === "circumscription") + headerLocalDropdownMenuPath; 138 } 139 } 140 141 // ãã¼ã¢ã¤ã³ã³ã®ç»åãã¹å¤æ´ 142 if (!locEnv.site.match("mypage")) { 143 $keyIcon.attr("src", mainMyPageDomain + $keyIcon.attr("src")); 144 } 145 146 // ã¹ã¿ã¤ã«ã®ãªãªã¸ãã«ã®å¤ãåå¾ 147 var getStyleValue = function(element, styleName) { 148 var style; 149 150 if (!element) return ""; 151 152 if (document.defaultView) { 153 style = document.defaultView.getComputedStyle(element, ""); 154 } else { 155 style = element.currentStyle; 156 } 157 158 return style[styleName]; 159 }; 160 161 /** 162 * ã°ãã¼ãã«ããã²ã¼ã·ã§ã³ 163 * ãããããã¦ã³ã¡ãã¥ã¼ 164 */ 165 (function() { 166 if (device === "sp" || device === "tab") return; 167 168 var isLoggedJudged = false; 169 var isDropdownMenuLoaded = false; 170 171 // 第äºé層ããããã¡ãã¥ã¼ãéã 172 var showSecDropMenu = function($ctrl, $panel) { 173 $panel.attr("aria-expanded", "true"); 174 $panel.parent().attr("aria-hidden", "false"); 175 $ctrl.parent().addClass("active"); 176 }; 177 178 // 第äºé層ããããã¡ãã¥ã¼ãéãã 179 var hideSecDropMenu = function() { 180 var $globalNavis = $("#header-navi-global > ul > li.active"); 181 182 $globalNavis.removeClass("active"); 183 $.each($globalNavis.find("> a"), function() { 184 var $panel = $("#" + $(this).attr("aria-controls")); 185 186 $panel.attr("aria-expanded", "false"); 187 $panel.css("height", ""); 188 $panel.parent().css("height", ""); 189 $panel.parent().attr("aria-hidden", "true"); 190 }); 191 }; 192 193 // ãããããã¦ã³ã¡ãã¥ã¼ã®å±éã¯ã©ã¹ååãæ¿ã 194 var changeOpenedClass = function() { 195 setTimeout(function() { 196 var $headerNavGlobal = $("#header-navi-global"); 197 if ($headerNavGlobal.find("li").hasClass("active")) { 198 $headerNavGlobal.addClass("dropdown-open"); 199 $("body").addClass("global-navi-dropdown-opened"); 200 } else { 201 $headerNavGlobal.removeClass("dropdown-open"); 202 $("body").removeClass("global-navi-dropdown-opened"); 203 } 204 }, 0); 205 }; 206 207 // å ¨ããã«ãéãã 208 var allClose = function() { 209 hideSecDropMenu(); 210 211 var $globalNavis = $("#header-navi-global > ul > li.active"); 212 213 $globalNavis.removeClass("active"); 214 $.each($globalNavis.find("> a"), function() { 215 var $panel = $("#" + $(this).attr("aria-controls")); 216 217 $panel.css("height", ""); 218 $panel.parent().css("height", ""); 219 }); 220 221 changeOverlayView(true); 222 changeOpenedClass(); 223 $("body").css("height", ""); 224 }; 225 226 // ãªã¼ãã¼ã¬ã¤ã®è¡¨ç¤ºåãæ¿ã 227 var changeOverlayView = function(closeMode) {
228 var $overlay = $("#header-navi-menu-overlay"); 229 230 if (closeMode) { 231 $overlay.attr("aria-hidden", "true"); 232 } else { 233 $overlay.attr("aria-hidden", "false"); 234 } 235 }; 236 237 // ããã«ã®é«ãã®åå¾ã¨è¨å® 238 var setHeaderNaviMenuHeight = function($panel) { 239 if ($panel) { 240 $panel.css("height", "auto"); 241 $panel.css("height", ""); 242 243 setTimeout(function() { 244 $panel.siblings("div").css("height", ""); 245 }, 10); 246 } else { 247 $.each($("#header-navi-global li").find("a[aria-controls]"), function() { 248 var $panel = $("#" + $(this).attr("aria-controls")); 249 250 if ($panel.length === 0) return true; 251 if ($panel.is("[aria-expanded=false]")) return true; 252 253 setHeaderNaviMenuHeight($panel); 254 }); 255 } 256 }; 257 258 /** 259 * ãããããã¦ã³ã¡ãã¥ã¼è¨ç½® 260 */ 261 var setDropDownMenu = function() { 262 var megaMenuTmpl = document.otsHeaderGlobalNaviDropDown2ndHtml; 263 var megaMenuCSS = document.otsHeaderGlobalNaviDropDownCss; 264 265 if (linkExternal) { 266 if (locEnv.isPublic) { 267 megaMenuTmpl = megaMenuTmpl.replace(/(src)=\"(\/[a-zA-Z])/g, "$1=\"" + mainDomain + "$2"); 268 megaMenuCSS = megaMenuCSS.replace(/(url\()(\/[a-zA-Z])/g, "$1" + mainDomain + "$2"); 269 } else { 270 megaMenuTmpl = megaMenuTmpl.replace(/(src)=\"(\/[a-zA-Z])/g, "$1=\"" + toDevDomain(mainDomain, "corp", locEnv.devType === "circumscription" || locEnv.devType === "noren") + "$2"); 271 megaMenuCSS = megaMenuCSS.replace(/(url\()(\/[a-zA-Z])/g, "$1" + toDevDomain(mainDomain, "corp", locEnv.devType === "circumscription" || locEnv.devType === "noren") + "$2"); 272 } 273 } 274 275 $("head").append(megaMenuCSS); 276 $("#header-navi-global").after(megaMenuTmpl); 277 278 $("#header-navi .header-navi-inner").append($('<div id="header-navi-menu-overlay" aria-hidden="true"></div>')); 279 280 // ãªã³ã¯ã絶対ãã¹ã«ç½®æ 281 $.each($("#header-navi-menu a"), function() { 282 if ($(this).attr("href").match(/^(https?:)?\/\//)) return true; 283 284 var href = $(this).attr("href"); 285 286 if ($(this).parents("#header-navi-menu-mypage").length === 0) { 287 if (linkExternal) { 288 if (locEnv.isPublic) { 289 $(this).attr("href", mainDomain + href); 290 } else { 291 $(this).attr("href", toDevDomain(mainDomain, "corp", locEnv.devType === "circumscription") + href); 292 } 293 } 294 } else if (!locEnv.site.match("mypage")) { 295 if (locEnv.isPublic) { 296 href = mainMyPageDomain + href; 297 } else { 298 href = "https:" + toDevDomain(mainMyPageDomain, "mypage", locEnv.devType === "circumscription" || locEnv.devType === "noren") + href; 299 } 300 301 $(this).attr("href", href); 302 } 303 }); 304 305 if (isLoggedJudged || $("body").hasClass("otsukaid-view-show")) { 306 mypageElemHide(); 307 } 308 }; 309 310 /** 311 * 大å¡IDãã°ã¤ã³æã¯ä¸é¨ã®é åãé表示 312 * @param {*} [data] ãã°ã¤ã³æ å ± 313 */ 314 var mypageElemHide = function(data) { 315 if (!data || data.result === "0") { 316 isLoggedJudged = true; 317 $("#header-navi-menu .not-logged-in-ots").hide(); 318 } 319 }; 320 321 /** 322 * ã»ããã¢ãã 323 */ 324 var setup = function() { 325 var $globalNavis = $("#header-navi-global li");
326 var isClickOpened = false; 327 328 // ã°ãã¼ãã«ããã²ã¼ã·ã§ã³ãã第äºé層ã¡ãã¥ã¼ãéã 329 $globalNavis.on({ 330 "click" : function() { 331 if ($("#" + $(this).find("a").attr("aria-controls")).length === 0) return true; 332 if ($(this).hasClass("current")) return true; 333 334 if (!isClickOpened) { 335 isClickOpened = true; 336 $(this).trigger("mouseenter"); 337 return false; 338 } 339 }, 340 341 "mouseenter" : function() { 342 if (!isClickOpened) return false; 343 if ($(this).hasClass("current")) return false; 344 345 var $anchor = $(this).find("a"); 346 var $panel = $("#" + $anchor.attr("aria-controls")); 347 348 if ($(this).hasClass("active")) return false; 349 350 if ($panel.length === 0) { 351 return false; 352 } else { 353 hideSecDropMenu(); 354 } 355 356 showSecDropMenu($anchor, $panel); 357 setHeaderNaviMenuHeight($panel); 358 changeOverlayView(false); 359 changeOpenedClass(); 360 361 return false; 362 } 363 }); 364 365 // éãããã¿ã³ã¯ãªãã¯æ 366 $("#header-navi-menu .close-dropdown-button").on("click", function() { 367 isClickOpened = false; 368 allClose(); 369 }); 370 371 // ãããããã¦ã³ã¡ãã¥ã¼ä»¥å¤ã¯ãªãã¯æ 372 $(document).on("click", function(event) { 373 if ($(event.target).parents("#header-navi-menu").length === 0) { 374 isClickOpened = false; 375 allClose(); 376 } 377 }); 378 379 $(window).on("scroll", function() { 380 if (isClickOpened) { 381 var $overlay = $("#header-navi-menu-overlay"); 382 var scrollTop = $(window).scrollTop(); 383 384 if (scrollTop < 42) { 385 $overlay.css("top", 42 - scrollTop); 386 } else { 387 $overlay.css("top", 0); 388 } 389 } 390 }); 391 392 // 第äºé層ãããããã¦ã³ã¡ãã¥ã¼ã®ã¢ãã¡ã¼ã·ã§ã³çµäºæ 393 $.each($globalNavis, function() { 394 var $panel = $("#" + $(this).find("a").attr("aria-controls")); 395 396 if ($panel.length === 0) return true; 397 }); 398 399 $(document).on("changeFontSize", function() { 400 setHeaderNaviMenuHeight(); 401 }); 402 }; 403 404 $(document).on("completedOtsukaId", function(event, data) { 405 mypageElemHide(data); 406 }); 407 408 $.getScript(headerGlobalDropdownMenuPath).done(function() { 409 isDropdownMenuLoaded = true; 410 411 if ($("#wrap").length > 0) { 412 setDropDownMenu(); 413 setup(); 414 } 415 }); 416 417 $(function() { 418 if (isDropdownMenuLoaded) { 419 setDropDownMenu(); 420 setup(); 421 } 422 }); 423 })(); 424 425 /** 426 * ãããã¼ãã¼ã«ã«ãã 427 * ãªã³ã¯é åã®æ¡å¤§ 428 */ 429 $(function() { 430 var $headerLocalNavis = $("#header-navi-local .header-navi-local-inner > ul > li"); 431 432 $headerLocalNavis.on("click", function(e) { 433 if ($(e.target).hasClass("global-dropdown") || 434 $(e.target).parents().hasClass("global-dropdown") || 435 $(e.target).hasClass("local-dropdown") || 436 $(e.target).parents().hasClass("local-dropdown") || 437 $(e.target).hasClass("mega-dropdown-menu") || 438 $(e.target).parents().hasClass("mega-dropdown-menu")) return true; 439 440 var $anchorObj = $(this).find("> a").eq(0); 441 var hrefVal = $anchorObj.attr("href");
442 var targetVal = ($anchorObj.attr("target") === "_blank") ? true : false; 443 444 if (targetVal) { 445 window.open(hrefVal, "_blank"); 446 } else { 447 window.location = hrefVal; 448 } 449 450 return false; 451 }); 452 }); 453 454 /** 455 * ãããã¼ãã¼ã«ã«ãã 456 * ãããããã¦ã³ã¡ãã¥ã¼ 457 */ 458 (function() { 459 var isDropdownMenuLoaded = false; 460 var isProcessAfterLoadedProcess = false; 461 var isDomLoaded = false; 462 var $localNaviBox = null; 463 var $localNavis = null; 464 var sid = null; 465 466 /* ãããããã¦ã³ã¡ãã¥ã¼è¨ç½® */ 467 var setDropDownMenu = function() { 468 var dropDownMenuTmpl = document.otsHeaderGlobalNaviHtml; 469 var $dropDownMenuTmpl = null; 470 471 if (linkExternal) { 472 dropDownMenuTmpl = dropDownMenuTmpl.replace(/(href|src)=\"(\/[a-zA-Z])/g, "$1=\"" + mainDomain + "$2"); 473 } 474 475 $dropDownMenuTmpl = $(dropDownMenuTmpl); 476 477 $.each($localNavis, function() { 478 var classVal = $(this).attr("class") || ""; 479 var classVals = classVal.split(" "); 480 481 var hasClassVal = $.grep(classVals, function(classVal) { 482 return (classVal.match(/(products|cs|corp)-/)); 483 }); 484 485 if (hasClassVal.length === 0) return true; 486 487 $(this).append($dropDownMenuTmpl.find("." + hasClassVal[0])); 488 }); 489 490 if ($localNavis.find(".local-dropdown").length > 0) { 491 $(document).trigger("completeLocalDropdown"); 492 } 493 }; 494 495 /* 496 * ãã¼ã«ã«ãããããã¦ã³ã¡ãã¥ã¼ã®æå¤§å¹ ï¼960pxï¼ã®æãè¿ãå¯¾å¿ 497 */ 498 var setDropDownOuter = function() { 499 var $localDropDown = $("#header-navi .header-navi-local-inner .local-dropdown"); 500 var $localDropDownWrap = $("<div>").addClass("local-dropdown-outer"); 501 502 $localDropDown.wrap($localDropDownWrap); 503 504 $.each($localDropDown, function() { 505 if ($(this).find(".dropdown-column").length > 1) { 506 $(this).find(".local-dropdown-inner").addClass("dropdown-columns"); 507 } 508 }); 509 }; 510 511 /* ãããããã¦ã³ã®ä½ç½®ãæãã 512 â» IEã§ã¯positionã®100%ã¨ããé åãç°ãªããã¨ã 513 ãã©ã¦ã¶å ¨ä½ã§ã«ã¬ã³ãæã®borderã100%ã«å«ã¾ããªããºã¬ãçºçããçºã®å¦ç */ 514 var dropDownMenuSetPosition = function() { 515 var localDropdownSetTop = function() { 516 var headerLocalNaviHeight = getStyleValue($localNaviBox.get(0), "height"); 517 518 if (!headerLocalNaviHeight || headerLocalNaviHeight === "auto") { 519 headerLocalNaviHeight = $localNaviBox.height() - 1; 520 } else { 521 headerLocalNaviHeight = parseInt(headerLocalNaviHeight) - 1; 522 } 523 524 $localNavis.find(".local-dropdown-outer").css("top", headerLocalNaviHeight + "px"); 525 }; 526 527 localDropdownSetTop(); 528 529 $(document).on("changeFontSize", function() { 530 localDropdownSetTop(); 531 }); 532 }; 533 534 /* ãã¦ã¹ã«ã¼ã½ã«ã®æãç§»åå¯¾å¿ */ 535 var headerLocalNaviAIM = function() { 536 $localNaviBox.on({ 537 "mouseenter" : function() { 538 $localNaviBox.addClass("over"); 539 }, 540 "mouseleave" : function() { 541 $localNaviBox.removeClass("over"); 542 } 543 }); 544 545 $localNaviBox.menuAim({ 546 rowSelector : "> li", 547 submenuDirection : "below", 548 activate : function(row) { 549 if ($localNaviBox.hasClass("over")) { 550 if ($(row).find(".local-dropdown").length > 0) { 551 $(row).find(".local-dropdown").show(); 552 $(row).addClass("show"); 553 } 554 $(row).addClass("hover"); 555 } else { 556 sid = setTimeout(function() { 557 if ($(row).find(".local-dropdown").length > 0) { 558 $(row).find(".local-dropdown").show(); 559 $(row).addClass("show"); 560 } 561 $(row).addClass("hover"); 562 }, dropdownOpenDelay); 563 } 564 }, 565 deactivate : function(row) { 566 clearTimeout(sid); 567 $(row).find(".local-dropdown").hide(); 568 $(row).removeClass("show").removeClass("hover"); 569 }, 570 exitMenu : function() { return true; } 571 }); 572 }; 573 574 /** 575 * ãããããã¦ã³ã¡ãã¥ã¼èªã¿è¾¼ã¿å¾ã®å¦ç 576 */ 577 var processAfterLoaded = function() { 578 $localNaviBox = $("#header-navi-local .header-navi-local-inner > ul"); 579 $localNavis = $localNaviBox.find("> li"); 580 581 if ($localNaviBox.length === 0) return; 582 583 if (locEnv.site.match("mypage") && $("#wrap").hasClass("promo")) { 584 setDropDownMenu(); 585 setDropDownOuter(); 586 dropDownMenuSetPosition(); 587 headerLocalNaviAIM(); 588 } 589 590 isProcessAfterLoadedProcess = true; 591 }; 592 593 if (device === "other") { 594 $.getScript(headerLocalDropdownMenuPath).done(function() { 595 isDropdownMenuLoaded = true; 596 if (isDomLoaded && !isProcessAfterLoadedProcess) processAfterLoaded(); 597 }); 598 599 $(function() { 600 isDomLoaded = true; 601 if (isDropdownMenuLoaded && !isProcessAfterLoadedProcess) processAfterLoaded(); 602 }); 603 } 604 })(); 605})(jQuery, document); 606 607/** 608 * ãããã¼ãã¼ã«ã«ãã 609 * ã«ã¬ã³ãå¦ç 610 */ 611(function($) { 612 $(function() { 613 var id = $("input[name=global-navi-current-item-id]").val(); 614 615 if (id) { 616 id = id.replace(/0$/, "1").replace(/-([0-9]{1})$/, "-0$1"); 617 618 var $targetNavItem = $("#header-navi-local .header-navi-local-inner > ul > li").filter("." + id); 619 620 $targetNavItem.addClass("current"); 621 622 } else if (!location.href.replace(/(index\.html)?[#\?].*?$/, "").replace("index.html").split("/")[3]) { 623 $("#header-navi-local .header-navi-local-inner > .cs-mypage-home").addClass("current"); 624 } 625 });
626})(jQuery); 627 628/** 629 * å ±éãããã¼ã®è¡¨ç¤ºåãæ¿ã 630 */ 631(function($) { 632 if (typeof getHojinName === "undefined") return; 633 if (typeof getSimeiSei === "undefined") return; 634 if (typeof getSimeiMei === "undefined") return; 635 636 $(function() { 637 638 var companyName = getHojinName(); 639 var firstName = getSimeiMei(); 640 var lastName = getSimeiSei(); 641 642 var $otsIdHeader = $(".otsukaid-header"); 643 var $companyName = $("#hojinMei"); 644 var $name = $("#simei"); 645 var $firstName = $("#hSimeiMei"); 646 var $lastName = $("#hSimeiSei"); 647 648 var loginType = $("#loginUserShubetsu").val(); 649 650 if (loginType) { 651 switch (loginType) { 652 case "01" : 653 $companyName.text(companyName + "ã"); 654 $firstName.text(firstName); 655 $lastName.text(lastName); 656 break; 657 case "03" : 658 case "05" : 659 companyName = ""; 660 break; 661 default : 662 $companyName.text(companyName + "ã"); 663 break; 664 } 665 666 if (loginType !== "01") { 667 $otsIdHeader.find("li").eq(0).text("大å¡IDä»¥å¤ ã§ãã°ã¤ã³ä¸"); 668 $name.unwrap(); 669 firstName = ""; 670 lastName = ""; 671 } 672 } 673 674 $otsIdHeader.attr({ 675 userShubetsu : loginType, 676 kigyoCdFlg : $("#kigyoCdFlg").val() 677 }).css("opacity", 1); 678 679 if (!companyName && !firstName && !lastName) $companyName.parents("li").remove(); 680 if (!companyName) $companyName.remove(); 681 if (!firstName && !lastName) $name.remove(); 682 }); 683})(jQuery); 684 685/** 686 * ããã¼ãã£ã³ã°ããã¼ 687 */ 688(function($) { 689 var $partsFloating = $(".parts-floating"); 690 var $loginUserStatus = $("#loginUserShubetsu"); 691 692 // å®äºç»é¢ä»¥å¤ãã¾ãã¯ãã°ã¤ã³ã¦ã¼ã¶ã¼ã大å¡ID以å¤ã«ã¯åºåããªã 693 if($partsFloating.length === 0 || $loginUserStatus.val() !== "01") return; 694 695 var $wd = $(window); 696 var $pageTop = $("#pagetop"); 697 var floatingMarginLeft = parseInt($partsFloating.css("margin-left")); 698 var partsFloatingHeight = $partsFloating.outerHeight(); 699 700 // éãããã¿ã³ 701 var $closeButtonBox = $("<button>"); 702 $closeButtonBox.addClass("button-close").attr("type", "button").text("éãã"); 703 $partsFloating.find(".parts-floating-content").prepend($closeButtonBox); 704 705 // éãããã¿ã³ã¯ãªã㯠706 $closeButtonBox.on("click", function(){ 707 $partsFloating.fadeOut("", function(){ 708 $pageTop.removeClass("position-up"); 709 }); 710 }); 711 712 // ããã¼ãã£ã³ã°è¡¨ç¤ºï¼ç»åã®èªã¿è¾¼ã¿é 延対çã®ãããloadï¼ 713 $wd.on("load", function(){ 714 setTimeout(function(){ 715 $pageTop.addClass("position-up"); 716 $partsFloating.animate({ 717 "top": window.innerHeight - partsFloatingHeight 718 }, 200); 719 }, 2000); 720 }); 721 722 // ã¦ã¤ã³ãã¦ãµã¤ãºç¸¦å¤æ´æãä½ç½®èª¿æ´ï¼å¸¸ã«ã¦ã¤ã³ãã¦ã®ä¸çªä¸ã«ä»ãããã«ããï¼ 723 $wd.resize(function() { 724 $partsFloating.css({"top": window.innerHeight - partsFloatingHeight + "px"}); 725 }); 726 727 // PCã®ã¿ã§ã¦ã¤ã³ãã¦ãªãµã¤ãºæã®ä½ç½®èª¿æ´ 728 if(document.OBSJL.utility.getDevice === "other"){ 729 // 横ã¹ã¯ãã¼ã«çºçæãä½ç½®èª¿æ´ 730 $wd.scroll(function() { 731 var mainW = $("#wrap").width(); 732 733 $partsFloating.css({"margin-left": floatingMarginLeft + "px"}); 734 if($wd.width() < mainW){ //ã¦ã¤ã³ãã¦ãµã¤ãºãã¡ã¤ã³é¨ããçãæãå³ã¡ãã¥ã¼ãã¼ã¸ã³ãè¨ç® 735 $partsFloating.css({"margin-left": floatingMarginLeft - $wd.scrollLeft() + "px"}); 736 } 737 }); 738 } 739})(jQuery); 740 741/** 742 * ããã¼ãã£ã³ã°ããã¼ï¼AT飿ºï¼ 743 */ 744(function($) { 745 /** 746 * Cookieã®åºæ¬è¨å® 747 */ 748 var baseCookieSettings = { 749 name : "otsFloatingBannerAT", 750 domain : ".otsuka-shokai.co.jp", 751 path : "/" 752 }; 753 754 // ã¿ã¤ã ã¢ã¦ã 755 var timeout = 10000; 756 757 if ($.cookie(baseCookieSettings.name)) return; 758 759 $(function() { 760 if ($(".mboxDefault, [data-at-mbox-name]").length === 0) return; 761 762 var sid = setInterval(function() { 763 var startTime = new Date().getTime(); 764 765 if (new Date().getTime() - startTime >= timeout) clearInterval(sid); 766 767 var $floating = $("[data-at-mbox-name] .boxes-floating-banner"); 768 769 if ($floating.length === 0) return; 770 771 clearInterval(sid); 772 773 var cookieSettings = {}; 774 775 var closeLimit = $floating.attr("data-close-limit"); 776 if (closeLimit === "session") cookieSettings.expires = "";
777 if (closeLimit.match(/^[0-9]+$/)) cookieSettings.expires = Number(closeLimit); 778 779 $(window).on("scroll.contactFloating resize.contactFloating orientationchange.contactFloating", function() { 780 $floating.attr("aria-hidden", $(window).scrollTop() > 0 ? "false" : "true"); 781 }).trigger("scroll.contactFloating"); 782 783 $floating.find(".button-close").on("click", function() { 784 $floating.fadeOut(400); 785 786 if (typeof cookieSettings.expires === "undefined") return true; 787 788 $.cookie(baseCookieSettings.name, "closed", { 789 domain : baseCookieSettings.domain, 790 path : baseCookieSettings.path, 791 expires : cookieSettings.expires 792 }); 793 }); 794 }); 795 }); 796})(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.