Index: trunk/extensions/Translate/Translate.css |
— | — | @@ -66,6 +66,13 @@ |
67 | 67 | font-size: small; |
68 | 68 | } |
69 | 69 | |
| 70 | +.mw-ajax-dialog #summary { |
| 71 | + width: 5em; |
| 72 | +} |
| 73 | +.mw-ajax-dialog #summary:focus { |
| 74 | + width: 85%; |
| 75 | +} |
| 76 | + |
70 | 77 | .mw-translate-tmsug { |
71 | 78 | margin-bottom: 0.2em; |
72 | 79 | } |
Index: trunk/extensions/Translate/js/jquery.autoresize.js |
— | — | @@ -0,0 +1,96 @@ |
| 2 | +/* |
| 3 | + * jQuery autoResize (textarea auto-resizer) |
| 4 | + * @copyright James Padolsey http://james.padolsey.com |
| 5 | + * @version 1.04 |
| 6 | + */ |
| 7 | + |
| 8 | +(function($){ |
| 9 | + |
| 10 | + $.fn.autoResize = function(options) { |
| 11 | + |
| 12 | + // Just some abstracted details, |
| 13 | + // to make plugin users happy: |
| 14 | + var settings = $.extend({ |
| 15 | + onResize : function(){}, |
| 16 | + animate : true, |
| 17 | + animateDuration : 150, |
| 18 | + animateCallback : function(){}, |
| 19 | + extraSpace : 20, |
| 20 | + limit: 1000 |
| 21 | + }, options); |
| 22 | + |
| 23 | + // Only textarea's auto-resize: |
| 24 | + this.filter('textarea').each(function(){ |
| 25 | + |
| 26 | + // Get rid of scrollbars and disable WebKit resizing: |
| 27 | + var textarea = $(this).css({resize:'none','overflow-y':'hidden'}), |
| 28 | + |
| 29 | + // Cache original height, for use later: |
| 30 | + origHeight = textarea.height(), |
| 31 | + |
| 32 | + // Need clone of textarea, hidden off screen: |
| 33 | + clone = (function(){ |
| 34 | + |
| 35 | + // Properties which may effect space taken up by chracters: |
| 36 | + var props = ['height','width','lineHeight','textDecoration','letterSpacing'], |
| 37 | + propOb = {}; |
| 38 | + |
| 39 | + // Create object of styles to apply: |
| 40 | + $.each(props, function(i, prop){ |
| 41 | + propOb[prop] = textarea.css(prop); |
| 42 | + }); |
| 43 | + |
| 44 | + // Clone the actual textarea removing unique properties |
| 45 | + // and insert before original textarea: |
| 46 | + return textarea.clone().removeAttr('id').removeAttr('name').css({ |
| 47 | + position: 'absolute', |
| 48 | + top: 0, |
| 49 | + left: -9999 |
| 50 | + }).css(propOb).attr('tabIndex','-1').insertBefore(textarea); |
| 51 | + |
| 52 | + })(), |
| 53 | + lastScrollTop = null, |
| 54 | + updateSize = function() { |
| 55 | + |
| 56 | + // Prepare the clone: |
| 57 | + clone.height(0).val($(this).val()).scrollTop(10000); |
| 58 | + |
| 59 | + // Find the height of text: |
| 60 | + var scrollTop = Math.max(clone.scrollTop(), origHeight) + settings.extraSpace, |
| 61 | + toChange = $(this).add(clone); |
| 62 | + |
| 63 | + // Don't do anything if scrollTip hasen't changed: |
| 64 | + if (lastScrollTop === scrollTop) { return; } |
| 65 | + lastScrollTop = scrollTop; |
| 66 | + |
| 67 | + // Check for limit: |
| 68 | + if ( scrollTop >= settings.limit ) { |
| 69 | + $(this).css('overflow-y',''); |
| 70 | + return; |
| 71 | + } |
| 72 | + // Fire off callback: |
| 73 | + settings.onResize.call(this); |
| 74 | + |
| 75 | + // Either animate or directly apply height: |
| 76 | + settings.animate && textarea.css('display') === 'block' ? |
| 77 | + toChange.stop().animate({height:scrollTop}, settings.animateDuration, settings.animateCallback) |
| 78 | + : toChange.height(scrollTop); |
| 79 | + }; |
| 80 | + |
| 81 | + // Bind namespaced handlers to appropriate events: |
| 82 | + textarea |
| 83 | + .unbind('.dynSiz') |
| 84 | + .bind('keyup.dynSiz', updateSize) |
| 85 | + .bind('keydown.dynSiz', updateSize) |
| 86 | + .bind('change.dynSiz', updateSize); |
| 87 | + |
| 88 | + }); |
| 89 | + |
| 90 | + // Chain: |
| 91 | + return this; |
| 92 | + |
| 93 | + }; |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +})(jQuery); |
\ No newline at end of file |
Property changes on: trunk/extensions/Translate/js/jquery.autoresize.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 98 | + native |
Index: trunk/extensions/Translate/js/quickedit.js |
— | — | @@ -111,6 +111,7 @@ |
112 | 112 | |
113 | 113 | var textarea = form.find( '.mw-translate-edit-area' ); |
114 | 114 | textarea.focus(); |
| 115 | + textarea.autoResize({extraSpace: 15, limit: 200}).trigger( 'change' ); |
115 | 116 | |
116 | 117 | if ( form.find( '.mw-translate-messagechecks' ) ) { |
117 | 118 | var checker = new MessageCheckUpdater( function() { |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -136,6 +136,12 @@ |
137 | 137 | 'remoteExtPath' => 'Translate', |
138 | 138 | ); |
139 | 139 | |
| 140 | +$wgResourceModules['jquery.autoresize'] = array( |
| 141 | + 'scripts' => 'js/jquery.autoresize.js', |
| 142 | + 'localBasePath' => dirname( __FILE__ ), |
| 143 | + 'remoteExtPath' => 'Translate', |
| 144 | +); |
| 145 | + |
140 | 146 | /** @endcond */ |
141 | 147 | |
142 | 148 | |
Index: trunk/extensions/Translate/utils/MessageTable.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | $wgOut->addModules( array( |
69 | 69 | 'jquery.form', |
70 | 70 | 'jquery.ui.dialog', |
| 71 | + 'jquery.autoresize', |
71 | 72 | 'ext.translate.quickedit', |
72 | 73 | ) ); |
73 | 74 | } else { |
Index: trunk/extensions/Translate/utils/TranslationEditPage.php |
— | — | @@ -80,11 +80,9 @@ |
81 | 81 | } |
82 | 82 | |
83 | 83 | $translation = $helpers->getTranslation(); |
84 | | - $rows = substr_count( $helpers->getDefinition(), "\n" ) + 2; |
85 | 84 | $textareaParams = array( |
86 | 85 | 'name' => 'text', |
87 | 86 | 'class' => 'mw-translate-edit-area', |
88 | | - 'rows' => $rows <= 15 ? $rows : 15, |
89 | 87 | 'id' => $id, |
90 | 88 | /* Target language might differ from interface language. Set |
91 | 89 | * a suitable default direction */ |