autosize-rails 1.18.0 → 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 +4 -4
- data/Rakefile +23 -0
- data/autosize-rails.gemspec +10 -12
- data/lib/autosize/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.autosize.js +261 -256
- metadata +15 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8d75b0e47370e822905a556f8ef790571f42378a
         | 
| 4 | 
            +
              data.tar.gz: b6c68179bd7dd0377234ccbd8c49229b2910b868
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f9ae2ee9c44334a9c3ec6e823c05eaef22e13c2b80fc8162a76c61b27e32f1cfbaef6ac4710a3cfb066eb59f527df4572c8d1be32d3927ad4bf4a487445324a9
         | 
| 7 | 
            +
              data.tar.gz: 6ecb5613567af78815c9643ad6aec6e1ea56e65cefe1d99bf80cbf70e10718e44d2f9422bb1a8ca06f8e8561277d120e1c68cfe282636d9c1370222b8b7a5e70
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1 +1,24 @@ | |
| 1 1 | 
             
            require "bundler/gem_tasks"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            task :update do
         | 
| 4 | 
            +
              require 'net/http'
         | 
| 5 | 
            +
              require 'json'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              tags_url = 'https://api.github.com/repos/jackmoore/autosize/tags'
         | 
| 8 | 
            +
              tags = JSON.parse(Net::HTTP.get(URI(tags_url)))
         | 
| 9 | 
            +
              latest_tag = tags.first
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              if latest_tag['name'] > Autosize::Rails::VERSION
         | 
| 12 | 
            +
                upstream_location = "/jackmoore/autosize/#{latest_tag['commit']['sha']}/jquery.autosize.js"
         | 
| 13 | 
            +
                file_location = File.join(File.dirname(File.absolute_path(__FILE__)), 'vendor', 'assets', 'javascripts', 'jquery.autosize.js')
         | 
| 14 | 
            +
                puts "Downloading new version (#{latest_tag['name']}):"
         | 
| 15 | 
            +
                puts upstream_location
         | 
| 16 | 
            +
                Net::HTTP.start('raw2.github.com', use_ssl: true) do |http|
         | 
| 17 | 
            +
                  resp = http.get(upstream_location)
         | 
| 18 | 
            +
                  File.open(file_location, 'w') { |file| file.write(resp.body) }
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
                puts "Please bump the version.rv, commit and open a pull request with the new version. (#{latest_tag['name']})"
         | 
| 21 | 
            +
              else
         | 
| 22 | 
            +
                puts "Already up to date. (#{latest_tag['name']})"
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
    
        data/autosize-rails.gemspec
    CHANGED
    
    | @@ -4,21 +4,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
| 4 4 | 
             
            require 'autosize/rails/version'
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |spec|
         | 
| 7 | 
            -
              spec.name          =  | 
| 7 | 
            +
              spec.name          = 'autosize-rails'
         | 
| 8 8 | 
             
              spec.version       = Autosize::Rails::VERSION
         | 
| 9 | 
            -
              spec.authors       = [ | 
| 10 | 
            -
              spec.email         = [ | 
| 11 | 
            -
              spec.description   =  | 
| 12 | 
            -
              spec.summary       =  | 
| 13 | 
            -
              spec.homepage      =  | 
| 14 | 
            -
              spec.license       =  | 
| 9 | 
            +
              spec.authors       = ['Caleb Thompson']
         | 
| 10 | 
            +
              spec.email         = ['cjaysson@gmail.com']
         | 
| 11 | 
            +
              spec.description   = 'Rails asset pipeline wrapper around jQuery Autosize: http://www.jacklmoore.com/autosize/'
         | 
| 12 | 
            +
              spec.summary       = 'A plugin to enable automatic height for textarea elements.'
         | 
| 13 | 
            +
              spec.homepage      = 'https://github.com/calebthompson/autosize-rails'
         | 
| 14 | 
            +
              spec.license       = 'MIT'
         | 
| 15 15 |  | 
| 16 16 | 
             
              spec.files         = `git ls-files`.split($/)
         | 
| 17 | 
            -
              spec. | 
| 18 | 
            -
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            -
              spec.require_paths = ["lib"]
         | 
| 17 | 
            +
              spec.require_paths = ['lib']
         | 
| 20 18 |  | 
| 21 19 | 
             
              spec.add_dependency 'rails', '>= 3.1'
         | 
| 22 | 
            -
              spec.add_development_dependency  | 
| 23 | 
            -
              spec.add_development_dependency  | 
| 20 | 
            +
              spec.add_development_dependency 'bundler', '~> 1.3'
         | 
| 21 | 
            +
              spec.add_development_dependency 'rake'
         | 
| 24 22 | 
             
            end
         | 
| @@ -1,258 +1,263 @@ | |
| 1 1 | 
             
            /*!
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 2 | 
            +
            	Autosize v1.18.4 - 2014-01-11
         | 
| 3 | 
            +
            	Automatically adjust textarea height based on user input.
         | 
| 4 | 
            +
            	(c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
         | 
| 5 | 
            +
            	license: http://www.opensource.org/licenses/mit-license.php
         | 
| 6 6 | 
             
            */
         | 
| 7 | 
            -
            (function ( | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
            } | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
             | 
| 164 | 
            -
             | 
| 165 | 
            -
             | 
| 166 | 
            -
             | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
             | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 | 
            -
             | 
| 184 | 
            -
             | 
| 185 | 
            -
             | 
| 186 | 
            -
             | 
| 187 | 
            -
             | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
             | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 196 | 
            -
             | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 206 | 
            -
             | 
| 207 | 
            -
             | 
| 208 | 
            -
             | 
| 209 | 
            -
             | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
             | 
| 213 | 
            -
             | 
| 214 | 
            -
             | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 217 | 
            -
             | 
| 218 | 
            -
             | 
| 219 | 
            -
             | 
| 220 | 
            -
             | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
             | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 238 | 
            -
             | 
| 239 | 
            -
             | 
| 240 | 
            -
             | 
| 241 | 
            -
             | 
| 242 | 
            -
             | 
| 243 | 
            -
             | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 249 | 
            -
             | 
| 250 | 
            -
             | 
| 251 | 
            -
             | 
| 252 | 
            -
             | 
| 253 | 
            -
             | 
| 254 | 
            -
             | 
| 255 | 
            -
             | 
| 256 | 
            -
             | 
| 257 | 
            -
             | 
| 258 | 
            -
             | 
| 7 | 
            +
            (function ($) {
         | 
| 8 | 
            +
            	var
         | 
| 9 | 
            +
            	defaults = {
         | 
| 10 | 
            +
            		className: 'autosizejs',
         | 
| 11 | 
            +
            		append: '',
         | 
| 12 | 
            +
            		callback: false,
         | 
| 13 | 
            +
            		resizeDelay: 10,
         | 
| 14 | 
            +
            		placeholder: true
         | 
| 15 | 
            +
            	},
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            	// border:0 is unnecessary, but avoids a bug in Firefox on OSX
         | 
| 18 | 
            +
            	copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            	// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
         | 
| 21 | 
            +
            	typographyStyles = [
         | 
| 22 | 
            +
            		'fontFamily',
         | 
| 23 | 
            +
            		'fontSize',
         | 
| 24 | 
            +
            		'fontWeight',
         | 
| 25 | 
            +
            		'fontStyle',
         | 
| 26 | 
            +
            		'letterSpacing',
         | 
| 27 | 
            +
            		'textTransform',
         | 
| 28 | 
            +
            		'wordSpacing',
         | 
| 29 | 
            +
            		'textIndent'
         | 
| 30 | 
            +
            	],
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            	// to keep track which textarea is being mirrored when adjust() is called.
         | 
| 33 | 
            +
            	mirrored,
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            	// the mirror element, which is used to calculate what size the mirrored element should be.
         | 
| 36 | 
            +
            	mirror = $(copy).data('autosize', true)[0];
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            	// test that line-height can be accurately copied.
         | 
| 39 | 
            +
            	mirror.style.lineHeight = '99px';
         | 
| 40 | 
            +
            	if ($(mirror).css('lineHeight') === '99px') {
         | 
| 41 | 
            +
            		typographyStyles.push('lineHeight');
         | 
| 42 | 
            +
            	}
         | 
| 43 | 
            +
            	mirror.style.lineHeight = '';
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            	$.fn.autosize = function (options) {
         | 
| 46 | 
            +
            		if (!this.length) {
         | 
| 47 | 
            +
            			return this;
         | 
| 48 | 
            +
            		}
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            		options = $.extend({}, defaults, options || {});
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            		if (mirror.parentNode !== document.body) {
         | 
| 53 | 
            +
            			$(document.body).append(mirror);
         | 
| 54 | 
            +
            		}
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            		return this.each(function () {
         | 
| 57 | 
            +
            			var
         | 
| 58 | 
            +
            			ta = this,
         | 
| 59 | 
            +
            			$ta = $(ta),
         | 
| 60 | 
            +
            			maxHeight,
         | 
| 61 | 
            +
            			minHeight,
         | 
| 62 | 
            +
            			boxOffset = 0,
         | 
| 63 | 
            +
            			callback = $.isFunction(options.callback),
         | 
| 64 | 
            +
            			originalStyles = {
         | 
| 65 | 
            +
            				height: ta.style.height,
         | 
| 66 | 
            +
            				overflow: ta.style.overflow,
         | 
| 67 | 
            +
            				overflowY: ta.style.overflowY,
         | 
| 68 | 
            +
            				wordWrap: ta.style.wordWrap,
         | 
| 69 | 
            +
            				resize: ta.style.resize
         | 
| 70 | 
            +
            			},
         | 
| 71 | 
            +
            			timeout,
         | 
| 72 | 
            +
            			width = $ta.width();
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            			if ($ta.data('autosize')) {
         | 
| 75 | 
            +
            				// exit if autosize has already been applied, or if the textarea is the mirror element.
         | 
| 76 | 
            +
            				return;
         | 
| 77 | 
            +
            			}
         | 
| 78 | 
            +
            			$ta.data('autosize', true);
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            			if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
         | 
| 81 | 
            +
            				boxOffset = $ta.outerHeight() - $ta.height();
         | 
| 82 | 
            +
            			}
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            			// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
         | 
| 85 | 
            +
            			minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            			$ta.css({
         | 
| 88 | 
            +
            				overflow: 'hidden',
         | 
| 89 | 
            +
            				overflowY: 'hidden',
         | 
| 90 | 
            +
            				wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
         | 
| 91 | 
            +
            				resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
         | 
| 92 | 
            +
            			});
         | 
| 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.
         | 
| 96 | 
            +
            			function setWidth() {
         | 
| 97 | 
            +
            				var width;
         | 
| 98 | 
            +
            				var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
         | 
| 99 | 
            +
            				
         | 
| 100 | 
            +
            				if (style) {
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            					width = ta.getBoundingClientRect().width;
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            					if (width === 0) {
         | 
| 105 | 
            +
            						width = parseInt(style.width,10);
         | 
| 106 | 
            +
            					}
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            					$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
         | 
| 109 | 
            +
            						width -= parseInt(style[val],10);
         | 
| 110 | 
            +
            					});
         | 
| 111 | 
            +
            				} else {
         | 
| 112 | 
            +
            					width = Math.max($ta.width(), 0);
         | 
| 113 | 
            +
            				}
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            				mirror.style.width = width + 'px';
         | 
| 116 | 
            +
            			}
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            			function initMirror() {
         | 
| 119 | 
            +
            				var styles = {};
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            				mirrored = ta;
         | 
| 122 | 
            +
            				mirror.className = options.className;
         | 
| 123 | 
            +
            				maxHeight = parseInt($ta.css('maxHeight'), 10);
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            				// mirror is a duplicate textarea located off-screen that
         | 
| 126 | 
            +
            				// is automatically updated to contain the same text as the
         | 
| 127 | 
            +
            				// original textarea.  mirror always has a height of 0.
         | 
| 128 | 
            +
            				// This gives a cross-browser supported way getting the actual
         | 
| 129 | 
            +
            				// height of the text, through the scrollTop property.
         | 
| 130 | 
            +
            				$.each(typographyStyles, function(i,val){
         | 
| 131 | 
            +
            					styles[val] = $ta.css(val);
         | 
| 132 | 
            +
            				});
         | 
| 133 | 
            +
            				$(mirror).css(styles);
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            				setWidth();
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            				// Chrome-specific fix:
         | 
| 138 | 
            +
            				// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
         | 
| 139 | 
            +
            				// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
         | 
| 140 | 
            +
            				if (window.chrome) {
         | 
| 141 | 
            +
            					var width = ta.style.width;
         | 
| 142 | 
            +
            					ta.style.width = '0px';
         | 
| 143 | 
            +
            					var ignore = ta.offsetWidth;
         | 
| 144 | 
            +
            					ta.style.width = width;
         | 
| 145 | 
            +
            				}
         | 
| 146 | 
            +
            			}
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            			// Using mainly bare JS in this function because it is going
         | 
| 149 | 
            +
            			// to fire very often while typing, and needs to very efficient.
         | 
| 150 | 
            +
            			function adjust() {
         | 
| 151 | 
            +
            				var height, original;
         | 
| 152 | 
            +
             | 
| 153 | 
            +
            				if (mirrored !== ta) {
         | 
| 154 | 
            +
            					initMirror();
         | 
| 155 | 
            +
            				} else {
         | 
| 156 | 
            +
            					setWidth();
         | 
| 157 | 
            +
            				}
         | 
| 158 | 
            +
             | 
| 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 | 
            +
             | 
| 168 | 
            +
            				mirror.style.overflowY = ta.style.overflowY;
         | 
| 169 | 
            +
            				original = parseInt(ta.style.height,10);
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            				// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
         | 
| 172 | 
            +
            				mirror.scrollTop = 0;
         | 
| 173 | 
            +
             | 
| 174 | 
            +
            				mirror.scrollTop = 9e4;
         | 
| 175 | 
            +
             | 
| 176 | 
            +
            				// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
         | 
| 177 | 
            +
            				height = mirror.scrollTop;
         | 
| 178 | 
            +
             | 
| 179 | 
            +
            				if (maxHeight && height > maxHeight) {
         | 
| 180 | 
            +
            					ta.style.overflowY = 'scroll';
         | 
| 181 | 
            +
            					height = maxHeight;
         | 
| 182 | 
            +
            				} else {
         | 
| 183 | 
            +
            					ta.style.overflowY = 'hidden';
         | 
| 184 | 
            +
            					if (height < minHeight) {
         | 
| 185 | 
            +
            						height = minHeight;
         | 
| 186 | 
            +
            					}
         | 
| 187 | 
            +
            				}
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            				height += boxOffset;
         | 
| 190 | 
            +
             | 
| 191 | 
            +
            				if (original !== height) {
         | 
| 192 | 
            +
            					ta.style.height = height + 'px';
         | 
| 193 | 
            +
            					if (callback) {
         | 
| 194 | 
            +
            						options.callback.call(ta,ta);
         | 
| 195 | 
            +
            					}
         | 
| 196 | 
            +
            				}
         | 
| 197 | 
            +
            			}
         | 
| 198 | 
            +
             | 
| 199 | 
            +
            			function resize () {
         | 
| 200 | 
            +
            				clearTimeout(timeout);
         | 
| 201 | 
            +
            				timeout = setTimeout(function(){
         | 
| 202 | 
            +
            					var newWidth = $ta.width();
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            					if (newWidth !== width) {
         | 
| 205 | 
            +
            						width = newWidth;
         | 
| 206 | 
            +
            						adjust();
         | 
| 207 | 
            +
            					}
         | 
| 208 | 
            +
            				}, parseInt(options.resizeDelay,10));
         | 
| 209 | 
            +
            			}
         | 
| 210 | 
            +
             | 
| 211 | 
            +
            			if ('onpropertychange' in ta) {
         | 
| 212 | 
            +
            				if ('oninput' in ta) {
         | 
| 213 | 
            +
            					// Detects IE9.  IE9 does not fire onpropertychange or oninput for deletions,
         | 
| 214 | 
            +
            					// so binding to onkeyup to catch most of those occasions.  There is no way that I
         | 
| 215 | 
            +
            					// know of to detect something like 'cut' in IE9.
         | 
| 216 | 
            +
            					$ta.on('input.autosize keyup.autosize', adjust);
         | 
| 217 | 
            +
            				} else {
         | 
| 218 | 
            +
            					// IE7 / IE8
         | 
| 219 | 
            +
            					$ta.on('propertychange.autosize', function(){
         | 
| 220 | 
            +
            						if(event.propertyName === 'value'){
         | 
| 221 | 
            +
            							adjust();
         | 
| 222 | 
            +
            						}
         | 
| 223 | 
            +
            					});
         | 
| 224 | 
            +
            				}
         | 
| 225 | 
            +
            			} else {
         | 
| 226 | 
            +
            				// Modern Browsers
         | 
| 227 | 
            +
            				$ta.on('input.autosize', adjust);
         | 
| 228 | 
            +
            			}
         | 
| 229 | 
            +
             | 
| 230 | 
            +
            			// Set options.resizeDelay to false if using fixed-width textarea elements.
         | 
| 231 | 
            +
            			// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
         | 
| 232 | 
            +
             | 
| 233 | 
            +
            			if (options.resizeDelay !== false) {
         | 
| 234 | 
            +
            				$(window).on('resize.autosize', resize);
         | 
| 235 | 
            +
            			}
         | 
| 236 | 
            +
             | 
| 237 | 
            +
            			// Event for manual triggering if needed.
         | 
| 238 | 
            +
            			// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
         | 
| 239 | 
            +
            			$ta.on('autosize.resize', adjust);
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            			// Event for manual triggering that also forces the styles to update as well.
         | 
| 242 | 
            +
            			// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
         | 
| 243 | 
            +
            			$ta.on('autosize.resizeIncludeStyle', function() {
         | 
| 244 | 
            +
            				mirrored = null;
         | 
| 245 | 
            +
            				adjust();
         | 
| 246 | 
            +
            			});
         | 
| 247 | 
            +
             | 
| 248 | 
            +
            			$ta.on('autosize.destroy', function(){
         | 
| 249 | 
            +
            				mirrored = null;
         | 
| 250 | 
            +
            				clearTimeout(timeout);
         | 
| 251 | 
            +
            				$(window).off('resize', resize);
         | 
| 252 | 
            +
            				$ta
         | 
| 253 | 
            +
            					.off('autosize')
         | 
| 254 | 
            +
            					.off('.autosize')
         | 
| 255 | 
            +
            					.css(originalStyles)
         | 
| 256 | 
            +
            					.removeData('autosize');
         | 
| 257 | 
            +
            			});
         | 
| 258 | 
            +
             | 
| 259 | 
            +
            			// Call adjust in case the textarea already contains text.
         | 
| 260 | 
            +
            			adjust();
         | 
| 261 | 
            +
            		});
         | 
| 262 | 
            +
            	};
         | 
| 263 | 
            +
            }(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
         | 
    
        metadata
    CHANGED
    
    | @@ -1,65 +1,65 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: autosize-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.18. | 
| 4 | 
            +
              version: 1.18.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Caleb Thompson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-01-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '3.1'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - -  | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '3.1'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: bundler
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - - ~>
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: '1.3'
         | 
| 34 34 | 
             
              type: :development
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - - ~>
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '1.3'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: rake
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - -  | 
| 45 | 
            +
                - - ">="
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: '0'
         | 
| 48 48 | 
             
              type: :development
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - -  | 
| 52 | 
            +
                - - ">="
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 | 
            -
            description: Rails asset pipeline wrapper around jQuery Autosize
         | 
| 55 | 
            +
            description: 'Rails asset pipeline wrapper around jQuery Autosize: http://www.jacklmoore.com/autosize/'
         | 
| 56 56 | 
             
            email:
         | 
| 57 57 | 
             
            - cjaysson@gmail.com
         | 
| 58 58 | 
             
            executables: []
         | 
| 59 59 | 
             
            extensions: []
         | 
| 60 60 | 
             
            extra_rdoc_files: []
         | 
| 61 61 | 
             
            files:
         | 
| 62 | 
            -
            - .gitignore
         | 
| 62 | 
            +
            - ".gitignore"
         | 
| 63 63 | 
             
            - Gemfile
         | 
| 64 64 | 
             
            - LICENSE.txt
         | 
| 65 65 | 
             
            - README.md
         | 
| @@ -69,7 +69,7 @@ files: | |
| 69 69 | 
             
            - lib/autosize/rails/engine.rb
         | 
| 70 70 | 
             
            - lib/autosize/rails/version.rb
         | 
| 71 71 | 
             
            - vendor/assets/javascripts/jquery.autosize.js
         | 
| 72 | 
            -
            homepage:  | 
| 72 | 
            +
            homepage: https://github.com/calebthompson/autosize-rails
         | 
| 73 73 | 
             
            licenses:
         | 
| 74 74 | 
             
            - MIT
         | 
| 75 75 | 
             
            metadata: {}
         | 
| @@ -79,18 +79,19 @@ require_paths: | |
| 79 79 | 
             
            - lib
         | 
| 80 80 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 81 81 | 
             
              requirements:
         | 
| 82 | 
            -
              - -  | 
| 82 | 
            +
              - - ">="
         | 
| 83 83 | 
             
                - !ruby/object:Gem::Version
         | 
| 84 84 | 
             
                  version: '0'
         | 
| 85 85 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 86 86 | 
             
              requirements:
         | 
| 87 | 
            -
              - -  | 
| 87 | 
            +
              - - ">="
         | 
| 88 88 | 
             
                - !ruby/object:Gem::Version
         | 
| 89 89 | 
             
                  version: '0'
         | 
| 90 90 | 
             
            requirements: []
         | 
| 91 91 | 
             
            rubyforge_project: 
         | 
| 92 | 
            -
            rubygems_version: 2. | 
| 92 | 
            +
            rubygems_version: 2.2.1
         | 
| 93 93 | 
             
            signing_key: 
         | 
| 94 94 | 
             
            specification_version: 4
         | 
| 95 95 | 
             
            summary: A plugin to enable automatic height for textarea elements.
         | 
| 96 96 | 
             
            test_files: []
         | 
| 97 | 
            +
            has_rdoc: 
         |