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