Index: trunk/extensions/Translate/js/jquery.autoresize.js |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | * jQuery autoResize (textarea auto-resizer) |
4 | 4 | * @copyright James Padolsey http://james.padolsey.com |
5 | 5 | * @version 1.04 |
| 6 | + * Modified by Nike |
6 | 7 | */ |
7 | 8 | |
8 | 9 | (function($){ |
— | — | @@ -16,9 +17,12 @@ |
17 | 18 | animateDuration : 150, |
18 | 19 | animateCallback : function(){}, |
19 | 20 | extraSpace : 20, |
20 | | - limit: 1000 |
| 21 | + limit: 1000, |
| 22 | + delay: 1000, |
21 | 23 | }, options); |
22 | 24 | |
| 25 | + var timer; |
| 26 | + |
23 | 27 | // Only textarea's auto-resize: |
24 | 28 | this.filter('textarea').each(function(){ |
25 | 29 | |
— | — | @@ -47,30 +51,34 @@ |
48 | 52 | top: 0, |
49 | 53 | left: -9999 |
50 | 54 | }).css(propOb).attr('tabIndex','-1').insertBefore(textarea); |
51 | | - |
| 55 | + |
52 | 56 | })(), |
53 | 57 | lastScrollTop = null, |
54 | 58 | updateSize = function() { |
55 | | - |
| 59 | + var that = this; |
| 60 | + if (timer !== null) clearTimeout(timer); |
| 61 | + timer = setTimeout(updateSizeLazy, settings.delay, that); |
| 62 | + }, |
| 63 | + updateSizeLazy = function(that) { |
56 | 64 | // Prepare the clone: |
57 | | - clone.height(0).val($(this).val()).scrollTop(10000); |
58 | | - |
| 65 | + clone.height(0).val($(that).val()).scrollTop(10000); |
| 66 | + |
59 | 67 | // Find the height of text: |
60 | 68 | var scrollTop = Math.max(clone.scrollTop(), origHeight) + settings.extraSpace, |
61 | | - toChange = $(this).add(clone); |
62 | | - |
| 69 | + toChange = $(that).add(clone); |
| 70 | + |
63 | 71 | // Don't do anything if scrollTip hasen't changed: |
64 | 72 | if (lastScrollTop === scrollTop) { return; } |
65 | 73 | lastScrollTop = scrollTop; |
66 | | - |
| 74 | + |
67 | 75 | // Check for limit: |
68 | 76 | if ( scrollTop >= settings.limit ) { |
69 | | - $(this).css('overflow-y',''); |
| 77 | + $(that).css('overflow-y',''); |
70 | 78 | return; |
71 | 79 | } |
72 | 80 | // Fire off callback: |
73 | | - settings.onResize.call(this); |
74 | | - |
| 81 | + settings.onResize.call(that); |
| 82 | + |
75 | 83 | // Either animate or directly apply height: |
76 | 84 | settings.animate && textarea.css('display') === 'block' ? |
77 | 85 | toChange.stop().animate({height:scrollTop}, settings.animateDuration, settings.animateCallback) |
Index: trunk/extensions/Translate/js/quickedit.js |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | this.setup = function() { |
35 | 35 | this.cancel(); |
36 | 36 | var self = this; |
37 | | - this.timeoutID = window.setTimeout( self.act, 600 ); |
| 37 | + this.timeoutID = window.setTimeout( self.act, 1000 ); |
38 | 38 | }; |
39 | 39 | |
40 | 40 | this.cancel = function() { |
— | — | @@ -114,8 +114,9 @@ |
115 | 115 | }); |
116 | 116 | |
117 | 117 | var textarea = form.find( '.mw-translate-edit-area' ); |
| 118 | + textarea.css( 'display', 'block' ); |
| 119 | + textarea.autoResize({extraSpace: 15, limit: 200}).trigger( 'change' ); |
118 | 120 | textarea.focus(); |
119 | | - textarea.autoResize({extraSpace: 15, limit: 200}).trigger( 'change' ); |
120 | 121 | |
121 | 122 | if ( form.find( '.mw-translate-messagechecks' ) ) { |
122 | 123 | var checker = new MessageCheckUpdater( function() { |