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