r110223 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110222‎ | r110223 | r110224 >
Date:21:15, 28 January 2012
Author:kaldari
Status:ok
Tags:
Comment:
updating jquery.elastic.js
Modified paths:
  • /trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/modules/jquery.elastic/jquery.elastic.js
@@ -1,7 +1,7 @@
22 /**
33 * @name Elastic
44 * @descripton Elastic is jQuery plugin that grow and shrink your textareas automatically
5 -* @version 1.6.10
 5+* @version 1.6.11
66 * @requires jQuery 1.2.6+
77 *
88 * @author Jan Jarfalk
@@ -9,12 +9,9 @@
1010 * @author-website http://www.unwrongest.com
1111 *
1212 * @licence MIT License - http://www.opensource.org/licenses/mit-license.php
13 -*
14 -* This file has been downloaded from http://unwrongest.com/projects/elastic/, please notify the author of
15 -* any changes.
1613 */
1714
18 -(function(jQuery){
 15+(function($){
1916 jQuery.fn.extend({
2017 elastic: function() {
2118
@@ -45,14 +42,19 @@
4643 ];
4744
4845 return this.each( function() {
49 -
 46+
5047 // Elastic only works on textareas
5148 if ( this.type !== 'textarea' ) {
5249 return false;
5350 }
5451
5552 var $textarea = jQuery(this),
56 - $twin = jQuery('<div />').css({'position': 'absolute','display':'none','word-wrap':'break-word'}),
 53+ $twin = jQuery('<div />').css({
 54+ 'position' : 'absolute',
 55+ 'display' : 'none',
 56+ 'word-wrap' : 'break-word',
 57+ 'white-space' : 'pre-wrap'
 58+ }),
5759 lineHeight = parseInt($textarea.css('line-height'),10) || parseInt($textarea.css('font-size'),'10'),
5860 minheight = parseInt($textarea.css('height'),10) || lineHeight*3,
5961 maxheight = parseInt($textarea.css('max-height'),10) || Number.MAX_VALUE,
@@ -73,7 +75,7 @@
7476
7577 // Updates the width of the twin. (solution for textareas with widths in percent)
7678 function setTwinWidth(){
77 - curatedWidth = Math.floor(parseInt($textarea.width(),10));
 79+ var curatedWidth = Math.floor(parseInt($textarea.width(),10));
7880 if($twin.width() !== curatedWidth){
7981 $twin.css({'width': curatedWidth + 'px'});
8082
@@ -84,14 +86,9 @@
8587
8688 // Sets a given height and overflow state on the textarea
8789 function setHeightAndOverflow(height, overflow){
88 -
8990 var curratedHeight = Math.floor(parseInt(height,10));
9091 if($textarea.height() !== curratedHeight){
9192 $textarea.css({'height': curratedHeight + 'px','overflow':overflow});
92 -
93 - // Fire the custom event resize
94 - //$textarea.trigger('resize');
95 -
9693 }
9794 }
9895

Status & tagging log