1Barba.Pjax.start(); 2Barba.Prefetch.init(); 3 4Barba.Dispatcher.on('newPageReady', function(currentStatus, oldStatus, container, newPageRawHTML) { 5 var head = document.head; 6 var newPageRawHead = newPageRawHTML.match(/<head[^>]*>([\s\S.]*)<\/head>/i)[0]; 7 var newPageHead = document.createElement('head'); 8 newPageHead.innerHTML = newPageRawHead; 9 10 var removeHeadTags = [ 11 "meta[name='keywords']" 12 ,"meta[name='description']" 13 ,"meta[property^='og']" 14 ,"meta[name^='twitter']" 15 ,"meta[itemprop]" 16 ,"link[itemprop]" 17 ,"link[rel='prev']" 18 ,"link[rel='next']" 19 ,"link[rel='canonical']" 20 ].join(','); 21 var headTags = head.querySelectorAll(removeHeadTags) 22 for(var i = 0; i < headTags.length; i++ ){ 23 head.removeChild(headTags[i]); 24 } 25 var newHeadTags = newPageHead.querySelectorAll(removeHeadTags) 26 27 for(var i = 0; i < newHeadTags.length; i++ ){ 28 head.appendChild(newHeadTags[i]); 29 } 30 31}); 32 33 34var PageTransition = Barba.BaseTransition.extend({ 35 start: function() { 36 Promise 37 .all([this.newContainerLoading, this.fadeOut()]) 38 .then(this.fadeIn.bind(this)); 39 }, 40 fadeOut: function() { 41 return $(this.oldContainer).delay(0).animate({ opacity: 0 }).promise(); 42 }, 43 fadeIn: function() { 44 var _this = this; 45 var $el = $(this.newContainer); 46 47 $(this.oldContainer).hide(); 48 49 $el.css({ 50 visibility : 'visible', 51 opacity : 0 52 }); 53 54 $('body, html').animate({ scrollTop: 0 }, 0); 55 $el.animate({ opacity: 1 }, 0, function() { 56 _this.done(); 57 }); 58 59 60 }, 61}); 62 63Barba.Pjax.getTransition = function() { 64 return PageTransition; 65}; 66 67Barba.Dispatcher.on('transitionCompleted', function() { 68 //ãã¼ã¸é·ç§»å®äºjsçºç« 69 $(document).ready(function () { 70 setEachFunc(); 71 }); 72}); 73 74 75 76!(function(){ 77$(function(){ 78 setEachFunc(); 79}); 80})(); 81 82 83function setEachFunc(){ 84 var options = { 85 hashTracking:false, 86 appendTo:'.barba-container' 87 }; 88 $('[data-remodal-id=sp_menu]').remodal(options); 89 $('.menu').on('click', function(event) { 90 $('[data-remodal-id=sp_menu]').remodal(options); 91 }); 92 $('.sp_menu a').on('click', function(event) { 93 $('[data-remodal-id=sp_menu]').remodal().close(); 94 }); 95 96 97 smoothScroll(); 98 99 if ($('#top').length>=1) { 100 $('#top').addClass('load'); 101 setTimeout(function (){ 102 contentsAnime(); 103 showTop(); 104 topAnime(); 105 slider($('.bnr')); 106 },500); 107 } 108 109 if ($('.under_page').length>=1) { 110 $('.under_page').addClass('load'); 111 setTimeout(function (){ 112 contentsAnime(); 113 },300); 114 115 116 if ($('#news').length>=1) { 117 sideLine('#news',170); 118 $('.pc_nav li a').removeClass('on'); 119 $('.pc_nav li:nth-child(2) a').addClass('on'); 120 } 121 122 if ($('#message').length>=1) { 123 sideLine('#message',225); 124 accordion(); 125 pulldown(); 126 $('.pc_nav li a').removeClass('on'); 127 $('.pc_nav li:nth-child(3) a').addClass('on'); 128 } 129 130 if ($('#tour').length>=1) { 131 sideLine('#tour',190); 132 $('.pc_nav li a').removeClass('on'); 133 $('.pc_nav li:nth-child(8) a').addClass('on'); 134 } 135 136 if ($('#contact').length>=1) { 137 sideLine('#contact',150); 138 $('.pc_nav li a').removeClass('on'); 139 } 140 141 if ($('#link').length>=1) { 142 sideLine('#link',100); 143 $('.pc_nav li a').removeClass('on'); 144 $('.pc_nav li:nth-child(9) a').addClass('on'); 145 } 146 147 if ($('#mail_mag').length>=1) { 148 sideLine('#mail_mag',180); 149 $('.pc_nav li a').removeClass('on'); 150 $('.pc_nav li:nth-child(10) a').addClass('on'); 151 } 152 153 if ($('#news_detail').length>=1) { 154 sideLine('#news_detail',170); 155 $('.pc_nav li a').removeClass('on'); 156 $('.pc_nav li:nth-child(2) a').addClass('on'); 157 } 158 159 if ($('#video').length>=1) { 160 sideLine('#video',100); 161 $('.pc_nav li a').removeClass('on'); 162 $('.pc_nav li:nth-child(7) a').addClass('on'); 163 } 164 165 if ($('#profile').length>=1) { 166 sideLine('#profile',120); 167 $('.pc_nav li a').removeClass('on'); 168 $('.pc_nav li:nth-child(4) a').addClass('on'); 169 } 170 171 if ($('#discography').length>=1) { 172 sideLine('#discography',240); 173 $('.pc_nav li a').removeClass('on'); 174 $('.pc_nav li:nth-child(5) a').addClass('on'); 175 } 176 177 if ($('.blog').length>=1) { 178 setArchiveMenu(); 179 editArchive(); 180 } 181 } 182} 183 184 185function setFirstMovie(){ 186 187 if($.cookie("modal_flg") !== 'true'){ 188 $.cookie("modal_flg", "true", { expires: 1 }); 189 var getWidth = $(window).width(); 190 if (getWidth > 768) { 191 $('[data-remodal-id=first_movie]').remodal().open(); 192 $(document).on('closing', '#modal', function (e) { 193 if (!$('.kv').hasClass('on')) { 194 showTop(); 195 topAnime(); 196 slider($('.bnr')); 197 } 198 }); 199 }else{ 200 if ($('.kv').hasClass('on') == false) { 201 showTop(); 202 topAnime(); 203 slider($('.bnr')); 204 } 205 } 206 var timer = false; 207 $(window).resize(function() { 208 if (timer !== false) { 209 clearTimeout(timer); 210 } 211 timer = setTimeout(function() { 212 getWidth = $(window).width(); 213 if (getWidth > 768) { 214 if ($('#modal').hasClass('remodal-is-closed')) { 215 $('[data-remodal-id=first_movie]').remodal().open(); 216 } 217 }else{ 218 $('[data-remodal-id=first_movie]').remodal().close(); 219 } 220 }, 200); 221 });
222 }else{ 223 if ($('.kv').hasClass('on') == false) { 224 showTop(); 225 topAnime(); 226 slider($('.bnr')); 227 } 228 } 229} 230 231function setArchiveMenu(){ 232 $('.archive_list h4').on('click', function(event) { 233 $(this).toggleClass('on'); 234 $(this).next('ul').slideToggle('600','easeOutSine'); 235 }); 236 $('.blog .menu_area h3').on('click', function(event) { 237 var getWidth = $(window).width(); 238 if (getWidth <= 768) { 239 $(this).toggleClass('on'); 240 $(this).next('.archive_list').slideToggle('600','easeOutSine'); 241 } 242 }); 243} 244 245 246function accordion(){ 247 $('.list_btn.accordion').on('click', function(event) { 248 event.preventDefault(); 249 $(this).parents('.accordion_area').find('.accordion_block').slideToggle('600','easeOutSine'); 250 $(this).find('span').removeClass('on').end().find('.off').addClass('on').removeClass('off').end().find('span:not(".on")').addClass('off'); 251 setTimeout(function() { 252 sideLine('#message',225); 253 }, 600); 254 255 }); 256} 257 258function sideLine(target,num){ 259 var getHeight = $('.contents_area').height(); 260 if (getHeight <= $(window).height()) { 261 getHeight = $(window).height()+50; 262 } 263 $(target +' .side_line').css('height', getHeight - num + 'px'); 264 var timer = false; 265 $(window).resize(function() { 266 if (timer !== false) { 267 clearTimeout(timer); 268 } 269 timer = setTimeout(function() { 270 var getHeight = $('.contents_area').height(); 271 if (getHeight <= $(window).height()) { 272 getHeight = $(window).height()+50; 273 } 274 $(target +' .side_line').css('height', getHeight - num + 'px'); 275 }, 200); 276 }); 277} 278 279 280function pulldown(){ 281 $('.celected_menu').on('click', function(event) { 282 event.preventDefault(); 283 $('.pulldown_menu').slideToggle('fast'); 284 }); 285 286 $('.pulldown_menu li a').on('click', function(event) { 287 var getClass = $(this).parent().attr('class'); 288 $('.pulldown_menu').slideUp('fast'); 289 290 $('.celected_menu li').removeClass('on'); 291 $('.celected_menu li.'+getClass ).addClass('on'); 292 }); 293 294 295} 296 297 298 299function slider(target){ 300 target.slick({ 301 slidesToShow: 1, 302 slidesToScroll: 1, 303 autoplay: true, 304 autoplaySpeed: 5000, 305 arrows:false, 306 speed:1000, 307 dots:true, 308 easing:'easeOutQuad' 309 }); 310} 311 312 313 314function showTop(){ 315 $('.kv, .bnr').delay(400).queue(function() { 316 $(this).addClass('on'); 317 }); 318 $('.pc_nav,.for_pc .logo').delay(2400).queue(function() { 319 $(this).addClass('on'); 320 }); 321 $('.for_sp .logo').delay(1200).queue(function() { 322 $(this).addClass('on'); 323 }); 324 325 setTimeout("svg($('#line1_pc'),1800,500,'easeOutCubic')",1500); 326 //setTimeout("svg($('#line1_sp'),1000,500,'swing')",200); 327} 328 329 330function svg(a_target,a_duration,a_stagger,a_easing){ 331 a_target.addClass('on'); 332 var ua = navigator.userAgent.toLowerCase(); 333 if(ua.indexOf('msie') == -1 && ua.indexOf("edge") == -1) { 334 var $svg = a_target.drawsvg({ 335 duration: a_duration, 336 stagger:a_stagger, 337 easing: a_easing 338 }); 339 $svg.drawsvg('animate'); 340 } 341 342} 343 344function topAnime(){ 345 var menu = $(".for_pc .sns_area"); 346 var menuTop = menu.offset().top; 347 $(window).scroll(function (){ 348 if($(window).scrollTop() >= menuTop-40) { 349 menu.addClass("fixed"); 350 } else { 351 menu.removeClass("fixed"); 352 } 353 $(".contents_title span").each(function(){ 354 var imgPos = $(this).offset().top; 355 var scroll = $(window).scrollTop(); 356 var windowHeight = $(window).height(); 357 var lengthCount = $(this).find('span').length; 358 if (scroll > imgPos - windowHeight-300 + windowHeight/2){ 359 for (var i = 0; i <= lengthCount; i++) { 360 $(this).find('span:nth-of-type('+i+')').delay(150*i).queue(function(){ 361 $(this).addClass('on'); 362 }); 363 } 364 } 365 }); 366 367 $(".line:not('.line1.for_pc')").each(function(){ 368 var imgPos = $(this).offset().top; 369 var scroll = $(window).scrollTop(); 370 var windowHeight = $(window).height(); 371 var scrollHeight = $(document).height(); 372 var scrollPosition = windowHeight + $(window).scrollTop(); 373 var duration; 374 var stagger; 375 var id = $(this).attr("id"); 376 if (id == 'line2_pc') { 377 duration = 800; 378 stagger = 0; 379 }else if (id == 'line3_pc') { 380 duration = 800; 381 stagger = 0; 382 }else if (id == 'line4_pc') { 383 duration = 600; 384 stagger = 500; 385 }else if (id == 'line5_pc') { 386 duration = 600; 387 stagger = 0; 388 }else if (id == 'line6_pc') { 389 duration = 600; 390 stagger = 0; 391 }else if (id == 'line1_sp') { 392 duration = 500; 393 stagger = 200; 394 }else if (id == 'line2_sp') { 395 duration = 500; 396 stagger = 0; 397 }else if (id == 'line3_sp') { 398 duration = 500; 399 stagger = 500; 400 }else if (id == 'line4_sp') { 401 duration = 500; 402 stagger = 0; 403 }else if (id == 'line5_sp') { 404 duration = 500; 405 stagger = 0; 406 } 407 //ã¹ã¯ãã¼ã«ããã£ããã©ã¹ã表示 408 if ((scrollHeight - scrollPosition) / scrollHeight <= 0 && !$('#line6_pc').hasClass('on')) { 409 svg($('#line6_pc'),1000,0,'easeOutCubic'); 410 } 411 412 if ((scrollHeight - scrollPosition) / scrollHeight <= 0.01 && !$('#line5_sp').hasClass('on')) { 413 svg($('#line5_sp'),500,0,'easeOutCubic'); 414 } 415 if (scroll > imgPos - windowHeight- 0 + windowHeight/2 && !$(this).hasClass('on')){ 416 svg($('#'+id),duration,stagger,'easeOutCubic'); 417 } 418 });
419 420 }); 421} 422 423 424function contentsAnime(){ 425 426 $('.contentsAnime').delay(2000).queue(function() { 427 $(".contentsAnime").each(function(){ 428 var windowHeight = $(window).height(); 429 var imgPos = $(this).offset().top; 430 if (windowHeight > imgPos) { 431 if (!$(this).hasClass('on')) { 432 $(this).addClass('on'); 433 } 434 } 435 }); 436 }); 437 438 $(".contentsAnime").each(function(){ 439 var windowHeight = $(window).height(); 440 var imgPos = $(this).offset().top; 441 if (windowHeight > imgPos) { 442 if (!$(this).hasClass('on')) { 443 $(this).addClass('on'); 444 } 445 } 446 }); 447 $(window).scroll(function (){ 448 $(".contentsAnime").each(function(){ 449 var imgPos = $(this).offset().top; 450 var scroll = $(window).scrollTop(); 451 var windowHeight = $(window).height(); 452 var scrollHeight = $(document).height(); 453 var scrollPosition = windowHeight + $(window).scrollTop(); 454 if (scroll > imgPos - windowHeight-300 + windowHeight/2){ 455 if (!$(this).hasClass('on')) { 456 $(this).addClass('on'); 457 if ($('.copy.contentsAnime').hasClass('on') && !$('#line5_sp').hasClass('on')) { 458 //svg($('#line5_sp'),500,0,'easeOutCubic'); 459 setTimeout("svg($('#line5_sp'),500,0,'easeOutCubic')",800); 460 } 461 } 462 } 463 464 //ã¹ã¯ãã¼ã«ããã£ããfotter表示 465 if ((scrollHeight - scrollPosition) / scrollHeight <= 0) { 466 if (!$('.footer_link.contentsAnime').hasClass('on')) { 467 $('.footer_link.contentsAnime').addClass('on'); 468 } 469 if (!$('.copy.contentsAnime').hasClass('on')) { 470 $('.copy.contentsAnime').addClass('on'); 471 } 472 } 473 474 }); 475 }); 476} 477 478function smoothScroll(){ 479 //ãã¼ã¸å ãªã³ã¯ 480 // ã¹ã¯ãã¼ã«ã®ãªãã»ããå¤ 481 var offsetY = 0; 482 // ã¹ã¯ãã¼ã«ã«ãããæé 483 var time = 500; 484 485 // ãã¼ã¸å ãªã³ã¯ã®ã¿ãåå¾ 486 $('a[href^="#"]').click(function() { 487 // ç§»åå ã¨ãªãè¦ç´ ãåå¾ 488 var target = $(this.hash); 489 if (!target.length) return ; 490 // ç§»åå ã¨ãªãå¤ 491 var targetY; 492 if ($('.under_page').length>=1) { 493 targetY = target.offset().top-56; 494 }else{ 495 targetY = target.offset().top+offsetY; 496 } 497 // ã¹ã¯ãã¼ã«ã¢ãã¡ã¼ã·ã§ã³ 498 $('html,body').animate({scrollTop: targetY}, time, 'easeOutQuint'); 499 // ããã·ã¥æ¸ãæãã¨ã 500 window.history.pushState(null, null, this.hash); 501 // ããã©ã«ãã®å¦çã¯ãã£ã³ã»ã« 502 return false; 503 }); 504} 505/* 506 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 507 * 508 * Uses the built in easing capabilities added In jQuery 1.1 509 * to offer multiple easing options 510 * 511 * TERMS OF USE - jQuery Easing 512 * 513 * Open source under the BSD License. 514 * 515 * Copyright © 2008 George McGinley Smith 516 * All rights reserved. 517 * 518 * Redistribution and use in source and binary forms, with or without modification, 519 * are permitted provided that the following conditions are met: 520 * 521 * Redistributions of source code must retain the above copyright notice, this list of 522 * conditions and the following disclaimer. 523 * Redistributions in binary form must reproduce the above copyright notice, this list 524 * of conditions and the following disclaimer in the documentation and/or other materials 525 * provided with the distribution. 526 * 527 * Neither the name of the author nor the names of contributors may be used to endorse 528 * or promote products derived from this software without specific prior written permission. 529 * 530 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 531 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 532 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 533 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 534 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 535 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 536 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 537 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 538 * OF THE POSSIBILITY OF SUCH DAMAGE. 539 * 540*/ 541 542// t: current time, b: begInnIng value, c: change In value, d: duration 543jQuery.easing['jswing'] = jQuery.easing['swing']; 544 545jQuery.extend( jQuery.easing, 546{ 547 def: 'easeOutQuad', 548 swing: function (x, t, b, c, d) { 549 //alert(jQuery.easing.default); 550 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 551 }, 552 easeInQuad: function (x, t, b, c, d) { 553 return c*(t/=d)*t + b; 554 }, 555 easeOutQuad: function (x, t, b, c, d) { 556 return -c *(t/=d)*(t-2) + b; 557 }, 558 easeInOutQuad: function (x, t, b, c, d) { 559 if ((t/=d/2) < 1) return c/2*t*t + b; 560 return -c/2 * ((--t)*(t-2) - 1) + b; 561 }, 562 easeInCubic: function (x, t, b, c, d) {
vendor: 4,865 bytes, lines 563-679
563 return c*(t/=d)*t*t + b; 564 }, 565 easeOutCubic: function (x, t, b, c, d) { 566 return c*((t=t/d-1)*t*t + 1) + b; 567 }, 568 easeInOutCubic: function (x, t, b, c, d) { 569 if ((t/=d/2) < 1) return c/2*t*t*t + b; 570 return c/2*((t-=2)*t*t + 2) + b; 571 }, 572 easeInQuart: function (x, t, b, c, d) { 573 return c*(t/=d)*t*t*t + b; 574 }, 575 easeOutQuart: function (x, t, b, c, d) { 576 return -c * ((t=t/d-1)*t*t*t - 1) + b; 577 }, 578 easeInOutQuart: function (x, t, b, c, d) { 579 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 580 return -c/2 * ((t-=2)*t*t*t - 2) + b; 581 }, 582 easeInQuint: function (x, t, b, c, d) { 583 return c*(t/=d)*t*t*t*t + b; 584 }, 585 easeOutQuint: function (x, t, b, c, d) { 586 return c*((t=t/d-1)*t*t*t*t + 1) + b; 587 }, 588 easeInOutQuint: function (x, t, b, c, d) { 589 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 590 return c/2*((t-=2)*t*t*t*t + 2) + b; 591 }, 592 easeInSine: function (x, t, b, c, d) { 593 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 594 }, 595 easeOutSine: function (x, t, b, c, d) { 596 return c * Math.sin(t/d * (Math.PI/2)) + b; 597 }, 598 easeInOutSine: function (x, t, b, c, d) { 599 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 600 }, 601 easeInExpo: function (x, t, b, c, d) { 602 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 603 }, 604 easeOutExpo: function (x, t, b, c, d) { 605 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 606 }, 607 easeInOutExpo: function (x, t, b, c, d) { 608 if (t==0) return b; 609 if (t==d) return b+c; 610 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 611 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 612 }, 613 easeInCirc: function (x, t, b, c, d) { 614 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 615 }, 616 easeOutCirc: function (x, t, b, c, d) { 617 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 618 }, 619 easeInOutCirc: function (x, t, b, c, d) { 620 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 621 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 622 }, 623 easeInElastic: function (x, t, b, c, d) { 624 var s=1.70158;var p=0;var a=c; 625 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 626 if (a < Math.abs(c)) { a=c; var s=p/4; } 627 else var s = p/(2*Math.PI) * Math.asin (c/a); 628 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 629 }, 630 easeOutElastic: function (x, t, b, c, d) { 631 var s=1.70158;var p=0;var a=c; 632 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 633 if (a < Math.abs(c)) { a=c; var s=p/4; } 634 else var s = p/(2*Math.PI) * Math.asin (c/a); 635 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 636 }, 637 easeInOutElastic: function (x, t, b, c, d) { 638 var s=1.70158;var p=0;var a=c; 639 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 640 if (a < Math.abs(c)) { a=c; var s=p/4; } 641 else var s = p/(2*Math.PI) * Math.asin (c/a); 642 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 643 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 644 }, 645 easeInBack: function (x, t, b, c, d, s) { 646 if (s == undefined) s = 1.70158; 647 return c*(t/=d)*t*((s+1)*t - s) + b; 648 }, 649 easeOutBack: function (x, t, b, c, d, s) { 650 if (s == undefined) s = 1.70158; 651 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 652 }, 653 easeInOutBack: function (x, t, b, c, d, s) { 654 if (s == undefined) s = 1.70158; 655 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 656 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 657 }, 658 easeInBounce: function (x, t, b, c, d) { 659 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 660 }, 661 easeOutBounce: function (x, t, b, c, d) { 662 if ((t/=d) < (1/2.75)) { 663 return c*(7.5625*t*t) + b; 664 } else if (t < (2/2.75)) { 665 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 666 } else if (t < (2.5/2.75)) { 667 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 668 } else { 669 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 670 } 671 }, 672 easeInOutBounce: function (x, t, b, c, d) { 673 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 674 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 675 } 676}); 677 678/* 679 *
680 * TERMS OF USE - EASING EQUATIONS 681 * 682 * Open source under the BSD License. 683 * 684 * Copyright © 2001 Robert Penner 685 * All rights reserved. 686 * 687 * Redistribution and use in source and binary forms, with or without modification, 688 * are permitted provided that the following conditions are met: 689 * 690 * Redistributions of source code must retain the above copyright notice, this list of 691 * conditions and the following disclaimer. 692 * Redistributions in binary form must reproduce the above copyright notice, this list 693 * of conditions and the following disclaimer in the documentation and/or other materials 694 * provided with the distribution. 695 * 696 * Neither the name of the author nor the names of contributors may be used to endorse 697 * or promote products derived from this software without specific prior written permission. 698 * 699 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 700 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 701 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 702 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 703 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 704 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 705 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 706 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 707 * OF THE POSSIBILITY OF SUCH DAMAGE. 708 * 709 */ 710/*! 711 * jQuery Cookie Plugin v1.4.1 712 * https://github.com/carhartl/jquery-cookie 713 * 714 * Copyright 2006, 2014 Klaus Hartl 715 * Released under the MIT license 716 */ 717(function (factory) { 718 if (typeof define === 'function' && define.amd) { 719 // AMD (Register as an anonymous module) 720 define(['jquery'], factory); 721 } else if (typeof exports === 'object') { 722 // Node/CommonJS 723 module.exports = factory(require('jquery')); 724 } else { 725 // Browser globals 726 factory(jQuery); 727 } 728}(function ($) { 729 730 var pluses = /\+/g; 731 732 function encode(s) { 733 return config.raw ? s : encodeURIComponent(s); 734 } 735 736 function decode(s) { 737 return config.raw ? s : decodeURIComponent(s); 738 } 739 740 function stringifyCookieValue(value) { 741 return encode(config.json ? JSON.stringify(value) : String(value)); 742 } 743 744 function parseCookieValue(s) { 745 if (s.indexOf('"') === 0) { 746 // This is a quoted cookie as according to RFC2068, unescape... 747 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 748 } 749 750 try { 751 // Replace server-side written pluses with spaces. 752 // If we can't decode the cookie, ignore it, it's unusable. 753 // If we can't parse the cookie, ignore it, it's unusable. 754 s = decodeURIComponent(s.replace(pluses, ' ')); 755 return config.json ? JSON.parse(s) : s; 756 } catch(e) {} 757 } 758 759 function read(s, converter) { 760 var value = config.raw ? s : parseCookieValue(s); 761 return $.isFunction(converter) ? converter(value) : value; 762 } 763 764 var config = $.cookie = function (key, value, options) { 765 766 // Write 767 768 if (arguments.length > 1 && !$.isFunction(value)) { 769 options = $.extend({}, config.defaults, options); 770 771 if (typeof options.expires === 'number') { 772 var days = options.expires, t = options.expires = new Date(); 773 t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 774 } 775 776 return (document.cookie = [ 777 encode(key), '=', stringifyCookieValue(value), 778 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 779 options.path ? '; path=' + options.path : '', 780 options.domain ? '; domain=' + options.domain : '', 781 options.secure ? '; secure' : '' 782 ].join('')); 783 } 784 785 // Read 786 787 var result = key ? undefined : {}, 788 // To prevent the for loop in the first place assign an empty array 789 // in case there are no cookies at all. Also prevents odd result when 790 // calling $.cookie(). 791 cookies = document.cookie ? document.cookie.split('; ') : [], 792 i = 0, 793 l = cookies.length; 794 795 for (; i < l; i++) { 796 var parts = cookies[i].split('='), 797 name = decode(parts.shift()), 798 cookie = parts.join('='); 799 800 if (key === name) { 801 // If second argument (value) is a function it's a converter... 802 result = read(cookie, value); 803 break; 804 } 805 806 // Prevent storing a cookie that we couldn't decode. 807 if (!key && (cookie = read(cookie)) !== undefined) { 808 result[name] = cookie; 809 } 810 } 811 812 return result; 813 }; 814 815 config.defaults = {}; 816 817 $.removeCookie = function (key, options) {
vendor: 20,334 bytes, lines 818-1609
818 // Must not alter options, thus extending a fresh object... 819 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 820 return !$.cookie(key); 821 }; 822 823})); 824 825/* 826 * Remodal - v1.1.0 827 * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. 828 * http://vodkabears.github.io/remodal/ 829 * 830 * Made by Ilya Makarov 831 * Under MIT License 832 */ 833 834!(function(root, factory) { 835 if (typeof define === 'function' && define.amd) { 836 define(['jquery'], function($) { 837 return factory(root, $); 838 }); 839 } else if (typeof exports === 'object') { 840 factory(root, require('jquery')); 841 } else { 842 factory(root, root.jQuery || root.Zepto); 843 } 844})(this, function(global, $) { 845 846 'use strict'; 847 848 /** 849 * Name of the plugin 850 * @private 851 * @const 852 * @type {String} 853 */ 854 var PLUGIN_NAME = 'remodal'; 855 856 /** 857 * Namespace for CSS and events 858 * @private 859 * @const 860 * @type {String} 861 */ 862 var NAMESPACE = global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.NAMESPACE || PLUGIN_NAME; 863 864 /** 865 * Animationstart event with vendor prefixes 866 * @private 867 * @const 868 * @type {String} 869 */ 870 var ANIMATIONSTART_EVENTS = $.map( 871 ['animationstart', 'webkitAnimationStart', 'MSAnimationStart', 'oAnimationStart'], 872 873 function(eventName) { 874 return eventName + '.' + NAMESPACE; 875 } 876 877 ).join(' '); 878 879 /** 880 * Animationend event with vendor prefixes 881 * @private 882 * @const 883 * @type {String} 884 */ 885 var ANIMATIONEND_EVENTS = $.map( 886 ['animationend', 'webkitAnimationEnd', 'MSAnimationEnd', 'oAnimationEnd'], 887 888 function(eventName) { 889 return eventName + '.' + NAMESPACE; 890 } 891 892 ).join(' '); 893 894 /** 895 * Default settings 896 * @private 897 * @const 898 * @type {Object} 899 */ 900 var DEFAULTS = $.extend({ 901 hashTracking: true, 902 closeOnConfirm: true, 903 closeOnCancel: true, 904 closeOnEscape: true, 905 closeOnOutsideClick: true, 906 modifier: '', 907 appendTo: null 908 }, global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.DEFAULTS); 909 910 /** 911 * States of the Remodal 912 * @private 913 * @const 914 * @enum {String} 915 */ 916 var STATES = { 917 CLOSING: 'closing', 918 CLOSED: 'closed', 919 OPENING: 'opening', 920 OPENED: 'opened' 921 }; 922 923 /** 924 * Reasons of the state change. 925 * @private 926 * @const 927 * @enum {String} 928 */ 929 var STATE_CHANGE_REASONS = { 930 CONFIRMATION: 'confirmation', 931 CANCELLATION: 'cancellation' 932 }; 933 934 /** 935 * Is animation supported? 936 * @private 937 * @const 938 * @type {Boolean} 939 */ 940 var IS_ANIMATION = (function() { 941 var style = document.createElement('div').style; 942 943 return style.animationName !== undefined || 944 style.WebkitAnimationName !== undefined || 945 style.MozAnimationName !== undefined || 946 style.msAnimationName !== undefined || 947 style.OAnimationName !== undefined; 948 })(); 949 950 /** 951 * Is iOS? 952 * @private 953 * @const 954 * @type {Boolean} 955 */ 956 var IS_IOS = /iPad|iPhone|iPod/.test(navigator.platform); 957 958 /** 959 * Current modal 960 * @private 961 * @type {Remodal} 962 */ 963 var current; 964 965 /** 966 * Scrollbar position 967 * @private 968 * @type {Number} 969 */ 970 var scrollTop; 971 972 /** 973 * Returns an animation duration 974 * @private 975 * @param {jQuery} $elem 976 * @returns {Number} 977 */ 978 function getAnimationDuration($elem) { 979 if ( 980 IS_ANIMATION && 981 $elem.css('animation-name') === 'none' && 982 $elem.css('-webkit-animation-name') === 'none' && 983 $elem.css('-moz-animation-name') === 'none' && 984 $elem.css('-o-animation-name') === 'none' && 985 $elem.css('-ms-animation-name') === 'none' 986 ) { 987 return 0; 988 } 989 990 var duration = $elem.css('animation-duration') || 991 $elem.css('-webkit-animation-duration') || 992 $elem.css('-moz-animation-duration') || 993 $elem.css('-o-animation-duration') || 994 $elem.css('-ms-animation-duration') || 995 '0s'; 996 997 var delay = $elem.css('animation-delay') || 998 $elem.css('-webkit-animation-delay') || 999 $elem.css('-moz-animation-delay') || 1000 $elem.css('-o-animation-delay') || 1001 $elem.css('-ms-animation-delay') || 1002 '0s'; 1003 1004 var iterationCount = $elem.css('animation-iteration-count') || 1005 $elem.css('-webkit-animation-iteration-count') || 1006 $elem.css('-moz-animation-iteration-count') || 1007 $elem.css('-o-animation-iteration-count') || 1008 $elem.css('-ms-animation-iteration-count') || 1009 '1'; 1010 1011 var max; 1012 var len; 1013 var num; 1014 var i; 1015 1016 duration = duration.split(', '); 1017 delay = delay.split(', '); 1018 iterationCount = iterationCount.split(', '); 1019 1020 // The 'duration' size is the same as the 'delay' size 1021 for (i = 0, len = duration.length, max = Number.NEGATIVE_INFINITY; i < len; i++) { 1022 num = parseFloat(duration[i]) * parseInt(iterationCount[i], 10) + parseFloat(delay[i]); 1023 1024 if (num > max) { 1025 max = num; 1026 } 1027 } 1028 1029 return max; 1030 } 1031 1032 /** 1033 * Returns a scrollbar width 1034 * @private 1035 * @returns {Number} 1036 */ 1037 function getScrollbarWidth() { 1038 if ($(document.body).height() <= $(window).height()) { 1039 return 0; 1040 } 1041 1042 var outer = document.createElement('div'); 1043 var inner = document.createElement('div'); 1044 var widthNoScroll; 1045 var widthWithScroll; 1046 1047 outer.style.visibility = 'hidden'; 1048 outer.style.width = '100px'; 1049 document.body.appendChild(outer); 1050 1051 widthNoScroll = outer.offsetWidth; 1052 1053 // Force scrollbars 1054 outer.style.overflow = 'scroll'; 1055 1056 // Add inner div 1057 inner.style.width = '100%'; 1058 outer.appendChild(inner); 1059 1060 widthWithScroll = inner.offsetWidth; 1061 1062 // Remove divs 1063 outer.parentNode.removeChild(outer); 1064 1065 return widthNoScroll - widthWithScroll; 1066 } 1067 1068 /** 1069 * Locks the screen 1070 * @private 1071 */ 1072 function lockScreen() { 1073 if (IS_IOS) { 1074 return; 1075 } 1076 1077 var $html = $('html'); 1078 var lockedClass = namespacify('is-locked'); 1079 var paddingRight; 1080 var $body; 1081 1082 if (!$html.hasClass(lockedClass)) { 1083 $body = $(document.body); 1084 1085 // Zepto does not support '-=', '+=' in the `css` method 1086 paddingRight = parseInt($body.css('padding-right'), 10) + getScrollbarWidth(); 1087 1088 $body.css('padding-right', paddingRight + 'px'); 1089 $html.addClass(lockedClass); 1090 } 1091 } 1092 1093 /** 1094 * Unlocks the screen 1095 * @private 1096 */ 1097 function unlockScreen() { 1098 if (IS_IOS) { 1099 return; 1100 } 1101 1102 var $html = $('html'); 1103 var lockedClass = namespacify('is-locked'); 1104 var paddingRight; 1105 var $body; 1106 1107 if ($html.hasClass(lockedClass)) { 1108 $body = $(document.body); 1109 1110 // Zepto does not support '-=', '+=' in the `css` method 1111 paddingRight = parseInt($body.css('padding-right'), 10) - getScrollbarWidth(); 1112 1113 $body.css('padding-right', paddingRight + 'px'); 1114 $html.removeClass(lockedClass); 1115 } 1116 } 1117 1118 /** 1119 * Sets a state for an instance 1120 * @private 1121 * @param {Remodal} instance 1122 * @param {STATES} state 1123 * @param {Boolean} isSilent If true, Remodal does not trigger events 1124 * @param {String} Reason of a state change. 1125 */ 1126 function setState(instance, state, isSilent, reason) { 1127 1128 var newState = namespacify('is', state); 1129 var allStates = [namespacify('is', STATES.CLOSING), 1130 namespacify('is', STATES.OPENING), 1131 namespacify('is', STATES.CLOSED), 1132 namespacify('is', STATES.OPENED)].join(' '); 1133 1134 instance.$bg 1135 .removeClass(allStates) 1136 .addClass(newState); 1137 1138 instance.$overlay 1139 .removeClass(allStates) 1140 .addClass(newState); 1141 1142 instance.$wrapper 1143 .removeClass(allStates) 1144 .addClass(newState); 1145 1146 instance.$modal 1147 .removeClass(allStates) 1148 .addClass(newState); 1149 1150 instance.state = state; 1151 !isSilent && instance.$modal.trigger({ 1152 type: state, 1153 reason: reason 1154 }, [{ reason: reason }]); 1155 } 1156 1157 /** 1158 * Synchronizes with the animation 1159 * @param {Function} doBeforeAnimation 1160 * @param {Function} doAfterAnimation 1161 * @param {Remodal} instance 1162 */ 1163 function syncWithAnimation(doBeforeAnimation, doAfterAnimation, instance) { 1164 var runningAnimationsCount = 0; 1165 1166 var handleAnimationStart = function(e) { 1167 if (e.target !== this) { 1168 return; 1169 } 1170 1171 runningAnimationsCount++; 1172 }; 1173 1174 var handleAnimationEnd = function(e) { 1175 if (e.target !== this) { 1176 return; 1177 } 1178 1179 if (--runningAnimationsCount === 0) { 1180 1181 // Remove event listeners 1182 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 1183 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 1184 }); 1185 1186 doAfterAnimation(); 1187 } 1188 }; 1189 1190 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 1191 instance[elemName] 1192 .on(ANIMATIONSTART_EVENTS, handleAnimationStart) 1193 .on(ANIMATIONEND_EVENTS, handleAnimationEnd); 1194 }); 1195 1196 doBeforeAnimation(); 1197 1198 // If the animation is not supported by a browser or its duration is 0 1199 if ( 1200 getAnimationDuration(instance.$bg) === 0 && 1201 getAnimationDuration(instance.$overlay) === 0 && 1202 getAnimationDuration(instance.$wrapper) === 0 && 1203 getAnimationDuration(instance.$modal) === 0 1204 ) { 1205 1206 // Remove event listeners 1207 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 1208 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 1209 }); 1210 1211 doAfterAnimation(); 1212 } 1213 } 1214 1215 /** 1216 * Closes immediately 1217 * @private 1218 * @param {Remodal} instance 1219 */ 1220 function halt(instance) { 1221 if (instance.state === STATES.CLOSED) { 1222 return; 1223 } 1224 1225 $.each(['$bg', '$overlay', '$wrapper', '$modal'], function(index, elemName) { 1226 instance[elemName].off(ANIMATIONSTART_EVENTS + ' ' + ANIMATIONEND_EVENTS); 1227 }); 1228 1229 instance.$bg.removeClass(instance.settings.modifier); 1230 instance.$overlay.removeClass(instance.settings.modifier).hide(); 1231 instance.$wrapper.hide(); 1232 unlockScreen(); 1233 setState(instance, STATES.CLOSED, true); 1234 } 1235 1236 /** 1237 * Parses a string with options 1238 * @private 1239 * @param str 1240 * @returns {Object} 1241 */ 1242 function parseOptions(str) { 1243 var obj = {}; 1244 var arr; 1245 var len; 1246 var val; 1247 var i; 1248 1249 // Remove spaces before and after delimiters 1250 str = str.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ','); 1251 1252 // Parse a string 1253 arr = str.split(','); 1254 for (i = 0, len = arr.length; i < len; i++) { 1255 arr[i] = arr[i].split(':'); 1256 val = arr[i][1]; 1257 1258 // Convert a string value if it is like a boolean 1259 if (typeof val === 'string' || val instanceof String) { 1260 val = val === 'true' || (val === 'false' ? false : val); 1261 } 1262 1263 // Convert a string value if it is like a number 1264 if (typeof val === 'string' || val instanceof String) { 1265 val = !isNaN(val) ? +val : val; 1266 } 1267 1268 obj[arr[i][0]] = val; 1269 } 1270 1271 return obj; 1272 } 1273 1274 /** 1275 * Generates a string separated by dashes and prefixed with NAMESPACE 1276 * @private 1277 * @param {...String} 1278 * @returns {String} 1279 */ 1280 function namespacify() { 1281 var result = NAMESPACE; 1282 1283 for (var i = 0; i < arguments.length; ++i) { 1284 result += '-' + arguments[i]; 1285 } 1286 1287 return result; 1288 } 1289 1290 /** 1291 * Handles the hashchange event 1292 * @private 1293 * @listens hashchange 1294 */ 1295 function handleHashChangeEvent() { 1296 var id = location.hash.replace('#', ''); 1297 var instance; 1298 var $elem; 1299 1300 if (!id) { 1301 1302 // Check if we have currently opened modal and animation was completed 1303 if (current && current.state === STATES.OPENED && current.settings.hashTracking) { 1304 current.close(); 1305 } 1306 } else { 1307 1308 // Catch syntax error if your hash is bad 1309 try { 1310 $elem = $( 1311 '[data-' + PLUGIN_NAME + '-id="' + id + '"]' 1312 ); 1313 } catch (err) {} 1314 1315 if ($elem && $elem.length) { 1316 instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; 1317 1318 if (instance && instance.settings.hashTracking) { 1319 instance.open(); 1320 } 1321 } 1322 1323 } 1324 } 1325 1326 /** 1327 * Remodal constructor 1328 * @constructor 1329 * @param {jQuery} $modal 1330 * @param {Object} options 1331 */ 1332 function Remodal($modal, options) { 1333 var $body = $(document.body); 1334 var $appendTo = $body; 1335 var remodal = this; 1336 1337 remodal.settings = $.extend({}, DEFAULTS, options); 1338 remodal.index = $[PLUGIN_NAME].lookup.push(remodal) - 1; 1339 remodal.state = STATES.CLOSED; 1340 1341 remodal.$overlay = $('.' + namespacify('overlay')); 1342 1343 if (remodal.settings.appendTo !== null && remodal.settings.appendTo.length) { 1344 $appendTo = $(remodal.settings.appendTo); 1345 } 1346 1347 if (!remodal.$overlay.length) { 1348 remodal.$overlay = $('<div>').addClass(namespacify('overlay') + ' ' + namespacify('is', STATES.CLOSED)).hide(); 1349 $appendTo.append(remodal.$overlay); 1350 } 1351 1352 remodal.$bg = $('.' + namespacify('bg')).addClass(namespacify('is', STATES.CLOSED)); 1353 1354 remodal.$modal = $modal 1355 .addClass( 1356 NAMESPACE + ' ' + 1357 namespacify('is-initialized') + ' ' + 1358 remodal.settings.modifier + ' ' + 1359 namespacify('is', STATES.CLOSED)) 1360 .attr('tabindex', '-1'); 1361 1362 remodal.$wrapper = $('<div>') 1363 .addClass( 1364 namespacify('wrapper') + ' ' + 1365 remodal.settings.modifier + ' ' + 1366 namespacify('is', STATES.CLOSED)) 1367 .hide() 1368 .append(remodal.$modal); 1369 $appendTo.append(remodal.$wrapper); 1370 1371 // Add the event listener for the close button 1372 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="close"]', function(e) { 1373 e.preventDefault(); 1374 1375 remodal.close(); 1376 }); 1377 1378 // Add the event listener for the cancel button 1379 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="cancel"]', function(e) { 1380 e.preventDefault(); 1381 1382 remodal.$modal.trigger(STATE_CHANGE_REASONS.CANCELLATION); 1383 1384 if (remodal.settings.closeOnCancel) { 1385 remodal.close(STATE_CHANGE_REASONS.CANCELLATION); 1386 } 1387 }); 1388 1389 // Add the event listener for the confirm button 1390 remodal.$wrapper.on('click.' + NAMESPACE, '[data-' + PLUGIN_NAME + '-action="confirm"]', function(e) { 1391 e.preventDefault(); 1392 1393 remodal.$modal.trigger(STATE_CHANGE_REASONS.CONFIRMATION); 1394 1395 if (remodal.settings.closeOnConfirm) { 1396 remodal.close(STATE_CHANGE_REASONS.CONFIRMATION); 1397 } 1398 }); 1399 1400 // Add the event listener for the overlay 1401 remodal.$wrapper.on('click.' + NAMESPACE, function(e) { 1402 var $target = $(e.target); 1403 1404 if (!$target.hasClass(namespacify('wrapper'))) { 1405 return; 1406 } 1407 1408 if (remodal.settings.closeOnOutsideClick) { 1409 remodal.close(); 1410 } 1411 }); 1412 } 1413 1414 /** 1415 * Opens a modal window 1416 * @public 1417 */ 1418 Remodal.prototype.open = function() { 1419 var remodal = this; 1420 var id; 1421 1422 // Check if the animation was completed 1423 if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) { 1424 return; 1425 } 1426 1427 id = remodal.$modal.attr('data-' + PLUGIN_NAME + '-id'); 1428 1429 if (id && remodal.settings.hashTracking) { 1430 scrollTop = $(window).scrollTop(); 1431 location.hash = id; 1432 } 1433 1434 if (current && current !== remodal) { 1435 halt(current); 1436 } 1437 1438 current = remodal; 1439 lockScreen(); 1440 remodal.$bg.addClass(remodal.settings.modifier); 1441 remodal.$overlay.addClass(remodal.settings.modifier).show(); 1442 remodal.$wrapper.show().scrollTop(0); 1443 remodal.$modal.focus(); 1444 1445 syncWithAnimation( 1446 function() { 1447 setState(remodal, STATES.OPENING); 1448 }, 1449 1450 function() { 1451 setState(remodal, STATES.OPENED); 1452 }, 1453 1454 remodal); 1455 }; 1456 1457 /** 1458 * Closes a modal window 1459 * @public 1460 * @param {String} reason 1461 */ 1462 Remodal.prototype.close = function(reason) { 1463 var remodal = this; 1464 1465 // Check if the animation was completed 1466 if (remodal.state === STATES.OPENING || remodal.state === STATES.CLOSING) { 1467 return; 1468 } 1469 1470 if ( 1471 remodal.settings.hashTracking && 1472 remodal.$modal.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) 1473 ) { 1474 location.hash = ''; 1475 $(window).scrollTop(scrollTop); 1476 } 1477 1478 syncWithAnimation( 1479 function() { 1480 setState(remodal, STATES.CLOSING, false, reason); 1481 }, 1482 1483 function() { 1484 remodal.$bg.removeClass(remodal.settings.modifier); 1485 remodal.$overlay.removeClass(remodal.settings.modifier).hide(); 1486 remodal.$wrapper.hide(); 1487 unlockScreen(); 1488 1489 setState(remodal, STATES.CLOSED, false, reason); 1490 }, 1491 1492 remodal); 1493 }; 1494 1495 /** 1496 * Returns a current state of a modal 1497 * @public 1498 * @returns {STATES} 1499 */ 1500 Remodal.prototype.getState = function() { 1501 return this.state; 1502 }; 1503 1504 /** 1505 * Destroys a modal 1506 * @public 1507 */ 1508 Remodal.prototype.destroy = function() { 1509 var lookup = $[PLUGIN_NAME].lookup; 1510 var instanceCount; 1511 1512 halt(this); 1513 this.$wrapper.remove(); 1514 1515 delete lookup[this.index]; 1516 instanceCount = $.grep(lookup, function(instance) { 1517 return !!instance; 1518 }).length; 1519 1520 if (instanceCount === 0) { 1521 this.$overlay.remove(); 1522 this.$bg.removeClass( 1523 namespacify('is', STATES.CLOSING) + ' ' + 1524 namespacify('is', STATES.OPENING) + ' ' + 1525 namespacify('is', STATES.CLOSED) + ' ' + 1526 namespacify('is', STATES.OPENED)); 1527 } 1528 }; 1529 1530 /** 1531 * Special plugin object for instances 1532 * @public 1533 * @type {Object} 1534 */ 1535 $[PLUGIN_NAME] = { 1536 lookup: [] 1537 }; 1538 1539 /** 1540 * Plugin constructor 1541 * @constructor 1542 * @param {Object} options 1543 * @returns {JQuery} 1544 */ 1545 $.fn[PLUGIN_NAME] = function(opts) { 1546 var instance; 1547 var $elem; 1548 1549 this.each(function(index, elem) { 1550 $elem = $(elem); 1551 1552 if ($elem.data(PLUGIN_NAME) == null) { 1553 instance = new Remodal($elem, opts); 1554 $elem.data(PLUGIN_NAME, instance.index); 1555 1556 if ( 1557 instance.settings.hashTracking && 1558 $elem.attr('data-' + PLUGIN_NAME + '-id') === location.hash.substr(1) 1559 ) { 1560 instance.open(); 1561 } 1562 } else { 1563 instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]; 1564 } 1565 }); 1566 1567 return instance; 1568 }; 1569 1570 $(document).ready(function() { 1571 1572 // data-remodal-target opens a modal window with the special Id 1573 $(document).on('click', '[data-' + PLUGIN_NAME + '-target]', function(e) { 1574 e.preventDefault(); 1575 1576 var elem = e.currentTarget; 1577 var id = elem.getAttribute('data-' + PLUGIN_NAME + '-target'); 1578 var $target = $('[data-' + PLUGIN_NAME + '-id="' + id + '"]'); 1579 1580 $[PLUGIN_NAME].lookup[$target.data(PLUGIN_NAME)].open(); 1581 }); 1582 1583 // Auto initialization of modal windows 1584 // They should have the 'remodal' class attribute 1585 // Also you can write the `data-remodal-options` attribute to pass params into the modal 1586 $(document).find('.' + NAMESPACE).each(function(i, container) { 1587 var $container = $(container); 1588 var options = $container.data(PLUGIN_NAME + '-options'); 1589 1590 if (!options) { 1591 options = {}; 1592 } else if (typeof options === 'string' || options instanceof String) { 1593 options = parseOptions(options); 1594 } 1595 1596 $container[PLUGIN_NAME](options); 1597 }); 1598 1599 // Handles the keydown event 1600 $(document).on('keydown.' + NAMESPACE, function(e) { 1601 if (current && current.settings.closeOnEscape && current.state === STATES.OPENED && e.keyCode === 27) { 1602 current.close(); 1603 } 1604 }); 1605 1606 // Handles the hashchange event 1607 $(window).on('hashchange.' + NAMESPACE, handleHashChangeEvent); 1608 }); 1609});
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.