1/*jslint browser: true*/ 2/*global $, jQuery, alert*/ 3jQuery.noConflict(); 4 5(function ($) { 6 'use strict'; 7 8 var conf = { 9 /** 10 * åæè¨å® 11 */ 12 13 /* ã¹ã ã¼ã¹ã¹ã¯ãã¼ã«ã«é¢ããè¨å® */ 14 smooth_scroll: { 15 // TOPã«æ»ããã¿ã³ã®è¡¨ç¤ºã表示ããã¹ã¯ãã¼ã«é 16 top: 100 17 }, 18 /* ãã¬ã¼ã¯ãã¤ã³ãã«é¢ããè¨å® */ 19 brakepoint: { 20 // ã¬ã¹ãã³ã·ãæã®ãã¬ã¼ã¯ãã¤ã³ãï¼ãã®å¤ä½ä»¥ä¸ã®ç»é¢å¹ ã§PC表示ã«ãªãã¾ãï¼ 21 medium: 768 22 }, 23 lp_header: { 24 // LPã®å ¨ç»é¢è¡¨ç¤ºã®æå¤§å¤ï¼ãã以ä¸ã®é«ãã«ããªãã¨ããå¶éå¤ï¼ 25 max_height: 1500 26 }, 27 /* ã¹ã©ã¤ãã¼ã«é¢ããè¨å® */ 28 slider: { 29 // ã¹ã©ã¤ãã¼ç»åã®åæ¢æé 30 time: 5000, 31 // ãã©ã¦ã¶ã®ã¿ãç§»åãªã©ããæ»ã£ã¦ããéã®ã¹ã©ã¤ãã¼åå§åéå§æé 32 weight: 1000 33 }, 34 /* SNSã«ã¦ã³ãæ°ã«é¢ããè¨å® */ 35 sns: { 36 // ã«ã¦ã³ãã®åæå¤ 37 count: 0 38 } 39 }, 40 41 /* 42 * 以ä¸ã¯æ¬ã¹ã¯ãªããå ã§ä½¿ç¨ãã夿°ç¾¤ã«ãªãã¾ãã 43 */ 44 45 /* SPã¡ãã¥ã¼å±éå¤å®ç¨å¤æ° */ 46 sp_menu_lock = false, 47 scroll_top, 48 49 /* ã¹ã¯ãã¼ã«å¦çç¨ã®ããã¯å¤æ° */ 50 scroll_lock = false, 51 52 /* ã¦ã£ã³ãã¦ã¹ã¯ãã¼ã«æã®å¦çç¨ã®å¤æ° */ 53 topBtn, 54 footerPanel, 55 panelDiff, 56 keniContainer, 57 58 /* ã¢ã³ã«ã¼ãªã³ã¯ç¨ã®å¤æ° */ 59 anchor = localStorage.getItem('anchor'), 60 61 /* SPã®ã°ãã¼ãã«ã¡ãã¥ã¼ç¨å¦çã®å¤æ° */ 62 menu, 63 body, 64 menuBtn, 65 clickSpace, 66 menuWidth, 67 68 /* PCã®ã°ãã¼ãã«ã¡ãã¥ã¼ç¨å¦çã®å¤æ° */ 69 hoverIn, 70 hoverOut, 71 72 /* ã¹ã¯ãã¼ã«ã§ãããã¼ã¨ããã¿ã¼ããã«ãåºå®ç¨ã®å¤æ° */ 73 hdrTop, 74 75 /* ç®æ¬¡ã®ééç¨ã®å¤æ° */ 76 tocList, 77 78 /* SNSãã¿ã³ã®è¨ç½®ã¨ã«ã¦ã³ãæ°ã®åå¾ã®å¤æ° */ 79 pageurl, 80 pagetitle, 81
82 /* ã¹ã©ã¤ãã¼ç¨ã®å¤æ° */ 83 start, 84 $pager = $('.keni-slider-pager'), 85 $slidesWrap = $('.keni-slider_outer'), 86 $nav = $('.keni-slider-nav'), 87 $slides = $('.keni-slider'), 88 $slideImg = $slides.find('img'), 89 current = 0, 90 number = $slideImg.length, 91 windowWidth = $(window).outerWidth(), 92 slider_lock = false, 93 isPc = false; 94 95 96 /** 97 * ç»åã«ãã¦ã¹ã«ã¼ã½ã«ãä¹ã£ãéã«ãèªåçã«ç»åã®ç½®ãæãããã¾ãã 98 * ç»åã®èªåç½®ãæããããã«ã¯ãç»åãã¡ã¤ã«ã®æ«å°¾ã«ã_offãã_onããä»ããã¦ãã ããã 99 * ä¾ï¼ 100 * ã»image_off.jpg 101 * ã»image_on.jpg 102 */ 103 104 /* ãã¼ã¸èªã¿è¾¼ã¿æã«å¯¾è±¡ã¨ãªãè¦ç´ ã«ã¯ã©ã¹ãæ¯ãå¦ç */ 105 $('img,input').each(function () { 106 var src = $(this).attr('src'); 107 if (src) { 108 if (src.match(/_off\./) || src.match(/_on\./)) { 109 $(this).addClass('fn-over-img'); 110 } 111 } 112 }); 113 114 /* 対象ã¨ãªãè¦ç´ ã«ãã¦ã¹ã«ã¼ã½ã«ãä¹ã£ãéã«ç»åãå·®ãæ¿ããå¦ç */ 115 $('.fn-over-img').hover(function () { 116 var src = $(this).attr('src'); 117 if (src.match(/_off\./)) { 118 $(this).attr('src', src.replace('_off.', '_on.')); 119 } 120 if (src.match(/_on\./)) { 121 $(this).attr('src', src.replace('_on.', '_off.')); 122 } 123 }); 124 125 126 /** 127 * ã¦ã£ã³ãã¦ã¹ã¯ãã¼ã«æã®å¦ç 128 * ã¹ã¯ãã¼ã«éã«å¿ãã¦ããã¼ã¸ä¸é¨ã®ãä¸ã¸æ»ãããã¿ã³ãããã«ç¸å½ãããã¿ã³é¡ã®è¡¨ç¤ºé表示ãã³ã³ããã¼ã«ãã¾ãã 129 * a. PC 130 * â ãã¼ã¸ä¸é¨ã«ãä¸ã¸æ»ãããã¿ã³ã表示ãã¾ã 131 * b. ã¹ãã¼ããã©ã³ 132 * â ãã¼ã¸ä¸é¨ã«ãä¸ã¸æ»ãããããåãåããããªã©å°ç·ãã¿ã³é¡ã表示ãã¾ã 133 */ 134 135 topBtn = $('.page-top'); 136 footerPanel = $('.keni-footer-panel_wrap'); 137 panelDiff = $('.keni-footer-panel_wrap').outerHeight(); 138 keniContainer = $('.keni-container'); 139 140 topBtn.hide(); 141 footerPanel.addClass('fn-footer-panel'); 142 143 // ããã¿èªåééæ 144 if (0 < lso) { 145 footerPanel.addClass('is-active'); 146 } 147 148 $(window).scroll(function () { 149 150 if (window.innerWidth < conf.brakepoint.medium && $('.utility-menu').length > 0) { 151 152 topBtn.fadeOut(); 153 154 if (!keniContainer.hasClass('fn-keni-container') && 0 !== lso) { 155 keniContainer.addClass('fn-keni-container'); 156 keniContainer.css('padding-bottom', panelDiff + 'px'); 157 } 158 // ãããåºå®æ 159 if (0 < lso) {} else { 160 if ($(this).scrollTop() > conf.smooth_scroll.top) { 161 if (!footerPanel.hasClass('is-active') && scroll_lock === false) { 162 footerPanel.addClass('is-active'); 163 } 164 } else { 165 if (footerPanel.hasClass('is-active') && scroll_lock === false) { 166 footerPanel.removeClass('is-active'); 167 } 168 } 169 } 170 171 } else { 172 173 if (keniContainer.hasClass('fn-keni-container')) { 174 keniContainer.removeClass('fn-keni-container'); 175 keniContainer.css('padding-bottom', '0'); 176 } 177 178 if ($(this).scrollTop() > conf.smooth_scroll.top) { 179 topBtn.fadeIn(); 180 } else { 181 topBtn.fadeOut(); 182 } 183 } 184 }); 185 186 187 /** 188 * link ref="canonical"ã«æå®ããããhref ãåå¾ãã 189 * link ã¿ã°ã® ref = canonical ã«æå®ããããhref 190 * è¦ã¤ãããªãã£ãå ´åãnull 191 * @return href | null 192 */ 193 function getCanonicalUrl() { 194 195 var links = document.getElementsByTagName("link"); 196 for (var i = 0; i < links.length; i++) { 197 if (links[i].rel) { 198 if (links[i].rel.toLowerCase() == "canonical") { 199 return links[i].href; 200 } 201 } 202 } 203 204 return null; 205 } 206 207 /** 208 * ã¢ã³ã«ã¼ãªã³ã¯ãã¯ãªãã¯ããéã®å¦ç 209 * ã¹ã ã¼ãºã¹ã¯ãã¼ã«ã«ã¯2éãã®åããå²ãå½ã¦ããã¦ãã¾ã 210 * 1. ãã¼ã¸å ç§»å 211 * â 該å½ããIDã®è¦ç´ ã¾ã§ã¹ã ã¼ãºã¹ã¯ãã¼ã«ãã¾ã 212 * 2. ä»ãã¼ã¸ã¸ã®ã¢ã³ã«ã¼ãªã³ã¯ 213 * â ãã¼ã¸é·ç§»å¾ã«è©²å½ããIDã®è¦ç´ ã¾ã§ã¹ã ã¼ãºã¹ã¯ãã¼ã«ãã¾ã 214 */ 215 // --- 216 function hideFooterPanel() { 217 if (footerPanel.hasClass('is-active')) { 218 footerPanel.removeClass('is-active'); 219 } 220 } 221 222 // --- 223 224 /* ã¢ã³ã«ã¼ã¸ã®ã¹ã¯ãã¼ã«ï¼1ããã³2ã§å ±éå©ç¨ï¼ */ 225 function scrollToAnchor(s) { 226 var target = (s === "#" || s === "" ? 'html' : s), 227 228 offsetTop, 229 fltHdrHeight = $('.keni-header_wrap').height(); 230 231 offsetTop = $(target).offset().top; 232 233 // ----- 234 if (0 >= lso && offsetTop <= conf.smooth_scroll.top) { 235 hideFooterPanel(); 236 } 237 238 var keniHeaderCont = 0; 239 240 if (window.innerWidth < conf.brakepoint.medium) { 241 $('html,body').animate({ 242 scrollTop: offsetTop - fltHdrHeight + keniHeaderCont 243 }, 'slow', 'swing', function () { 244 scroll_lock = false;
245 }); 246 } else { 247 $('html,body').animate({ 248 scrollTop: offsetTop 249 }, 'slow', 'swing', function () { 250 scroll_lock = false; 251 }); 252 } 253 return false; 254 } 255 256 /* 1. ãã¼ã¸å ç§»åã§ã¹ã¯ãã¼ã«ããå¦ç */ 257 $('a').on('click', function () { 258 let href = $(this).attr('href'); 259 let page_transition_flg = isPageTransition(this); 260 if (page_transition_flg === true) { 261 // å¤é¨ãªã³ã¯ã¾ãã¯åä¸ãã¡ã¤ã³ã®å¥ãã¼ã¸ 262 return true; 263 } else { 264 scroll_lock = true; 265 sp_menu_lock = false; 266 $('.keni-gnav_inner').hide(); 267 $('#click-space').css('height', '0'); 268 $('.keni-gnav_btn_icon-close').addClass('keni-gnav_btn_icon-open').removeClass('keni-gnav_btn_icon-close'); 269 // ãããåºå®æ 270 if (0 === shf) { 271 $('.keni-header_wrap').addClass('fixed'); 272 } 273 $(body).css('overflow', 'scroll'); 274 if (href.indexOf('#') >= 0) { 275 href = href.substr(href.indexOf('#')); 276 } 277 return scrollToAnchor(href); 278 } 279 }); 280 281 /** 282 * isPageTransition 283 * ã¯ãªãã¯ããaè¦ç´ ã®href屿§ããã¼ã¸é·ç§»ãããå¤å® 284 * @param this_a_obj 285 * @return true | false 286 */ 287 function isPageTransition(this_a_obj) { 288 let this_location = location.origin + location.pathname; 289 if (this_location.toLowerCase() !== this_a_obj['href'].split('#')[0].toLowerCase()) { 290 return true; 291 } else { 292 return false; 293 } 294 } 295 296 /* ãã¼ã¸èªã¿è¾¼ã¿æã«ãåçã«è¦ç´ ã®é«ããå¤ããLPãããã¼ããªãå ´åã§ãanchorã«å¤ãããå ´åã¢ã³ã«ã¼ã¸ã¹ã¯ãã¼ã«ãã */ 297 if (!$('.keni-lp .keni-header_wrap').length && anchor) { 298 scrollToAnchor(anchor); 299 anchor = null; 300 localStorage.removeItem('anchor'); 301 } 302 303 304 /** 305 * SPã®ã°ãã¼ãã«ã¡ãã¥ã¼ç¨å¦ç 306 */ 307 308 menu = $('.keni-gnav_inner'); 309 body = $(document.body); 310 menuBtn = $('.keni-gnav_btn'); 311 clickSpace = $('#click-space'); 312 menuWidth = menu.outerWidth(); 313 314 $(window).resize(function () { 315 var menuWidth = menu.outerWidth(); 316 }); 317 318 if ($('.keni-gnav').hasClass('keni-gnav-scrolling-touch')) { 319 $('.keni-gnav_inner').css({ 320 '-webkit-overflow-scrolling': 'touch', 321 'overflow-scrolling': 'touch' 322 }); 323 } 324 325 menuBtn.on('click', function () { 326 327 if ($(this).find('span').hasClass('keni-gnav_btn_icon-open')) { 328 sp_menu_lock = true; 329 scroll_top = $(window).scrollTop(); 330 menu.slideDown(); 331 $(this).find('.keni-gnav_btn_icon-open').addClass('keni-gnav_btn_icon-close'); 332 $(this).find('.keni-gnav_btn_icon-open').removeClass('keni-gnav_btn_icon-open'); 333 clickSpace.css({ 334 'width': '100%', 335 'height': '100%' 336 }); 337 $(body).css('overflow', 'hidden'); 338 $('.keni-gnav_inner').css({ 339 'bottom': '0' 340 }); 341 } else { 342 menu.slideUp('fast'); 343 $(this).find('.keni-gnav_btn_icon-close').addClass('keni-gnav_btn_icon-open'); 344 $(this).find('.keni-gnav_btn_icon-close').removeClass('keni-gnav_btn_icon-close'); 345 clickSpace.css({ 346 'width': 0, 347 'height': 0 348 }); 349 $('.keni-container').css({ 350 'position': 'static' 351 }); 352 $(body).css('overflow', 'scroll'); 353 $('.keni-gnav_inner').css({ 354 'bottom': '0' 355 }); 356 $(window).scrollTop(scroll_top); 357 sp_menu_lock = false; 358 scroll_top = 0; 359 } 360 }); 361 362 clickSpace.on('click', function () { 363 menu.slideUp('fast'); 364 menuBtn.find('.keni-gnav_btn_icon-close').addClass('keni-gnav_btn_icon-open'); 365 menuBtn.find('.keni-gnav_btn_icon-close').removeClass('keni-gnav_btn_icon-close'); 366 clickSpace.css({ 367 'width': 0, 368 'height': 0 369 }); 370 $('.keni-container').css({ 371 'position': 'static' 372 }); 373 $('.keni-gnav_inner').css({ 374 'bottom': '0' 375 }); 376 $(window).scrollTop(scroll_top); 377 $(body).css('overflow', 'scroll'); 378 sp_menu_lock = false; 379 scroll_top = 0; 380 }); 381 382 $('.keni-gnav li').has('ul').append('<span class="keni-gnav-child_btn"></span>'); 383 $('.keni-gnav li').has('ul').addClass('keni-gnav-child_btn_icon-open').addClass('fn-gnav-toggle-children'); 384 385 $(document).on('click', '.keni-gnav-child_btn', function () { 386 if ($(this).parent('li').hasClass('keni-gnav-child_btn_icon-open')) { 387 $(this).parent('li').addClass('keni-gnav-child_btn_icon-close'); 388 $(this).parent('li').removeClass('keni-gnav-child_btn_icon-open'); 389 $(this).siblings('li').slideDown(); 390 } else { 391 $(this).parent('li').addClass('keni-gnav-child_btn_icon-open'); 392 $(this).parent('li').removeClass('keni-gnav-child_btn_icon-close');
393 $(this).siblings('li').slideUp(); 394 } 395 }); 396 397 $(document).on('click', '.btn_share', function () { 398 $(".keni-footer-panel_sns").slideToggle('fast'); 399 }); 400 401 402 /** 403 * PCã®ã°ãã¼ãã«ã¡ãã¥ã¼ç¨å¦ç 404 */ 405 406 hoverIn = function () { 407 $(this).addClass('keni-gnav-child_btn_icon-close'); 408 $(this).removeClass('keni-gnav-child_btn_icon-open'); 409 }; 410 hoverOut = function () { 411 $(this).addClass('keni-gnav-child_btn_icon-open'); 412 $(this).removeClass('keni-gnav-child_btn_icon-close'); 413 }; 414 415 function desktopNav() { 416 if (window.innerWidth > conf.brakepoint.medium) { 417 $('.keni-gnav li').has('ul').hover(hoverIn, hoverOut); 418 } else { 419 $('.keni-gnav li').has('ul').off('mouseenter mouseleave'); 420 } 421 } 422 423 desktopNav(); 424 $(window).resize(function () { 425 desktopNav(); 426 }); 427 428 429 /** 430 * ã¹ã¯ãã¼ã«ã§ãããã¼ã¨ããã¿ã¼ããã«ãåºå® 431 */ 432 433 hdrTop = $('.keni-header_wrap').offset().top; 434 435 function resetPanel() { 436 // ããã«åè¨å® 437 $('.keni-header_wrap').removeClass('fixed'); 438 $('.keni-container').css('padding-top', 0); 439 $('.keni-header_col1 .keni-header_cont').show('fast'); 440 $('.keni-gnav_btn').removeClass('fixed'); 441 $('.keni-footer-panel_wrap').removeClass('fixed-bottom'); 442 $('.keni-container').css('padding-bottom', 0); 443 } 444 445 $(window).on('scroll resize', function () { 446 447 // SPã¡ãã¥ã¼ãéå±éæã«ã®ã¿æ¬åä½ãè¡ãã¾ã 448 if (sp_menu_lock === false) { 449 450 var hdr = $('.keni-header_wrap'), 451 ftrPanel = $('.keni-footer-panel_wrap'), 452 gnavBtn = $('.keni-gnav_btn'), 453 hdrHeight = $('.keni-header_wrap').outerHeight(), 454 ftrPanelHeight = $('.keni-footer-panel_outer').height(); 455 456 if (window.innerWidth < conf.brakepoint.medium) { 457 if ($(window).scrollTop() > hdrTop) { 458 // ãããåºå®æ 459 if (0 === shf) { 460 hdr.addClass('fixed'); 461 $('.keni-container').css('padding-top', hdrHeight); 462 $('.keni-header_col1 .keni-header_cont').hide('fast'); 463 gnavBtn.addClass('fixed'); 464 ftrPanel.addClass('fixed-bottom'); 465 } 466 $('.keni-container').css('padding-bottom', ftrPanelHeight); 467 } else { 468 // ãããåºå®ãããã¿åºå®ï¼éããã¾ã¾ï¼æ 469 if (0 !== lso || 0 === shf ) { 470 resetPanel(); 471 } 472 } 473 } else { 474 // ãããåºå®ãããã¿åºå®ï¼éããã¾ã¾ï¼æ 475 if (0 !== lso || 0 === shf ) { 476 resetPanel(); 477 } 478 } 479 } 480 }); 481 482 483 /** 484 * ãã¼ãã¸ã¥ã¢ã«ãç»é¢ã®é«ããã£ã±ãã«ãããå ´åã®å¦ç 485 */ 486 487 function lpHeader() { 488 489 var winHeight = $(window).height(), 490 lpHdrHeight = ($('.keni-lp .keni-header_wrap').length) ? $('.keni-lp .keni-header_wrap').height() : 0, 491 lpGnavHeight = ($('.keni-lp .keni-gnav_wrap').length) ? $('.keni-lp .keni-gnav_wrap').height() : 0; 492 493 if (window.innerWidth < conf.brakepoint.medium) { 494 $('.keni-lp .keni-mv_outer').css({ 495 height: (winHeight - lpHdrHeight) + 'px', 496 maxHeight: conf.lp_header.max_height + 'px' 497 }); 498 } else { 499 $('.keni-lp .keni-mv_outer').css({ 500 height: (winHeight - lpHdrHeight - lpGnavHeight) + 'px', 501 maxHeight: conf.lp_header.max_height + 'px' 502 }); 503 } 504 /* è¦ç´ ã®é«ãã»ããå¾ãanchorã«å¤ãããå ´åã¢ã³ã«ã¼ã¸ã¹ã¯ãã¼ã«ãã */ 505 if (anchor) { 506 scrollToAnchor(anchor); 507 anchor = null; 508 localStorage.removeItem('anchor'); 509 } 510 } 511 512 lpHeader(); 513 $(window).resize(function () { 514 lpHeader(); 515 }); 516 517 518 /** 519 * ã¢ã³ã¼ãã£ãªã³ 520 */ 521 522 $('.accordion-list_cont').hide(); 523 $('.accordion-list_btn').css('cursor', 'pointer'); 524 $('.accordion-list_btn').on('click', function () { 525 $(this).next('.accordion-list_cont').slideToggle(); 526 $(this).toggleClass('accordion-list_btn_open'); 527 }); 528 529 530 /** 531 * ã¿ãã¡ãã¥ã¼ 532 */ 533 $('.tab-conts > li').not('.tab-conts li:first-child').hide(); 534 $('.tab-box > .tab-menu > li').on('click', function () { 535 if ($(this).hasClass('tab-menu_select')) { 536 return false; 537 } else { 538 var tabbox = $('.tab-box'), 539 thisTabBox = $(this).closest('.tab-box'), 540 thisTabIndex = $(this).parent().children('li').index(this), 541 thisLength = $(this).closest('.tab-box').index('.tab-box'), 542 tabContsList = tabbox.eq(thisLength).find('.tab-conts > li'); 543 tabContsList.hide(); 544 tabContsList.eq(thisTabIndex).show().addClass('tab-menu_select'); 545 tabbox.eq(thisLength).find('.tab-menu > li').removeClass('tab-menu_select'); 546 $(this).addClass('tab-menu_select'); 547 } 548 }); 549 550 /** 551 * ç®æ¬¡ã®éé 552 */ 553 554 tocList = $('.toc-area_list'); 555 $('.toc-area_btn').on('click', function () { 556 if ($(this).hasClass('toc-area_btn_close')) { 557 $(this).addClass('toc-area_btn_open'); 558 $(this).removeClass('toc-area_btn_close'); 559 tocList.slideUp('fast'); 560 } else { 561 $(this).addClass('toc-area_btn_close'); 562 $(this).removeClass('toc-area_btn_open'); 563 tocList.slideDown(); 564 } 565 }); 566 567 568 /** 569 * SNSãã¿ã³ã®è¨ç½®ã¨ã«ã¦ã³ãæ°ã®åå¾ 570 * åæç¶æ ã§ã¯ãç¾å¨è¡¨ç¤ºããã¦ãããã¼ã¸ã®ã«ã¦ã³ãæ°ãåå¾ãã¾ãã 571 * ãªããã¿ã°ã«data-url屿§ãæå®ãããã¨ã§ç¹å®ã®URLã«ã¤ãã¦ã®ã«ã¦ã³ãæ°ãåå¾ãããã¨ãã§ãã¾ãã 572 * ãã®éãtwitterãã¯ã¦ã¶ã«ã¤ãã¦ã¯ãã¿ã°ã«data-title屿§ã«ã¿ã¤ãã«ãæå®ãã¦ããå¿ è¦ãããã¾ãã 573 * ä¾ï¼ 574 * <div class="sns-btn_fb" data-url="http://example.com/" data-title="EXAMPLE"></div> 575 */ 576 577 pageurl = getCanonicalUrl() || window.location.href; 578 pagetitle = encodeURIComponent(document.title); 579 580 if (false != sns_cnt) { 581 582 /* twitter */ 583 $('.sns-btn_tw').each(function () { 584 var $count_html, 585 target_url = $(this).data('url') || pageurl, 586 target_title = $(this).data('title') || pagetitle; 587 if (typeof twitter_via_text !== "undefined" && twitter_via_text != "") { 588 target_title = target_title + " " + encodeURIComponent(twitter_via_text); 589 } 590 591 target_url = encodeURI(target_url); 592 593 $(this).append('<a target="_blank" href="https://twitter.com/intent/tweet?url=' + target_url + '&text=' + target_title + '"><i class="fab fa-twitter" aria-hidden="true"></i><span>Tweet</span></a>'); 594 }); 595 596 /* facebook */ 597 $('.sns-btn_fb').each(function () { 598 var $count_html, 599 target_url = $(this).attr('data-url') || pageurl, 600 count = null; 601 var enc_target_url = encodeURI(target_url); 602 $(this).append('<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=' + enc_target_url + '"><i class="fab fa-facebook" aria-hidden="true"></i><span class="count_fb"></span></a>'); 603 $count_html = $(this).find('.count_fb'); 604 var cache_flg = '1'; 605 if (!($('.entry').size())) { 606 cache_flg = '0'; 607 } 608 $.ajax({ 609 url: ajaxurl, 610 type: 'post', 611 data: { 612 id: target_url, 613 'action': 'keni_sns_fb',
614 'cache': cache_flg 615 } 616 }) 617 .done(function (data, textStatus, jqXHR) { 618 $count_html.html(data); 619 }).fail(function (a) { 620 console.log(a); 621 $count_html.html(conf.sns.count); 622 }); 623 }); 624 625 /* ã¯ã¦ã */ 626 $('.sns-btn_hatena').each(function () { 627 var $count_html, 628 target_url = $(this).data('url') || pageurl, 629 target_title = $(this).data('title') || pagetitle, 630 count = null; 631 632 $(this).append('<a target="_blank" href="http://b.hatena.ne.jp/add?mode=confirm&url=' + target_url + '&title=' + target_title + '"><i class="f-hatena" aria-hidden="true"></i><span class="count_hatena"></span></a>'); 633 $count_html = $(this).find('.count_hatena'); 634 635 $.ajax({ 636 url: 'https://b.hatena.ne.jp/entry.count', 637 type: 'get', 638 dataType: 'jsonp', 639 data: { 640 url: target_url 641 } 642 }) 643 .done(function (data, textStatus, jqXHR) { 644 count = (typeof (data) === 'undefined' || !data) ? conf.sns.count : Number(data); 645 $count_html.html(count); 646 }) 647 .fail(function () { 648 $count_html.html(conf.sns.count); 649 }); 650 }); 651 } else { 652 /* twitter */ 653 $('.sns-btn_tw').each(function () { 654 var target_url = $(this).data('url') || pageurl, 655 target_title = $(this).data('title') || pagetitle; 656 if (typeof twitter_via_text !== "undefined" && twitter_via_text != "") { 657 target_title = target_title + " " + encodeURIComponent(twitter_via_text); 658 } 659 target_url = encodeURI(target_url); 660 661 $(this).append('<a target="_blank" href="https://twitter.com/intent/twwet?url=' + target_url + '&text=' + target_title + '"><i class="fab fa-twitter" aria-hidden="true"></i><span>Tweet</span></a>'); 662 }); 663 664 /* facebook */ 665 $('.sns-btn_fb').each(function () { 666 var target_url = $(this).attr('data-url') || pageurl; 667 var enc_target_url = encodeURI(target_url); 668 $(this).append('<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=' + enc_target_url + '"><i class="fab fa-facebook" aria-hidden="true"></i></span></a>'); 669 }); 670 671 /* ã¯ã¦ã */ 672 $('.sns-btn_hatena').each(function () { 673 var target_url = $(this).data('url') || pageurl, 674 target_title = $(this).data('title') || pagetitle; 675 676 $(this).append('<a target="_blank" href="http://b.hatena.ne.jp/add?mode=confirm&url=' + target_url + '&title=' + target_title + '"><i class="f-hatena" aria-hidden="true"></i></span></a>'); 677 }); 678 } 679 /* Line */ 680 $('.sns-btn_line').each(function () { 681 var $count_html, 682 target_url = $(this).data('url') || pageurl; 683 684 $(this).append('<a href="http://line.me/R/msg/text/?' + target_url + '\"><i class="fab fa-line"></i><span>LINE</span></a>'); 685 686 }); 687 688 /* Pocket */ 689 $('.sns-btn_pocket').each(function () { 690 var $count_html, 691 target_url = $(this).data('url') || pageurl, 692 target_title = $(this).data('title') || pagetitle; 693 694 $(this).append('<a href="http://getpocket.com/edit?url=' + target_url + '&title=' + target_title + '\" onclick="window.open(this.href, \'PCwindow\', \'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes\'); return false;"><i class="fab fa-get-pocket" aria-hidden="true"></i><span>Pocket</span></a>'); 695 }); 696 697 /** 698 * ã¹ã©ã¤ãã¼ç¨ã®å¦ç 699 * ã¹ã©ã¤ãã¼ã¯ã表示ãããç»åã追å ããã¨èªåçã«ãã®æ°ãå¢ãã¾ãã 700 */ 701 702 function setImgVisible($elems, visiblity) { 703 $elems.each(function (i) { 704 $(this).css("display", visiblity); 705 }); 706 } 707 708 function findSlideImg() { 709 var pcImgs = [], 710 spImgs = [], 711 returnImgs; 712 713 isPc = windowWidth >= 768 ? true : false; 714 715 $slides.find('img').each(function (i) { 716 var $this = $(this); 717 if ($this.hasClass('show-pc')) { 718 pcImgs.push($this); 719 } else if ($this.hasClass('show-sp')) { 720 spImgs.push($this); 721 } else { 722 pcImgs.push($this); 723 spImgs.push($this); 724 } 725 }); 726 727 if (isPc) { 728 setImgVisible($(spImgs), "none"); 729 setImgVisible($(pcImgs), "block"); 730 } else { 731 setImgVisible($(pcImgs), "none"); 732 setImgVisible($(spImgs), "block"); 733 } 734 735 returnImgs = isPc ? $(pcImgs) : returnImgs = $(spImgs); 736 737 return returnImgs; 738 } 739 740 function navUpdate() { 741 $nav.find('a').removeClass('keni-slider-nav_active'); 742 $nav.find('a').eq(current).addClass('keni-slider-nav_active'); 743 } 744 745 function slider(index) { 746 if (index < 0) { 747 index = number - 1; 748 } 749 if (index > number - 1) { 750 index = 0; 751 } 752 $slides.animate({ 753 left: -100 * index + '%' 754 }); 755 current = index; 756 navUpdate(); 757 } 758 759 function timerStop() { 760 clearInterval(start); 761 } 762 763 function timerStart() { 764 timerStop(); 765 var pauseTime = conf.slider.time; 766 if (typeof slider_pause_time !== "undefined" && slider_pause_time > 0) { 767 pauseTime = slider_pause_time; 768 } 769 start = setInterval(function () { 770 slider(current + 1); 771 }, pauseTime); 772 } 773 774 function sliderCreator() { 775 776 if (!slider_lock) { 777 778 timerStop(); 779 780 slider_lock = true; 781 782 $(".keni-slider-pager, .keni-slider-nav").remove(); 783 784 $('.keni-slider_outer').append('<ul class="keni-slider-pager"><li><a href="#" class="keni-slider-pager_prev"></a></li><li><a href="#" class="keni-slider-pager_next"></a></li></ul><div class="keni-slider-nav"></div>'); 785 786 $pager = $('.keni-slider-pager'); 787 $slidesWrap = $('.keni-slider_outer'); 788 $nav = $('.keni-slider-nav'); 789 $slides = $('.keni-slider');
790 $slideImg = $(findSlideImg()); 791 current = 0; 792 number = $slideImg.length; 793 windowWidth = $(window).outerWidth(); 794 795 $slideImg.each(function (i) { 796 if ($(this).height() > ($slidesWrap.height() * 2)) { 797 $(this).css({ 798 'top': '-50%' 799 }); 800 } 801 $(this).css({ 802 left: 100 * i + '%' 803 }); 804 $nav.append('<a href="#"></a>'); 805 }); 806 807 $pager.find('a').on('click', function (event) { 808 timerStop(); 809 event.preventDefault(); 810 if ($(this).hasClass('keni-slider-pager_prev')) { 811 slider(current - 1); 812 } else { 813 slider(current + 1); 814 } 815 timerStart(); 816 }); 817 818 $nav.find('a').on('click', function (event) { 819 timerStop(); 820 event.preventDefault(); 821 var navIndex = $(this).index(); 822 navUpdate(); 823 slider(navIndex); 824 timerStart(); 825 }); 826 827 slider(current); 828 829 timerStart(); 830 831 $slideImg.on({ 832 mouseover: timerStop, 833 mouseout: timerStart 834 }); 835 836 } 837 838 } 839 840 /* setIntervalç¹æã®åé¡ãè§£æ¶ããããã«ããã®ã¦ã£ã³ãã¦ãããã©ã¼ã«ã¹ãã¯ããããsetintervalãã¯ãªã¢ãå度å®è¡ããå¦ç */ 841 $(window).bind('focus', function () { 842 timerStop(); 843 timerStart(); 844 }); 845 846 $(window).resize(function () { 847 var width = $(window).outerWidth(); 848 if ((width >= 768 && !isPc) || (width < 768 && isPc)) { 849 slider_lock = false; 850 sliderCreator(); 851 } 852 }); 853 854 sliderCreator(); 855 856 /** 857 * target="_blank"ã«rel="noopener"ã追å ããå¦ç 858 * rel屿§ã'nofollow'ã®å ´åã¯ä»ä¸ããªã 859 */ 860 $('a[target="_blank"]').each(function () { 861 let getAttr = $(this).attr('rel'); 862 if (typeof getAttr != 'undefined') { 863 if (getAttr.match(/nofollow/)) { 864 return; 865 } else { 866 $(this).attr('rel', 'noopener'); 867 } 868 } else { 869 $(this).attr('rel', 'noopener'); 870 } 871 }); 872 const headElm = document.getElementsByTagName('head'); 873 let fontAwesomeStr = document.createElement('link'); 874 fontAwesomeStr.rel = 'stylesheet'; 875 fontAwesomeStr.href = 'https://use.fontawesome.com/releases/v5.8.1/css/all.css'; 876 headElm.item(0).appendChild(fontAwesomeStr); 877}(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.