jquery-textchange-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/jquery-textchange-rails.gemspec +22 -0
- data/lib/jquery/textchange/rails.rb +4 -0
- data/lib/jquery/textchange/rails/engine.rb +9 -0
- data/lib/jquery/textchange/rails/version.rb +9 -0
- data/vendor/assets/javascripts/jquery.textchange.js +76 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff3a6301829a408423246c359ffec34392a4b538
|
4
|
+
data.tar.gz: f267bf4fa4b8e1eabf301e73912ed61b82fd05c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f8d63a9c36c78cbff8f4f60c11110a820d2a0c0662f4979ca728400b0bf717ee0d770039c691dcb6546b46a1885e7c8cdef23ec1151ef8bd73e0428d3b8e2cd
|
7
|
+
data.tar.gz: 0485424b8747f1be9fec99e2b6f401d89f76957be8a58e5b628c3933f44d2cf5a7fadb3c82260591fde1ccc69063945f49440aec765d545b7af18392c76e9fac
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eito Katagiri
|
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
@@ -0,0 +1,29 @@
|
|
1
|
+
# Jquery::Textchange::Rails
|
2
|
+
|
3
|
+
Simple cross browser detection of text changes for input and textarea
|
4
|
+
elements using a jQuery custom event plugin by ZURB.
|
5
|
+
|
6
|
+
The javascript file (vendor/assets/javascripts/jquery.textchange.js) is
|
7
|
+
taken from [here](https://gist.github.com/mkelly12/424774).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'jquery-textchange-rails'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install jquery-textchange-rails
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jquery/textchange/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jquery-textchange-rails"
|
8
|
+
spec.version = Jquery::Textchange::Rails::VERSION
|
9
|
+
spec.authors = ["Matt Kelly", "Eito Katagiri"]
|
10
|
+
spec.email = ["matt@zurb.com", "eitoball@gmail.com"]
|
11
|
+
spec.description = %q{Simple cross browser detection of text changes for input and textarea elements using a jQuery custom event plugin by ZURB.}
|
12
|
+
spec.summary = %q{A jQuery plugin of simple cross browser detection of text changes by ZURB}
|
13
|
+
spec.homepage = "http://github.com/eitoball/jquery-textchange-rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
spec.add_development_dependency "railties", ">= 3.2.0", "< 5.0"
|
22
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery TextChange Plugin
|
3
|
+
* http://www.zurb.com/playground/jquery-text-change-custom-event
|
4
|
+
*
|
5
|
+
* Copyright 2010, ZURB
|
6
|
+
* Released under the MIT License
|
7
|
+
*/
|
8
|
+
(function ($) {
|
9
|
+
|
10
|
+
$.event.special.textchange = {
|
11
|
+
|
12
|
+
setup: function (data, namespaces) {
|
13
|
+
$(this).data('lastValue', this.contentEditable === 'true' ? $(this).html() : $(this).val());
|
14
|
+
$(this).bind('keyup.textchange', $.event.special.textchange.handler);
|
15
|
+
$(this).bind('cut.textchange paste.textchange input.textchange', $.event.special.textchange.delayedHandler);
|
16
|
+
},
|
17
|
+
|
18
|
+
teardown: function (namespaces) {
|
19
|
+
$(this).unbind('.textchange');
|
20
|
+
},
|
21
|
+
|
22
|
+
handler: function (event) {
|
23
|
+
$.event.special.textchange.triggerIfChanged($(this));
|
24
|
+
},
|
25
|
+
|
26
|
+
delayedHandler: function (event) {
|
27
|
+
var element = $(this);
|
28
|
+
setTimeout(function () {
|
29
|
+
$.event.special.textchange.triggerIfChanged(element);
|
30
|
+
}, 25);
|
31
|
+
},
|
32
|
+
|
33
|
+
triggerIfChanged: function (element) {
|
34
|
+
var current = element[0].contentEditable === 'true' ? element.html() : element.val();
|
35
|
+
if (current !== element.data('lastValue')) {
|
36
|
+
element.trigger('textchange', [element.data('lastValue')]);
|
37
|
+
element.data('lastValue', current);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
$.event.special.hastext = {
|
43
|
+
|
44
|
+
setup: function (data, namespaces) {
|
45
|
+
$(this).bind('textchange', $.event.special.hastext.handler);
|
46
|
+
},
|
47
|
+
|
48
|
+
teardown: function (namespaces) {
|
49
|
+
$(this).unbind('textchange', $.event.special.hastext.handler);
|
50
|
+
},
|
51
|
+
|
52
|
+
handler: function (event, lastValue) {
|
53
|
+
if ((lastValue === '') && lastValue !== $(this).val()) {
|
54
|
+
$(this).trigger('hastext');
|
55
|
+
}
|
56
|
+
}
|
57
|
+
};
|
58
|
+
|
59
|
+
$.event.special.notext = {
|
60
|
+
|
61
|
+
setup: function (data, namespaces) {
|
62
|
+
$(this).bind('textchange', $.event.special.notext.handler);
|
63
|
+
},
|
64
|
+
|
65
|
+
teardown: function (namespaces) {
|
66
|
+
$(this).unbind('textchange', $.event.special.notext.handler);
|
67
|
+
},
|
68
|
+
|
69
|
+
handler: function (event, lastValue) {
|
70
|
+
if ($(this).val() === '' && $(this).val() !== lastValue) {
|
71
|
+
$(this).trigger('notext');
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
})(jQuery);
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-textchange-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Kelly
|
8
|
+
- Eito Katagiri
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.3'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.3'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: railties
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 3.2.0
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '5.0'
|
52
|
+
type: :development
|
53
|
+
prerelease: false
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 3.2.0
|
59
|
+
- - <
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
description: Simple cross browser detection of text changes for input and textarea
|
63
|
+
elements using a jQuery custom event plugin by ZURB.
|
64
|
+
email:
|
65
|
+
- matt@zurb.com
|
66
|
+
- eitoball@gmail.com
|
67
|
+
executables: []
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- .gitignore
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- jquery-textchange-rails.gemspec
|
77
|
+
- lib/jquery/textchange/rails.rb
|
78
|
+
- lib/jquery/textchange/rails/engine.rb
|
79
|
+
- lib/jquery/textchange/rails/version.rb
|
80
|
+
- vendor/assets/javascripts/jquery.textchange.js
|
81
|
+
homepage: http://github.com/eitoball/jquery-textchange-rails
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.0.3
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: A jQuery plugin of simple cross browser detection of text changes by ZURB
|
105
|
+
test_files: []
|