turbolinks-animate 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d8b1396f4d0980e6c14e3d266d6198b645365d80bd96fe9fa657d84ef3f9f380
4
+ data.tar.gz: 5eddd2847328720874a9292d437de3f7cc138676ac891a8a2eb2e8d0d4230f9c
5
+ SHA512:
6
+ metadata.gz: 36966b9cdaaefd91d286753f5c85e06ef104483fc61dc76ef54800708a6ab8c92c06b10f2a90b19c6bef192718b21bb714fbb0c09a7b09a645d5e4e3612f56a7
7
+ data.tar.gz: 3d334f70a7ce9a9bad5b0874238f9c6adc90508870438a2d3d45d6230890e4fcc638048c4e538c6c1b0b282038c9f9d0fe744a018a43b7a381f7abc4350575a1
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.3
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ### master
4
+
5
+ * nothing yet
6
+
7
+ ### 1.0.0 - 2017-12-17
8
+
9
+ * initial release
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at help@slooob.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1 @@
1
+ # Contributing
@@ -0,0 +1,3 @@
1
+ # Deprecations
2
+
3
+ No deprecations
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source :github do |repo_name|
4
+ "https://github.com/#{repo_name}"
5
+ end
6
+
7
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jonas Hübotter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,120 @@
1
+ # turbolinks-animate
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/turbolinks-animate.svg)](https://badge.fury.io/rb/turbolinks-animate) <img src="https://travis-ci.org/jonhue/turbolinks-animate.svg?branch=master" />
4
+
5
+ A dead simple & powerful way of adding rich & adaptive animations to your Rails app which is already using Turbolinks™.
6
+
7
+ This gem extends the [turbolinks-animate.js](https://github.com/jonhue/turbolinks-animate.js) library to work better within Rails apps.
8
+
9
+ [**Demo**](https://phylator.herokuapp.com)
10
+
11
+ ---
12
+
13
+ ## Table of Contents
14
+
15
+ * [Installation](#installation)
16
+ * [Usage](#usage)
17
+ * [To Do](#to-do)
18
+ * [Contributing](#contributing)
19
+ * [Contributors](#contributors)
20
+ * [License](#license)
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ `turbolinks-animate` works with Rails 4.0 onwards. You can add it to your `Gemfile` with:
27
+
28
+ ```ruby
29
+ gem 'turbolinks-animate'
30
+ ```
31
+
32
+ And then execute:
33
+
34
+ $ bundle
35
+
36
+ Or install it yourself as:
37
+
38
+ $ gem install turbolinks-animate
39
+
40
+ If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
41
+
42
+ ```ruby
43
+ gem 'turbolinks-animate', github: 'jonhue/turbolinks-animate'
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ The javascript files will be added to the asset pipeline and available for you to use:
49
+
50
+ ```js
51
+ //= require turbolinks-animate
52
+ ```
53
+
54
+ To use turbolinks-animate, replace the `body` tag in your layout with the `turbolinks_animate_body` view helper:
55
+
56
+ ```ruby
57
+ = turbolinks_animate_body class: 'custom-class' do
58
+ = yield
59
+ ```
60
+
61
+ In your controller simply include the `TurbolinksAnimateHelper` module, and specify your animation.
62
+
63
+ ```ruby
64
+ class WelcomeController < ApplicationController
65
+ include TurbolinksAnimateHelper
66
+
67
+ def index
68
+ turbolinks_animate 'fadein'
69
+ end
70
+
71
+ def more
72
+ turbolinks_animate { desktop: 'fadein', mobile: 'fadeinright' }
73
+ end
74
+ end
75
+ ```
76
+
77
+ [Here](https://github.com/jonhue/turbolinks-animate.js) are more details about the usage of turbolinks-animate.js.
78
+
79
+ ## To Do
80
+
81
+ [Here](https://github.com/jonhue/turbolinks-animate/projects/1) is the full list of current projects.
82
+ To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/turbolinks-animate/issues/new).
83
+
84
+ ---
85
+
86
+ ## Contributing
87
+
88
+ We hope that you will consider contributing to turbolinks-animate. Please read this short overview for some information about how to get started:
89
+
90
+ [Learn more about contributing to this repository](https://github.com/jonhue/turbolinks-animate/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/turbolinks-animate/blob/master/CODE_OF_CONDUCT.md)
91
+
92
+ ### Contributors
93
+
94
+ Give the people some :heart: who are working on this project. See them all at:
95
+
96
+ https://github.com/jonhue/turbolinks-animate/graphs/contributors
97
+
98
+ ## License
99
+
100
+ MIT License
101
+
102
+ Copyright (c) 2017 Jonas Hübotter
103
+
104
+ Permission is hereby granted, free of charge, to any person obtaining a copy
105
+ of this software and associated documentation files (the "Software"), to deal
106
+ in the Software without restriction, including without limitation the rights
107
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
108
+ copies of the Software, and to permit persons to whom the Software is
109
+ furnished to do so, subject to the following conditions:
110
+
111
+ The above copyright notice and this permission notice shall be included in all
112
+ copies or substantial portions of the Software.
113
+
114
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
@@ -0,0 +1,22 @@
1
+ module TurbolinksAnimateHelper
2
+
3
+ def turbolinks_animate animation
4
+ @turbolinks_animate_animation = animation.to_json
5
+ end
6
+
7
+ def turbolinks_animate_body options = {}, &block
8
+ default_options = {
9
+ class: ''
10
+ data: {}
11
+ }
12
+ options = default_options.merge options
13
+ if @turbolinks_animate_animation
14
+ options[:class] += ( options[:class].length > 0 ? 'turbolinks-animate ' : 'turbolinks-animate' )
15
+ options[:data][:turbolinks_animate_animation] = @turbolinks_animate_animation
16
+ end
17
+ if block_given?
18
+ content_tag 'body', options, capture(&block)
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,6 @@
1
+ require 'turbolinks-animate/version'
2
+
3
+ module TurbolinksAnimate
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module TurbolinksAnimate
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,22 @@
1
+ lib = File.expand_path '../lib', __FILE__
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'turbolinks-animate/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'turbolinks-animate'
7
+ gem.version = TurbolinksAnimate::VERSION
8
+ gem.authors = ['Jonas Hübotter']
9
+ gem.email = ['jonas.huebotter@gmail.com']
10
+
11
+ gem.summary = 'Rich & adaptive animations for apps using Rails w/ Turbolinks™'
12
+ gem.description = 'A dead simple & powerful way of adding rich & adaptive animations to your Rails app which is already using Turbolinks™.'
13
+ gem.homepage = 'https://github.com/jonhue/turbolinks-animate'
14
+
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.require_paths = ['lib']
17
+
18
+ gem.add_development_dependency 'bundler', '~> 1.16'
19
+ gem.add_development_dependency 'rake', '~> 10.0'
20
+ gem.add_dependency 'railties', '>= 4.0'
21
+ gem.required_ruby_version = '>= 2.3'
22
+ end
@@ -0,0 +1,168 @@
1
+ /**!
2
+ * @fileOverview turbolinks-animate.js - Animations extending Turbolinks
3
+ * @version 1.3.4
4
+ * @license
5
+ * MIT License
6
+ *
7
+ * Copyright (c) 2017 Slooob
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+ $.fn.extend({
28
+ turbolinksAnimate: function(options) {
29
+ var defaults = {
30
+ animation: 'fadein',
31
+ duration: '0.3s',
32
+ delay: false,
33
+ reversedDisappearing: true,
34
+ mobileMedia: '500',
35
+ tabletMedia: '1024'
36
+ };
37
+
38
+ options = $.extend( defaults, options );
39
+
40
+ turbolinksAnimateInit( $(this), options );
41
+ }
42
+ });
43
+
44
+
45
+ var turbolinksAnimateData = {}, turbolinksAnimateInline = false, turbolinksAnimateElement;
46
+
47
+ function turbolinksAnimateInit( el, options ) {
48
+ var turbolinksAnimatePreviousType = turbolinksAnimateData['type'],
49
+ turbolinksAnimateAppear = turbolinksAnimateData['appear'];
50
+ turbolinksAnimateData = {};
51
+ turbolinksAnimateElement = el;
52
+ turbolinksAnimateData['animation'] = options.animation;
53
+ turbolinksAnimateData['duration'] = options.duration;
54
+ turbolinksAnimateData['delay'] = options.delay;
55
+ turbolinksAnimateData['mobileMedia'] = options.mobileMedia;
56
+ turbolinksAnimateData['tabletMedia'] = options.tabletMedia;
57
+ turbolinksAnimateData['appear'] = turbolinksAnimateAppear;
58
+ turbolinksAnimateData['previousType'] = turbolinksAnimatePreviousType;
59
+ $('a, button').click( function() {
60
+ turbolinksAnimateData['animation'] = $(this).data('turbolinks-animate-animation');
61
+ if ( $(this).data('turbolinks-animate-animation') !== undefined ) { turbolinksAnimateInline = true };
62
+ turbolinksAnimateData['appear'] = $(this).data('turbolinks-animate-appear');
63
+ turbolinksAnimateData['duration'] = $(this).data('turbolinks-animate-duration');
64
+ turbolinksAnimateData['delay'] = $(this).data('turbolinks-animate-delay');
65
+ turbolinksAnimateData['type'] = $(this).data('turbolinks-animate-type');
66
+ });
67
+ };
68
+
69
+
70
+
71
+ function turbolinksAnimateAppear() {
72
+ turbolinksAnimateToggle(false);
73
+ delete turbolinksAnimateData['appear'];
74
+ };
75
+
76
+ function turbolinksAnimateDisappear() {
77
+ turbolinksAnimateToggle(true);
78
+ };
79
+
80
+ function turbolinksAnimateToggle(disappears) {
81
+ if ( turbolinksAnimateData['animation'] != 'false' ) {
82
+ turbolinksAnimateReset();
83
+ turbolinksAnimateOptions();
84
+
85
+ Turbolinks.clearCache() // fix for cache issues
86
+ turbolinksAnimateAnimateElements(disappears);
87
+ };
88
+ };
89
+
90
+
91
+
92
+ function turbolinksAnimateGetAnimation(disappears) {
93
+ return ( disappears == false ? turbolinksAnimateData['appear'] : undefined ) || ( turbolinksAnimateInline ? turbolinksAnimateData['animation'] : ( turbolinksAnimateElement.data('turbolinks-animate-animation') || turbolinksAnimateData['animation'] ) );
94
+ };
95
+
96
+ function turbolinksAnimateOptions() {
97
+ turbolinksAnimateElement.css({ 'animation-duration': turbolinksAnimateData['duration'] });
98
+ if (turbolinksAnimateData['delay'] != false) {
99
+ turbolinksAnimateElement.css({ 'animation-delay': turbolinksAnimateData['delay'] });
100
+ };
101
+ };
102
+
103
+ function turbolinksAnimateReset() {
104
+ turbolinksAnimateElement.removeClass('fadeIn fadeInUp fadeInDown fadeInLeft fadeInRightfadeOut fadeOutUp fadeOutDown fadeOutLeft fadeOutRight');
105
+ };
106
+
107
+
108
+
109
+ function turbolinksAnimateAnimateElements(disappears) {
110
+ if ( turbolinksAnimateElement.find('[data-turbolinks-animate-persist]').length > 0 || turbolinksAnimateElement.find('[data-turbolinks-animate-persist-itself]').length > 0 ) {
111
+ var turbolinksAnimateElements = turbolinksAnimateGetElements();
112
+ $(turbolinksAnimateElements).each(function() {
113
+ $(this).addClass(turbolinksAnimateGetClassListFor( turbolinksAnimateGetAnimation(disappears), disappears ));
114
+ });
115
+ } else {
116
+ turbolinksAnimateElement.addClass(turbolinksAnimateGetClassListFor( turbolinksAnimateGetAnimation(disappears), disappears ));
117
+ };
118
+
119
+ delete turbolinksAnimateData['previousType'];
120
+ turbolinksAnimateInline = false;
121
+ };
122
+
123
+ function turbolinksAnimateGetElements() {
124
+ var turbolinksAnimateElements = [];
125
+
126
+ getChildren(turbolinksAnimateElement);
127
+
128
+ function getChildren(parent) {
129
+ var turbolinksAnimateType = turbolinksAnimateData['type'] || turbolinksAnimateData['previousType'] || 'true';
130
+ if (parent.attr('data-turbolinks-animate-persist') == turbolinksAnimateType) {
131
+ return;
132
+ } else if ( parent.attr('data-turbolinks-animate-persist-itself') == turbolinksAnimateType || parent.find('[data-turbolinks-animate-persist]').length > 0 || parent.find('[data-turbolinks-animate-persist-itself]').length > 0 ) {
133
+ parent.children().each(function() {
134
+ getChildren($(this));
135
+ });
136
+ } else {
137
+ turbolinksAnimateElements.push(parent);
138
+ };
139
+ };
140
+
141
+ return turbolinksAnimateElements
142
+ };
143
+
144
+
145
+
146
+ function turbolinksAnimateGetClassListFor( animations, disappears ) {
147
+ var classList = 'animated',
148
+ browserWidth = $(window).width();
149
+ if ( browserWidth <= turbolinksAnimateData['mobileMedia'] ) {
150
+ var animation = animations['mobile'] || animations['tablet'] || animations['desktop'] || animations;
151
+ } else if ( browserWidth <= turbolinksAnimateData['tabletMedia'] ) {
152
+ var animation = animations['tablet'] || animations['desktop'] || animations;
153
+ } else {
154
+ var animation = animations['desktop'] || animations;
155
+ };
156
+ animation.toLowerCase();
157
+ if ( animation == 'fadein' ) { classList += ( disappears ? ' fadeOut' : ' fadeIn' ) }
158
+ else if ( animation == 'fadeinup' ) { classList += ( disappears ? ( turbolinksAnimateData['reversedDisappearing'] ? ' fadeOutDown' : ' fadeOutUp' ) : ' fadeInUp' ) }
159
+ else if ( animation == 'fadeindown' ) { classList += ( disappears ? ( turbolinksAnimateData['reversedDisappearing'] ? ' fadeOutUp' : ' fadeOutDown' ) : ' fadeInDown' ) }
160
+ else if ( animation == 'fadeinleft' ) { classList += ( disappears ? ' fadeOutLeft' : ' fadeInLeft' ) }
161
+ else if ( animation == 'fadeinright' ) { classList += ( disappears ? ' fadeOutRight' : ' fadeInRight' ) }
162
+ else if ( animation == 'fadeout' ) { classList += ' fadeOut' }
163
+ else if ( animation == 'fadeoutup' ) { classList += ( turbolinksAnimateData['reversedDisappearing'] ? ' fadeOutDown' : ' fadeOutUp' ) }
164
+ else if ( animation == 'fadeoutdown' ) { classList += ( turbolinksAnimateData['reversedDisappearing'] ? ' fadeOutUp' : ' fadeOutDown' ) }
165
+ else if ( animation == 'fadeoutleft' ) { classList += ' fadeOutLeft' }
166
+ else if ( animation == 'fadeoutright' ) { classList += ' fadeOutRight' };
167
+ return classList;
168
+ };
@@ -0,0 +1,27 @@
1
+ /**!
2
+ * @fileOverview turbolinks-animate.js - Animations extending Turbolinks
3
+ * @version 1.3.4
4
+ * @license
5
+ * MIT License
6
+ *
7
+ * Copyright (c) 2017 Slooob
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+ $.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;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(){turbolinksAnimateData.animation=$(this).data("turbolinks-animate-animation");if($(this).data("turbolinks-animate-animation")!==undefined){turbolinksAnimateInline=true}turbolinksAnimateData.appear=$(this).data("turbolinks-animate-appear");turbolinksAnimateData.duration=$(this).data("turbolinks-animate-duration");turbolinksAnimateData.delay=$(this).data("turbolinks-animate-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){return(a==false?turbolinksAnimateData.appear:undefined)||(turbolinksAnimateInline?turbolinksAnimateData.animation:(turbolinksAnimateElement.data("turbolinks-animate-animation")||turbolinksAnimateData.animation))}function turbolinksAnimateOptions(){turbolinksAnimateElement.css({"animation-duration":turbolinksAnimateData.duration});if(turbolinksAnimateData.delay!=false){turbolinksAnimateElement.css({"animation-delay":turbolinksAnimateData.delay})}}function turbolinksAnimateReset(){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){var b=turbolinksAnimateGetElements();$(b).each(function(){$(this).addClass(turbolinksAnimateGetClassListFor(turbolinksAnimateGetAnimation(a),a))})}else{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};
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: turbolinks-animate
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonas Hübotter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ description: A dead simple & powerful way of adding rich & adaptive animations to
56
+ your Rails app which is already using Turbolinks™.
57
+ email:
58
+ - jonas.huebotter@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
+ - CHANGELOG.md
66
+ - CODE_OF_CONDUCT.md
67
+ - CONTRIBUTING.md
68
+ - DEPRECATIONS.md
69
+ - Gemfile
70
+ - LICENSE
71
+ - README.md
72
+ - Rakefile
73
+ - app/helpers/turbolinks_animate_helper.rb
74
+ - lib/turbolinks-animate.rb
75
+ - lib/turbolinks-animate/version.rb
76
+ - turbolinks-animate.gemspec
77
+ - vendor/assets/javascripts/turbolinks-animate.js
78
+ - vendor/assets/javascripts/turbolinks-animate.min.js
79
+ homepage: https://github.com/jonhue/turbolinks-animate
80
+ licenses: []
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '2.3'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.7.3
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Rich & adaptive animations for apps using Rails w/ Turbolinks™
102
+ test_files: []