textillate 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +2 -0
- data/Rakefile.rb +1 -0
- data/lib/textillate.rb +15 -0
- data/lib/textillate/engine.rb +7 -0
- data/lib/textillate/railtie.rb +7 -0
- data/lib/textillate/sprockets.rb +5 -0
- data/lib/textillate/version.rb +4 -0
- data/textillate.gemspec +19 -0
- data/vendor/assets/javascripts/jquery.fittext.js +43 -0
- data/vendor/assets/javascripts/jquery.lettering.js +66 -0
- data/vendor/assets/javascripts/jquery.textillate.js +287 -0
- data/vendor/assets/stylesheets/animate.css +3263 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 415210b53e6d4e10558a960aa474528448538da2
|
4
|
+
data.tar.gz: a4be776e8f9933b1ea851bc3aad47f43ffe4c1e0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 737f476e696a9afc25338c1f1ae278c947337df6de0e1f35785f0b7ea91cb1a790c12dc046ce3e658f510a4cca791f1f8743e10093b8c75b499b8303e59c1d8b
|
7
|
+
data.tar.gz: 206b4c9f1b6a6be8715f29904bcf7a76ba3f0845890823a8a43d324b40c63083e21e37c71fde8eeb9e77f612041616329c55b402fda0fb592e4d1d1034696f14
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
|
19
|
+
# Ignore minified upstreams
|
20
|
+
vendor/assets/javascripts/textillate.min.js
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mauricio Pasquier Juan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/textillate.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'textillate/version'
|
2
|
+
|
3
|
+
# Public: Adds jquery-countdown to the asset pipeline, for rails and
|
4
|
+
# standalone Sprockets
|
5
|
+
module TextillateRails
|
6
|
+
if defined? ::Rails
|
7
|
+
if ::Rails.version.to_s < '3.1'
|
8
|
+
require 'textillate/railtie'
|
9
|
+
else
|
10
|
+
require 'textillate/engine'
|
11
|
+
end
|
12
|
+
elsif defined? ::Sprockets
|
13
|
+
require 'textillate/sprockets'
|
14
|
+
end
|
15
|
+
end
|
data/textillate.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'textillate/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'textillate'
|
7
|
+
s.version = TextillateRails::VERSION
|
8
|
+
s.date = '2010-07-30'
|
9
|
+
s.summary = "textillate.js for rails asset pipeline"
|
10
|
+
s.description = "textillate.js A simple plugin for CSS3 text animations."
|
11
|
+
s.authors = ["Axel Catusse"]
|
12
|
+
s.email = 'axel.catusse@gmail.com'
|
13
|
+
s.files = `git ls-files`.split($/)
|
14
|
+
s.homepage = 'https://github.com/catuss-a/textillate'
|
15
|
+
s.license = 'MIT'
|
16
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*global jQuery */
|
2
|
+
/*!
|
3
|
+
* FitText.js 1.1
|
4
|
+
*
|
5
|
+
* Copyright 2011, Dave Rupert http://daverupert.com
|
6
|
+
* Released under the WTFPL license
|
7
|
+
* http://sam.zoy.org/wtfpl/
|
8
|
+
*
|
9
|
+
* Date: Thu May 05 14:23:00 2011 -0600
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function( $ ){
|
13
|
+
|
14
|
+
$.fn.fitText = function( kompressor, options ) {
|
15
|
+
|
16
|
+
// Setup options
|
17
|
+
var compressor = kompressor || 1,
|
18
|
+
settings = $.extend({
|
19
|
+
'minFontSize' : Number.NEGATIVE_INFINITY,
|
20
|
+
'maxFontSize' : Number.POSITIVE_INFINITY
|
21
|
+
}, options);
|
22
|
+
|
23
|
+
return this.each(function(){
|
24
|
+
|
25
|
+
// Store the object
|
26
|
+
var $this = $(this);
|
27
|
+
|
28
|
+
// Resizer() resizes items based on the object width divided by the compressor * 10
|
29
|
+
var resizer = function () {
|
30
|
+
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
|
31
|
+
};
|
32
|
+
|
33
|
+
// Call once to set.
|
34
|
+
resizer();
|
35
|
+
|
36
|
+
// Call on resize. Opera debounces their resize by default.
|
37
|
+
$(window).on('resize', resizer);
|
38
|
+
|
39
|
+
});
|
40
|
+
|
41
|
+
};
|
42
|
+
|
43
|
+
})( jQuery );
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/*global jQuery */
|
2
|
+
/*!
|
3
|
+
* Lettering.JS 0.6.1
|
4
|
+
*
|
5
|
+
* Copyright 2010, Dave Rupert http://daverupert.com
|
6
|
+
* Released under the WTFPL license
|
7
|
+
* http://sam.zoy.org/wtfpl/
|
8
|
+
*
|
9
|
+
* Thanks to Paul Irish - http://paulirish.com - for the feedback.
|
10
|
+
*
|
11
|
+
* Date: Mon Sep 20 17:14:00 2010 -0600
|
12
|
+
*/
|
13
|
+
(function($){
|
14
|
+
function injector(t, splitter, klass, after) {
|
15
|
+
var a = t.text().split(splitter), inject = '';
|
16
|
+
if (a.length) {
|
17
|
+
$(a).each(function(i, item) {
|
18
|
+
inject += '<span class="'+klass+(i+1)+'">'+item+'</span>'+after;
|
19
|
+
});
|
20
|
+
t.empty().append(inject);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
var methods = {
|
25
|
+
init : function() {
|
26
|
+
|
27
|
+
return this.each(function() {
|
28
|
+
injector($(this), '', 'char', '');
|
29
|
+
});
|
30
|
+
|
31
|
+
},
|
32
|
+
|
33
|
+
words : function() {
|
34
|
+
|
35
|
+
return this.each(function() {
|
36
|
+
injector($(this), ' ', 'word', ' ');
|
37
|
+
});
|
38
|
+
|
39
|
+
},
|
40
|
+
|
41
|
+
lines : function() {
|
42
|
+
|
43
|
+
return this.each(function() {
|
44
|
+
var r = "eefec303079ad17405c889e092e105b0";
|
45
|
+
// Because it's hard to split a <br/> tag consistently across browsers,
|
46
|
+
// (*ahem* IE *ahem*), we replaces all <br/> instances with an md5 hash
|
47
|
+
// (of the word "split"). If you're trying to use this plugin on that
|
48
|
+
// md5 hash string, it will fail because you're being ridiculous.
|
49
|
+
injector($(this).children("br").replaceWith(r).end(), r, 'line', '');
|
50
|
+
});
|
51
|
+
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
$.fn.lettering = function( method ) {
|
56
|
+
// Method calling logic
|
57
|
+
if ( method && methods[method] ) {
|
58
|
+
return methods[ method ].apply( this, [].slice.call( arguments, 1 ));
|
59
|
+
} else if ( method === 'letters' || ! method ) {
|
60
|
+
return methods.init.apply( this, [].slice.call( arguments, 0 ) ); // always pass an array
|
61
|
+
}
|
62
|
+
$.error( 'Method ' + method + ' does not exist on jQuery.lettering' );
|
63
|
+
return this;
|
64
|
+
};
|
65
|
+
|
66
|
+
})(jQuery);
|
@@ -0,0 +1,287 @@
|
|
1
|
+
/*
|
2
|
+
* textillate.js
|
3
|
+
* http://jschr.github.com/textillate
|
4
|
+
* MIT licensed
|
5
|
+
*
|
6
|
+
* Copyright (C) 2012-2013 Jordan Schroter
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function ($) {
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
function isInEffect (effect) {
|
13
|
+
return /In/.test(effect) || $.inArray(effect, $.fn.textillate.defaults.inEffects) >= 0;
|
14
|
+
};
|
15
|
+
|
16
|
+
function isOutEffect (effect) {
|
17
|
+
return /Out/.test(effect) || $.inArray(effect, $.fn.textillate.defaults.outEffects) >= 0;
|
18
|
+
};
|
19
|
+
|
20
|
+
|
21
|
+
function stringToBoolean(str) {
|
22
|
+
if (str !== "true" && str !== "false") return str;
|
23
|
+
return (str === "true");
|
24
|
+
};
|
25
|
+
|
26
|
+
// custom get data api method
|
27
|
+
function getData (node) {
|
28
|
+
var attrs = node.attributes || []
|
29
|
+
, data = {};
|
30
|
+
|
31
|
+
if (!attrs.length) return data;
|
32
|
+
|
33
|
+
$.each(attrs, function (i, attr) {
|
34
|
+
var nodeName = attr.nodeName.replace(/delayscale/, 'delayScale');
|
35
|
+
if (/^data-in-*/.test(nodeName)) {
|
36
|
+
data.in = data.in || {};
|
37
|
+
data.in[nodeName.replace(/data-in-/, '')] = stringToBoolean(attr.nodeValue);
|
38
|
+
} else if (/^data-out-*/.test(nodeName)) {
|
39
|
+
data.out = data.out || {};
|
40
|
+
data.out[nodeName.replace(/data-out-/, '')] =stringToBoolean(attr.nodeValue);
|
41
|
+
} else if (/^data-*/.test(nodeName)) {
|
42
|
+
data[nodeName.replace(/data-/, '')] = stringToBoolean(attr.nodeValue);
|
43
|
+
}
|
44
|
+
})
|
45
|
+
|
46
|
+
return data;
|
47
|
+
}
|
48
|
+
|
49
|
+
function shuffle (o) {
|
50
|
+
for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
|
51
|
+
return o;
|
52
|
+
}
|
53
|
+
|
54
|
+
function animate ($t, effect, cb) {
|
55
|
+
$t.addClass('animated ' + effect)
|
56
|
+
.css('visibility', 'visible')
|
57
|
+
.show();
|
58
|
+
|
59
|
+
$t.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
|
60
|
+
$t.removeClass('animated ' + effect);
|
61
|
+
cb && cb();
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
function animateTokens ($tokens, options, cb) {
|
66
|
+
var that = this
|
67
|
+
, count = $tokens.length;
|
68
|
+
|
69
|
+
if (!count) {
|
70
|
+
cb && cb();
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
if (options.shuffle) $tokens = shuffle($tokens);
|
75
|
+
if (options.reverse) $tokens = $tokens.toArray().reverse();
|
76
|
+
|
77
|
+
$.each($tokens, function (i, t) {
|
78
|
+
var $token = $(t);
|
79
|
+
|
80
|
+
function complete () {
|
81
|
+
if (isInEffect(options.effect)) {
|
82
|
+
$token.css('visibility', 'visible');
|
83
|
+
} else if (isOutEffect(options.effect)) {
|
84
|
+
$token.css('visibility', 'hidden');
|
85
|
+
}
|
86
|
+
count -= 1;
|
87
|
+
if (!count && cb) cb();
|
88
|
+
}
|
89
|
+
|
90
|
+
var delay = options.sync ? options.delay : options.delay * i * options.delayScale;
|
91
|
+
|
92
|
+
$token.text() ?
|
93
|
+
setTimeout(function () { animate($token, options.effect, complete) }, delay) :
|
94
|
+
complete();
|
95
|
+
});
|
96
|
+
};
|
97
|
+
|
98
|
+
var Textillate = function (element, options) {
|
99
|
+
var base = this
|
100
|
+
, $element = $(element);
|
101
|
+
|
102
|
+
base.init = function () {
|
103
|
+
base.$texts = $element.find(options.selector);
|
104
|
+
|
105
|
+
if (!base.$texts.length) {
|
106
|
+
base.$texts = $('<ul class="texts"><li>' + $element.html() + '</li></ul>');
|
107
|
+
$element.html(base.$texts);
|
108
|
+
}
|
109
|
+
|
110
|
+
base.$texts.hide();
|
111
|
+
|
112
|
+
base.$current = $('<span>')
|
113
|
+
.html(base.$texts.find(':first-child').html())
|
114
|
+
.prependTo($element);
|
115
|
+
|
116
|
+
if (isInEffect(options.in.effect)) {
|
117
|
+
base.$current.css('visibility', 'hidden');
|
118
|
+
} else if (isOutEffect(options.out.effect)) {
|
119
|
+
base.$current.css('visibility', 'visible');
|
120
|
+
}
|
121
|
+
|
122
|
+
base.setOptions(options);
|
123
|
+
|
124
|
+
base.timeoutRun = null;
|
125
|
+
|
126
|
+
setTimeout(function () {
|
127
|
+
base.options.autoStart && base.start();
|
128
|
+
}, base.options.initialDelay)
|
129
|
+
};
|
130
|
+
|
131
|
+
base.setOptions = function (options) {
|
132
|
+
base.options = options;
|
133
|
+
};
|
134
|
+
|
135
|
+
base.triggerEvent = function (name) {
|
136
|
+
var e = $.Event(name + '.tlt');
|
137
|
+
$element.trigger(e, base);
|
138
|
+
return e;
|
139
|
+
};
|
140
|
+
|
141
|
+
base.in = function (index, cb) {
|
142
|
+
index = index || 0;
|
143
|
+
|
144
|
+
var $elem = base.$texts.find(':nth-child(' + ((index||0) + 1) + ')')
|
145
|
+
, options = $.extend(true, {}, base.options, $elem.length ? getData($elem[0]) : {})
|
146
|
+
, $tokens;
|
147
|
+
|
148
|
+
$elem.addClass('current');
|
149
|
+
|
150
|
+
base.triggerEvent('inAnimationBegin');
|
151
|
+
|
152
|
+
base.$current
|
153
|
+
.html($elem.html())
|
154
|
+
.lettering('words');
|
155
|
+
|
156
|
+
// split words to individual characters if token type is set to 'char'
|
157
|
+
if (base.options.type == "char") {
|
158
|
+
base.$current.find('[class^="word"]')
|
159
|
+
.css({
|
160
|
+
'display': 'inline-block',
|
161
|
+
// fix for poor ios performance
|
162
|
+
'-webkit-transform': 'translate3d(0,0,0)',
|
163
|
+
'-moz-transform': 'translate3d(0,0,0)',
|
164
|
+
'-o-transform': 'translate3d(0,0,0)',
|
165
|
+
'transform': 'translate3d(0,0,0)'
|
166
|
+
})
|
167
|
+
.each(function () { $(this).lettering() });
|
168
|
+
}
|
169
|
+
|
170
|
+
$tokens = base.$current
|
171
|
+
.find('[class^="' + base.options.type + '"]')
|
172
|
+
.css('display', 'inline-block');
|
173
|
+
|
174
|
+
if (isInEffect(options.in.effect)) {
|
175
|
+
$tokens.css('visibility', 'hidden');
|
176
|
+
} else if (isOutEffect(options.in.effect)) {
|
177
|
+
$tokens.css('visibility', 'visible');
|
178
|
+
}
|
179
|
+
|
180
|
+
base.currentIndex = index;
|
181
|
+
|
182
|
+
animateTokens($tokens, options.in, function () {
|
183
|
+
base.triggerEvent('inAnimationEnd');
|
184
|
+
if (options.in.callback) options.in.callback();
|
185
|
+
if (cb) cb(base);
|
186
|
+
});
|
187
|
+
};
|
188
|
+
|
189
|
+
base.out = function (cb) {
|
190
|
+
var $elem = base.$texts.find(':nth-child(' + ((base.currentIndex||0) + 1) + ')')
|
191
|
+
, $tokens = base.$current.find('[class^="' + base.options.type + '"]')
|
192
|
+
, options = $.extend(true, {}, base.options, $elem.length ? getData($elem[0]) : {})
|
193
|
+
|
194
|
+
base.triggerEvent('outAnimationBegin');
|
195
|
+
|
196
|
+
animateTokens($tokens, options.out, function () {
|
197
|
+
$elem.removeClass('current');
|
198
|
+
base.triggerEvent('outAnimationEnd');
|
199
|
+
if (options.out.callback) options.out.callback();
|
200
|
+
if (cb) cb(base);
|
201
|
+
});
|
202
|
+
};
|
203
|
+
|
204
|
+
base.start = function (index) {
|
205
|
+
setTimeout(function () {
|
206
|
+
base.triggerEvent('start');
|
207
|
+
|
208
|
+
(function run (index) {
|
209
|
+
base.in(index, function () {
|
210
|
+
var length = base.$texts.children().length;
|
211
|
+
|
212
|
+
index += 1;
|
213
|
+
|
214
|
+
if (!base.options.loop && index >= length) {
|
215
|
+
if (base.options.callback) base.options.callback();
|
216
|
+
base.triggerEvent('end');
|
217
|
+
} else {
|
218
|
+
index = index % length;
|
219
|
+
|
220
|
+
base.timeoutRun = setTimeout(function () {
|
221
|
+
base.out(function () {
|
222
|
+
run(index)
|
223
|
+
});
|
224
|
+
}, base.options.minDisplayTime);
|
225
|
+
}
|
226
|
+
});
|
227
|
+
}(index || 0));
|
228
|
+
}, base.options.initialDelay);
|
229
|
+
};
|
230
|
+
|
231
|
+
base.stop = function () {
|
232
|
+
if (base.timeoutRun) {
|
233
|
+
clearInterval(base.timeoutRun);
|
234
|
+
base.timeoutRun = null;
|
235
|
+
}
|
236
|
+
};
|
237
|
+
|
238
|
+
base.init();
|
239
|
+
}
|
240
|
+
|
241
|
+
$.fn.textillate = function (settings, args) {
|
242
|
+
return this.each(function () {
|
243
|
+
var $this = $(this)
|
244
|
+
, data = $this.data('textillate')
|
245
|
+
, options = $.extend(true, {}, $.fn.textillate.defaults, getData(this), typeof settings == 'object' && settings);
|
246
|
+
|
247
|
+
if (!data) {
|
248
|
+
$this.data('textillate', (data = new Textillate(this, options)));
|
249
|
+
} else if (typeof settings == 'string') {
|
250
|
+
data[settings].apply(data, [].concat(args));
|
251
|
+
} else {
|
252
|
+
data.setOptions.call(data, options);
|
253
|
+
}
|
254
|
+
})
|
255
|
+
};
|
256
|
+
|
257
|
+
$.fn.textillate.defaults = {
|
258
|
+
selector: '.texts',
|
259
|
+
loop: false,
|
260
|
+
minDisplayTime: 2000,
|
261
|
+
initialDelay: 0,
|
262
|
+
in: {
|
263
|
+
effect: 'fadeInLeftBig',
|
264
|
+
delayScale: 1.5,
|
265
|
+
delay: 50,
|
266
|
+
sync: false,
|
267
|
+
reverse: false,
|
268
|
+
shuffle: false,
|
269
|
+
callback: function () {}
|
270
|
+
},
|
271
|
+
out: {
|
272
|
+
effect: 'hinge',
|
273
|
+
delayScale: 1.5,
|
274
|
+
delay: 50,
|
275
|
+
sync: false,
|
276
|
+
reverse: false,
|
277
|
+
shuffle: false,
|
278
|
+
callback: function () {}
|
279
|
+
},
|
280
|
+
autoStart: true,
|
281
|
+
inEffects: [],
|
282
|
+
outEffects: [ 'hinge' ],
|
283
|
+
callback: function () {},
|
284
|
+
type: 'char'
|
285
|
+
};
|
286
|
+
|
287
|
+
}(jQuery));
|