rails_autosize_jquery 3.0.15

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3bfe21243c0210989e62d4267e07c248888543a9
4
+ data.tar.gz: a85d31a3cdb6c9c709d88d6b24e2732e2958cc2e
5
+ SHA512:
6
+ metadata.gz: 360fdaa816e7758df588f19f92febad97802f5a69546a3d184d145c4dfa350284f111a486fff18cbab4b740bf680cbd353534c5775b7a022bc4dc19ddd63754b
7
+ data.tar.gz: be7e0a5805a30806ab1b8209a95617f09037faea37fd3b072d0f7eab3fbada4689f252f8f60b79efc0fb89db4b5ae775b770145c70c909f34aa1b9c42554607c
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_autosize_jquery.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # RailsAutosizeJquery
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_autosize_jquery`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rails_autosize_jquery'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rails_autosize_jquery
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_autosize_jquery.
36
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,2 @@
1
+ $(document).on 'ready page:load page:restore', ->
2
+ $('.autosize').autosize()
@@ -0,0 +1,5 @@
1
+ require "rails_autosize_jquery/version"
2
+ require "rails_autosize_jquery/engine"
3
+
4
+ module RailsAutosizeJquery
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'rails/engine'
2
+
3
+ module RailsAutosizeJquery
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module RailsAutosizeJquery
2
+ VERSION = "3.0.15"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails_autosize_jquery/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails_autosize_jquery"
8
+ spec.version = RailsAutosizeJquery::VERSION
9
+ spec.authors = ["Anthony Robin"]
10
+ spec.email = ["anthony@lr-agenceweb.fr"]
11
+
12
+ spec.summary = "Rais asset pipeline integration for jQuery autosize plugin"
13
+ spec.description = "Autosize is a small, stand-alone script to automatically adjust textarea height to fit text"
14
+ spec.homepage = "http://github.com/lr-agenceweb/"
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest"
25
+ end
@@ -0,0 +1,254 @@
1
+ /*!
2
+ Autosize 3.0.15
3
+ license: MIT
4
+ http://www.jacklmoore.com/autosize
5
+ */
6
+ (function (global, factory) {
7
+ if (typeof define === 'function' && define.amd) {
8
+ define(['exports', 'module'], factory);
9
+ } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
10
+ factory(exports, module);
11
+ } else {
12
+ var mod = {
13
+ exports: {}
14
+ };
15
+ factory(mod.exports, mod);
16
+ global.autosize = mod.exports;
17
+ }
18
+ })(this, function (exports, module) {
19
+ 'use strict';
20
+
21
+ var set = typeof Set === 'function' ? new Set() : (function () {
22
+ var list = [];
23
+
24
+ return {
25
+ has: function has(key) {
26
+ return Boolean(list.indexOf(key) > -1);
27
+ },
28
+ add: function add(key) {
29
+ list.push(key);
30
+ },
31
+ 'delete': function _delete(key) {
32
+ list.splice(list.indexOf(key), 1);
33
+ } };
34
+ })();
35
+
36
+ var createEvent = function createEvent(name) {
37
+ return new Event(name);
38
+ };
39
+ try {
40
+ new Event('test');
41
+ } catch (e) {
42
+ // IE does not support `new Event()`
43
+ createEvent = function (name) {
44
+ var evt = document.createEvent('Event');
45
+ evt.initEvent(name, true, false);
46
+ return evt;
47
+ };
48
+ }
49
+
50
+ function assign(ta) {
51
+ var _ref = arguments[1] === undefined ? {} : arguments[1];
52
+
53
+ var _ref$setOverflowX = _ref.setOverflowX;
54
+ var setOverflowX = _ref$setOverflowX === undefined ? true : _ref$setOverflowX;
55
+ var _ref$setOverflowY = _ref.setOverflowY;
56
+ var setOverflowY = _ref$setOverflowY === undefined ? true : _ref$setOverflowY;
57
+
58
+ if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;
59
+
60
+ var heightOffset = null;
61
+ var overflowY = null;
62
+ var clientWidth = ta.clientWidth;
63
+
64
+ function init() {
65
+ var style = window.getComputedStyle(ta, null);
66
+
67
+ overflowY = style.overflowY;
68
+
69
+ if (style.resize === 'vertical') {
70
+ ta.style.resize = 'none';
71
+ } else if (style.resize === 'both') {
72
+ ta.style.resize = 'horizontal';
73
+ }
74
+
75
+ if (style.boxSizing === 'content-box') {
76
+ heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
77
+ } else {
78
+ heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
79
+ }
80
+ // Fix when a textarea is not on document body and heightOffset is Not a Number
81
+ if (isNaN(heightOffset)) {
82
+ heightOffset = 0;
83
+ }
84
+
85
+ update();
86
+ }
87
+
88
+ function changeOverflow(value) {
89
+ {
90
+ // Chrome/Safari-specific fix:
91
+ // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
92
+ // made available by removing the scrollbar. The following forces the necessary text reflow.
93
+ var width = ta.style.width;
94
+ ta.style.width = '0px';
95
+ // Force reflow:
96
+ /* jshint ignore:start */
97
+ ta.offsetWidth;
98
+ /* jshint ignore:end */
99
+ ta.style.width = width;
100
+ }
101
+
102
+ overflowY = value;
103
+
104
+ if (setOverflowY) {
105
+ ta.style.overflowY = value;
106
+ }
107
+
108
+ resize();
109
+ }
110
+
111
+ function resize() {
112
+ var htmlTop = window.pageYOffset;
113
+ var bodyTop = document.body.scrollTop;
114
+ var originalHeight = ta.style.height;
115
+
116
+ ta.style.height = 'auto';
117
+
118
+ var endHeight = ta.scrollHeight + heightOffset;
119
+
120
+ if (ta.scrollHeight === 0) {
121
+ // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
122
+ ta.style.height = originalHeight;
123
+ return;
124
+ }
125
+
126
+ ta.style.height = endHeight + 'px';
127
+
128
+ // used to check if an update is actually necessary on window.resize
129
+ clientWidth = ta.clientWidth;
130
+
131
+ // prevents scroll-position jumping
132
+ document.documentElement.scrollTop = htmlTop;
133
+ document.body.scrollTop = bodyTop;
134
+ }
135
+
136
+ function update() {
137
+ var startHeight = ta.style.height;
138
+
139
+ resize();
140
+
141
+ var style = window.getComputedStyle(ta, null);
142
+
143
+ if (style.height !== ta.style.height) {
144
+ if (overflowY !== 'visible') {
145
+ changeOverflow('visible');
146
+ }
147
+ } else {
148
+ if (overflowY !== 'hidden') {
149
+ changeOverflow('hidden');
150
+ }
151
+ }
152
+
153
+ if (startHeight !== ta.style.height) {
154
+ var evt = createEvent('autosize:resized');
155
+ ta.dispatchEvent(evt);
156
+ }
157
+ }
158
+
159
+ var pageResize = function pageResize() {
160
+ if (ta.clientWidth !== clientWidth) {
161
+ update();
162
+ }
163
+ };
164
+
165
+ var destroy = (function (style) {
166
+ window.removeEventListener('resize', pageResize, false);
167
+ ta.removeEventListener('input', update, false);
168
+ ta.removeEventListener('keyup', update, false);
169
+ ta.removeEventListener('autosize:destroy', destroy, false);
170
+ ta.removeEventListener('autosize:update', update, false);
171
+ set['delete'](ta);
172
+
173
+ Object.keys(style).forEach(function (key) {
174
+ ta.style[key] = style[key];
175
+ });
176
+ }).bind(ta, {
177
+ height: ta.style.height,
178
+ resize: ta.style.resize,
179
+ overflowY: ta.style.overflowY,
180
+ overflowX: ta.style.overflowX,
181
+ wordWrap: ta.style.wordWrap });
182
+
183
+ ta.addEventListener('autosize:destroy', destroy, false);
184
+
185
+ // IE9 does not fire onpropertychange or oninput for deletions,
186
+ // so binding to onkeyup to catch most of those events.
187
+ // There is no way that I know of to detect something like 'cut' in IE9.
188
+ if ('onpropertychange' in ta && 'oninput' in ta) {
189
+ ta.addEventListener('keyup', update, false);
190
+ }
191
+
192
+ window.addEventListener('resize', pageResize, false);
193
+ ta.addEventListener('input', update, false);
194
+ ta.addEventListener('autosize:update', update, false);
195
+ set.add(ta);
196
+
197
+ if (setOverflowX) {
198
+ ta.style.overflowX = 'hidden';
199
+ ta.style.wordWrap = 'break-word';
200
+ }
201
+
202
+ init();
203
+ }
204
+
205
+ function destroy(ta) {
206
+ if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
207
+ var evt = createEvent('autosize:destroy');
208
+ ta.dispatchEvent(evt);
209
+ }
210
+
211
+ function update(ta) {
212
+ if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;
213
+ var evt = createEvent('autosize:update');
214
+ ta.dispatchEvent(evt);
215
+ }
216
+
217
+ var autosize = null;
218
+
219
+ // Do nothing in Node.js environment and IE8 (or lower)
220
+ if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
221
+ autosize = function (el) {
222
+ return el;
223
+ };
224
+ autosize.destroy = function (el) {
225
+ return el;
226
+ };
227
+ autosize.update = function (el) {
228
+ return el;
229
+ };
230
+ } else {
231
+ autosize = function (el, options) {
232
+ if (el) {
233
+ Array.prototype.forEach.call(el.length ? el : [el], function (x) {
234
+ return assign(x, options);
235
+ });
236
+ }
237
+ return el;
238
+ };
239
+ autosize.destroy = function (el) {
240
+ if (el) {
241
+ Array.prototype.forEach.call(el.length ? el : [el], destroy);
242
+ }
243
+ return el;
244
+ };
245
+ autosize.update = function (el) {
246
+ if (el) {
247
+ Array.prototype.forEach.call(el.length ? el : [el], update);
248
+ }
249
+ return el;
250
+ };
251
+ }
252
+
253
+ module.exports = autosize;
254
+ });
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_autosize_jquery
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.15
5
+ platform: ruby
6
+ authors:
7
+ - Anthony Robin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-30 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Autosize is a small, stand-alone script to automatically adjust textarea
56
+ height to fit text
57
+ email:
58
+ - anthony@lr-agenceweb.fr
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - app/assets/javascripts/jquery.autosize.initializer.coffee
69
+ - lib/rails_autosize_jquery.rb
70
+ - lib/rails_autosize_jquery/engine.rb
71
+ - lib/rails_autosize_jquery/version.rb
72
+ - rails_autosize_jquery.gemspec
73
+ - vendor/assets/javascripts/jquery.autosize.js
74
+ homepage: http://github.com/lr-agenceweb/
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.8
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Rais asset pipeline integration for jQuery autosize plugin
98
+ test_files: []