r96116 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96115‎ | r96116 | r96117 >
Date:16:07, 2 September 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Moved the last js file into RL. This script too needs to be rewritten, but at least it works (with the other fix I did, the automatic wp prefix addition had broken it earlier)
Modified paths:
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/resources/ext.translate.selecttoinput.js (added) (history)
  • /trunk/extensions/Translate/utils/JsSelectToInput.js (deleted) (history)
  • /trunk/extensions/Translate/utils/JsSelectToInput.php (modified) (history)
  • /trunk/extensions/Translate/utils/UserToggles.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -168,6 +168,10 @@
169169 'scripts' => 'resources/ext.translate.special.importtranslations.js',
170170 ) + $resourcePaths;
171171
 172+$wgResourceModules['ext.translate.selecttoinput'] = array(
 173+ 'scripts' => 'resources/ext.translate.selecttoinput.js',
 174+) + $resourcePaths;
 175+
172176 $wgResourceModules['jquery.autoresize'] = array(
173177 'scripts' => 'resources/jquery.autoresize.js',
174178 ) + $resourcePaths;
Index: trunk/extensions/Translate/utils/JsSelectToInput.js
@@ -1,11 +0,0 @@
2 -function appendFromSelect(selectid,targetid) {
3 - var select = document.getElementById(selectid);
4 - var target = document.getElementById(targetid);
5 - if(!target || !select) return;
6 - var atxt = select.options[select.selectedIndex].value;
7 - if(!atxt) return;
8 - /* Ugly hack */
9 - target.value = target.value.replace(/default/, '' );
10 - if(target.value.replace(/[\s\t\n]/ig,'') != '') atxt = ', ' + atxt;
11 - target.value += atxt;
12 -}
Index: trunk/extensions/Translate/utils/JsSelectToInput.php
@@ -112,6 +112,6 @@
113113 if ( $done ) return;
114114
115115 global $wgOut;
116 - $wgOut->addScriptFile( TranslateUtils::assetPath( 'utils/JsSelectToInput.js' ) );
 116+ $wgOut->addModules( 'ext.translate.selecttoinput' );
117117 }
118118 }
Index: trunk/extensions/Translate/utils/UserToggles.php
@@ -63,6 +63,7 @@
6464 'help-message' => 'translate-pref-editassistlang-help',
6565 'select' => $select,
6666 'valid-values' => array_keys( $languages ),
 67+ 'name' => 'translate-editlangs',
6768 );
6869
6970 return true;
Index: trunk/extensions/Translate/resources/ext.translate.selecttoinput.js
@@ -0,0 +1,11 @@
 2+window.appendFromSelect = function(selectid,targetid) {
 3+ var select = document.getElementById(selectid);
 4+ var target = document.getElementById(targetid);
 5+ if(!target || !select) return;
 6+ var atxt = select.options[select.selectedIndex].value;
 7+ if(!atxt) return;
 8+ /* Ugly hack */
 9+ target.value = target.value.replace(/default/, '' );
 10+ if(target.value.replace(/[\s\t\n]/ig,'') != '') atxt = ', ' + atxt;
 11+ target.value += atxt;
 12+}
Property changes on: trunk/extensions/Translate/resources/ext.translate.selecttoinput.js
___________________________________________________________________
Added: svn:eol-style
113 + native

Status & tagging log