1 2(function(){ 3var $ = FI.jQuery; 4 5//------------------------------------------------- 6// â¼å種è¨å® 夿´å¯è½ã¨ãªã¢ ãããã 7//------------------------------------------------- 8//ãã¬ã¤ã¯ãã¤ã³ãã®è¨å®ï¼ã¦ã¤ã³ãã¦å¹ ã®è¨å®ï¼ 9var point = { 10 //ãã¬ã¤ã¯ãã¤ã³ãã®åå(è¦ç´ ç§»åãªã©ã§ä½¿ç¨) : MediaQueryã®å¤ãâ»PCã¨ã¹ããã®å¹ ã®æ°å¤ã夿´ 11 pc: '(min-width : 821px)', 12 smp: 'only screen and (max-width : 820px)' 13}; 14 15//è¦ç´ ç§»åã®è¨å® 16//ç§»åã®è¨å®ã¯4ã¤ã®ã¿ãbefore:è¦ç´ ã®åãafter:è¦ç´ ã®å¾ãprepend:åè¦ç´ ã®å é ãappend:åè¦ç´ ã®æå¾ã 17var MOVE_E = [{ 18 //åé¤ä¸å¯ï¼ã¤ãã³ãã«ã¬ã³ãã¼ 19 elem: '#eventlink', 20 pc: ['#eventsearch','prepend'], 21 smp: ['h1','after'] 22},{ 23 // 24 elem: '.sample', 25 pc: ['#sample','after'], 26 smp: ['#sample','prepend'] 27}]; 28 29//è¦ç´ è¤è£½ã®è¨å® 30//追å ä½ç½®ã®æå®è¨å®ã¯4ã¤ã®ã¿ãbefore:è¦ç´ ã®åãafter:è¦ç´ ã®å¾ãprepend:åè¦ç´ ã®å é ãappend:åè¦ç´ ã®æå¾ã 31var CLONE_E = [{ 32 elem: 'test', //è¤è£½ããè¦ç´ 33 move: ['test','after'], //ç§»åå è¦ç´ ã追å ä½ç½®ã®æå® 34 only: 'pc'//pconlyã追å ã®å ´åã¯'pc'ãsmponlyã追å ã®å ´åã¯'smp'ãè¨è¿° 35},{ 36 // 37 elem: '.sample', 38 move: ['#sample','append'], 39 only: '' 40} 41]; 42 43//â¼ãããã¼ããã¼ãèµ·åè¨å®ï¼trueã®å ´åããã¼ãããï¼ 44var gyoseiHeaderActive = true; 45 46//â¼ãfunctionèµ·åç¨ãèµ·åããªãfunctionãããå ´åã¯ã³ã¡ã³ãã¢ã¦ã scriptã«idã追å ããããå ´åã®ã¿èªã¿è¾¼ã 47function LoadF(mode){ 48 CSSchange(); 49 ELEMENT(mode); 50 commentMove(mode); 51 bottom_navi_change(mode); 52 SMPjs(mode); 53 Tablescroll(mode); 54 if(gyoseiHeaderActive) { 55 gyoseiHeader(mode); 56 }else{ 57 AnchorLink(); 58 } 59 ARTICLEALL(mode); 60 dropdown_menu(mode); 61 viewModeChange(mode); 62} 63//â²ãfunctionèµ·åç¨ 64 65//------------------------------------------------- 66// â²å種è¨å® 夿´å¯è½ã¨ãªã¢ ããã¾ã§ 67//------------------------------------------------- 68 69 var mediaary = Array(); 70 var mode; 71 var commentNodes = []; 72 73 //â¼ããã ããåç§°ç¨ 74 var $smpmenutext = "ã¡ãã¥ã¼"; 75 var $smpmenup1text = $("#smpmenup1 .hnmenu span").text(); 76 var $smpmenup2text = $("#smpmenup2 .hnmenu span").text(); 77 78 //â¼è¡¨ç¤ºåºå®ç¨ 79 var BASE_PC = "pc"; 80 var BASE_SMP = "smp"; 81 82 //â¼css åæ¿ç¨åæè¨å® 83 var css_pcary = ["#cmncss_pc","#cmncss_pc2"]; 84 var css_smpary = ["#cmncss_smp","#cmncss_smp2"]; 85 86 //â¼cookieã®æé 87 var cookie_date = 7; 88 89 $(function(){ 90 91 CLONE(); 92 93 // è¦ç´ ç§»åç¨ã®ã³ã¡ã³ããåå¾ 94 $('*').contents().each(function () { 95 if (this.nodeType === 8) { 96 commentNodes.push(this); 97 } 98 }); 99 100 //cookieã®å¤å®ãcookieã¯å ¬éãµã¤ãã§ã¯ä½¿ç¨ããªã 101 if($.cookie('smp_mode')=="smp"){ 102 if($('body').hasClass('viewmode_'+BASE_PC)){ 103 $('body').removeClass('viewmode_'+BASE_PC); 104 } 105 if(!$('body').hasClass('viewmode_'+BASE_SMP)){ 106 $('body').addClass('viewmode_'+BASE_SMP); 107 } 108 LoadF(BASE_SMP); 109 }else if($.cookie('smp_mode')=="pc"){ 110 if(!$('body').hasClass('viewmode_'+BASE_PC)){ 111 $('body').addClass('viewmode_'+BASE_PC); 112 } 113 if($('body').hasClass('viewmode_'+BASE_SMP)){ 114 $('body').removeClass('viewmode_'+BASE_SMP); 115 } 116 LoadF(BASE_PC); 117 } 118 119 for(mode in point){ 120 mediaary[mode] = window.matchMedia(point[mode]); 121 mediaary[mode].addEventListener('change', MODECHANGE, false); 122 } 123 124 //ãã¹ããåæ¿ãã¿ã³ãã¯ãªãã¯ã¤ãã³ã 125 $('#viewmode_smp').on('click',function(){ 126 $.cookie('smp_mode',"smp",{expires:cookie_date}); 127 MODECHANGE(); 128 }); 129 //ãPCãã¯ãªãã¯ã¤ãã³ã 130 $('#viewmode_pc').on('click',function(){ 131 $.cookie('smp_mode',"pc",{expires:cookie_date}); 132 MODECHANGE(); 133 }); 134 135 if(!($.cookie('smp_mode'))){ 136 MODECHANGE(); 137 } 138 139 bottomNaviSet(); 140 }); 141 142 143//â¼â¼â¼â¼â¼ãã³ã¡ã³ãã¢ã¦ãã¸ã®ä½ç½®ç§»åãâ¼â¼â¼â¼â¼ 144function commentMove(mode){ 145 146 // åã³ã¡ã³ããè§£æãã¦ç§»å 147 $.each(commentNodes, function (i, node) { 148 149 const pattern = new RegExp('^\\[move-' + mode + ':\\s*(.+?)\\]$'); 150 const match = $.trim(node.nodeValue).match(pattern); 151 if (!match) return; 152 153 const moveKey = $.trim(match[1]); 154 // data-move ã®å¤ãä¸è´ããè¦ç´ ãåå¾ 155 const $target = $('[data-move="' + moveKey + '"]'); 156 if ($target.length === 0) return; 157 158 // ã³ã¡ã³ãã®ç´å¾ã«è¦ç´ ãç§»å 159 $(node).after($target); 160 }); 161 162} 163//â²â²â²â²â²ãã³ã¡ã³ãã¢ã¦ãã¸ã®ä½ç½®ç§»åãâ²â²â²â²â² 164 165 166//â¼â¼â¼â¼â¼ãfunctionãâ¼â¼â¼â¼â¼ 167//â¼ããã¬ã¤ã¯ãã¤ã³ãå¦ç 168function MODECHANGE(){ 169 var mc = $.cookie('smp_mode'); 170 if(mc){ 171 for(mode in point){ 172 $('body').removeClass('viewmode_'+mode); 173 } 174 if(mc=="pc"){ 175 $('body').addClass('viewmode_'+BASE_PC); 176 LoadF(BASE_PC); 177 }else if(mc=="smp"){ 178 $('body').addClass('viewmode_'+BASE_SMP);
179 LoadF(BASE_SMP); 180 } 181 resetEventListeners(); 182 }else if(!mc){ 183 for(mode in point){ 184 if(mediaary[mode].matches && !$('body').hasClass('viewmode_'+mode)){ 185 $('body').addClass('viewmode_'+mode); 186 LoadF(mode); 187 resetEventListeners(); 188 } 189 if(!mediaary[mode].matches && $('body').hasClass('viewmode_'+mode)){ 190 $('body').removeClass('viewmode_'+mode); 191 } 192 } 193 } 194} 195//â²ããã¬ã¤ã¯ãã¤ã³ãå¦ç 196 197//â¼ãããã ãã 198//--- â¼é¢æ° ---------------------------- 199//ééæã«ã¯ã©ã¹ã追å ã»åé¤ãã 200var storedScrollY = 0; 201bodyopen = function(){ 202 var h = $(window).height(); 203 204 if($("body").hasClass("open")){ 205 $("body").removeClass("open"); 206 var currentFontSize = $("body").css("font-size"); 207 $("body").removeAttr("style"); 208 if(currentFontSize){ 209 $("body").css("font-size", currentFontSize); 210 } 211 $('body,html').scrollTop(storedScrollY); 212 }else{ 213 var scrollY = $(window).scrollTop(); 214 $("body").addClass("open"); 215 $("body").height(h); 216 storedScrollY = scrollY; 217 $('body').css({ 218 top: `-${scrollY}px`, 219 }).data('scrollY', scrollY); 220 } 221}; 222//PCå ¨ç»é¢ã¡ãã¥ã¼ 223bodypcopen = function(){ 224 var h = $(window).height(); 225 if($("body").hasClass("pcopen")){ 226 $("body").removeClass("pcopen"); 227 var currentFontSize = $("body").css("font-size"); 228 $("body").removeAttr("style"); 229 if(currentFontSize){ 230 $("body").css("font-size", currentFontSize); 231 } 232 }else{ 233 $("body").addClass("pcopen"); 234 $("body").height(h); 235 } 236}; 237 238//æãããã¿ãéããã¨ãã«é«ããåºå®ãã 239gnavismpheight = function(){ 240 if($('body').hasClass('viewmode_smp')){ 241 var h = window.innerHeight; 242 var jbnh = $("#jssmpbtmnavi").outerHeight(); 243 $("#jssmpbtmnavi .openmenu").css({ 244 "height": h - jbnh + "px", // ãã©ã¼ã«ãã㯠245 "bottom": jbnh + "px" 246 }); 247 // dvhãµãã¼ããã§ãã¯ã¨ã¹ã¿ã¤ã«é©ç¨ 248 if (CSS.supports("height", "100dvh")) { 249 $("#jssmpbtmnavi .openmenu").css({ 250 "height": "calc(100dvh - " + jbnh + "px)" 251 }); 252 } 253 } 254}; 255 256//ãªã³ã¯åç§°ããéãããã«ãã 257//ã¡ãã¥ã¼åãè¨æ¶ãéããéã«æ»ãç¨ 258closeText = function(){ 259 if($("#jssmpbtmnavi #smpmenu .choice").length){ 260 $("#jssmpbtmnavi #smpmenu .hnmenu span").text("éãã"); 261 }else{ 262 $("#jssmpbtmnavi #smpmenu .hnmenu span").text($smpmenutext); 263 } 264 if($("#jssmpbtmnavi #smpmenup1 .choice").length){ 265 $("#jssmpbtmnavi #smpmenup1 .hnmenu span").text("éãã"); 266 }else{ 267 $("#jssmpbtmnavi #smpmenup1 .hnmenu span").text($smpmenup1text); 268 } 269 if($("#jssmpbtmnavi #smpmenup2 .choice").length){ 270 $("#jssmpbtmnavi #smpmenup2 .hnmenu span").text("éãã"); 271 }else{ 272 $("#jssmpbtmnavi #smpmenup2 .hnmenu span").text($smpmenup2text); 273 } 274 if($("#header #smpmenup2 .choice").length){ 275 $("#header #smpmenup2 .hnmenu span").text("éãã"); 276 }else{ 277 $("#header #smpmenup2 .hnmenu span").text($smpmenup2text); 278 } 279}; 280 281function bottom_view_change(){ 282 $('#jssmpbtmnavi #smpmenu.bmenu ,#jssmpbtmnavi #smpmenup1.bmenu ,#jssmpbtmnavi #smpmenup2.bmenu').each(function(){ 283 $('.hnmenu',this).each(function(){ 284 if($(this).hasClass("view_pc")){ 285 $(this).removeClass("view_pc"); 286 $(this).attr('aria-expanded', 'false'); 287 $(this).next().attr('aria-hidden', 'true'); 288 } 289 if(!$(this).hasClass("view_smp")){ 290 $(this).addClass("view_smp"); 291 } 292 }); 293 }); 294} 295 296function bottom_navi_change(mode){ 297 if($('#jssmpbtmnavi').length){ 298 299 //ã°ãã¼ãã«ããå¦ç 300 if($('#topgnavibg , #gnavibg').length){ 301 $gnavi = $('#topgnavibg , #gnavibg'); 302 if(mode=="pc"){ 303 $('#jssmpbtmnavi .scate').each(function(){ 304 $('.navi',this).css('display', 'none'); 305 $(".tismenu",this).attr('aria-expanded', 'false'); 306 $('.navi',this).attr('aria-hidden', 'true'); 307 }); 308 } 309 if(mode=="smp"){ 310 $('#jssmpbtmnavi .scate').each(function(){ 311 $('.navi',this).removeAttr("style"); 312 $(this).removeClass("choice"); 313 $(".tismenu",this).removeClass("choice"); 314 $(".tismenu",this).removeAttr('aria-expanded'); 315 $('.navi',this).removeAttr('aria-hidden'); 316 }); 317 } 318 } 319 320 //表示å¦ç 321 if(mode=="pc"){ 322 $('#jssmpbtmnavi #smpmenu.bmenu .hnmenu').each(function(){ 323 if(!$(this).hasClass("view_pc")){ 324 $(this).addClass("view_pc"); 325 $(this).removeClass("choice"); 326 $(this).attr('aria-expanded', 'false'); 327 $(this).next().attr('aria-hidden', 'true'); 328 } 329 if($(this).hasClass("view_smp")){ 330 $(this).removeClass("view_smp"); 331 } 332 }); 333 334 if($("body").hasClass("open")){ 335 $("body").removeClass("open"); 336 var currentFontSize = $("body").css("font-size"); 337 $("body").removeAttr("style"); 338 if(currentFontSize){ 339 $("body").css("font-size", currentFontSize); 340 } 341 $('body,html').scrollTop(storedScrollY); 342 } 343 } 344 345 if(mode=="smp"){ 346 $('#jssmpbtmnavi #smpmenu.bmenu ,#jssmpbtmnavi #smpmenup1.bmenu ,#jssmpbtmnavi #smpmenup2.bmenu').each(function(){ 347 $('.hnmenu',this).off(); 348 $('.psclose',this).off(); 349 350 gnavismpheight(); 351 352 $('.hnmenu',this).each(function(){ 353 if($(this).hasClass("view_pc")){ 354 $(this).removeClass("view_pc"); 355 $(this).removeClass("choice"); 356 $(this).attr('aria-expanded', 'false'); 357 $(this).next().attr('aria-hidden', 'true'); 358 } 359 if(!$(this).hasClass("view_smp")){ 360 $(this).addClass("view_smp"); 361 } 362 }); 363 364 //bottom_view_change(); 365 366 var $bmenu = $(this).children('*').not('.bmenu .hnmenu'); 367 var $currentButton = $('.hnmenu',this); 368 369 // ã¢ã¼ãåæ¿æï¼æ¢ã«éãã¦ããå ´åã¯ã¤ãã³ããè¨é² 370 var isMenuOpen = $currentButton.hasClass('choice'); 371 372 $bmenu.hide(); 373 $(this).toggleClass("pscatenone"); 374 375 //ããã ãããã¯ãªãã¯ããã 376 $('.view_smp',this).on('click', function() { 377 if($('body').hasClass('viewmode_smp')){ 378 $bmenu.slideToggle(); 379 $(this).toggleClass("choice"); 380 $(this).attr('aria-expanded', 'true'); 381 $(this).next().attr('aria-hidden', 'false'); 382 $(this).parents('.bmenu').toggleClass("pscatenone"); 383 384 bodyopen(); 385 gnavismpheight(); 386 //closeText(); 387 388 //WAI-ARIA 389 if(!$(this).hasClass("choice")){ 390 $(this).attr('aria-expanded', 'false'); 391 $(this).next().attr('aria-hidden', 'true'); 392 } else { 393 // ã¡ãã¥ã¼ãéããæã«ãã©ã¼ã«ã¹ãã©ãããè¨å® 394 setupBottomNaviFocusTrap($(this)); 395 } 396 397 //ä»ãéãã 398 menuSwitch = function($id){ 399 if($($id + ' .hnmenu').hasClass('choice')){ 400 $($id).children('*').not('.bmenu .hnmenu').slideUp(); 401 $($id + ' .hnmenu').removeClass("choice"); 402 $($id + ' .hnmenu').attr('aria-expanded', 'false'); 403 $($id + ' .openmenu').attr('aria-hidden', 'true'); 404 $($id).addClass("pscatenone"); 405 // ãã©ã¼ã«ã¹ãã©ãããè§£é¤ 406 $($id + ' .openmenu').find('*').off('.bottomnavitrap'); 407 $($id + ' .openmenu').off('.bottomnavitrap'); 408 $($id + ' .hnmenu').off('.bottomnavibutton'); 409 bodyopen(); 410 //closeText(); 411 } 412 }; 413 //smpmenuãã¯ãªãã¯ããã¨ãã«ä»ãéãã 414 $('#jssmpbtmnavi #smpmenu .hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 415 menuSwitch("#jssmpbtmnavi #smpmenup1"); 416 menuSwitch("#jssmpbtmnavi #smpmenup2"); 417 }); 418 //smpmenup1ãã¯ãªãã¯ããã¨ãã«ä»ãéãã 419 $('#jssmpbtmnavi #smpmenup1 .hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 420 menuSwitch("#jssmpbtmnavi #smpmenu"); 421 menuSwitch("#jssmpbtmnavi #smpmenup2"); 422 }); 423 //smpmenup2ãã¯ãªãã¯ããã¨ãã«ä»ãéãã 424 $('#jssmpbtmnavi #smpmenup2 .hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 425 menuSwitch("#jssmpbtmnavi #smpmenu"); 426 menuSwitch("#jssmpbtmnavi #smpmenup1"); 427 }); 428 } 429 }); 430
431 // ã¢ã¼ãåæ¿å¾ï¼ã¡ãã¥ã¼ãéãã¦ããå ´åã¯ãã©ã¼ã«ã¹ãã©ãããåè¨å® 432 if(isMenuOpen && $('body').hasClass('viewmode_smp')){ 433 setTimeout(function() { 434 setupBottomNaviFocusTrap($currentButton); 435 }, 100); 436 } 437 }); 438 439 if($("body").hasClass("pcopen")){ 440 $("body").removeClass("pcopen"); 441 var currentFontSize = $("body").css("font-size"); 442 $("body").removeAttr("style"); 443 if(currentFontSize){ 444 $("body").css("font-size", currentFontSize); 445 } 446 } 447 448 } 449 450 //éãããã¿ã³ãæ¼ãããéãã 451 $('#jssmpbtmnavi .psclose, #jssmpbtmnavi .hnclose').on('click keydown', null, function(e) { 452 // Enterãã¼ã¾ãã¯ãã¦ã¹ã¯ãªãã¯ã®ã¿å¦ç 453 if (e.type === 'keydown' && e.keyCode !== 13) { 454 return; 455 } 456 e.preventDefault(); 457 e.stopPropagation(); 458 459 var $menu = $(this).parent(); 460 var $menuButton = $menu.prev('.hnmenu'); 461 462 // ãã©ã¼ã«ã¹ãã©ããã®ã¤ãã³ããè§£é¤ï¼bodyopenã®äºéå®è¡ã鲿¢ï¼ 463 $menu.find('*').off('.bottomnavitrap'); 464 $menu.off('.bottomnavitrap'); 465 $menuButton.off('.bottomnavibutton'); 466 467 // ãã¼ãã¼ãæä½ã®å ´åã®ã¿ãã©ã¼ã«ã¹ãç§»å 468 if (e.type === 'keydown') { 469 $menuButton.focus(); 470 } 471 472 bodyopen(); 473 $menu.slideUp(); 474 475 $menuButton.removeClass("choice"); 476 $menuButton.attr('aria-expanded', 'false'); 477 $menu.attr('aria-hidden', 'true'); 478 $menuButton.parents('.bmenu').addClass("pscatenone"); 479 //closeText(); 480 }); 481 482 } 483} 484 485// ããã ããç¨ãã©ã¼ã«ã¹ãã©ããã®è¨å®é¢æ° 486function setupBottomNaviFocusTrap($menuButton) { 487 var $menu = $menuButton.next('.openmenu'); 488 var menuId = $menu.attr('id'); 489 490 // æ¢åã®ã¤ãã³ããåé¤ï¼éè¤ç»é²ãé²ãï¼ 491 $menu.find('*').off('focusout.bottomnavitrap'); 492 $menu.find('*').off('keydown.bottomnavitrap'); 493 $menuButton.off('keydown.bottomnavibutton'); 494 495 // ã¡ãã¥ã¼å ã®ããã©ã¼ã«ã¹å¯è½è¦ç´ ããåå¾ 496 var $focusableElements = $menu.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible'); 497 var $lastFocusable = $focusableElements.last(); 498 499 // Escapeãã¼ï¼ã¡ãã¥ã¼ãã¿ã³ã§æ¼ãããå ´å 500 $menuButton.on('keydown.bottomnavibutton', function(event) { 501 // Escape 502 if (event.keyCode === 27 && $menuButton.hasClass("choice")) { 503 event.preventDefault(); 504 505 // ã¡ãã¥ã¼ãéãã¦ãã©ã¼ã«ã¹ããã¿ã³ã«æ»ã 506 $menu.slideUp(); 507 $menuButton.removeClass("choice"); 508 $menuButton.attr('aria-expanded', 'false'); 509 $menu.attr('aria-hidden', 'true'); 510 $menu.parent().addClass("pscatenone"); 511 bodyopen(); 512 513 // ãã©ã¼ã«ã¹ã¯æ¢ã«ãã¿ã³ã«ãã 514 } 515 516 // Shift + Tab 517 else if (event.shiftKey && event.keyCode === 9 && $menuButton.hasClass("choice")) { 518 event.preventDefault(); 519 520 // ã¡ãã¥ã¼ãéãã 521 $menu.slideUp(); 522 $menuButton.removeClass("choice"); 523 $menuButton.attr('aria-expanded', 'false'); 524 $menu.attr('aria-hidden', 'true'); 525 $menu.parent().addClass("pscatenone"); 526 bodyopen(); 527 528 // åã®è¦ç´ ã«èªç¶ã«ãã©ã¼ã«ã¹ 529 setTimeout(function() { 530 var $allFocusable = $('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible'); 531 var currentIndex = $allFocusable.index($menuButton); 532 if (currentIndex > 0) { 533 $allFocusable.eq(currentIndex - 1).focus(); 534 } 535 }, 10); 536 } 537 }); 538 539 // Escapeãã¼ï¼ã¡ãã¥ã¼å ã§æ¼ãããå ´å 540 $menu.on('keydown.bottomnavitrap', function(event) { 541 if (event.keyCode === 27) { 542 event.preventDefault(); 543 544 // ã¡ãã¥ã¼ãã¿ã³ã«ãã©ã¼ã«ã¹ãæ»ãã¦ããéãã 545 $menuButton.focus(); 546 547 $menu.slideUp(); 548 $menuButton.removeClass("choice"); 549 $menuButton.attr('aria-expanded', 'false'); 550 $menu.attr('aria-hidden', 'true'); 551 $menu.parent().addClass("pscatenone"); 552 bodyopen(); 553 } 554 }); 555 556 // Tabï¼æå¾ã®è¦ç´ ããæããå ´å 557 $lastFocusable.on('focusout.bottomnavitrap', function(event) { 558 setTimeout(function() { 559 var activeElement = $(document.activeElement); 560 561 // ã¡ãã¥ã¼å¤ã«åºããã¡ãã¥ã¼ãéããï¼ãã©ã¼ã«ã¹ã¯èªç¶ã«æ¬¡ã®è¦ç´ ã¸ï¼ 562 if (!activeElement.closest('#' + menuId).length && !activeElement.is($menuButton)) { 563 $menu.slideUp(); 564 $menuButton.removeClass("choice"); 565 $menuButton.attr('aria-expanded', 'false'); 566 $menu.attr('aria-hidden', 'true'); 567 $menu.parent().addClass("pscatenone"); 568 bodyopen(); 569 } 570 }, 10); 571 }); 572} 573//--- â²é¢æ° ---------------------------- 574 575function bottomNaviSet() { 576 577 // ã°ãã¼ãã«ãã ãããããã¦ã³ã¡ãã¥ã¼ 578 if($('#jssmpbtmnavi').length){ 579 //ããã ããã®é«ããï¼»ã¦ã¤ã³ãã¦ãµã¤ãºï¼½âï¼»ã¡ãã¥ã¼ãã¿ã³ä¸é¨ï¼½ã¾ã§ã
579®è·é¢ã«ãã 580 // ãã¼ãã¨ãªãµã¤ãºæã®å¦ç 581 $(window).on('load orientationchange resize',function() { 582 gnavismpheight(); 583 //bottom_view_change(); 584 }); 585 586 gnavismpheight(); 587 } 588} 589//â²ãããã ãã 590 591//â¼ãè¦ç´ è¤è£½ 592function CLONE() { 593 var clone_e = CLONE_E; 594 var clone = ''; //è¤è£½è¦ç´ ä¿åç¨ 595 if(!clone_e || clone_e.length <= 0) return false; 596 $.each(clone_e,function(){ 597 //è¤è£½å¦ç 598 if(this.move && this.move[1] && $(this.elem).length){ 599 clone = $(this.elem).clone(); 600 if(clone.hasClass('pconly')){ 601 clone = clone.removeClass('pconly'); 602 } 603 if(clone.hasClass('smponly')){ 604 clone = clone.removeClass('smponly'); 605 } 606 if(this.only=='pc'){ 607 clone = clone.addClass('pconly'); 608 }else if(this.only=='smp'){ 609 clone = clone.addClass('smponly'); 610 } 611 switch(this.move[1]){ 612 case("append"): $(this.move[0]).append(clone);break; 613 case("prepend"): $(this.move[0]).prepend(clone);break; 614 case("after"): $(this.move[0]).after(clone);break; 615 case("before"): $(this.move[0]).before(clone);break; 616 } 617 } 618 }); 619} 620//â²ãè¦ç´ è¤è£½ 621 622//â¼ãè¦ç´ ç§»å 623function ELEMENT(mode) { 624 var element = MOVE_E; 625 if(!element || element.length <= 0) return false; 626 $.each(element,function(){ 627 if(this[mode] && this[mode][1] && $(this.elem).length){ 628 switch(this[mode][1]){ 629 case("append"): $(this[mode][0]).append($(this.elem));break; 630 case("prepend"): $(this[mode][0]).prepend($(this.elem));break; 631 case("after"): $(this[mode][0]).after($(this.elem));break; 632 case("before"): $(this[mode][0]).before($(this.elem));break; 633 } 634 } 635 }); 636} 637//â²ãè¦ç´ ç§»å 638 639//â¼ãCSSåæ¿ 640function CSSchange(){ 641 var pc_hrefcss = ""; 642 var smp_hrefcss = ""; 643 var smp_mediacss = ""; 644 if($.cookie('smp_mode')=="smp"){ 645 for(let cs = 0;cs < 2;cs++){ 646 if($(css_pcary[cs]).length && $(css_smpary[cs]).length){ 647 if($(css_pcary[cs]).attr('name') == undefined){ 648 $(css_pcary[cs]).attr('name',''); 649 } 650 if($(css_smpary[cs]).attr('name') == undefined){ 651 $(css_smpary[cs]).attr('name',''); 652 } 653 if($(css_pcary[cs]).attr('href').length && !($(css_pcary[cs]).attr('name').length)){ 654 pc_hrefcss = $(css_pcary[cs]).attr('href'); 655 $(css_pcary[cs]).attr('href',''); 656 $(css_pcary[cs]).attr('name',pc_hrefcss); 657 } 658 if($(css_smpary[cs]).attr('href').length && $(css_smpary[cs]).attr('media').length && !($(css_smpary[cs]).attr('name').length)){ 659 smp_mediacss = $(css_smpary[cs]).attr('media'); 660 $(css_smpary[cs]).attr('media',''); 661 $(css_smpary[cs]).attr('name',smp_mediacss); 662 } else if($(css_smpary[cs]).attr('media').length && $(css_smpary[cs]).attr('name').length && !($(css_smpary[cs]).attr('href').length)){ 663 smp_hrefcss = $(css_smpary[cs]).attr('media'); 664 $(css_smpary[cs]).attr('media',''); 665 $(css_smpary[cs]).attr('href',smp_hrefcss); 666 } 667 } 668 } 669 }else if($.cookie('smp_mode')=="pc"){ 670 for(let cs = 0;cs < 2;cs++){ 671 if($(css_pcary[cs]).length && $(css_smpary[cs]).length){ 672 if($(css_pcary[cs]).attr('name') == undefined){ 673 $(css_pcary[cs]).attr('name',''); 674 } 675 if($(css_smpary[cs]).attr('name') == undefined){ 676 $(css_smpary[cs]).attr('name',''); 677 } 678 if(!($(css_pcary[cs]).attr('href').length) && $(css_pcary[cs]).attr('name').length){ 679 pc_hrefcss = $(css_pcary[cs]).attr('name'); 680 $(css_pcary[cs]).attr('name',''); 681 $(css_pcary[cs]).attr('href',pc_hrefcss); 682 } 683 if($(css_smpary[cs]).attr('href').length && $(css_smpary[cs]).attr('name').length && !$(css_smpary[cs]).attr('media').length){ 684 smp_hrefcss = $(css_smpary[cs]).attr('href'); 685 $(css_smpary[cs]).attr('href',''); 686 $(css_smpary[cs]).attr('media',''); 687 $(css_smpary[cs]).attr('media',smp_hrefcss); 688 } 689 } 690 } 691 } 692} 693//â²ãCSSåæ¿ 694 695//â¼ãè¡¨ãæ¨ªã¹ã¯ãã¼ã« 696function Tablescroll(mode){ 697 var tables = $('table'); 698 if (typeof tables == 'undefined' || !tables) return; 699 700 if (tables.length > 0 && !$('#eventcalendar').length && !$('#form1').length && !$('#map').length && !$('#googlesearch').length){ 701 var resizeTimer; 702 var tableCounter = 0; // ãã¼ãã«é£çªç¨ã«ã¦ã³ã¿ã¼ 703 704 function adjustTables() { 705 tableCounter = 0; // ã«ã¦ã³ã¿ã¼ãªã»ãã 706 tables.each(function(){ 707 var $table = $(this); 708 var $wrapper = $table.parent('.tablewrap'); 709 710 // ãã¼ãã«ã®è¦ªè¦ç´ ãã#contentã#content2ã#content3ã®ãããããæ¤ç´¢ 711 var $contentParent = $table.closest('#content, #content2, #content3'); 712 // 親ããã¯ã¹ã®æ¨ªå¹ ãåå¾ 713 var winWidth = $contentParent.length ? $contentParent.innerWidth() : $(window).width(); 714 715 // ãã¼ãã«ã«IDããªããã°ä»ä¸ 716 var tableId = $table.attr('id'); 717 if (!tableId) {
718 tableId = 'scrolltable' + (++tableCounter); 719 $table.attr('id', tableId); 720 } 721 722 if ($wrapper.length === 0) { 723 $table.wrap('<div class="tablewrap tablenormal">'); 724 $wrapper = $table.parent('.tablewrap'); 725 } 726 727 if($table.outerWidth(true) < winWidth){ 728 $wrapper.removeClass('tablescroll').addClass('tablenormal'); 729 $wrapper.find('.tsbutton').remove(); 730 } else { 731 $wrapper.removeClass('tablescroll').addClass('tablenormal'); 732 if ($wrapper.find('.tsbutton').length === 0) { 733 $('<button class="tsbutton" aria-controls="' + tableId + '" aria-pressed="false">è¡¨ã®æ¨ªã¹ã¯ãã¼ã«ãæå¹ã«ãã</button>').insertBefore($table); 734 } 735 } 736 }); 737 } 738 739 // åæèª¿æ´ 740 adjustTables(); 741 742 // ãªãµã¤ãºæã®èª¿æ´ - æ¢åã®ã¤ãã³ããªã¹ãã¼ãè§£é¤ãã¦ããåè¨å® 743 $(window).off('orientationchange.tablescroll resize.tablescroll').on('orientationchange.tablescroll resize.tablescroll', function() { 744 clearTimeout(resizeTimer); 745 resizeTimer = setTimeout(function() { 746 adjustTables(); 747 }, 200); // 200ããªç§å¾ã«å®è¡ 748 }); 749 750 // ã¯ãªãã¯ã¤ãã³ããåå空éä»ãã§è¨å®ãç´ã 751 $(document).off('click.tablescroll', '.tablewrap .tsbutton').on('click.tablescroll', '.tablewrap .tsbutton', function() { 752 var isScrollMode = $(this).parent('.tablewrap').hasClass('tablescroll'); 753 // ç¶æ ã«å¿ãã¦aria-pressedã¨aria-labelãåãæ¿ã 754 if (isScrollMode) { 755 $(this).attr('aria-pressed', 'false').text('è¡¨ã®æ¨ªã¹ã¯ãã¼ã«ãæå¹ã«ãã'); 756 } else { 757 $(this).attr('aria-pressed', 'true').text('è¡¨ã®æ¨ªã¹ã¯ãã¼ã«ãè§£é¤ãã'); 758 } 759 $(this).parent('.tablewrap').toggleClass("tablescroll").toggleClass("tablenormal"); 760 }); 761 } 762} 763//â²ãè¡¨ãæ¨ªã¹ã¯ãã¼ã« 764 765//â¼ãè¡æ¿ãµã¤ãããããã¼åºå® 766//ç·æ¥æ å ±ã®ééæã«ãå¼ã³åºããããã°ãã¼ãã«ã«å ¬é 767var updateHeaderFloat = function(){}; 768 769function gyoseiHeader(mode){ 770 if($('#wrap #header').length){ 771 var floatingContent = $("#topheaderbg #headerinner , #headerbg #headerinner"); //ããã¼ãããè¦ç´ 772 var $toppageContent = $("#toppagebody, #pagebody #tpath"); //é常æã®å é è¦ç´ 773 var $kinkyuArea = $("#kinkyuarea"); //ç·æ¥æ å ±ã¨ãªã¢ 774 var heightH = floatingContent.outerHeight(); 775 776 //â¼è¿½å ï¼è¡¨ç¤ºç¶æ ã«å¿ãã¦ãããã¼ãå¾ã«å é ã«ãªãè¦ç´ ããå¤å® 777 function getFirstContent(){ 778 if($kinkyuArea.length && $kinkyuArea.is(':visible')){ 779 return $kinkyuArea; 780 } 781 return $toppageContent; 782 } 783 784 //if(mode=="pc"){ 785 786 // URLã«ããã·ã¥ãå«ã¾ãã¦ããå ´åã«å®è¡ 787 if(location.hash && $('#googlecontent').length == 0){ 788 var target2 = $(location.hash); 789 var position2 = target2.offset().top - heightH; 790 $('html, body').animate({scrollTop: position2}, 500, 'swing'); 791 } 792 793 //â¼å¤æ´ï¼margin-topå¶å¾¡ã颿°åããã°ãã¼ãã«å¤æ°updateHeaderFloatã«ä»£å ¥ 794 //ããããï¼ç·æ¥æ å ±ã®ééã¯ãªãã¯æã«ãå¼ã³åºããããã«ããï¼ 795 updateHeaderFloat = function(){ 796 var value = $(window).scrollTop(); 797 var headH = floatingContent.outerHeight(); 798 var $firstContent = getFirstContent(); 799 800 //対象å¤ã«ãªã£ãè¦ç´ ã®margin-topããªã»ããï¼ä¸¡æ¹ã¯ãªã¢ãã¦ããä»ä¸ï¼ 801 $toppageContent.css('margin-top', ''); 802 if($kinkyuArea.length){ 803 $kinkyuArea.css('margin-top', ''); 804 } 805 806 if (value > headH) { 807 floatingContent.addClass("headerfixed"); 808 $firstContent.css('margin-top', headH); 809 } else { 810 floatingContent.removeClass("headerfixed"); 811 $firstContent.css('margin-top', '0px'); 812 } 813 }; 814 815 //追å¾ãããã¼ã®åã空ãã¤ã¤ã¹ã ã¼ã¹ã¹ã¯ãã¼ã« 816 $(window).off('scroll.headscroll load.headscroll').on('load.headscroll scroll.headscroll', function() { 817 updateHeaderFloat(); 818 }); 819 820 //â¼è¿½å ï¼åæè¡¨ç¤ºæã«ãä¸åº¦å®è¡ï¼ãã¼ã¸ãã¼ãç´å¾ããªãµã¤ãºæã®ã¢ã¼ãåæ¿æãªã©ï¼ 821 updateHeaderFloat(); 822 823 //}else{ 824 // $(window).off('scroll.headscroll'); 825 // floatingContent.removeClass("headerfixed"); 826 // $toppageContent.css('margin-top', ''); 827 // if($kinkyuArea.length){ 828 // $kinkyuArea.css('margin-top', ''); 829 // } 830 // //â¼è¿½å ï¼ã¹ããã¢ã¼ãã§ã¯ç¡å¹å 831 // updateHeaderFloat = function(){}; 832 //} 833 834 //ã¯ãªãã¯ã¤ãã³ããå®è¡ãã¿ã.jsã¯é¤å¤ 835 $('a[href^="#"]').not('.ui-tabs-anchor').off('click').on('click', AnchorScroll); 836 function AnchorScroll(){ 837 if($(this).attr('href') != "#wrap" && !$(this).hasClass('ui-tabs-anchor')){ 838 var speed = 500; 839 var href = $(this).attr("href"); 840 if(href == "#" || href == ""){ 841 var target = href; 842 }else if(href.indexOf("#") !== -1){ 843 var target = href.substring(href.indexOf("#"),href.length); 844 if($(target).length){ 845 if(mode=="pc"){ 846 var position = $(target).offset().top - heightH; 847 }else{ 848 var position = $(target).offset().top; 849 } 850 $('body,html').animate({scrollTop:position}, speed, 'swing'); 851 } 852 } 853 } 854 } 855 } 856 //ã¡ãã¥ã¼ã®é«ãï¼å¤æ´ãªãï¼ 857 if($('#wrap #dropdownmenu').length){ 858 if(mode=="pc"){ 859 var $menuButton = $("#smpmenup2bg .bmenu > button"); 860 var $dropMenus = $('#wrap #header #smpmenup1menu, #wrap #header #emergencymenu'); 861 862 function dropHeightSet(){ 863 if($('body').hasClass('viewmode_pc')){ 864 var winHeight = $(window).outerHeight(); 865 var heightH2 = $menuButton[0].getBoundingClientRect().bottom; 866 var dropHeight = winHeight - heightH2; 867 $dropMenus.css('height', winHeight); 868 } 869 } 870 871 dropHeightSet(); 872 873 $(window).off('load.dropheight').on('load.dropheight', function(){ 874 dropHeightSet(); 875 }); 876 877 $(window).off('orientationchange.dropheight resize.dropheight').on('orientationchange.dropheight resize.dropheight',function(){ 878 setTimeout(function() { 879 dropHeightSet(); 880 }, 100); 881 setTimeout(function() { 882 dropHeightSet(); 883 }, 1000); 884 }); 885 886 $('[onclick*="fsChange"]').off('click.fschange').on('click.fschange', function(){ 887 setTimeout(function(){ 888 dropHeightSet(); 889 }, 100); 890 }); 891 } 892 } 893 894} 895//â²ãè¡æ¿ãµã¤ãããããã¼åºå® 896 897//â¼ãpconlyãsmponlyã®è¡¨ç¤ºåæ¿ 898function viewModeChange(mode) { 899 if(mode=="smp"){ 900 $('.pconly').each(function(){ 901 $(this).hide(); 902 }); 903 $('.smponly').each(function(){ 904 $(this).show(); 905 }); 906 }else if(mode=="pc"){ 907 $('.pconly').each(function(){ 908 $(this).show(); 909 }); 910 $('.smponly').each(function(){ 911 $(this).hide(); 912 }); 913 } 914} 915//â²ãpconlyãsmponlyã®è¡¨ç¤ºåæ¿ 916 917//â¼ãsmp.js 918function SMPjs(mode) { 919 if(mode=="smp"){ 920 $('#viewmode_smp').attr('aria-current', 'page'); 921 922 //ããã¿ã«ããã ããã®é«ãåãæ¿å ¥ 923 if($('#jssmpbtmnavi').length){ 924 var jbnh = $("#jssmpbtmnavi").outerHeight(); 925 $("footer").css("padding-bottom",jbnh); 926 $("html").css("scroll-padding-bottom",jbnh); 927 } 928 929 //ç·æ¥æ å ±ãããã¾ã 930 if($("#headkinkyumsg").length){ 931 $headkinkyumsg = $('#headkinkyumsg'); 932 $($headkinkyumsg).appendTo("#headerbg"); 933 } 934 935 //âå¤§è¦æ¨¡ç½å®³ï¼ãããããã¦ã³ã¡ãã¥ã¼ 936 if($("#wrapbg").hasClass("saigai")){ 937 //æãããã¿ç¨ã®å¤æ ããã¿ã³è¿½å 938 $('#util , #utilmenuwrap').removeClass("pconly") 939 $('#util').wrap('<div id="smpmenu">').wrap('<div id="gnavismp" aria-hidden="true" class="clearfix">').removeClass("pconly");
940 $('<button class="hnplus" aria-controls="gnavismp" aria-expanded="false"><span>ã¡ãã¥ã¼</span></button>').insertBefore('#gnavismp'); 941 $('<button class="hnclose">éãã</button>').appendTo('#gnavismp'); 942 //æãããã¿å¦ç 943 $('#gnavismp').each(function() { 944 var hnFlg = false; 945 var $this = $(this); 946 var $ul = $('#gnavismp'); 947 var $button = $('#smpmenu > button'); 948 949 if($(this).children('*').hasClass("hnplus") ){ 950 $ul.hide(); 951 hnFlg = false; 952 } 953 //表示 954 $button.on('click',function() { 955 $('#smpmenu > button').toggleClass("hnplus").toggleClass("hnminus"); 956 hnFlg = !hnFlg; 957 if(hnFlg){ 958 $("#smpmenu").css('width','100%'); 959 $("#smpmenu > button").attr('aria-expanded', 'true'); 960 $("#gnavismp").attr('aria-hidden', 'false'); 961 } 962 $ul.slideToggle('normal', function() { 963 if(!hnFlg){ 964 $("#smpmenu").css('width','auto'); 965 $("#smpmenu > button").attr('aria-expanded', 'false'); 966 $("#gnavismp").attr('aria-hidden', 'true'); 967 } 968 }); 969 return false; 970 }); 971 //éãããã¿ã³æ¼ä¸ 972 $('button.hnclose').on('click',function() { 973 $('#smpmenu button').toggleClass("hnplus").toggleClass("hnminus"); 974 hnFlg = !hnFlg; 975 $ul.slideToggle('normal', function() { 976 $("#smpmenu").css('width','auto'); 977 $("#smpmenu button").attr('aria-expanded', 'false'); 978 $("#gnavismp").attr('aria-hidden', 'true'); 979 }); 980 return false; 981 }); 982 }); 983 } 984 985 // ã«ã«ã¼ã»ã«Bãã¹ããã®å ´å 986 if($("#scroll_b").length && $('body').hasClass('viewmode_smp')){ 987 $(window).off('orientationchange.scrollb resize.scrollb'); 988 $('#scroll_b .imgtxt').css("height",""); 989 } 990 991 }else if(mode=="pc"){ 992 $('#viewmode_pc').attr('aria-current', 'page'); 993 994 //ç·æ¥æ å ±ãããã¾ã(å ã®ä½ç½®ä¸æ) 995 if($("#headkinkyumsg").length){ 996 $headkinkyumsg = $('#headkinkyumsg'); 997 $($headkinkyumsg).appendTo("#headerbg"); 998 } 999 1000 //ããã¿ã«ããã ããã®é«ãåãæ¿å ¥ 1001 if($('#jssmpbtmnavi').length){ 1002 $("footer").css("padding-bottom",""); 1003 } 1004 1005 // âå¤§è¦æ¨¡ç½å®³ï¼ãããããã¦ã³ã¡ãã¥ã¼ 1006 if ($("#wrapbg").hasClass("saigai") && $('body').hasClass('viewmode_pc')) { 1007 1008 //ã¹ããç¨ã¤ãã³ãè§£é¤ 1009 $('#smpmenu > button').off(); 1010 $('#smpmenu button.hnclose').off(); 1011 1012 //ã¹ããç¨ãã¿ã³åé¤ 1013 $('#smpmenu > button.hnplus, #smpmenu > button.hnminus').remove(); 1014 $('#smpmenu .hnclose').remove(); 1015 1016 //#util ãå ã®ä½ç½®ã¸æ»ã 1017 if ($('#util').length && $('#gnavismp').length) { 1018 $('#util').unwrap(); // #gnavismp ãå¤ã 1019 } 1020 1021 if ($('#util').length && $('#smpmenu').length) { 1022 $('#util').unwrap(); // #smpmenu ãå¤ã 1023 } 1024 1025 //PCç¨ã¯ã©ã¹ã復å 1026 $('#utilmenuwrap').addClass('pconly'); 1027 $('#util').addClass('pconly'); 1028 1029 // #smpmenu ãæ®ã£ã¦ãããåé¤ 1030 $('#smpmenu').remove(); 1031 } 1032 1033 // ã«ã«ã¼ã»ã«BãPCã®å ´å 1034 if($("#scroll_b").length && $('body').hasClass('viewmode_pc')){ 1035 //imgtxtã®é«ã 1036 $("#scroll_b .imgtxt").height($("#scroll_b .window").height() - 33); 1037 $(window).off('orientationchange.scrollb resize.scrollb').on('orientationchange.scrollb resize.scrollb', function(){ 1038 $("#scroll_b .imgtxt").height($("#scroll_b .window").height() - 33); 1039 }); 1040 } 1041 } 1042} 1043//â²ãsmp.js 1044})(); 1045 1046//â¼articleall 1047function ARTICLEALL(mode) { 1048 var $ = FI.jQuery; 1049 if(mode=="smp"){ 1050 $('.articleall').each(function(){ 1051 //æãããã¿ãããªãè¦ç´ ã«ã¯ã¯ã©ã¹ã.dispããè¨å® 1052 var $ul = $(this).children('*').not('.plus,.minus,.disp'); 1053 if($(this).children('*').hasClass("plus") ){ 1054 $ul.hide(); 1055 $(this).children('.plus').attr('aria-expanded', 'false'); 1056 } else if($(this).children('*').hasClass("minus") ){ 1057 $(this).children('.minus').attr('aria-expanded', 'true'); 1058 } 1059 //tabindexã«ãã©ã¼ã«ã¹ 1060 $('.articleall h2').attr('tabindex', '0'); 1061 $('.opendata .articleall h3').attr('tabindex', '0');//ãªã¼ãã³ãã¼ã¿ 1062 $('.categoryfaq .articleall h3').attr('tabindex', '0');//FAQããã 1063 $('.category.articleall h3').attr('tabindex', '0');//ã¤ãã³ããã¼ã¿ã« 1064 //éé 1065 $('.plus,.minus',this).on('click keyup', function(e){ 1066 if(e.keyCode == 13 || e.keyCode == null){ 1067 if($('body').hasClass('viewmode_smp')){ 1068 $(this).toggleClass("plus").toggleClass("minus"); 1069 $ul.slideToggle(); 1070 $(this).attr('aria-expanded', $(this).hasClass('minus') ? 'true' : 'false'); 1071 } 1072 } 1073 }); 1074 }); 1075 }else if(mode=="pc"){ 1076 $('.articleall').each(function(){ 1077 $('.plus,.minus',this).off(); 1078 //æãããã¿ãããªãè¦ç´ ã«ã¯ã¯ã©ã¹ã.dispããè¨å® 1079 var $ul = $(this).children('*').not('.plus,.minus,.disp'); 1080 if($(this).children('*')){ 1081 $ul.show(); 1082 } 1083 //tabindexã«ãã©ã¼ã«ã¹ 1084 $('.articleall h2').removeAttr('tabindex'); 1085 $('.opendata .articleall h3').removeAttr('tabindex');//ãªã¼ãã³ãã¼ã¿ 1086 $('.categoryfaq .articleall h3').removeAttr('tabindex');//FAQããã 1087 $('.category.articleall h3').removeAttr('tabindex');//ã¤ãã³ããã¼ã¿ã« 1088 $('.plus,.minus',this).removeAttr('aria-expanded'); 1089 }); 1090 } 1091 1092 //ã»ã«ã³ããããã®ééåæè¡¨ç¤ºãã¹ããã¨åãã 1093 //if($('#second').length){ 1094 // if($('.pmbtn').length){ 1095 // $('.articleall2').each(function(){ 1096 // if(!$('h2',this).hasClass('none')){ 1097 // 1098 // if(mode=="smp"){ 1099 // if(!$('h2',this).hasClass("plus2")){ 1100 // $('h2',this).addClass("plus2") 1101 // } 1102 // if($('h2',this).hasClass("minus2")){ 1103 // $('h2',this).removeClass("minus2") 1104 // } 1105 // }else if(mode=="pc"){ 1106 // if(!$('h2',this).hasClass("minus2")){ 1107 // $('h2',this).addClass("minus2") 1108 // } 1109 // if($('h2',this).hasClass("plus2")){ 1110 // $('h2',this).removeClass("plus2") 1111 // } 1112 // } 1113 // 1114 // var $ul = $(this).children('*').not('.plus2,.minus2,.disp2'); 1115 // if($('h2',this).hasClass("plus2") ){ 1116 // $ul.hide(); 1117 // $ul.attr('aria-hidden', 'true'); 1118 // } 1119 // if($('h2',this).hasClass("minus2") ){ 1120 // $ul.show(); 1121 // $ul.attr('aria-hidden', 'false'); 1122 // } 1123 // 1124 // //ééãã¿ã³ 1125 // if($('h2',this).hasClass("minus2") ){ 1126 // $('.pmbtn',this).children('img').attr({ 1127 // src: $('.pmbtn',this).children('img').attr('src').replace('plus', 'minus'), 1128 // alt: "éãã" 1129 // }); 1130 // $('.pmbtn',this).attr('aria-expanded', 'true'); 1131 // $ul.attr('aria-hidden', 'false'); 1132 // }else{ 1133 // $('.pmbtn',this).children('img').attr({ 1134 // src: $('.pmbtn',this).children('img').attr('src').replace('minus', 'plus'), 1135 // alt: "éã" 1136 // }); 1137 // $('.pmbtn',this).attr('aria-expanded', 'false'); 1138 // $ul.attr('aria-hidden', 'true'); 1139 // } 1140 // } 1141 // }); 1142 // } 1143 //} 1144} 1145//â²articleall 1146 1147//â¼dropdown_menu 1148function dropdown_menu(mode){ 1149 var $ = FI.jQuery; 1150 1151 //---------------------------------------------------------------
1152 // æä»å¶å¾¡å¯¾è±¡ãmodeã§åãæ¿ã 1153 // SMPæã¯ç¿»è¨³(translation)ã対象å¤ã«ãã¦ç¬ç«åä½ã«ãã 1154 var headerExclusiveMenus = (mode === "smp") 1155 ? ['#header #smpmenup1', '#header #smpmenup2', '#kinkyubtn'] 1156 : ['#header #translation', '#header #sitesearch', '#header #smpmenup1', '#header #smpmenup2', '#kinkyubtn']; 1157 //--------------------------------------------------------------------------- 1158 //æå®ããã¡ãã¥ã¼ãéãã¦ããã°éãã 1159 function closeHeaderExclusiveMenu(id){ 1160 1161 //ç·æ¥æ å ± 1162 if(id === '#kinkyubtn'){ 1163 var $kp = $('#kinkyubtn p'); 1164 var $kbtn = $('#kinkyubtn button'); 1165 var $karea = $('#kinkyuarea'); 1166 1167 if($kp.hasClass('active')){ 1168 $karea.slideUp(); 1169 $kp.removeClass('active'); 1170 $kbtn.attr('aria-expanded', 'false'); 1171 $karea.attr('aria-hidden', 'true'); 1172 } 1173 return; 1174 } 1175 1176 var $box = $(id); 1177 var $btn = $box.children('.hnmenu'); 1178 var $menu = $btn.next('.openmenu'); 1179 1180 if($btn.hasClass('choice')){ 1181 $menu.slideUp(); 1182 $box.removeClass('choice'); 1183 $btn.removeClass('choice'); 1184 $btn.attr('aria-expanded', 'false'); 1185 $menu.attr('aria-hidden', 'true'); 1186 $box.addClass('pscatenone'); 1187 1188 //smpmenup1/smpmenup2ç¨ï¼ãã©ã¼ã«ã¹ãã©ããã®è§£é¤ 1189 $menu.find('*').off('.menutrap'); 1190 $menu.off('.menutrap'); 1191 $btn.off('.menubutton'); 1192 1193 //smpmenup1/smpmenup2ç¨ï¼bodyå¶å¾¡ãå ã«æ»ã 1194 if(id === '#header #smpmenup1' || id === '#header #smpmenup2'){ 1195 if($('body').hasClass('viewmode_smp')){ 1196 bodyopen(); 1197 gnavismpheight(); 1198 }else{ 1199 bodypcopen(); 1200 } 1201 } 1202 } 1203 } 1204 1205 //èªå以å¤ã®3ã¤ãéãã 1206 function closeOtherHeaderExclusiveMenus(currentId){ 1207 $.each(headerExclusiveMenus, function(i, id){ 1208 if(id !== currentId){ 1209 closeHeaderExclusiveMenu(id); 1210 } 1211 }); 1212 } 1213 //--------------------------------------------------------------------------- 1214 //ã°ãã¼ãã«ãããããããã¦ã³ã¡ãã¥ã¼ 1215 1216 $('.scate').not('#gnavismp .scate').each(function(){ 1217 $('.tismenu',this).off(); 1218 var $scate = $(this); 1219 var $ul = $(this).children('*').not('.tismenu'); 1220 var target = $('.scate .navi').not('#gnavismp .navi'); 1221 var target2 = $('.scate .tismenu').not('#gnavismp .tismenu'); 1222 var target3 = $('.scate').not('#gnavismp .scate'); 1223 if(mode=="pc"){ 1224 $ul.hide(); 1225 $('.tismenu',this).on('click', function() { 1226 //èªå以å¤ã®å¦ç 1227 var self = $(this).next("div"); 1228 target.not(self).hide().prev().removeClass("choice"); 1229 target3.not(self).removeClass("choice"); 1230 target.not(self).hide().prev().children().attr('aria-expanded', 'false'); 1231 target.not(self).hide().attr('aria-hidden', 'true'); 1232 1233 //èªåã®å¦ç 1234 $ul.slideToggle(); 1235 $(this).toggleClass("choice"); 1236 //WAI-ARIA 1237 if($(this).hasClass("choice")){ 1238 $(this).attr('aria-expanded', 'true'); 1239 $(this).next().attr('aria-hidden', 'false'); 1240 $(this).parent('li').addClass("choice"); 1241 }else{ 1242 $(this).attr('aria-expanded', 'false'); 1243 $(this).next().attr('aria-hidden', 'true'); 1244 $(this).parent('li').removeClass("choice"); 1245 } 1246 }); 1247 1248 //.naviãããã©ã¼ã«ã¹ãå¤ãããéãã 1249 $("#gnavi .navi ul li:last-child").on('focusout', function() { 1250 $ul.slideUp(); 1251 $scate.removeClass("choice"); 1252 $(".scate .tismenu").removeClass("choice"); 1253 $(".scate .tismenu").attr('aria-expanded', 'false'); 1254 $(target).attr('aria-hidden', 'true'); 1255 }); 1256 $("#translation ul li:last-child").on('focusout', function() { 1257 $ul.slideUp(); 1258 $scate.removeClass("choice"); 1259 $(".scate .tismenu").removeClass("choice"); 1260 $(".scate .tismenu").attr('aria-expanded', 'false'); 1261 $(target).attr('aria-hidden', 'true'); 1262 }); 1263 1264 //éãããã¿ã³ 1265 $('.gnaviclose').on('click', null, function() { 1266 $ul.slideUp(); 1267 $scate.removeClass("choice"); 1268 $(".scate .tismenu").removeClass("choice"); 1269 $(".scate .tismenu").attr('aria-expanded', 'false'); 1270 $(target).attr('aria-hidden', 'true'); 1271 }); 1272 }else if(mode=="smp"){ 1273 $ul.show(); 1274 } 1275 }); 1276 1277 //---------------------------------------------------------------
1278 // 翻訳ãããããã¦ã³ï¼PC/SMPå ±éã§ééããããæä»å¶å¾¡ã¯PCã®ã¿ï¼ 1279 $('#header #translation.bmenu').each(function(){ 1280 $('.hnmenu',this).off(); 1281 $('.psclose',this).off(); 1282 1283 var $scate = $(this); 1284 var $ul = $(this).children('*').not('.hnmenu, .psclose'); 1285 var $menuId = '#header #' + $scate.attr('id'); 1286 1287 $ul.hide(); 1288 1289 $('.hnmenu',this).on('click', function() { 1290 $ul.slideToggle(); 1291 $(this).toggleClass("choice"); 1292 1293 if($(this).hasClass("choice")){ 1294 $scate.addClass("choice"); 1295 $(this).attr('aria-expanded', 'true'); 1296 $(this).next().attr('aria-hidden', 'false'); 1297 1298 //â¼PCã®ã¨ãã ãä»ã¡ãã¥ã¼ãéãããSMPã¯ç¬ç«åä½ã«ãã 1299 if(mode === "pc"){ 1300 closeOtherHeaderExclusiveMenus($menuId); 1301 } 1302 }else{ 1303 $scate.removeClass("choice"); 1304 $(this).attr('aria-expanded', 'false'); 1305 $(this).next().attr('aria-hidden', 'true'); 1306 } 1307 }); 1308 1309 // pscloseãfocusoutå¦çã¯æ¢åã®ã¾ã¾ç§»æ¤ 1310 $('.psclose',this).on('click keydown', function(e){ 1311 if (e.type === 'keydown' && e.keyCode !== 13) return; 1312 e.preventDefault(); 1313 e.stopPropagation(); 1314 var $menuButton = $scate.children('.hnmenu'); 1315 $ul.slideUp(); 1316 $scate.removeClass('choice'); 1317 $menuButton.removeClass('choice').attr('aria-expanded', 'false'); 1318 $ul.attr('aria-hidden', 'true'); 1319 if(e.type === 'keydown'){ $menuButton.focus(); } 1320 }); 1321 }); 1322 1323 //--------------------------------------------------------------- 1324 // æ¤ç´¢ï¼PCã®ã¿ééãSMPã¯å¸¸æè¡¨ç¤ºï¼ãã©ã¼ã ããã®ã¾ã¾åºãï¼ 1325 $('#header #sitesearch.bmenu').each(function(){ 1326 var $scate = $(this); 1327 var $btn = $scate.children('.hnmenu'); 1328 var $ul = $(this).children('*').not('.hnmenu, .psclose'); 1329 var $psclose = $scate.find('.psclose'); 1330 1331 $btn.off(); 1332 $psclose.off(); 1333 1334 if(mode === "smp"){ 1335 //â¼ééãããã¦å¸¸æè¡¨ç¤º 1336 $ul.show().removeAttr('style').attr('aria-hidden', 'false'); 1337 $btn.hide(); // ãã¿ã³èªä½ã¯ä¸è¦ï¼CSSã§pconlyæå®ã§ãå¯ï¼ 1338 $psclose.hide(); // éãããã¿ã³ãä¸è¦ 1339 $scate.removeClass('choice'); 1340 }else{ 1341 //â¼PCï¼å¾æ¥éãã®éé 1342 $ul.hide(); 1343 $btn.show(); 1344 $psclose.show(); 1345 1346 $btn.on('click', function(){ 1347 $ul.slideToggle(); 1348 $(this).toggleClass("choice"); 1349 if($(this).hasClass("choice")){ 1350 $scate.addClass("choice"); 1351 $(this).attr('aria-expanded', 'true'); 1352 $ul.attr('aria-hidden', 'false'); 1353 closeOtherHeaderExclusiveMenus('#header #sitesearch'); 1354 }else{ 1355 $scate.removeClass("choice"); 1356 $(this).attr('aria-expanded', 'false'); 1357 $ul.attr('aria-hidden', 'true'); 1358 } 1359 }); 1360 1361 $psclose.on('click keydown', function(e){ 1362 if (e.type === 'keydown' && e.keyCode !== 13) return; 1363 e.preventDefault(); 1364 e.stopPropagation(); 1365 $ul.slideUp(); 1366 $scate.removeClass('choice'); 1367 $btn.removeClass('choice').attr('aria-expanded', 'false'); 1368 $ul.attr('aria-hidden', 'true'); 1369 if(e.type === 'keydown'){ $btn.focus(); } 1370 }); 1371 } 1372 }); 1373 //--------------------------------------------------------------- 1374 //ç·æ¥æ å ±ï¼#kinkyubtn â #kinkyuareaï¼ 1375 if($('#kinkyubtn').length && $('#kinkyuarea').length){ 1376 1377 var $kinkyuBtn = $('#kinkyubtn button'); 1378 var $kinkyuP = $('#kinkyubtn p'); 1379 var $kinkyuArea = $('#kinkyuarea'); 1380 var $menuBtn = $('#smpmenup2 .hnmenu'); 1381 1382 $kinkyuBtn.off('click.kinkyu keydown.kinkyufocus'); 1383 $kinkyuArea.off('keydown.kinkyufocus'); 1384 $kinkyuArea.find('.psclose').off('click.kinkyu keydown.kinkyu'); 1385 $menuBtn.off('keydown.kinkyufocus'); 1386 1387 if($kinkyuP.hasClass('active')){ 1388 $kinkyuArea.attr('aria-hidden', 'false'); 1389 }else{ 1390 $kinkyuArea.hide().attr('aria-hidden', 'true'); 1391 } 1392 1393 //â¼å¤æ´ï¼slideToggleã®ã³ã¼ã«ããã¯ã§updateHeaderFloatãå¼ã¶ 1394 $kinkyuBtn.on('click.kinkyu', function(){ 1395 $kinkyuArea.slideToggle(function(){ 1396 if(typeof updateHeaderFloat === 'function'){ 1397 updateHeaderFloat(); 1398 } 1399 }); 1400 $kinkyuP.toggleClass('active'); 1401 1402 if($kinkyuP.hasClass('active')){ 1403 $(this).attr('aria-expanded', 'true'); 1404 $kinkyuArea.attr('aria-hidden', 'false'); 1405 closeOtherHeaderExclusiveMenus('#kinkyubtn'); 1406 }else{ 1407 $(this).attr('aria-expanded', 'false'); 1408 $kinkyuArea.attr('aria-hidden', 'true'); 1409 } 1410 }); 1411 1412 function getKinkyuFocusable(){ 1413 return $kinkyuArea 1414 .find('a, button, input, select, textarea, [tabindex]:not
1414([tabindex="-1"])') 1415 .filter(':visible'); 1416 } 1417 1418 $kinkyuBtn.on('keydown.kinkyufocus', function(e){ 1419 if(e.keyCode === 9 && !e.shiftKey && $kinkyuP.hasClass('active')){ 1420 var $focusable = getKinkyuFocusable(); 1421 if($focusable.length){ 1422 e.preventDefault(); 1423 $focusable.first().focus(); 1424 } 1425 } 1426 }); 1427 1428 $kinkyuArea.on('keydown.kinkyufocus', 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])', function(e){ 1429 var $focusable = getKinkyuFocusable(); 1430 var $first = $focusable.first(); 1431 var $last = $focusable.last(); 1432 1433 if(e.keyCode === 9 && !e.shiftKey && $(this).is($last)){ 1434 e.preventDefault(); 1435 $menuBtn.focus(); 1436 } 1437 else if(e.keyCode === 9 && e.shiftKey && $(this).is($first)){ 1438 e.preventDefault(); 1439 $kinkyuBtn.focus(); 1440 } 1441 }); 1442 1443 $menuBtn.on('keydown.kinkyufocus', function(e){ 1444 if(e.keyCode === 9 && e.shiftKey && $kinkyuP.hasClass('active')){ 1445 var $focusable = getKinkyuFocusable(); 1446 if($focusable.length){ 1447 e.preventDefault(); 1448 $focusable.last().focus(); 1449 } 1450 } 1451 }); 1452 1453 //â¼å¤æ´ï¼éãããã¿ã³ã§ãupdateHeaderFloatãå¼ã¶ 1454 $kinkyuArea.find('.psclose').on('click.kinkyu keydown.kinkyu', function(e){ 1455 if (e.type === 'keydown' && e.keyCode !== 13) { 1456 return; 1457 } 1458 e.preventDefault(); 1459 e.stopPropagation(); 1460 1461 $kinkyuArea.slideUp(function(){ 1462 if(typeof updateHeaderFloat === 'function'){ 1463 updateHeaderFloat(); 1464 } 1465 }); 1466 $kinkyuP.removeClass('active'); 1467 $kinkyuBtn.attr('aria-expanded', 'false'); 1468 $kinkyuArea.attr('aria-hidden', 'true'); 1469 1470 if(e.type === 'keydown'){ 1471 $kinkyuBtn.focus(); 1472 } 1473 }); 1474 } 1475 //--------------------------------------------------------------------------- 1476 //ãè¡æ¿ãããã¨ããã¨ãï¼ç®ç奿¤ç´¢ï¼PCï¼ã¹ããï¼ 1477 $('#header #smpmenup1.bmenu , #header #smpmenup2.bmenu').each(function(){ 1478 1479 var $bmenu = $(this); 1480 var $menuButton = $bmenu.children('.hnmenu'); // â ç´ä¸ã®ã¿ 1481 var $openMenu = $bmenu.children('.openmenu'); // â ç´ä¸ã®ã¿ï¼#smpmenup1menuï¼ 1482 var $psclose = $openMenu.children('.psclose'); // â ç´ä¸ã®ã¿ï¼ç¿»è¨³/æ¤ç´¢ã®pscloseã¯å«ã¾ããªãï¼ 1483 1484 $menuButton.off(); 1485 $psclose.off(); 1486 1487 if(!$menuButton.hasClass("view_pc")){ 1488 $menuButton.addClass("view_pc"); 1489 $menuButton.removeClass("choice"); 1490 $menuButton.attr('aria-expanded', 'false'); 1491 $openMenu.attr('aria-hidden', 'true'); 1492 } 1493 if($menuButton.hasClass("view_smp")){ 1494 $menuButton.removeClass("view_smp"); 1495 } 1496 1497 var $ul2 = $openMenu; // ç´ä¸ã®openmenuã®ã¿ãéé対象㫠1498 1499 var isMenuOpen = $menuButton.hasClass('choice'); 1500 var $currentButton = $menuButton; 1501 1502 if(!$menuButton.hasClass('choice')){ 1503 $ul2.hide(); 1504 $bmenu.toggleClass("pscatenone"); 1505 } 1506 1507 $menuButton.on('click', function() { 1508 $ul2.slideToggle(); 1509 $menuButton.toggleClass("choice"); 1510 $bmenu.toggleClass("pscatenone"); 1511 1512 if(!$menuButton.hasClass("choice")){ 1513 $menuButton.attr('aria-expanded', 'false'); 1514 $ul2.attr('aria-hidden', 'true'); 1515 } else { 1516 $menuButton.attr('aria-expanded', 'true'); 1517 $ul2.attr('aria-hidden', 'false'); 1518 setupFocusTrap($menuButton); 1519 closeOtherHeaderExclusiveMenus('#header #' + $bmenu.attr('id')); 1520 } 1521 1522 if($('body').hasClass('viewmode_smp')){ 1523 bodyopen(); 1524 gnavismpheight(); 1525 }else{ 1526 bodypcopen(); 1527 } 1528 1529 //ä»ãéããï¼å¤æ´ãªãï¼ 1530 menuSwitch = function($id){ 1531 if($('#' + $id + ' .hnmenu').hasClass('choice')){ 1532 $('#' + $id + '.bmenu').children('.openmenu').slideUp(); 1533 $('#' + $id + '.bmenu').children('.hnmenu').removeClass("choice").attr('aria-expanded', 'false'); 1534 $('#' + $id + '.bmenu').children('.openmenu').attr('aria-hidden', 'true'); 1535 $('#' + $id + '.bmenu').addClass("pscatenone"); 1536 $('#' + $id + ' .openmenu').find('*').off('.menutrap'); 1537 $('#' + $id + ' .openmenu').off('.menutrap'); 1538 $('#' + $id + ' .hnmenu').off('.menubutton'); 1539 if($('body').hasClass('viewmode_smp')){ 1540 bodyopen(); 1541 gnavismpheight(); 1542 }else{ 1543 bodypcopen(); 1544 } 1545 } 1546 }; 1547 1548 if($('body').hasClass('viewmode_smp')){ 1549 $('#smpmenu .hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 1550 menuSwitch("smpmenup1"); 1551 menuSwitch("smpmenup2"); 1552 }); 1553 } 1554 $('#smpmenup1').children('.hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 1555 menuSwitch("smpmenup2"); 1556 }); 1557 $('#smpmenup2').children('.hnmenu').off('click.menuswitch').on('click.menuswitch', function() { 1558 menuSwitch("smpmenup1"); 1559 }); 1560 }); 1561 1562 //éãããã¿ã³ï¼ç´ä¸ã®pscloseã®ã¿å¯¾è±¡ï¼ 1563 $psclose.on('click keydown', null, function(e) { 1564 if (e.type === 'keydown' && e.keyCode !== 13) return; 1565 e.preventDefault(); 1566 e.stopPropagation(); 1567 1568 $menuButton.off('keydown.menubutton'); 1569 $openMenu.find('*').off('.menutrap'); 1570 $openMenu.off('.menutrap'); 1571 1572 if (e.type === 'keydown') { 1573 $menuButton.focus(); 1574 } 1575 1576 $ul2.slideUp(); 1577 $menuButton.removeClass("choice").attr('aria-expanded', 'false'); 1578 $ul2.attr('aria-hidden', 'true'); 1579 1580 if($('body').hasClass('viewmode_smp')){ 1581 bodyopen(); 1582 gnavismpheight(); 1583 }else{ 1584 bodypcopen(); 1585 } 1586 }); 1587 1588 if(mode=="pc" && isMenuOpen){ 1589 setTimeout(function() { 1590 setupFocusTrap($currentButton); 1591 }, 100); 1592 } 1593 1594 // ãã©ã¼ã«ã¹ãã©ããã®è¨å®é¢æ° 1595 function setupFocusTrap($menuButton) { 1596 var $menu = $menuButton.next('.openmenu'); 1597 var menuId = $menu.attr('id'); 1598 1599 $menu.find('*').off('focusout.menutrap keydown.menutrap'); 1600 $menuButton.off('keydown.menubutton'); 1601
1602 var $focusableElements = $menu.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible'); 1603 var $lastFocusable = $focusableElements.last(); 1604 1605 //â¼å ±éåï¼éããå¦çãã¾ã¨ãã 1606 function closeThisMenu(){ 1607 $menu.slideUp(); 1608 $menuButton.removeClass("choice"); 1609 $menuButton.attr('aria-expanded', 'false'); 1610 $menu.attr('aria-hidden', 'true'); 1611 $menu.parent().addClass("pscatenone"); 1612 1613 //â¼ä¿®æ£ï¼4ç®æãã¹ã¦ãããéããã¨ã§çµ±ä¸ 1614 if($('body').hasClass('viewmode_smp')){ 1615 bodyopen(); 1616 gnavismpheight(); 1617 }else{ 1618 bodypcopen(); 1619 } 1620 } 1621 1622 // â â¡ãEscape / Shift+Tabï¼ã¡ãã¥ã¼ãã¿ã³ã§æ¼ãããå ´å 1623 $menuButton.on('keydown.menubutton', function(event) { 1624 if (event.keyCode === 27 && $menuButton.hasClass("choice")) { 1625 event.preventDefault(); 1626 closeThisMenu(); 1627 } 1628 else if (event.shiftKey && event.keyCode === 9 && $menuButton.hasClass("choice")) { 1629 event.preventDefault(); 1630 closeThisMenu(); 1631 1632 setTimeout(function() { 1633 var $allFocusable = $('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible'); 1634 var currentIndex = $allFocusable.index($menuButton); 1635 if (currentIndex > 0) { 1636 $allFocusable.eq(currentIndex - 1).focus(); 1637 } 1638 }, 10); 1639 } 1640 }); 1641 1642 // â¢ãEscapeï¼ã¡ãã¥ã¼å ã§æ¼ãããå ´å 1643 $menu.on('keydown.menutrap', function(event) { 1644 if (event.keyCode === 27) { 1645 event.preventDefault(); 1646 $menuButton.focus(); 1647 closeThisMenu(); 1648 } 1649 }); 1650 1651 // â£ãTabï¼æå¾ã®è¦ç´ ããæããå ´åï¼.pscloseãããã«è©²å½ï¼ 1652 $lastFocusable.on('focusout.menutrap', function(event) { 1653 setTimeout(function() { 1654 var activeElement = $(document.activeElement); 1655 if (!activeElement.closest('#' + menuId).length && !activeElement.is($menuButton)) { 1656 closeThisMenu(); 1657 } 1658 }, 10); 1659 }); 1660 } 1661 }); 1662 1663} 1664//â²dropdown_menu 1665 1666//â¼common.js 1667(function(){ 1668 var $ = FI.jQuery; 1669 $(function() { 1670 //æ¬æã¸ 1671 $("#blockskip a").on('focus',function(){ 1672 $(this).addClass("show"); 1673 }); 1674 $("#blockskip a").on('blur',function(){ 1675 $(this).removeClass("show"); 1676 }); 1677 //ããã·ã¥ã使ããã«ã¹ã¯ãã¼ã« 1678 $('a[href="#HONBUN"]').on('click', function(e) { 1679 e.preventDefault(); 1680 var $target = $('#HONBUN'); 1681 if ($target.length) { 1682 $target[0].scrollIntoView(); 1683 $target.trigger('focus'); 1684 } 1685 }); 1686 1687 //ãã£ãã·ã§ã³ã®ããç»åã®ã¢ã¯ã»ã·ããªãã£å¯¾å¿ 1688 $("figure").each(function(i){ 1689 $(this).attr("role","group"); 1690 i += 1; 1691 $(this).attr("aria-labelledby","figimage" + i); 1692 $(this).children("figcaption").attr("id","figimage" + i); 1693 }); 1694 1695 //ããã¼ãç»åãå²ã 1696 var targetSelectors = '.imageleft, .imageright'; 1697 // 対象è¦ç´ ãé çªã«å¦ç 1698 $(targetSelectors).each(function(index, element) { 1699 // æ¢ã«imagewrapã§å²ã¾ãã¦ããªãå ´åã®ã¿å¦ç 1700 if (!$(element).parent().hasClass('imagewrap')) { 1701 var $currentElement = $(element); 1702 var $wrapElements = $currentElement; 1703 // é£ç¶ããè¦ç´ ãã°ã«ã¼ãå 1704 while ($currentElement.next().is(targetSelectors)) { 1705 $currentElement = $currentElement.next(); 1706 $wrapElements = $wrapElements.add($currentElement); 1707 } 1708 // è¦ç´ ãimagewrapã§å²ã 1709 $wrapElements.wrapAll('<div class="imagewrap"></div>'); 1710 1711 // imagewrapã®æ¬¡ã®è¦ç´ ãp,ol,ul以å¤ã®å ´åãclearfixã¯ã©ã¹ã追å 1712 var $imagewrap = $wrapElements.parent('.imagewrap'); 1713 if (!$imagewrap.next().is('p , ol , ul')) { 1714 $imagewrap.addClass('clearfix'); 1715 } 1716 } 1717 }); 1718 1719 //imageleftï¼imageleftãå«ãimagewrapï¼ã®å¾ãã®ulãolã«clearãä»ä¸ 1720 $('#content, #content2').each(function() { 1721 var $container = $(this); 1722 var selectors = '.imageleft, .imageright, .imagecenter, .imagewrap, h2, h3, h4, h5, h6'; 1723 var $elements = $container.find(selectors); 1724 1725 // ç¾å¨ã®ããã¼ãç¶æ ã追跡 1726 var hasLeftFloat = false; 1727 1728 $elements.each(function() { 1729 var $element = $(this); 1730 1731 // imagewrapã®å ´åãä¸ã«imageleftãããããã§ã㯠1732 if ($element.hasClass('imagewrap')) { 1733 if ($element.find('.imageleft').length > 0) { 1734 hasLeftFloat = true; 1735 } else { 1736 hasLeftFloat = false;
1737 } 1738 // imageleftã®å ´å 1739 } else if ($element.hasClass('imageleft')) { 1740 hasLeftFloat = true; 1741 // imageright, imagecenter, è¦åºãã®å ´å 1742 } else{ 1743 hasLeftFloat = false; 1744 } 1745 1746 // ç¾å¨ã®è¦ç´ ã®å¾ãã«ããulãolãå¦ç 1747 var $current = $element; 1748 while ($current.next().length && !$current.next().is(selectors)) { 1749 if ($current.next().is('ul, ol') && hasLeftFloat) { 1750 $current.next().addClass('clear'); 1751 } 1752 $current = $current.next(); 1753 } 1754 }); 1755 }); 1756 1757 //æ°åã®åéãè©°ããå¦çï¼ãã¼ã¸IDãæ´æ°æ¥ãæ°çæ¥ä»ãç½å®³æ å ±é ä¿¡æ¥ããããï¼ 1758 $('.box .update .idnumber, .fi_like').each(function() { 1759 // ããã¹ããã¼ãã®ã¿ãå¦ç 1760 $(this).contents().each(function() { 1761 if (this.nodeType === 3) { // ããã¹ããã¼ãã®å ´å 1762 var text = this.nodeValue; 1763 // 2æ¡ä»¥ä¸ã®æ°åã<span>ã§å²ã 1764 var replaced = text.replace(/(\d{2,})/g, '<span class="spacing">$1</span>'); 1765 if (text !== replaced) { 1766 $(this).replaceWith(replaced); 1767 } 1768 } 1769 }); 1770 }); 1771 1772 //ãµãããªãããããæ¥æ¬èªï¼ãã¼ã¸å åãè¾¼ã¿ç 1773 $('.easy').each(function(){ 1774 if($.cookie('__tsutaeruMO')=="easy"){ 1775 //ãããããæ¥æ¬èªããæ¶ã 1776 if($(this).is('#tsutaeru-button-easy')){ 1777 $(this).hide().attr('aria-hidden', 'true'); 1778 $(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label'); 1779 }else{ 1780 $(this).show().attr('aria-hidden', 'false'); 1781 $(this).find('button').attr('aria-pressed', 'true').attr('aria-label', 'ããããæ¥æ¬èªã§è¡¨ç¤ºãã¦ãã¾ã'); 1782 } 1783 }else{ 1784 //ããã¨ã®ãã¼ã¸ãã¿ãããæ¶ã 1785 if($(this).is('#tsutaeru-button-easyreset')){ 1786 $(this).hide().attr('aria-hidden', 'true'); 1787 $(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label'); 1788 }else{ 1789 $(this).show().attr('aria-hidden', 'false'); 1790 $(this).find('button').attr('aria-pressed', 'false').attr('aria-label', 'ããããæ¥æ¬èªã§è¡¨ç¤ºãã¾ã'); 1791 } 1792 } 1793 }); 1794 $('.furigana').each(function(){ 1795 if($.cookie('__tsutaeruMO')=="ruby"){ 1796 //ããµãããªããæ¶ã 1797 if($(this).is('#tsutaeru-button-ruby')){ 1798 $(this).hide().attr('aria-hidden', 'true'); 1799 $(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label'); 1800 }else{ 1801 $(this).show().attr('aria-hidden', 'false'); 1802 $(this).find('button').attr('aria-pressed', 'true').attr('aria-label', 'ãµãããªã表示ãã¦ãã¾ã'); 1803 } 1804 }else{ 1805 //ããµãããªãããããæ¶ã 1806 if($(this).is('#tsutaeru-button-rubyreset')){ 1807 $(this).hide().attr('aria-hidden', 'true'); 1808 $(this).find('button').removeAttr('aria-pressed').removeAttr('aria-label'); 1809 }else{ 1810 $(this).show().attr('aria-hidden', 'false'); 1811 $(this).find('button').attr('aria-pressed', 'false').attr('aria-label', 'ãµãããªã表示ãã¾ã'); 1812 } 1813 } 1814 }); 1815 //ãããããæ¥æ¬èªã夿ãå®è¡ 1816 $('#header #easyjp , #jssmpbtmnavi #easyjp').on('click',function(){ 1817 __tsutaeruMO.start(); 1818 $("#header #tsutaeru-button-easy , #jssmpbtmnavi #tsutaeru-button-easy").hide(); 1819 $("#header #tsutaeru-button-easyreset , #jssmpbtmnavi #tsutaeru-button-easyreset").show(); 1820 }); 1821 //ãã²ãããªãã¤ããã夿ãå®è¡ 1822 $('#header #ruby , #jssmpbtmnavi #ruby').on('click',function(){ 1823 __tsutaeruMO.start({mode:'ruby'}); 1824 $("#header #tsutaeru-button-ruby , #jssmpbtmnavi #tsutaeru-button-ruby").hide(); 1825 $("#header #tsutaeru-button-rubyreset , #jssmpbtmnavi #tsutaeru-button-rubyreset").show(); 1826 }); 1827 //ãããããæ¥æ¬èªããã²ãããªãã¤ãããå¤æãæ¶ã 1828 $('#header #easyjpreset , #jssmpbtmnavi #easyjpreset , #header #rubyreset , #jssmpbtmnavi #rubyreset').on('click',function(){ 1829 __tsutaeruMO.reset(); 1830 $("#header #tsutaeru-button-easyreset , #jssmpbtmnavi #tsutaeru-button-easyreset").hide(); 1831 $("#header #tsutaeru-button-easy , #jssmpbtmnavi #tsutaeru-button-easy").show(); 1832 $("#header #tsutaeru-button-rubyreset , #jssmpbtmnavi #tsutaeru-button-rubyreset").hide(); 1833 $("#header #tsutaeru-button-ruby , #jssmpbtmnavi #tsutaeru-button-ruby").show(); 1834 }); 1835
1836 //æ¤ç´¢çµæã®aria-labelåé¤ 1837 var count = 0; 1838 var timer = setInterval(function() { 1839 count++; 1840 if ($('#googlecontent').length && $('.gsc-refinementHeader').length) { 1841 $('.gsc-refinementHeader').removeAttr("aria-label"); 1842 clearInterval(timer); 1843 } 1844 if (count >= 20) { // 20å(ç´4ç§)ã§è«¦ãã 1845 clearInterval(timer); 1846 } 1847 }, 200); 1848 1849 }); 1850})(); 1851 1852//大ããªæåã§å°å· 1853function printData(){ 1854var target = document.getElementById("printcss"); 1855target.href = target.href.replace("print_dummy","print_l"); 1856var printx = 0; 1857var printSet = setInterval(function() { 1858 printx++; 1859 //çµäºæ¡ä»¶ 1860 if (printx == 1) { 1861 window.print(); 1862 target.href = target.href.replace("print_l","print_dummy"); 1863 clearInterval(printSet); 1864 } 1865}, 500); 1866} 1867 1868//â¼ã»ã«ã³ããããï¼ãã£ã¨è¦ãï¼ 1869(function(){ 1870 var $ = FI.jQuery; 1871 1872 $(function(){ 1873 $('.smenu.secondlist').each(function(){ 1874 var $menu = $(this); 1875 var $ul = $menu.find('ul').first(); 1876 var $button = $menu.find('.morebtn'); 1877 var $label = $button.find('.txtlabel'); 1878 var $heading = $menu.find('h2 > a'); 1879 1880 if(!$ul.length || !$button.length || !$label.length) return; 1881 1882 var groupName = $heading.length 1883 ? ($heading.attr('aria-label') || $heading.text().trim()) 1884 : ''; 1885 1886 var $items = $ul.children('li'); 1887 var visibleCount = 5; 1888 1889 if($items.length <= visibleCount){ 1890 return; // CSSã§display:noneã®ã¾ã¾ããã¿ã³ã¯è¡¨ç¤ºããªã 1891 } 1892 1893 $button.addClass('is-visible'); // ã¯ã©ã¹è¿½å ã§è¡¨ç¤º 1894 1895 $items.each(function(index){ 1896 if(index >= visibleCount){ 1897 $(this).prop('hidden', true); 1898 } 1899 }); 1900 1901 $button.on('click', function(){ 1902 var isExpanded = $menu.toggleClass('is-open').hasClass('is-open'); 1903 1904 $button.attr('aria-expanded', String(isExpanded)); 1905 1906 if(isExpanded){ 1907 $items.each(function(){ 1908 $(this).prop('hidden', false); 1909 }); 1910 1911 $label.text('éãã'); 1912 $button.attr('aria-label', groupName + ' éãã'); 1913 1914 var $firstHiddenItem = $items.eq(visibleCount); 1915 var $link = $firstHiddenItem.find('a').first(); 1916 1917 if($link.length){ 1918 $link.trigger('focus'); 1919 } 1920 }else{ 1921 $button.trigger('focus'); // æç¤ºçã«ãã©ã¼ã«ã¹ãæ»ã 1922 1923 $items.each(function(index){ 1924 $(this).prop('hidden', index >= visibleCount); 1925 }); 1926 1927 $label.text('ãã£ã¨è¦ã'); 1928 $button.attr('aria-label', groupName + ' ãã£ã¨è¦ã'); 1929 } 1930 }); 1931 }); 1932 }); 1933})(); 1934//â²ã»ã«ã³ããããï¼ãã£ã¨è¦ãï¼ 1935//â²common.js 1936 1937//â¼ã¢ã³ã«ã¼ãªã³ã¯ 1938function AnchorLink() { 1939 var $ = FI.jQuery; 1940 //ãã¼ã¸å ãªã³ã¯ 1941 $(".pagetop2 a").off('click').on('click', function(){ 1942 $('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing').trigger('focus'); 1943 $('h1').attr('tabindex', '0'); 1944 $('h1').focus(); 1945 $('h1').attr('tabindex', '-1'); 1946 return false; 1947 }); 1948 1949 //ã¢ã³ã«ã¼ãªã³ã¯ï¼åãã¼ã¸ããé·ç§»æï¼ 1950 $('#anchor a').off('click').on('click', function(){ 1951 var target2 = $($(this).attr("href")); 1952 $('html,body').animate({ scrollTop: target2.offset().top }, 'slow','swing').trigger('focus'); 1953 target2.attr('tabindex', '0'); 1954 target2.focus(); 1955 target2.attr('tabindex', '-1'); 1956 return false; 1957 }); 1958 1959 //ã¤ãã³ãã«ã¬ã³ãã¼ 1960 $("#eventjump a").off('click').on('click', function(){ 1961 $('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top-35 }, 'slow','swing').trigger('focus'); 1962 }); 1963 1964} 1965//â²ã¢ã³ã«ã¼ãªã³ã¯ 1966 1967//â¼é³å£°èªã¿ä¸ããªã¼ãã¼ã®ã¹ã©ã¤ã表示 1968function resetEventListeners() { 1969 var $ = FI.jQuery; 1970 if($("#onsei").length){ 1971 $('#header #readbtn, #jssmpbtmnavi #readbtn').off('click').on('click', function(){ 1972 var $onsei = $(this).closest('#header, #jssmpbtmnavi').find('#onsei'); 1973 $onsei.slideToggle(); 1974 }); 1975 } 1976} 1977//â²é³å£°èªã¿ä¸ããªã¼ãã¼ã®ã¹ã©ã¤ã表示
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.