jquery_caret_rails 1.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 +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/jquery_caret_rails.gemspec +18 -0
- data/lib/jquery_caret_rails.rb +10 -0
- data/lib/jquery_caret_rails/version.rb +10 -0
- data/vendor/assets/javascripts/jquery.caret.js +79 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ca9f0328d10f1127570114996be6f679a5c770c
|
4
|
+
data.tar.gz: f55655a3819e9465b70e99bcf42f7380650ddd12
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8234ddb248f471ef0a18f90874120a8371e8f904276a0f65d55807da4d69b7adcde86185e334a0b89a08da1c5ee151b14e6d37c6a6427cc5eecbb5d3801a9e58
|
7
|
+
data.tar.gz: 5b7ff7956c1856d35f170936ba2af34c4cf243647b6a149565a61fb56f111b4006856a0f7be8c026d4169d70f35fdab40982b2012ad37f53a9a557e856404b32
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (4.2.4)
|
5
|
+
actionpack (= 4.2.4)
|
6
|
+
actionview (= 4.2.4)
|
7
|
+
activejob (= 4.2.4)
|
8
|
+
mail (~> 2.5, >= 2.5.4)
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
+
actionpack (4.2.4)
|
11
|
+
actionview (= 4.2.4)
|
12
|
+
activesupport (= 4.2.4)
|
13
|
+
rack (~> 1.6)
|
14
|
+
rack-test (~> 0.6.2)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
+
actionview (4.2.4)
|
18
|
+
activesupport (= 4.2.4)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
activejob (4.2.4)
|
24
|
+
activesupport (= 4.2.4)
|
25
|
+
globalid (>= 0.3.0)
|
26
|
+
activemodel (4.2.4)
|
27
|
+
activesupport (= 4.2.4)
|
28
|
+
builder (~> 3.1)
|
29
|
+
activerecord (4.2.4)
|
30
|
+
activemodel (= 4.2.4)
|
31
|
+
activesupport (= 4.2.4)
|
32
|
+
arel (~> 6.0)
|
33
|
+
activesupport (4.2.4)
|
34
|
+
i18n (~> 0.7)
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
36
|
+
minitest (~> 5.1)
|
37
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
38
|
+
tzinfo (~> 1.1)
|
39
|
+
arel (6.0.3)
|
40
|
+
builder (3.2.2)
|
41
|
+
erubis (2.7.0)
|
42
|
+
globalid (0.3.6)
|
43
|
+
activesupport (>= 4.1.0)
|
44
|
+
i18n (0.7.0)
|
45
|
+
json (1.8.3)
|
46
|
+
loofah (2.0.3)
|
47
|
+
nokogiri (>= 1.5.9)
|
48
|
+
mail (2.6.3)
|
49
|
+
mime-types (>= 1.16, < 3)
|
50
|
+
mime-types (2.6.1)
|
51
|
+
mini_portile (0.6.2)
|
52
|
+
minitest (5.8.0)
|
53
|
+
nokogiri (1.6.6.2)
|
54
|
+
mini_portile (~> 0.6.0)
|
55
|
+
rack (1.6.4)
|
56
|
+
rack-test (0.6.3)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (4.2.4)
|
59
|
+
actionmailer (= 4.2.4)
|
60
|
+
actionpack (= 4.2.4)
|
61
|
+
actionview (= 4.2.4)
|
62
|
+
activejob (= 4.2.4)
|
63
|
+
activemodel (= 4.2.4)
|
64
|
+
activerecord (= 4.2.4)
|
65
|
+
activesupport (= 4.2.4)
|
66
|
+
bundler (>= 1.3.0, < 2.0)
|
67
|
+
railties (= 4.2.4)
|
68
|
+
sprockets-rails
|
69
|
+
rails-deprecated_sanitizer (1.0.3)
|
70
|
+
activesupport (>= 4.2.0.alpha)
|
71
|
+
rails-dom-testing (1.0.7)
|
72
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
73
|
+
nokogiri (~> 1.6.0)
|
74
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
75
|
+
rails-html-sanitizer (1.0.2)
|
76
|
+
loofah (~> 2.0)
|
77
|
+
railties (4.2.4)
|
78
|
+
actionpack (= 4.2.4)
|
79
|
+
activesupport (= 4.2.4)
|
80
|
+
rake (>= 0.8.7)
|
81
|
+
thor (>= 0.18.1, < 2.0)
|
82
|
+
rake (10.4.2)
|
83
|
+
sprockets (3.3.3)
|
84
|
+
rack (~> 1.0)
|
85
|
+
sprockets-rails (2.3.2)
|
86
|
+
actionpack (>= 3.0)
|
87
|
+
activesupport (>= 3.0)
|
88
|
+
sprockets (>= 2.8, < 4.0)
|
89
|
+
thor (0.19.1)
|
90
|
+
thread_safe (0.3.5)
|
91
|
+
tzinfo (1.2.2)
|
92
|
+
thread_safe (~> 0.1)
|
93
|
+
|
94
|
+
PLATFORMS
|
95
|
+
ruby
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
rails
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.10.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Thomas Barker
|
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,31 @@
|
|
1
|
+
# jquery_caret_rails
|
2
|
+
Lightweight plugin to allow you to move the caret (or cursor) position in an element.
|
3
|
+
|
4
|
+
By exposing three jQuery.fn methods you can easily move a a caret to any position you like:
|
5
|
+
|
6
|
+
### Installation
|
7
|
+
|
8
|
+
Add it to your `Gemfile`:
|
9
|
+
```
|
10
|
+
gem 'jquery_caret_rails', '~> 1.0.0'
|
11
|
+
```
|
12
|
+
|
13
|
+
### Usage
|
14
|
+
|
15
|
+
You can add jquery_caret_rails to your `application.js` file using a require statement like this:
|
16
|
+
|
17
|
+
```
|
18
|
+
//= require jquery.caret
|
19
|
+
```
|
20
|
+
|
21
|
+
### License
|
22
|
+
|
23
|
+
The gem is still under active development and although it is publicly available, we won't be held responsible if you install it in your own project and something goes wrong. Use at your own risk.
|
24
|
+
|
25
|
+
[License](https://github.com/pwcshipyard/feature_it/blob/master/LICENSE) under the MIT license.
|
26
|
+
|
27
|
+
### Authors
|
28
|
+
1. This gem: Thomas Barker
|
29
|
+
2. Inspiration from: piton [https://github.com/piton/jquery-caret-rails]
|
30
|
+
3. Original gem: Changok Kim [@okidokim](http://twitter.com/okidokim) [https://github.com/changok/jquery-caret-rails]
|
31
|
+
4. jquery-caret: Luke Morton, it's [on github](https://github.com/DrPheltRight/jquery-caret)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jquery_caret_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'jquery_caret_rails'
|
8
|
+
spec.version = Jquery::Caret::Rails::VERSION
|
9
|
+
spec.authors = ['Thomas Barker']
|
10
|
+
spec.email = ['thomas.john.barker@gmail.com']
|
11
|
+
spec.summary = 'jquery_caret for the Rails asset pipeline'
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0")
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ['lib']
|
17
|
+
spec.add_dependency 'railties', '>= 3.1'
|
18
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// Set caret position easily in jQuery
|
2
|
+
// Written by and Copyright of Luke Morton, 2011
|
3
|
+
// Licensed under MIT
|
4
|
+
(function ($) {
|
5
|
+
// Behind the scenes method deals with browser
|
6
|
+
// idiosyncrasies and such
|
7
|
+
$.caretTo = function (el, index) {
|
8
|
+
if (el.createTextRange) {
|
9
|
+
var range = el.createTextRange();
|
10
|
+
range.move("character", index);
|
11
|
+
range.select();
|
12
|
+
} else if (el.selectionStart != null) {
|
13
|
+
el.focus();
|
14
|
+
el.setSelectionRange(index, index);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
// Another behind the scenes that collects the
|
19
|
+
// current caret position for an element
|
20
|
+
|
21
|
+
// TODO: Get working with Opera
|
22
|
+
$.caretPos = function (el) {
|
23
|
+
if ("selection" in document) {
|
24
|
+
var range = el.createTextRange();
|
25
|
+
try {
|
26
|
+
range.setEndPoint("EndToStart", document.selection.createRange());
|
27
|
+
} catch (e) {
|
28
|
+
// Catch IE failure here, return 0 like
|
29
|
+
// other browsers
|
30
|
+
return 0;
|
31
|
+
}
|
32
|
+
return range.text.length;
|
33
|
+
} else if (el.selectionStart != null) {
|
34
|
+
return el.selectionStart;
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
// The following methods are queued under fx for more
|
39
|
+
// flexibility when combining with $.fn.delay() and
|
40
|
+
// jQuery effects.
|
41
|
+
|
42
|
+
// Set caret to a particular index
|
43
|
+
$.fn.caret = function (index, offset) {
|
44
|
+
if (typeof(index) === "undefined") {
|
45
|
+
return $.caretPos(this.get(0));
|
46
|
+
}
|
47
|
+
|
48
|
+
return this.queue(function (next) {
|
49
|
+
if (isNaN(index)) {
|
50
|
+
var i = $(this).val().indexOf(index);
|
51
|
+
|
52
|
+
if (offset === true) {
|
53
|
+
i += index.length;
|
54
|
+
} else if (typeof(offset) !== "undefined") {
|
55
|
+
i += offset;
|
56
|
+
}
|
57
|
+
|
58
|
+
$.caretTo(this, i);
|
59
|
+
} else {
|
60
|
+
$.caretTo(this, index);
|
61
|
+
}
|
62
|
+
|
63
|
+
next();
|
64
|
+
});
|
65
|
+
};
|
66
|
+
|
67
|
+
// Set caret to beginning of an element
|
68
|
+
$.fn.caretToStart = function () {
|
69
|
+
return this.caret(0);
|
70
|
+
};
|
71
|
+
|
72
|
+
// Set caret to the end of an element
|
73
|
+
$.fn.caretToEnd = function () {
|
74
|
+
return this.queue(function (next) {
|
75
|
+
$.caretTo(this, $(this).val().length);
|
76
|
+
next();
|
77
|
+
});
|
78
|
+
};
|
79
|
+
}(jQuery));
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery_caret_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Barker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- thomas.john.barker@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- jquery_caret_rails.gemspec
|
41
|
+
- lib/jquery_caret_rails.rb
|
42
|
+
- lib/jquery_caret_rails/version.rb
|
43
|
+
- vendor/assets/javascripts/jquery.caret.js
|
44
|
+
homepage:
|
45
|
+
licenses: []
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.4.5.1
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: jquery_caret for the Rails asset pipeline
|
67
|
+
test_files: []
|
68
|
+
has_rdoc:
|