diff options
Diffstat (limited to 'MLEB/Translate/resources/js/ext.translate.selecttoinput.js')
-rw-r--r-- | MLEB/Translate/resources/js/ext.translate.selecttoinput.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/MLEB/Translate/resources/js/ext.translate.selecttoinput.js b/MLEB/Translate/resources/js/ext.translate.selecttoinput.js new file mode 100644 index 00000000..9558ec9e --- /dev/null +++ b/MLEB/Translate/resources/js/ext.translate.selecttoinput.js @@ -0,0 +1,27 @@ +window.appendFromSelect = function ( selectid, targetid ) { + 'use strict'; + + var select, target, atxt; + + select = document.getElementById( selectid ); + target = document.getElementById( targetid ); + + if ( !target || !select ) { + return; + } + + atxt = select.options[select.selectedIndex].value; + + if ( !atxt ) { + return; + } + + /* Ugly hack */ + + target.value = target.value.replace( /default/, '' ); + + if ( target.value.replace( /[\s\t\n]/ig, '' ) !== '' ) { + atxt = ', ' + atxt; + } + target.value += atxt; +}; |