1var $minkyou_pc = (function($){ 2 var returnObj={}; 3 // ---------------------------------------- 4 // å ±é颿° $minkyou_pcå ã§ä½¿ç¨ 5 // ä¾åãã©ã°ã¤ã³ => ãªã 6 // ---------------------------------------- 7 //èµ·åã¯ã©ã¹ã®æç¡ãbooleanã§ãªã¿ã¼ã³ 8 var checkExecClass = function(classname){ 9 return ($(classname).length > 0)?true:false; 10 }; 11 //ã¿ãã¬ããå¤å® 12 var isSmartDevice = (function(){ 13 var ua = navigator.userAgent; 14 var is_smartdevice = false; 15 if(ua.indexOf('Android') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('iPhone') > 0 || ua.indexOf('Blackberry') > 0 || ua.indexOf('Kindle') > 0 || ua.indexOf('Silk') > 0){ 16 is_smartdevice = true; 17 } else { 18 is_smartdevice = false; 19 } 20 return is_smartdevice; 21 })(); 22 23 // ---------------------------------------- 24 // _util 25 // ã¡ãã£ã¨ããæ©è½ã¨ã 26 // ä¾åãã©ã°ã¤ã³ => ãªã 27 // ---------------------------------------- 28 var _util = (function(){ 29 // htmlã®ã¨ã¹ã±ã¼ãå¦çãè¡ã 30 var _escape_html = function(input){ 31 if(input === null){ 32 return ''; 33 } 34 input = input.replace(/&/g, '&'); 35 input = input.replace(/</g, '<'); 36 input = input.replace(/>/g, '>'); 37 input = input.replace(/"/g, '"'); 38 input = input.replace(/'/g, '''); 39 return input; 40 }; 41 42 var public_interface = {}; 43 public_interface.escape_html = _escape_html; 44 return public_interface; 45 })(); 46 47 // ---------------------------------------- 48 // smooth scroll 49 // ä¾åãã©ã°ã¤ã³ => ãªã 50 // ---------------------------------------- 51 var _smoothScroll = (function(){ 52 var EXEC_CLASS = 'a[data-smoothscroll]'; 53 54 var smooth_scroll = function(event){ 55 event.preventDefault(); 56 var target = $(this).attr('data-smoothscroll'); 57 var target_offset = (target=='header')?0:$('#' + target).offset().top; 58 $('html,body').animate({scrollTop:target_offset},500,'swing'); 59 }; 60 61 var _init = function(){ 62 if(!checkExecClass(EXEC_CLASS)) return false; 63 $(EXEC_CLASS).on('click',smooth_scroll); 64 }; 65 66 var public_interface = {}; 67 public_interface.init = _init; 68 return public_interface; 69 })(); 70 71 // ---------------------------------------- 72 // exclusion right 73 // ä¾åãã©ã°ã¤ã³ => ãªã 74 // ---------------------------------------- 75 var _exclusionRight = (function(){ 76 var EXEC_CLASS = '[data-exclusion-right]'; 77 78 var exclusion_right = function(event){ 79 return false; 80 }; 81 82 var _init = function(){ 83 if(!checkExecClass(EXEC_CLASS)) return false; 84 $(EXEC_CLASS).on('contextmenu',exclusion_right); 85 }; 86 87 var public_interface = {}; 88 public_interface.init = _init; 89 return public_interface; 90 })(); 91 92 93 // ======================================================== 94 // collapse block 95 // ä¾åãã©ã°ã¤ã³ => ãªã 96 // ======================================================== 97 var _collapseBlock = (function(){ 98 var EXEC_CLASS = 'a[data-collapse]'; 99 var collapse_each = function(i,e){ 100 if($("#" + $(e).attr('data-collapse')).is(':visible')){ 101 $(e).addClass('visible'); 102 }else{ 103 $(e).addClass('hidden'); 104 } 105 }; 106 var collapse_click = function(event){ 107 event.preventDefault(); 108 var _$this = $(this); 109 $("#" + _$this.attr('data-collapse')).slideToggle(300,function(){ 110 var selector = 'a[data-collapse="' + _$this.attr('data-collapse') + '"]'; 111 var group = _$this.data('collapse-group'); 112 if($(this).is(':visible')){ 113 if(group !== undefined && group !== ""){ 114 var current = $(EXEC_CLASS).filter('.visible').data('collapse'); 115 $("#" + current).slideToggle(300); 116 $(EXEC_CLASS).filter('.visible').addClass('hidden').removeClass('visible'); 117 } 118 $(selector).addClass('visible'); 119 $(selector).removeClass('hidden'); 120 }else{ 121 $(selector).addClass('hidden'); 122 $(selector).removeClass('visible'); 123 } 124 $minkyou_pc.outerFixImage.reset(); 125 }); 126 }; 127 var _init = function(){ 128 //check 129 if(!checkExecClass(EXEC_CLASS)) return false; 130 //init 131 $(EXEC_CLASS).each(collapse_each); 132 //click 133 $(EXEC_CLASS).on('click',collapse_click); 134 }; 135 136 var public_interface = {}; 137 public_interface.init = _init; 138 return public_interface; 139 })(); 140 141 // ---------------------------------------- 142 // section link 143 // ä¾åãã©ã°ã¤ã³ => ãªã 144 // ---------------------------------------- 145 var _sectionLink = (function(){ 146 var EXEC_CLASS = '[data-url]'; 147 148 var stop_propagation = function(event){ 149 event.stopPropagation(); 150 }; 151 152 var each_ancher = function(i,e){ 153 $(e).on({ 154 'click':stop_propagation, 155 'mouseenter':function(event){ 156 stop_propagation(event); 157 $(this).parents(EXEC_CLASS).removeClass('section-link-hover'); 158 }, 159 'mouseleave':function(event){ 160 $(this).parents(EXEC_CLASS).addClass('section-link-hover'); 161 } 162 }); 163 }; 164 165 var each_section = function(i,e){ 166 var target = $(e).data('url'); 167 $(e).on({ 168 'click':function(){ 169 location.href = target; 170 }, 171 'mouseenter':function(){ 172 $(this).addClass('section-link-hover'); 173 }, 174 'mouseleave':function(){ 175 $(this).removeClass('section-link-hover'); 176 } 177 }); 178 $(e).find('a').each(each_ancher); 179 }; 180 181 var _init = function(){ 182 if(!checkExecClass(EXEC_CLASS)) return false; 183 $(EXEC_CLASS).each(each_section); 184 }; 185 186 var public_interface = {}; 187 public_interface.init = _init; 188 return public_interface; 189 })(); 190 191 192 // ======================================================== 193 // custom forms 194 // ä¾åãã©ã°ã¤ã³ => ãªã 195 // ======================================================== 196 var _customForms = (function(){ 197 var colorsize_popovers = []; 198
199 var each_check = function(i,e){ 200 $(e).find('input[type="checkbox"]').after('<span class="checkbox"></span>'); 201 }; 202 203 var each_radio = function(i,e){ 204 $(e).find('input[type="radio"]').after('<span class="radio"></span>'); 205 }; 206 207 var _init = function(){ 208 $('label.c-check').each(each_check); 209 $('label.c-radio').each(each_radio); 210 }; 211 212 var public_interface = {}; 213 public_interface.init = _init; 214 return public_interface; 215 })(); 216 217 // ---------------------------------------- 218 // outer fix image 219 // ä¾åãã©ã°ã¤ã³ => ãªã 220 // ---------------------------------------- 221 var _outerFixImage = (function(){ 222 var EXEC_CLASS = '[data-outerfix-img]'; 223 224 var set_img = function(){ 225 var iw = $(this).width(); 226 var ih = $(this).height(); 227 var ww = $(this).parent().width(); 228 var wh = $(this).parent().height(); 229 var left_pos = (iw < ih)?(ww-iw)/2:(wh/ih*iw-ww)/2*-1; 230 //if(iw === ih) left_pos = 0; 231 //var top_pos = (iw < ih)?(ww/iw*ih-wh)/2*-1:0; 232 var top_pos = 0; 233 //var width_val = (iw < ih)?'100%':'auto'; 234 //var height_val = (iw < ih)?'auto':'100%'; 235 var width_val = 'auto'; 236 var height_val = '100%'; 237 $(this).css({ 238 position:'relative', 239 left:left_pos, 240 top:top_pos, 241 width:width_val, 242 height:height_val 243 }); 244 }; 245 246 var each_img = function(i,e){ 247 $(e).on('load',set_img); 248 }; 249 250 var _init = function(){ 251 if(!checkExecClass(EXEC_CLASS)) return false; 252 $(EXEC_CLASS).each(set_img); 253 $(window).on('load',function(){ 254 $(EXEC_CLASS).each(set_img); 255 }); 256 }; 257 258 var _reset = function(){ 259 $(EXEC_CLASS).each(set_img); 260 }; 261 262 var public_interface = {}; 263 public_interface.init = _init; 264 public_interface.reset = _reset; 265 return public_interface; 266 })(); 267 268 // ---------------------------------------- 269 // col height 270 // ä¾åãã©ã°ã¤ã³ => ãªã 271 // ---------------------------------------- 272 var _colHeight = (function(){ 273 var EXEC_CLASS = '[data-colheight]'; 274 275 var each_row = function(i,e){ 276 var col_num = $(e).data('colheight')*1; 277 var heights = []; 278 var arr = []; 279 var resize_heights = []; 280 var h_count = 0; 281 $(e).find('.col').each(function(idx,elm){ 282 arr.push($(elm).outerHeight()); 283 if((idx+1)%col_num===0){ 284 heights.push(arr); 285 arr = []; 286 }else if(idx == $(e).find('.col').length-1){ 287 heights.push(arr); 288 } 289 }); 290 $.each(heights,function(idx,elm){ 291 elm.sort(function(a,b){ 292 if( a > b ) return -1; 293 if( a < b ) return 1; 294 return 0; 295 }); 296 resize_heights.push(elm[0]); 297 }); 298 $(e).find('.col').each(function(idx,elm){ 299 $(elm).css({height:resize_heights[h_count]}); 300 if((idx+1)%col_num===0){ 301 h_count++; 302 } 303 }); 304 }; 305 306 var _init = function(){ 307 if(!checkExecClass(EXEC_CLASS)) return false; 308 $(EXEC_CLASS).each(each_row); 309 }; 310 311 var public_interface = {}; 312 public_interface.init = _init; 313 return public_interface; 314 })(); 315 316 317 // ======================================================== 318 // tab set 319 // ä¾åãã©ã°ã¤ã³ => ãªã 320 // ======================================================== 321 var _tabSet = (function(){ 322 var EXEC_CLASS = '.mk-tabset'; 323 324 var on_tab_click = function($elm,target){ 325 $elm.tabs.find('> .mk-tab.active').removeClass('active'); 326 $elm.tabs.find('> .mk-tab[data-tab-target="' + target + '"]').addClass('active'); 327 $elm.tabcontents.find('> .mk-tab-content.active').removeClass('on').removeClass('active'); 328 $elm.tabcontents.find('> .mk-tab-content.' + target).addClass('active'); 329 setTimeout(function(){ 330 $elm.tabcontents.find('> .mk-tab-content.' + target).addClass('on'); 331 $minkyou_pc.outerFixImage.reset(); 332 },150); 333 }; 334 335 var each_tabset = function(i,e){ 336 var $elm = {}; 337 $elm.tabset = $(e); 338 $elm.tabs = $elm.tabset.find('> .mk-tab-tabs'); 339 $elm.tabcontents = $elm.tabset.find('> .mk-tab-contents'); 340 $elm.tabs.find('> .mk-tab').eq(0).addClass('active'); 341 $elm.tabcontents.find('> .mk-tab-content').eq(0).addClass('active').addClass('on'); 342 343 $elm.tabs.find('> .mk-tab[data-tab-target]').on('click',function(event){ 344 event.preventDefault(); 345 if($(this).hasClass('active')) return false; 346 var target = $(this).data('tab-target'); 347 on_tab_click($elm,target); 348 }); 349 }; 350 351 var _init = function(){
352 console.log('aa'); 353 if(!checkExecClass(EXEC_CLASS)) return false; 354 $(EXEC_CLASS).each(each_tabset); 355 }; 356 357 var public_interface = {}; 358 public_interface.init = _init; 359 return public_interface; 360 })(); 361 362 363 // ======================================================== 364 // modal exec 365 // ä¾åãã©ã°ã¤ã³ => ãªã 366 // ======================================================== 367 var _modalExec = (function(){ 368 var EXEC_CLASS = 'a[data-execmodal]'; 369 var $modal_bg = null; 370 var $modal_target = null; 371 372 var close_modal = function(event){ 373 if(event) event.preventDefault(); 374 $modal_bg.removeClass('in'); 375 $modal_target.removeClass('in'); 376 setTimeout(function(){ 377 $modal_bg.removeClass('fade'); 378 $modal_target.removeClass('fade'); 379 $modal_bg.hide(); 380 $modal_target.hide(); 381 $('body').removeClass('modal-open'); 382 },150); 383 }; 384 385 var exec_modal = function(event){ 386 if(event) event.preventDefault(); 387 var target = $(this).data('execmodal'); 388 $modal_target = $('#' + target); 389 $('body').addClass('modal-open'); 390 $modal_bg.addClass('fade'); 391 $modal_target.addClass('fade'); 392 $modal_bg.show(); 393 $modal_target.show(); 394 setTimeout(function(){ 395 $modal_bg.addClass('in'); 396 $modal_target.addClass('in'); 397 $minkyou_pc.outerFixImage.reset(); 398 },100); 399 $modal_target.off().on('click',close_modal); 400 $modal_target.find('.modal-dialog').on('click',function(event){ 401 event.stopPropagation(); 402 }); 403 }; 404 405 var each_modal = function(i,e){ 406 var target = $(this).data('execmodal'); 407 var $target = $('#' + target); 408 //$target.hide(); 409 }; 410 411 var _init = function(){ 412 // if(!checkExecClass(EXEC_CLASS)) return false; 413 // check if class already exists 414 if(checkExecClass('.modal-backdrop')) return false; 415 //add bg element 416 $modal_bg = $('<div class="modal-backdrop"></div>'); 417 $('body').append($modal_bg); 418 //has carousel 419 $(EXEC_CLASS).each(each_modal); 420 //click events 421 $(EXEC_CLASS).on('click',exec_modal); 422 $('a[data-closemodal]').on('click',close_modal); 423 }; 424 425 var _reset = function() { 426 $(EXEC_CLASS).each(each_modal); 427 $(EXEC_CLASS).off('click',exec_modal); 428 $(EXEC_CLASS).on('click',exec_modal); 429 $('a[data-closemodal]').off('click',close_modal); 430 $('a[data-closemodal]').on('click',close_modal); 431 }; 432 433 var public_interface = {}; 434 public_interface.init = _init; 435 public_interface.reset = _reset; 436 return public_interface; 437 })(); 438 439 440 // ======================================================== 441 // fix side 442 // ä¾åãã©ã°ã¤ã³ => ãªã 443 // ======================================================== 444 var _fixSide = (function(){ 445 var EXEC_CLASS = '.side--contents[data-follow-sidearea]'; 446 var $main = null; 447 var $sub_wrap = null; 448 var $sub = null; 449 var pos = {}; 450 var is_shortside = false; 451 452 var set_pos = function(){ 453 pos.st = $(window).scrollTop(); 454 pos.ww = $(window).width(); 455 pos.wh = $(window).height(); 456 pos.main_x = $main.offset().left; 457 pos.main_y = $main.offset().top; 458 pos.main_width = $main.width(); 459 pos.main_height = $main.height(); 460 pos.sub_x = $sub_wrap.offset().left; 461 pos.sub_y = $sub_wrap.offset().top; 462 pos.sub_width = $sub.width(); 463 pos.sub_height = $sub.height(); 464 }; 465 466 var on_scroll = function(){ 467 set_pos(); 468 if(pos.main_height < pos.sub_height) return false; 469 if(pos.st > pos.main_y + pos.main_height - pos.wh){ 470 $sub.css({position:'relative',bottom:'auto',top:pos.main_height - pos.sub_height}); 471 }else if(pos.st > pos.sub_y + pos.sub_height - pos.wh){ 472 $sub.css({position:'fixed',bottom:0,top:'auto'}); 473 }else{ 474 $sub.css({position:'relative',bottom:'auto',top:'auto'}); 475 } 476 }; 477 478 var on_scroll_short = function(){ 479 set_pos(); 480 if(pos.main_height < pos.sub_height) return false; 481 if(pos.st > pos.main_y + pos.main_height - pos.sub_height){ 482 $sub.css({position:'relative',bottom:'auto',top:pos.main_height - pos.sub_height}); 483 }else if(pos.st > pos.main_y){ 484 $sub.css({position:'fixed',bottom:'auto',top:'0'}); 485 }else{ 486 $sub.css({position:'relative',bottom:'auto',top:'auto'}); 487 } 488 }; 489 490 var _init = function(){ 491 if(!checkExecClass(EXEC_CLASS)) return false;
492 $main = $('#main-col'); 493 $sub_wrap = $('#sub-col'); 494 $sub = $(EXEC_CLASS); 495 if($sub.find('.side--short-side').length > 0){ 496 is_shortside = true; 497 } 498 if(is_shortside){ 499 $(window).on('scroll',on_scroll_short); 500 $(window).on('load',on_scroll_short); 501 }else{ 502 $(window).on('scroll',on_scroll); 503 $(window).on('load',on_scroll); 504 } 505 }; 506 507 var public_interface = {}; 508 public_interface.init = _init; 509 return public_interface; 510 })(); 511 512 513 // ======================================================== 514 // range select 515 // ä¾åãã©ã°ã¤ã³ => ãªã 516 // ======================================================== 517 var _rangeSelect = (function(){ 518 var EXEC_CLASS = '[data-rangeselect]'; 519 520 var reset_rangeselect = function($lower,$upper,lower,upper){ 521 $lower.find('option').each(function(i,e){ 522 if($(e).data('rangeselect-val')*1 > upper){ 523 $(e).hide(); 524 }else{ 525 $(e).show(); 526 } 527 }); 528 $upper.find('option').each(function(i,e){ 529 if($(e).data('rangeselect-val')*1 < lower){ 530 $(e).hide(); 531 }else{ 532 $(e).show(); 533 } 534 }); 535 }; 536 537 var each_rangeselect = function(i,e){ 538 var $set = $(e); 539 var $lower = $set.find('[data-rangeselect-lower]'); 540 var $upper = $set.find('[data-rangeselect-upper]'); 541 var lower = $lower.find('option:selected').data('rangeselect-val')*1; 542 var upper = $upper.find('option:selected').data('rangeselect-val')*1; 543 reset_rangeselect($lower,$upper,lower,upper); 544 $lower.on('change',function(){ 545 lower = $lower.find('option:selected').data('rangeselect-val')*1; 546 upper = $upper.find('option:selected').data('rangeselect-val')*1; 547 reset_rangeselect($lower,$upper,lower,upper); 548 }); 549 $upper.on('change',function(){ 550 lower = $lower.find('option:selected').data('rangeselect-val')*1; 551 upper = $upper.find('option:selected').data('rangeselect-val')*1; 552 reset_rangeselect($lower,$upper,lower,upper); 553 }); 554 }; 555 556 var _init = function(){ 557 if(!checkExecClass(EXEC_CLASS)) return false; 558 $(EXEC_CLASS).each(each_rangeselect); 559 }; 560 561 var public_interface = {}; 562 public_interface.init = _init; 563 return public_interface; 564 })(); 565 566 567 // ======================================================== 568 // popup 569 // ä¾åãã©ã°ã¤ã³ => ãªã 570 // ======================================================== 571 var _popupExec = (function(){ 572 var EXEC_CLASS = '[data-execpopup]'; 573 var target = ''; 574 var exec_popup = false; 575 576 var each_popup = function(i,e){ 577 var t = $(e).data('execpopup'); 578 $('#' + t).hide(); 579 $('#' + t).each(function(idx,elm){ 580 $(elm).on('click',function(event){ 581 event.stopPropagation(); 582 }); 583 }); 584 }; 585 586 var click_popup = function(event){ 587 event.preventDefault(); 588 target = $(this).data('execpopup'); 589 if(exec_popup){ 590 $('#' + target).fadeOut(300,function(){exec_popup = false;}); 591 }else{ 592 $('#' + target).fadeIn(300,function(){exec_popup = true;}); 593 } 594 }; 595 596 var click_window = function(){ 597 if(exec_popup){ 598 $('#' + target).fadeOut(300,function(){exec_popup = false;}); 599 } 600 }; 601 602 var _init = function(){ 603 if(!checkExecClass(EXEC_CLASS)) return false; 604 $(EXEC_CLASS).each(each_popup); 605 $(EXEC_CLASS).on('click',click_popup); 606 $(window).on('click',click_window); 607 }; 608 609 var public_interface = {}; 610 public_interface.init = _init; 611 return public_interface; 612 })(); 613 614 615 // ======================================================== 616 // header menu 617 // ä¾åãã©ã°ã¤ã³ => ãªã 618 // ======================================================== 619 var _headerMenu = (function(){ 620 var EXEC_CLASS = '#header'; 621 var menu_opened = false; 622 var $elm = {}; 623 624 var open_expd = function(event){ 625 event.preventDefault(); 626 $(this).addClass('active'); 627 $elm.header_expd.addClass('on'); 628 setTimeout(function(){ 629 $elm.header_expd.addClass('fade'); 630 $minkyou_pc.outerFixImage.reset(); 631 menu_opened = true; 632 },700); 633 }; 634 635 var close_expd = function(event){ 636 event.preventDefault(); 637 if($(this).data('exec-expandmenu') !== undefined) return false; 638 if($(this).prop('tagName').toLowerCase() !== 'a' && event.pageY < $elm.header_expd.offset().top) return false; 639 menu_opened = false; 640 $('[data-exec-expandmenu]').removeClass('active'); 641 $elm.header_expd.removeClass('fade'); 642 $elm.header_expd.removeClass('on'); 643 }; 644 645 var change_submenu = function(event){ 646 event.preventDefault(); 647 if($(this).parent('.m-navi').hasClass('active')) return false; 648 var target = $(this).data('expand-submenu'); 649 $elm.header_menu_navi.find('.m-navi.active').removeClass('active'); 650 $(this).parent('.m-navi').addClass('active'); 651 $elm.header_menu_row.find('.header-menu-main.active').removeClass('active'); 652 $elm.header_menu_row.find('.header-menu-main#' + target).addClass('active'); 653 $minkyou_pc.outerFixImage.reset(); 654 }; 655 656 var _init = function(){ 657 if(!checkExecClass(EXEC_CLASS)) return false; 658 $elm.header_main = $(EXEC_CLASS).find('.header-main'); 659 $elm.header_expd = $('#header-menu').find('.header-menu'); 660 $elm.header_menu_row = $elm.header_expd.find('.header-menu-row'); 661 $elm.header_menu_navi = $elm.header_menu_row.find('.header-menu-navi'); 662 $('[data-exec-expandmenu]').on('mouseenter',open_expd); 663 $elm.header_main.find('a').on('mouseenter',close_expd); 664 $elm.header_expd.find('.header-menu-inner').on('mouseleave',close_expd); 665 666 $elm.header_menu_navi.find('.m-navi').eq(0).addClass('active'); 667 $elm.header_menu_row.find('.header-menu-main').eq(0).addClass('active'); 668 $elm.header_menu_navi.find('[data-expand-submenu]').on('mouseenter',change_submenu); 669 }; 670 671 var public_interface = {}; 672 public_interface.init = _init; 673 return public_interface; 674 })(); 675 676 677 // ======================================================== 678 // recipe top menu 679 // ä¾åãã©ã°ã¤ã³ => ãªã 680 // ======================================================== 681 var _recipeTopMenu = (function(){ 682 var EXEC_CLASS = '.recipe--top-menu'; 683 var $elm = {}; 684 685 var change_submenu = function(event){ 686 event.preventDefault(); 687 if($(this).parent('.m-navi').hasClass('active')) return false; 688 var target = $(this).data('expand-submenu'); 689 $elm.recipe_menu_navi.find('.m-navi.active').removeClass('active'); 690 $(this).parent('.m-navi').addClass('active'); 691 $elm.recipe_menu_row.find('.menu-value-main.active').removeClass('active'); 692 $elm.recipe_menu_row.find('.menu-value-main#' + target).addClass('active'); 693 $minkyou_pc.outerFixImage.reset(); 694 }; 695 696 var _init = function(){ 697 if(!checkExecClass(EXEC_CLASS)) return false; 698 $elm.recipe_expd = $(EXEC_CLASS).find('.menu-value'); 699 $elm.recipe_menu_row = $elm.recipe_expd.find('.menu-value-row'); 700 $elm.recipe_menu_navi = $elm.recipe_menu_row.find('.menu-value-navi'); 701 $elm.recipe_menu_navi.find('.m-navi').eq(0).addClass('active'); 702 $elm.recipe_menu_row.find('.menu-value-main').eq(0).addClass('active'); 703 $elm.recipe_menu_navi.find('[data-expand-submenu]').on('mouseenter',change_submenu); 704 }; 705 706 var public_interface = {}; 707 public_interface.init = _init; 708 return public_interface; 709 })(); 710 711 712 // ======================================================== 713 // top carousel 714 // ä¾åãã©ã°ã¤ã³ =>
714 jquery.bxslider 715 // ======================================================== 716 var _topCarousel = (function(){ 717 var EXEC_CLASS = '.top--top-carousel'; 718 719 var _init = function(){ 720 if(!checkExecClass(EXEC_CLASS)) return false; 721 $(EXEC_CLASS).find('.slides').bxSlider({ 722 slideMargin:20, 723 slideWidth: 1100, 724 minSlides: 1, 725 maxSlides: 1, 726 moveSlides: 1, 727 useCSS:false, 728 auto:true, 729 speed:800, 730 stopAutoOnClick: true 731 }); 732 }; 733 734 var public_interface = {}; 735 public_interface.init = _init; 736 return public_interface; 737 })(); 738 739 740 // ======================================================== 741 // kenko carousel 742 // ä¾åãã©ã°ã¤ã³ => jquery.bxslider 743 // ======================================================== 744 var _kenkoCarousel = (function(){ 745 var EXEC_CLASS = '.kenko--top-carousel'; 746 747 var _init = function(){ 748 if(!checkExecClass(EXEC_CLASS)) return false; 749 $(EXEC_CLASS).find('.slides').bxSlider({ 750 useCSS:false, 751 auto:true, 752 speed:800, 753 stopAutoOnClick: true 754 }); 755 }; 756 757 var public_interface = {}; 758 public_interface.init = _init; 759 return public_interface; 760 })(); 761 762 763 // ======================================================== 764 // open help 765 // ä¾åãã©ã°ã¤ã³ => ãªã 766 // ======================================================== 767 var _openHelp = (function(){ 768 var EXEC_CLASS = '[data-openhelp]'; 769 770 var on_click = function(event){ 771 event.preventDefault(); 772 var target = $(this).data('openhelp'); 773 window.open(target, 'help', 'width=730,height=630,toolbar=0,status=0,menubars=0,resizable=0,scrollbars=1'); 774 }; 775 776 var _init = function(){ 777 if(!checkExecClass(EXEC_CLASS)) return false; 778 $(EXEC_CLASS).on('click',on_click); 779 }; 780 781 var public_interface = {}; 782 public_interface.init = _init; 783 return public_interface; 784 })(); 785 786 787 // ======================================================== 788 // popover show 789 // ä¾åãã©ã°ã¤ã³ => ãªã 790 // ======================================================== 791 var _popoverShow = (function(){ 792 var EXEC_CLASS = '[data-btn-myrecipe]'; 793 var EXEC_CLASS_LG = '[data-btn-myrecipe-long]'; 794 var is_anim = false; 795 var is_anim_lg = false; 796 797 var exec_popover = function($elm){ 798 799 $elm.addClass('on'); 800 setTimeout(function(){ 801 $elm.addClass('fade'); 802 803 },10); 804 setTimeout(function(){ 805 $elm.removeClass('fade'); 806 },3000); 807 setTimeout(function(){ 808 $elm.removeClass('on'); 809 is_anim = false; 810 },3300); 811 }; 812 813 814 var on_click = function(event){ 815 if (!member_id) { 816 return; 817 } 818 819 event.preventDefault(); 820 if(is_anim) return false; 821 is_anim = true; 822 var status = $(this).attr('data-btn-myrecipe'); 823 var containar = $(this); 824 825 if(status === 'off'){ 826 827 $.ajax({
828 type: "POST", 829 url: "//"+document.domain+"/api/myrecipe/entry", 830 data: "member_id="+member_id+"&recipe_id="+recipe_id+"&"+tkn_name+"="+tkn_val, 831 dataType: "json", 832 success: function(msg){ 833 console.log('favorite entry success:'); 834 console.log(msg); 835 if (msg.status == 'OK') { 836 exec_popover(containar.find('.popover.status-on')); 837 containar.attr('data-btn-myrecipe','on'); 838 } 839 }, 840 error: function(XMLHttpRequest, textStatus, errorThrown) { 841 console.log('favorite entry error:'); 842 console.log(XMLHttpRequest); 843 exec_popover(containar.find('.popover.status-error')); 844 } 845 }); 846 847 848 }else{ 849 850 $.ajax({ 851 type: "POST", 852 url: "//"+document.domain+"/api/myrecipe/delete", 853 data: "member_id="+member_id+"&recipe_id="+recipe_id+"&"+tkn_name+"="+tkn_val, 854 dataType: "json", 855 success: function(msg){ 856 console.log('favorite delete success:'); 857 console.log(msg); 858 if (msg.status == 'OK') { 859 exec_popover(containar.find('.popover.status-off')); 860 containar.attr('data-btn-myrecipe','off'); 861 } 862 }, 863 error: function(XMLHttpRequest, textStatus, errorThrown) { 864 console.log('favorite delete error:'); 865 console.log(XMLHttpRequest); 866 exec_popover(containar.find('.popover.status-error')); 867 } 868 }); 869 870 } 871 }; 872 873 var exec_popover_lg = function($elm){ 874 $elm.addClass('on'); 875 setTimeout(function(){ 876 $elm.addClass('fade'); 877 },10); 878 setTimeout(function(){ 879 $elm.removeClass('fade'); 880 },3000); 881 setTimeout(function(){ 882 $elm.removeClass('on'); 883 is_anim_lg = false; 884 },3300); 885 }; 886 887 var on_click_lg = function(event){ 888 event.preventDefault(); 889 if(is_anim_lg) return false; 890 is_anim_lg = true; 891 var containar = $(this); 892 var status = $(this).attr('data-btn-myrecipe-long'); 893 if(status === 'off'){ 894 $.ajax({
895 type: "POST", 896 url: "//"+document.domain+"/api/myrecipe/entry", 897 data: "member_id="+member_id+"&recipe_id="+recipe_id+"&"+tkn_name+"="+tkn_val, 898 dataType: "json", 899 success: function(msg){ 900 if (msg.status == 'OK') { 901 console.log('favorite entry success:'); 902 exec_popover_lg(containar.find('.popover.status-on')); 903 current_num = document.querySelector('.myrecipe-num').dataset.num; 904 result_num = parseInt(current_num)+parseInt(1); 905 console.log(result_num); 906 $("a[data-btn-myrecipe-long]").attr('data-btn-myrecipe-long','on'); 907 $("a[data-btn-myrecipe-long] .num").text(result_num); 908 document.querySelector('.myrecipe-num').dataset.num = result_num; 909 } 910 }, 911 error: function(XMLHttpRequest, textStatus, errorThrown) { 912 console.log('favorite entry error:'); 913 console.log(XMLHttpRequest); 914 exec_popover_lg(containar.find('.popover.status-error')); 915 } 916 }); 917 } else { 918 $.ajax({ 919 type: "POST", 920 url: "//"+document.domain+"/api/myrecipe/delete", 921 data: "member_id="+member_id+"&recipe_id="+recipe_id+"&"+tkn_name+"="+tkn_val, 922 dataType: "json", 923 success: function(msg){ 924 if (msg.status == 'OK') { 925 console.log('favorite delete success:'); 926 exec_popover_lg(containar.find('.popover.status-off')); 927 current_num = document.querySelector('.myrecipe-num').dataset.num; 928 result_num = parseInt(current_num)-parseInt(1); 929 if (result_num < 0) { 930 result_num = 0; 931 } 932 console.log(result_num); 933 $("a[data-btn-myrecipe-long]").attr('data-btn-myrecipe-long','off'); 934 $("a[data-btn-myrecipe-long] .num").text(result_num); 935 document.querySelector('.myrecipe-num').dataset.num = result_num; 936 } 937 }, 938 error: function(XMLHttpRequest, textStatus, errorThrown) { 939 console.log('favorite delete error:'); 940 console.log(XMLHttpRequest); 941 exec_popover(containar.find('.popover.status-error')); 942 } 943 }); 944 945 } 946 }; 947 948 var _init = function(){ 949 //if(!checkExecClass(EXEC_CLASS)) return false; 950 $(EXEC_CLASS).on('click',on_click); 951 $(EXEC_CLASS_LG).on('click',on_click_lg); 952 }; 953 954 var public_interface = {}; 955 public_interface.init = _init; 956 return public_interface; 957 })(); 958 959 // ======================================================== 960 // footer feedback 961 // ä¾åãã©ã°ã¤ã³ => ãªã 962 // ======================================================== 963 var _footerFeedback = (function(){ 964 var EXEC_CLASS = '#footer-feedback-form'; 965 var $form = null; 966 var $btn = null; 967 var $completed = null; 968 969 var on_click = function(event){ 970 event.preventDefault(); 971 var comment = $form.find('textarea').val(); 972 var data = {}; 973 if(comment === '') return false; 974 data.comment = comment; 975 data[tkn_name] = tkn_val; 976 $.ajax({ 977 url: '/api/feedback', 978 method: 'post', 979 data: data, 980 dataType: 'json' 981 }).success(function(res){ 982 if(res.status != 'OK') console.log(res); 983 $form.slideToggle(); 984 $completed.slideToggle(); 985 }).fail(function(res){ 986 console.log(res); 987 }); 988 }; 989 990 var on_submit = function(event){ 991 event.preventDefault(); 992 return false; 993 }; 994 995 var _init = function(){ 996 if(!checkExecClass(EXEC_CLASS)) return false; 997 998 $form = $(EXEC_CLASS).find('form'); 999 $btn = $form.find('[name="submit"]'); 1000 $completed = $(EXEC_CLASS).find('.complete-box'); 1001 1002 $form.on('submit', on_submit); 1003 $btn.on('click', on_click); 1004 }; 1005 1006 var public_interface = {}; 1007 public_interface.init = _init; 1008 return public_interface; 1009 })(); 1010 1011 1012 1013 1014 // ======================================================== 1015 // å½¹ã«ç«ã£ãæ¼ä¸ 1016 // ä¾åãã©ã°ã¤ã³ => ãªã 1017 // ======================================================== 1018 var _yakunitatta_click = (function () { 1019 var _init = function(){ 1020 $("#tukuttacomment_wrapper").on("click", ".yakunitatta a", function(event){ 1021 var target = $(this); 1022 if (target.hasClass('disable')) { 1023 return; 1024 } 1025 var mode = target.hasClass('inactive') ? 'off' : 'on'; 1026 var tukuttacomment_id = target.closest('div').find('input[name=tukutta_comment_id]').val(); 1027 $.ajax({
1028 type: "POST", 1029 url: "//"+document.domain+"/api/tukuttacomment/yakunitatta", 1030 data: "tukuttacomment_id="+tukuttacomment_id+"&mode="+mode+"&"+tkn_name+"="+tkn_val, 1031 dataType: "json", 1032 success: function(msg){ 1033 if (msg.status == 'OK') { 1034 if (mode == 'on') { 1035 target.addClass('inactive'); 1036 } else { 1037 target.removeClass('inactive'); 1038 } 1039 target.closest('div').find('.balloon').text(msg.body.cnt); 1040 } else { 1041 console.log('å½¹ã«ç«ã£ã失æ'); 1042 console.log(msg); 1043 } 1044 }, 1045 error: function(XMLHttpRequest, textStatus, errorThrown) { 1046 console.log(XMLHttpRequest); 1047 } 1048 }); 1049 }); 1050 }; 1051 var public_interface = {}; 1052 public_interface.init = _init; 1053 return public_interface; 1054 })(); 1055 1056 1057 // ======================================================== 1058 // floating banner 1059 // ä¾åãã©ã°ã¤ã³ => ãªã 1060 // ======================================================== 1061 var _floatingBanner = (function () { 1062 var EXEC_CLASS = '#floating-banner'; 1063 var set_timeout_id = null; 1064 var set_interval_id = null; 1065 var scrolling = false; 1066 1067 var init_show = function(){ 1068 setTimeout(function(){ 1069 $(EXEC_CLASS).addClass('active'); 1070 },3000); 1071 }; 1072 1073 var window_scroll = function(){ 1074 scrolling = true; 1075 if(set_timeout_id){ 1076 clearTimeout(set_timeout_id); 1077 } 1078 set_timeout_id = setTimeout(function(){ 1079 scrolling = false; 1080 set_timeout_id = null; 1081 },500); 1082 }; 1083 1084 var window_resize = function(){ 1085 var ww = $(window).width(); 1086 var cw = $('#container').width(); 1087 if(ww<cw){ 1088 $(EXEC_CLASS).css({left:0}); 1089 }else{ 1090 $(EXEC_CLASS).css({left:(ww-cw)/2}); 1091 } 1092 }; 1093 1094 var banner_fade = function(){ 1095 set_interval_id = setInterval(function(){ 1096 if(scrolling){ 1097 $(EXEC_CLASS).addClass('blur'); 1098 }else{ 1099 $(EXEC_CLASS).removeClass('blur'); 1100 } 1101 },100); 1102 }; 1103 1104 var click_close = function(event){ 1105 if(event) event.preventDefault(); 1106 $(EXEC_CLASS).removeClass('active'); 1107 clearInterval(set_interval_id); 1108 }; 1109 1110 var _init = function(){ 1111 if(!checkExecClass(EXEC_CLASS)) return false; 1112 init_show(); 1113 banner_fade(); 1114 $(window).on('scroll',window_scroll); 1115 window_resize(); 1116 $(window).on('resize',window_resize); 1117 $(EXEC_CLASS).find('a.close').on('click',click_close); 1118 }; 1119 1120 var public_interface = {}; 1121 public_interface.init = _init; 1122 return public_interface; 1123 })(); 1124 1125 // -------------------------------------------------------------------------------- 1126 // ã·ã³ãã«ã®æ¸ãåºã 1127 // -------------------------------------------------------------------------------- 1128 returnObj.util = _util; 1129 returnObj.smoothScroll = _smoothScroll; 1130 returnObj.exclusionRight = _exclusionRight; 1131 returnObj.collapseBlock = _collapseBlock; 1132 returnObj.sectionLink = _sectionLink; 1133 returnObj.customForms = _customForms; 1134 returnObj.outerFixImage = _outerFixImage; 1135 returnObj.colHeight = _colHeight; 1136 returnObj.tabSet = _tabSet; 1137 returnObj.modalExec = _modalExec; 1138 returnObj.fixSide = _fixSide; 1139 returnObj.rangeSelect = _rangeSelect; 1140 returnObj.popupExec = _popupExec; 1141 returnObj.headerMenu = _headerMenu; 1142 returnObj.recipeTopMenu = _recipeTopMenu; 1143 returnObj.topCarousel = _topCarousel; 1144 returnObj.kenkoCarousel = _kenkoCarousel; 1145 returnObj.openHelp = _openHelp; 1146 returnObj.popoverShow = _popoverShow; 1147 returnObj.footerFeedback = _footerFeedback; 1148 returnObj.yakunitatta_click = _yakunitatta_click; 1149 returnObj.floatingBanner = _floatingBanner; 1150 1151 return returnObj; 1152})(jQuery); 1153 1154function checkCookiePopup() { 1155 if (document.cookie.indexOf('hidePopup=true') === -1) { 1156 const terms_link = 'https://www.nhk-ed.co.jp/kiyaku/#7th'; 1157 const html_text = '<div>å½ãµã¤ãã§ã¯ãå©ä¾¿æ§ã®åä¸ãå©ç¨åæããã³ã¦ã¼ã¶ã¼ã®çæ§ã®ãèå³ã»ãé¢å¿ã«ãã£ãåºåé ä¿¡çã®ããã«ã¯ããã¼ï¼cookieï¼ãå©ç¨ãã¦ããã¾ãã'+ 1158 '詳ããã¯å½ç¤¾NHKã¨ãã¥ã±ã¼ã·ã§ãã«ã®ã'+ 1159 '<a class="popup-link" href="'+terms_link+'" target="_blank">ããããµã¼ãã¹å©ç¨è¦ç´</a>'+ 1160 'ã第7ï½9æ¡ãã覧ãã ãããã¾ãã¯ããã¼ã®åæ¢ï¼ãªããã¢ã¦ãï¼ããã¡ãããå¯è½ã§ãã</div>'; 1161 Swal.fire({ 1162 toast: true, 1163 html: html_text, 1164 position: 'bottom', 1165 background: '#ffffe0', 1166 customClass: { 1167 container: 'popup-container', 1168 popup: 'popup-popup', 1169 actions: 'popup-actions', 1170 confirmButton: 'popup-button', 1171 denyButton: 'popup-button', 1172 },
1173 confirmButtonText: 'éãã', 1174 showDenyButton: true, 1175 denyButtonText:'ããããµã¼ãã¹å©ç¨è¦ç´ã¸', 1176 allowEscapeKey: false, 1177 reverseButtons: true, 1178 preDeny: () => { 1179 const url = terms_link; 1180 window.open(url, '_black'); 1181 return false 1182 }, 1183 showClass: { 1184 popup: '' 1185 } 1186 }).then((result) =>{ 1187 if (result.isConfirmed) { 1188 const period_date = 730; 1189 const date = new Date(); 1190 date.setTime(date.getTime() + period_date * 24 * 3600 * 1000); 1191 let exprires = "; expires=" + date.toUTCString(); 1192 document.cookie = "hidePopup=true" + exprires + "; path=/"; 1193 } 1194 }); 1195 } 1196} 1197 1198$(function() { 1199 const topSwiper = new Swiper(".top-swiper", { 1200 speed: 800, 1201 autoplay: { 1202 delay: 4000, 1203 }, 1204 loop: true, 1205 loopedSlides: 1, 1206 slidesPerView: 'auto', 1207 spaceBetween: 0, 1208 centeredSlides: true, 1209 navigation: { 1210 nextEl: ".swiper-button-next", 1211 prevEl: ".swiper-button-prev", 1212 }, 1213 pagination: { 1214 el: ".swiper-pagination", 1215 clickable: true, 1216 }, 1217 }); 1218 const kenkoTopSwiper = new Swiper(".kenko-top-swiper", { 1219 speed: 800, 1220 autoplay: { 1221 delay: 4000, 1222 }, 1223 loop: true, 1224 loopedSlides: 1, 1225 slidesPerView: 'auto', 1226 spaceBetween: 0, 1227 centeredSlides: true, 1228 navigation: { 1229 nextEl: ".swiper-button-next", 1230 prevEl: ".swiper-button-prev", 1231 } 1232 }); 1233}); 1234 1235function displayControl() { 1236 $(".display-control").click(function(){ 1237 const target = $(this).data('target'); 1238 const img = $(this).find(".icon-yajirushi img"); 1239 if ($(target).hasClass("d-none")) { 1240 $(target).removeClass("d-none"); 1241 $(img).addClass("rotated"); 1242 } else { 1243 $(target).addClass("d-none"); 1244 $(img).removeClass("rotated"); 1245 } 1246 }); 1247} 1248 1249;(function($){ 1250$(document).ready(function(){ 1251 //[smooth scroll] 1252 $minkyou_pc.smoothScroll.init(); 1253 //[exclution right] 1254 $minkyou_pc.exclusionRight.init(); 1255 //[collapse block] 1256 $minkyou_pc.collapseBlock.init(); 1257 //[section link] 1258 $minkyou_pc.sectionLink.init(); 1259 //[custom forms] 1260 $minkyou_pc.customForms.init(); 1261 //[outer fix image] 1262 $minkyou_pc.outerFixImage.init(); 1263 //[col height] 1264 $minkyou_pc.colHeight.init(); 1265 //[tab set]ãã¼ã¸åèªã¿è¾¼ã¿ã®çºä¸è¦ 1266 //$minkyou_pc.tabSet.init(); 1267 //[modal exec] 1268 $minkyou_pc.modalExec.init(); 1269 //[fix side] 1270 $minkyou_pc.fixSide.init(); 1271 //[range select] 1272 $minkyou_pc.rangeSelect.init(); 1273 //[popup exec] 1274 $minkyou_pc.popupExec.init(); 1275 //[header menu] 1276 $minkyou_pc.headerMenu.init(); 1277 //[recipe top menu] 1278 $minkyou_pc.recipeTopMenu.init(); 1279 //[top carousel] 1280 $minkyou_pc.topCarousel.init(); 1281 //[kenko carousel] 1282 $minkyou_pc.kenkoCarousel.init(); 1283 //[open help] 1284 $minkyou_pc.openHelp.init(); 1285 //[popover show] 1286 $minkyou_pc.popoverShow.init(); 1287 //[yakunitatta click] 1288 $minkyou_pc.yakunitatta_click.init(); 1289 //[footer feedback] 1290 $minkyou_pc.footerFeedback.init(); 1291 //[floating banner] 1292 $minkyou_pc.floatingBanner.init(); 1293}); 1294$(window).on('load',function(){ 1295 // check Cookie Popup 1296 checkCookiePopup(); 1297 displayControl(); 1298}); 1299})(jQuery); 1300
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.