Index: trunk/extensions/LiveTranslate/LiveTranslate.php |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | 'includes/jquery.replaceText.js', |
105 | 105 | 'includes/jquery.liveTranslate.js' |
106 | 106 | ), |
107 | | - 'dependencies' => array( 'jquery', 'jquery.ui.button' ), |
| 107 | + 'dependencies' => array( 'jquery'/*, 'jquery.ui.button'*/ ), |
108 | 108 | 'messages' => $egLTJSMessages |
109 | 109 | ); |
110 | 110 | |
Index: trunk/extensions/LiveTranslate/includes/ext.lt.ms.js |
— | — | @@ -16,6 +16,9 @@ |
17 | 17 | this.checkingForIdle = false; |
18 | 18 | this.lastCompletion; |
19 | 19 | |
| 20 | + // This is to enable a hack to decode quotes. |
| 21 | + this.textAreaElement = document.createElement( 'textarea' ); |
| 22 | + |
20 | 23 | /** |
21 | 24 | * Determines a chunk to translate of an DOM elements contents and calls the Microsoft Translate API. |
22 | 25 | * Then calls itself if there is any remaining work to be done. |
— | — | @@ -96,8 +99,8 @@ |
97 | 100 | |
98 | 101 | if ( untranslatedsentences.length == 0 ) { |
99 | 102 | // If the current chunk was smaller then the max size, node translation is complete, so update text. |
100 | | - window.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
101 | | - element.replaceData( 0, element.length, window.textAreaElement.value ); |
| 103 | + self.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
| 104 | + element.replaceData( 0, element.length, self.textAreaElement.value ); |
102 | 105 | |
103 | 106 | lt.debug( 'MS: Translated element' ); |
104 | 107 | self.handleTranslationCompletion(); |
— | — | @@ -187,7 +190,7 @@ |
188 | 191 | this.done(); |
189 | 192 | } |
190 | 193 | |
191 | | - this.checkForIdleness = function( targetLang, hits ) { |
| 194 | + this.checkForIdleness = function( hits ) { |
192 | 195 | lt.debug( 'MS: checkForIdleness' ); |
193 | 196 | lt.debug( 'MS: last + 250: ' + ( this.lastCompletion + 250 ) ); |
194 | 197 | lt.debug( 'MS: now: ' + (new Date()).getTime() ); |
— | — | @@ -200,10 +203,10 @@ |
201 | 204 | } |
202 | 205 | |
203 | 206 | if ( hits > 4 ) { |
204 | | - this.invokeDone( targetLang ); |
| 207 | + this.invokeDone(); |
205 | 208 | } |
206 | 209 | else if ( this.runningJobs > 0 ) { |
207 | | - setTimeout( function() { self.checkForIdleness( targetLang, hits ); }, 250 ); |
| 210 | + setTimeout( function() { self.checkForIdleness( hits ); }, 250 ); |
208 | 211 | } |
209 | 212 | } |
210 | 213 | |
— | — | @@ -215,7 +218,7 @@ |
216 | 219 | this.handleTranslationCompletion = function() { |
217 | 220 | if ( !this.checkingForIdle && this.runningJobs > 1 && this.runningJobs < 20 ) { |
218 | 221 | this.checkingForIdle = true; |
219 | | - setTimeout( function() { self.checkForIdleness( targetLang, 0 ); }, 250 ); |
| 222 | + setTimeout( function() { self.checkForIdleness( 0 ); }, 250 ); |
220 | 223 | } |
221 | 224 | |
222 | 225 | if ( this.checkingForIdle ) { |
Index: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php |
— | — | @@ -60,14 +60,12 @@ |
61 | 61 | |
62 | 62 | $wgOut->addHeadItem( |
63 | 63 | 'ext.livetranslate', |
64 | | - Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.livetranslate.js' ) |
| 64 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.livetranslate.js' ) . |
| 65 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.tm.js' ) . |
| 66 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/jquery.replaceText.js' ) . |
| 67 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/jquery.liveTranslate.js' ) |
65 | 68 | ); |
66 | 69 | |
67 | | - $wgOut->addHeadItem( |
68 | | - 'ext.livetranslate.tm', |
69 | | - Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.tm.js' ) |
70 | | - ); |
71 | | - |
72 | 70 | switch( $GLOBALS['egLiveTranslateService'] ) { |
73 | 71 | case LTS_GOOGLE: |
74 | 72 | $wgOut->addHeadItem( |