jquery-livetype-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +15 -0
- data/lib/jquery-livetype-rails/version.rb +5 -0
- data/lib/jquery-livetype-rails.rb +8 -0
- data/vendor/assets/javascripts/jquery.liveType.js +72 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f5b0345b9418bc2b7df68d6f91f41164cacaa56
|
4
|
+
data.tar.gz: 7af91c6bd2e8546a5d8d9d85d7c00da116cb6d52
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9a628ee0dde23f47c655e6114c5f4b003c6e0284933e5e5f2fd951dd989fea5aabfbd15ad862fc9c6daf520adf98717a28200a996bee5726df0ade21f5fb71d
|
7
|
+
data.tar.gz: ff7e21b0e5874e42081a1d6d8e6ced9084f3a80a43e524537f92d6e6843d427e8b06b861351fc150dbc50954d968f850452b5fdf1c8c6a49e8df88444a7880d5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Tobal San
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# jquery-livetype-rails
|
2
|
+
|
3
|
+
[jQuery LiveType](https://github.com/tobalsan/livetype) plugin for jQuery, written by [Tobal San](https://github.com/tobalsan), packaged for the Rails asset pipeline.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add the following to your JavaScript application manifest:
|
8
|
+
|
9
|
+
```
|
10
|
+
//= require jquery.liveType
|
11
|
+
```
|
12
|
+
|
13
|
+
## Disclaimer
|
14
|
+
|
15
|
+
This repo is a Rails gem package. All issues with the library should be reported on the library's [GitHub page](https://github.com/tobalsan/livetype). This repo will be updated each time a new version of the library is released.
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery LiveType 0.1
|
3
|
+
*
|
4
|
+
* Copyright 2013, Tobal San (http://www.smartrock.fr)
|
5
|
+
* Licensed under the MIT license.
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
|
9
|
+
$.fn.liveType = function(opts){
|
10
|
+
var $this = this,
|
11
|
+
defaults = {
|
12
|
+
typeSpeed : 50, // Time between each character typed
|
13
|
+
pauseEvery : 40, // Number of characters between each pause. Only used when pauseOnPunctuation is set to false
|
14
|
+
pauseTime : 1500, // The duration of pause
|
15
|
+
pauseOnPunctuation : true, // If the pause should be on punctuation characters
|
16
|
+
punctuationChars : ['.', '.', '?', '!', ':', ';'], // An array of characters to pause on
|
17
|
+
cursorEffect : true, // "True" for smooth blinking, "false" for plain blinking
|
18
|
+
cursorSpeed : 500, // Cursor blinking speed
|
19
|
+
cursor : '|' // Cursor type
|
20
|
+
},
|
21
|
+
settings = $.extend(defaults, opts);
|
22
|
+
|
23
|
+
text = $this.html();
|
24
|
+
$this.empty().append('<span class="cursor">' + settings.cursor + '</span>');
|
25
|
+
|
26
|
+
cursor = 0
|
27
|
+
|
28
|
+
setInterval(cursorAnimation, settings.cursorSpeed);
|
29
|
+
t = setTimeout(type, settings.typeSpeed);
|
30
|
+
|
31
|
+
function cursorAnimation() {
|
32
|
+
if (settings.cursorEffect) {
|
33
|
+
$("span.cursor", $this).animate({
|
34
|
+
opacity: 0
|
35
|
+
}, "fast", 'swing').animate({
|
36
|
+
opacity: 1
|
37
|
+
}, "fast", 'swing');
|
38
|
+
} else {
|
39
|
+
if ($('span.cursor', $this).is(':visible')) {
|
40
|
+
$('span.cursor', $this).hide();
|
41
|
+
} else {
|
42
|
+
$('span.cursor', $this).show();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
function type() {
|
49
|
+
cursor++;
|
50
|
+
if(cursor <= text.length) {
|
51
|
+
if (settings.pauseOnPunctuation) {
|
52
|
+
if(settings.punctuationChars.indexOf(text.substr(cursor-2, 1)) > -1) {
|
53
|
+
clearTimeout(t);
|
54
|
+
cursor++;
|
55
|
+
setTimeout(type, settings.pauseTime);
|
56
|
+
} else {
|
57
|
+
$this.html(text.substr(0, cursor) + '<span class="cursor">' + settings.cursor + '</span>');
|
58
|
+
setTimeout(type, settings.typeSpeed)
|
59
|
+
}
|
60
|
+
} else {
|
61
|
+
if(cursor % settings.pauseEvery) {
|
62
|
+
$this.html(text.substr(0, cursor) + '<span class="cursor">' + settings.cursor + '</span>');
|
63
|
+
setTimeout(type, settings.typeSpeed)
|
64
|
+
} else {
|
65
|
+
clearTimeout(t);
|
66
|
+
cursor++;
|
67
|
+
setTimeout(type, settings.pauseTime);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-livetype-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Curt Howard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A build of the jQuery LiveType Plugin, written by written by Tobal San,
|
14
|
+
packaged for the Rails asset pipeline.
|
15
|
+
email:
|
16
|
+
- choward@weblinc.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
- lib/jquery-livetype-rails.rb
|
24
|
+
- lib/jquery-livetype-rails/version.rb
|
25
|
+
- vendor/assets/javascripts/jquery.liveType.js
|
26
|
+
homepage: https://github.com/meowsus/jquery-livetype-rails
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.4.5
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: A build of the jQuery LiveType Plugin, written by written by Tobal San, packaged
|
50
|
+
for the Rails asset pipeline.
|
51
|
+
test_files: []
|