/**! * @fileOverview turbolinks-animate.js - Animations extending Turbolinks * @version 1.3.8 * @license * MIT License * * Copyright (c) 2017 Jonas Hübotter * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ $.fn.extend({turbolinksAnimate:function(a){var b={animation:"fadein",duration:"0.3s",delay:false,reversedDisappearing:true,mobileMedia:"500",tabletMedia:"1024"};a=$.extend(b,a);turbolinksAnimateInit($(this),a)}});var turbolinksAnimateData={},turbolinksAnimateInline=false,turbolinksAnimateElement,turbolinksAnimateElements;function turbolinksAnimateInit(c,b){var d=turbolinksAnimateData.type,a=turbolinksAnimateData.appear;turbolinksAnimateData={};turbolinksAnimateElement=c;turbolinksAnimateData.animation=b.animation;turbolinksAnimateData.duration=b.duration;turbolinksAnimateData.delay=b.delay;turbolinksAnimateData.mobileMedia=b.mobileMedia;turbolinksAnimateData.tabletMedia=b.tabletMedia;turbolinksAnimateData.appear=a;turbolinksAnimateData.previousType=d;$("a, button").click(function(){if($(this).data("turbolinks-animate-animation")!==undefined){turbolinksAnimateInline=true}turbolinksAnimateData.animation=$(this).data("turbolinks-animate-animation")||b.animation;turbolinksAnimateData.appear=$(this).data("turbolinks-animate-appear");turbolinksAnimateData.duration=$(this).data("turbolinks-animate-duration")||b.duration;turbolinksAnimateData.delay=$(this).data("turbolinks-animate-delay")||b.delay;turbolinksAnimateData.type=$(this).data("turbolinks-animate-type")})}function turbolinksAnimateAppear(){turbolinksAnimateToggle(false);delete turbolinksAnimateData.appear}function turbolinksAnimateDisappear(){turbolinksAnimateToggle(true)}function turbolinksAnimateToggle(a){if(turbolinksAnimateData.animation!="false"){turbolinksAnimateReset();turbolinksAnimateOptions();Turbolinks.clearCache();turbolinksAnimateAnimateElements(a)}}function turbolinksAnimateGetAnimation(a){var b;if(!a){b=turbolinksAnimateData.appear}if(turbolinksAnimateInline){b=turbolinksAnimateData.animation}else{if(typeof turbolinksAnimateElement.data("turbolinks-animate-animation")!=="undefined"){b=turbolinksAnimateElement.data("turbolinks-animate-animation")}else{b=turbolinksAnimateData.animation}}return b}function turbolinksAnimateOptions(){turbolinksAnimateElement.css("animationDuration",turbolinksAnimateData.duration);if(turbolinksAnimateData.delay!=false){turbolinksAnimateElement.css("animationDelay",turbolinksAnimateData.delay)}if(typeof turbolinksAnimateElements!=="undefined"){$(turbolinksAnimateElements).each(function(){$(this).css("animationDuration",turbolinksAnimateData.duration);if(turbolinksAnimateData.delay!=false){$(this).css("animationDelay",turbolinksAnimateData.delay)}})}}function turbolinksAnimateReset(){if(typeof turbolinksAnimateElements!=="undefined"){$(turbolinksAnimateElements).each(function(){$(this).removeClass("fadeIn fadeInUp fadeInDown fadeInLeft fadeInRightfadeOut fadeOutUp fadeOutDown fadeOutLeft fadeOutRight")})}turbolinksAnimateElement.removeClass("fadeIn fadeInUp fadeInDown fadeInLeft fadeInRightfadeOut fadeOutUp fadeOutDown fadeOutLeft fadeOutRight")}function turbolinksAnimateAnimateElements(a){if(turbolinksAnimateElement.find("[data-turbolinks-animate-persist]").length>0||turbolinksAnimateElement.find("[data-turbolinks-animate-persist-itself]").length>0){turbolinksAnimateElements=turbolinksAnimateGetElements();$(turbolinksAnimateElements).each(function(){$(this).one("webkitAnimationEnd mozAnimationEnd oAnimationEnd oanimationend animationend",function(){setTimeout(function(){turbolinksAnimateReset()},250)});$(this).addClass(turbolinksAnimateGetClassListFor(turbolinksAnimateGetAnimation(a),a))})}turbolinksAnimateElement.one("webkitAnimationEnd mozAnimationEnd oAnimationEnd oanimationend animationend",function(){setTimeout(function(){turbolinksAnimateReset()},250)});turbolinksAnimateElement.addClass(turbolinksAnimateGetClassListFor(turbolinksAnimateGetAnimation(a),a));delete turbolinksAnimateData.previousType;turbolinksAnimateInline=false}function turbolinksAnimateGetElements(){var a=[];b(turbolinksAnimateElement);function b(c){var d=turbolinksAnimateData.type||turbolinksAnimateData.previousType||"true";if(c.attr("data-turbolinks-animate-persist")==d){return}else{if(c.attr("data-turbolinks-animate-persist-itself")==d||c.find("[data-turbolinks-animate-persist]").length>0||c.find("[data-turbolinks-animate-persist-itself]").length>0){c.children().each(function(){b($(this))})}else{a.push(c)}}}return a}function turbolinksAnimateGetClassListFor(e,a){var d="animated",c=$(window).width();if(c<=turbolinksAnimateData.mobileMedia){var b=e.mobile||e.tablet||e.desktop||e}else{if(c<=turbolinksAnimateData.tabletMedia){var b=e.tablet||e.desktop||e}else{var b=e.desktop||e}}b.toLowerCase();if(b=="fadein"){d+=(a?" fadeOut":" fadeIn")}else{if(b=="fadeinup"){d+=(a?(turbolinksAnimateData.reversedDisappearing?" fadeOutDown":" fadeOutUp"):" fadeInUp")}else{if(b=="fadeindown"){d+=(a?(turbolinksAnimateData.reversedDisappearing?" fadeOutUp":" fadeOutDown"):" fadeInDown")}else{if(b=="fadeinleft"){d+=(a?" fadeOutLeft":" fadeInLeft")}else{if(b=="fadeinright"){d+=(a?" fadeOutRight":" fadeInRight")}else{if(b=="fadeout"){d+=" fadeOut"}else{if(b=="fadeoutup"){d+=(turbolinksAnimateData.reversedDisappearing?" fadeOutDown":" fadeOutUp")}else{if(b=="fadeoutdown"){d+=(turbolinksAnimateData.reversedDisappearing?" fadeOutUp":" fadeOutDown")}else{if(b=="fadeoutleft"){d+=" fadeOutLeft"}else{if(b=="fadeoutright"){d+=" fadeOutRight"}}}}}}}}}}return d};