Index: trunk/extensions/LanguageSelector/LanguageSelector.js |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +addOnloadHook(function() { |
| 3 | + var i = 1; |
| 4 | + while ( true ) { |
| 5 | + var btn = document.getElementById("languageselector-commit-"+i); |
| 6 | + var sel = document.getElementById("languageselector-select-"+i); |
| 7 | + var idx = i; |
| 8 | + |
| 9 | + if (!btn) break; |
| 10 | + |
| 11 | + btn.style.display = "none"; |
| 12 | + sel.onchange = function() { |
| 13 | + node = this.parentNode; |
| 14 | + while( true ) { |
| 15 | + if( node.tagName.toLowerCase() == "form" ) { |
| 16 | + node.submit(); |
| 17 | + break; |
| 18 | + } |
| 19 | + node = node.parentNode; |
| 20 | + } |
| 21 | + }; |
| 22 | + |
| 23 | + i++; |
| 24 | + } |
| 25 | +}); |
\ No newline at end of file |
Property changes on: trunk/extensions/LanguageSelector/LanguageSelector.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 26 | + native |
Index: trunk/extensions/LanguageSelector/LanguageSelector.php |
— | — | @@ -71,6 +71,7 @@ |
72 | 72 | |
73 | 73 | $dir = dirname(__FILE__) . '/'; |
74 | 74 | $wgExtensionMessagesFiles['LanguageSelector'] = $dir . 'LanguageSelector.i18n.php'; |
| 75 | +$wgJSAutoloadClasses['LanguageSelector'] = "extensions/LanguageSelector/LanguageSelector.js"; |
75 | 76 | |
76 | 77 | function wgLanguageSelectorSetHook() { |
77 | 78 | global $wgParser; |
— | — | @@ -166,32 +167,14 @@ |
167 | 168 | } |
168 | 169 | } |
169 | 170 | |
170 | | - $wgOut->addScript('<script type="'.$wgJsMimeType.'"> |
171 | | - addOnloadHook(function() { |
172 | | - var i = 1; |
173 | | - while ( true ) { |
174 | | - var btn = document.getElementById("languageselector-commit-"+i); |
175 | | - var sel = document.getElementById("languageselector-select-"+i); |
176 | | - var idx = i; |
177 | | - |
178 | | - if (!btn) break; |
179 | | - |
180 | | - btn.style.display = "none"; |
181 | | - sel.onchange = function() { |
182 | | - node = this.parentNode; |
183 | | - while( true ) { |
184 | | - if( node.tagName.toLowerCase() == "form" ) { |
185 | | - node.submit(); |
186 | | - break; |
187 | | - } |
188 | | - node = node.parentNode; |
189 | | - } |
190 | | - }; |
191 | | - |
192 | | - i++; |
193 | | - } |
194 | | - }); |
195 | | - </script>'); |
| 171 | + if ( method_exists( $wgOut, 'addScriptClass' ) ) { |
| 172 | + $wgOut->addScriptClass( 'LanguageSelector' ); |
| 173 | + } else { |
| 174 | + $wgOut->addScript( "<script type=\"$wgJsMimeType\">" . |
| 175 | + file_get_contents( dirname( __FILE__ ) . '/LanguageSelector.js' ) . |
| 176 | + '</script>' |
| 177 | + ); |
| 178 | + } |
196 | 179 | } |
197 | 180 | |
198 | 181 | function wfLanguageSelectorBeforePageDisplay( &$out ) { |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | $wgHooks['SkinTemplateToolboxEnd'][] = 'TranslateToolbox::toolboxAllTranslations'; |
69 | 69 | |
70 | 70 | $wgJSAutoloadClasses['TranslateImport'] = "extensions/Translate/js/import.js"; |
| 71 | +$wgJSAutoloadClasses['JsSelectToInput'] = "extensions/Translate/utils/JsSelectToInput.js"; |
71 | 72 | |
72 | 73 | |
73 | 74 | $wgEnablePageTranslation = false; |
Index: trunk/extensions/Translate/utils/JsSelectToInput.php |
— | — | @@ -68,7 +68,11 @@ |
69 | 69 | if ( $done ) return; |
70 | 70 | |
71 | 71 | global $wgOut, $wgScriptPath; |
72 | | - $wgOut->addScriptFile( "$wgScriptPath/extensions/Translate/utils/JsSelectToInput.js" ); |
| 72 | + if ( method_exists( $wgOut, 'addScriptClass' ) ) { |
| 73 | + $wgOut->addScriptClass( 'JsSelectToInput' ); |
| 74 | + } else { |
| 75 | + $wgOut->addScriptFile( "$wgScriptPath/extensions/Translate/utils/JsSelectToInput.js" ); |
| 76 | + } |
73 | 77 | } |
74 | 78 | |
75 | 79 | } |
\ No newline at end of file |