summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js')
-rw-r--r--www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js b/www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js
new file mode 100644
index 00000000..cb4a51bd
--- /dev/null
+++ b/www/wiki/extensions/Translate/resources/js/ext.translate.selecttoinput.js
@@ -0,0 +1,27 @@
+window.appendFromSelect = function ( selectid, targetid ) {
+ 'use strict';
+
+ var select = document.getElementById( selectid ),
+ target = document.getElementById( targetid ),
+ atxt;
+
+ if ( !target || !select ) {
+ return;
+ }
+
+ atxt = select.options[ select.selectedIndex ].value;
+
+ if ( !atxt ) {
+ return;
+ }
+
+ if ( target.value.replace( /\s+/g, '' ) !== '' ) {
+ atxt = ', ' + atxt;
+ }
+
+ atxt = target.value + atxt;
+
+ atxt = atxt.replace( /\bdefault\b[,\s]*/i, '' );
+
+ target.value = atxt;
+};