Index: trunk/extensions/LiveTranslate/includes/ext.lt.google.js |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | * @param {integer} currentMaxSize |
31 | 31 | * @param {string} sourceLang |
32 | 32 | * @param {string} targetLang |
33 | | - * @param {jQuery} element |
| 33 | + * @param {DOM element} element |
34 | 34 | */ |
35 | 35 | this.translateChunk = function( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
36 | 36 | ltdebug( 'Google: Translating chunk' ); |
Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js |
— | — | @@ -20,7 +20,12 @@ |
21 | 21 | |
22 | 22 | window.ltdebug = function( message ) { |
23 | 23 | if ( window.ltDebugMessages ) { |
24 | | - console.log( 'Live Translate: ' + message ); |
| 24 | + if ( typeof console === 'undefined' ) { |
| 25 | + document.title = 'Live Translate: ' + message; |
| 26 | + } |
| 27 | + else { |
| 28 | + console.log( 'Live Translate: ' + message ); |
| 29 | + } |
25 | 30 | } |
26 | 31 | }; |
27 | 32 | |
— | — | @@ -29,6 +34,8 @@ |
30 | 35 | // For the "show original" feature. |
31 | 36 | var originalHtml = false; |
32 | 37 | |
| 38 | + window.textAreaElement = document.createElement( 'textarea' ); |
| 39 | + |
33 | 40 | // Compatibility with pre-RL code. |
34 | 41 | // Messages will have been loaded into wgPushMessages. |
35 | 42 | if ( typeof mediaWiki === 'undefined' ) { |
Index: trunk/extensions/LiveTranslate/includes/ext.lt.ms.js |
— | — | @@ -14,9 +14,6 @@ |
15 | 15 | |
16 | 16 | this.runningJobs = 0; |
17 | 17 | |
18 | | - // This is to enable a hack to decode quotes. |
19 | | - this.textAreaElement = document.createElement( 'textarea' ); |
20 | | - |
21 | 18 | /** |
22 | 19 | * Determines a chunk to translate of an DOM elements contents and calls the Microsoft Translate API. |
23 | 20 | * Then calls itself if there is any remaining work to be done. |
— | — | @@ -26,7 +23,7 @@ |
27 | 24 | * @param {integer} currentMaxSize |
28 | 25 | * @param {string} sourceLang |
29 | 26 | * @param {string} targetLang |
30 | | - * @param {jQuery} element |
| 27 | + * @param {DOM element} element |
31 | 28 | */ |
32 | 29 | this.translateChunk = function( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
33 | 30 | ltdebug( 'MS: Translating chunk' ); |
— | — | @@ -105,8 +102,9 @@ |
106 | 103 | |
107 | 104 | if ( untranslatedsentences.length == 0 ) { |
108 | 105 | // If the current chunk was smaller then the max size, node translation is complete, so update text. |
109 | | - self.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
110 | | - element.replaceData( 0, element.length, self.textAreaElement.value ); |
| 106 | + window.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
| 107 | + element.replaceData( 0, element.length, window.textAreaElement.value ); |
| 108 | + |
111 | 109 | self.handleTranslationCompletion( targetLang ); |
112 | 110 | } |
113 | 111 | else { |