autosize 1.1.18.1 → 1.1.18.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78caa83420a54d3ede34029eda2809b335b94f7a
4
- data.tar.gz: f6959ebb8ba72d90a1eaa6fc681fae3696f66987
3
+ metadata.gz: 98671965689ddc4534c46e5952269fe9c7285c00
4
+ data.tar.gz: 1d41daa95bbdf19d2fb06f1d6d827388d60a53e2
5
5
  SHA512:
6
- metadata.gz: 1ea639b67a85e4a73176e6f6b114a30b664d870fcbadfc29b6e35cfc6e18618a6dfab30eb28672d38405d9a219296b5f93773e02f7036c27c42fb4b30c43dda2
7
- data.tar.gz: 26a46e44517f36b449678b6557e9f155016ff2b09e0bdba4381fd1fa775c9234e2b850d080096ccda3cf15af98700ec78bb3b7cea84670de53bdff0f4d378706
6
+ metadata.gz: f0a7b9b0ec956baa3984e240834bc57a128d0afc9526b939b6e1d84139a6dce0e57c53bdd0b66b33ef969fdef692d80e2c94116935311597041a25d95c66a780
7
+ data.tar.gz: a9ce722a0356fae797065689889819091e13faacade5982da693d299def4de81ab0e3cfda7f9795cba0bf869fed4a7fa9ff41b0dbcddccdaac6b0cdd1a59aee8
data/README.md CHANGED
@@ -25,3 +25,7 @@ Contributing
25
25
  License
26
26
  ------------
27
27
  The MIT License (MIT)
28
+
29
+
30
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/acrogenesis/autosize/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
31
+
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.version = Autosize::Rails::VERSION
7
7
  gem.authors = ["Jack Moore", "Adrian Rangel"]
8
8
  gem.email = ["adrian.rangel@gmail.com"]
9
- gem.homepage = "https://github.com/acrogenesis/autosize"
9
+ gem.homepage = "http://www.jacklmoore.com/autosize/"
10
10
  gem.summary = %q{This gem allows you to use Autosize jQuery plugin}
11
11
  gem.description = %q{Small jQuery plugin to allow dynamic resizing of textarea height, so that it grows as based on visitor input. To use, just call the .autosize() method on any textarea element.}
12
12
  gem.license = "MIT"
@@ -1,5 +1,5 @@
1
1
  module Autosize
2
2
  module Rails
3
- VERSION = "1.1.18.1"
3
+ VERSION = "1.1.18.4"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  /*!
2
- Autosize v1.18.1 - 2013-11-05
2
+ Autosize v1.18.4 - 2014-01-11
3
3
  Automatically adjust textarea height based on user input.
4
- (c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
4
+ (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5
5
  license: http://www.opensource.org/licenses/mit-license.php
6
6
  */
7
7
  (function ($) {
@@ -10,7 +10,8 @@
10
10
  className: 'autosizejs',
11
11
  append: '',
12
12
  callback: false,
13
- resizeDelay: 10
13
+ resizeDelay: 10,
14
+ placeholder: true
14
15
  },
15
16
 
16
17
  // border:0 is unnecessary, but avoids a bug in Firefox on OSX
@@ -91,23 +92,27 @@
91
92
  });
92
93
 
93
94
  // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
95
+ // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
94
96
  function setWidth() {
95
- var style, width;
97
+ var width;
98
+ var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
96
99
 
97
- if ('getComputedStyle' in window) {
98
- style = window.getComputedStyle(ta, null);
100
+ if (style) {
101
+
99
102
  width = ta.getBoundingClientRect().width;
100
103
 
104
+ if (width === 0) {
105
+ width = parseInt(style.width,10);
106
+ }
107
+
101
108
  $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
102
109
  width -= parseInt(style[val],10);
103
110
  });
104
-
105
- mirror.style.width = width + 'px';
106
- }
107
- else {
108
- // window.getComputedStyle, getBoundingClientRect returning a width are unsupported and unneeded in IE8 and lower.
109
- mirror.style.width = Math.max($ta.width(), 0) + 'px';
111
+ } else {
112
+ width = Math.max($ta.width(), 0);
110
113
  }
114
+
115
+ mirror.style.width = width + 'px';
111
116
  }
112
117
 
113
118
  function initMirror() {
@@ -151,7 +156,15 @@
151
156
  setWidth();
152
157
  }
153
158
 
154
- mirror.value = ta.value + options.append;
159
+ if (!ta.value && options.placeholder) {
160
+ // If the textarea is empty, copy the placeholder text into
161
+ // the mirror control and use that for sizing so that we
162
+ // don't end up with placeholder getting trimmed.
163
+ mirror.value = ($(ta).attr("placeholder") || '') + options.append;
164
+ } else {
165
+ mirror.value = ta.value + options.append;
166
+ }
167
+
155
168
  mirror.style.overflowY = ta.style.overflowY;
156
169
  original = parseInt(ta.style.height,10);
157
170
 
@@ -247,4 +260,4 @@
247
260
  adjust();
248
261
  });
249
262
  };
250
- }(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
263
+ }(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.18.1
4
+ version: 1.1.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-06 00:00:00.000000000 Z
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
@@ -57,7 +57,7 @@ files:
57
57
  - lib/autosize.rb
58
58
  - lib/autosize/version.rb
59
59
  - vendor/assets/javascripts/jquery.autosize.js
60
- homepage: https://github.com/acrogenesis/autosize
60
+ homepage: http://www.jacklmoore.com/autosize/
61
61
  licenses:
62
62
  - MIT
63
63
  metadata: {}
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project: autosize
80
- rubygems_version: 2.2.0
80
+ rubygems_version: 2.2.1
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: This gem allows you to use Autosize jQuery plugin