1 2var translator = { 3 4 run: function(translationLanguage, translationTextarea, masterKey, categoryID) { 5 6 var options = { 7 'call' : '_google_translation', 8 'key': masterKey, 9 'translation': translationLanguage, 10 'category' : categoryID 11 }; 12 13 var ajax = new sack(DOKU_BASE + 'lib/exe/ajax.php'); 14 ajax.AjaxFailedAlert = function() {}; 15 ajax.encodeURIString = true; 16 ajax.onCompletion = function() { 17 $(translationTextarea).value = ajax.response; 18 }; 19 20 for ( var option in options) { 21 if ( option === null ) { continue; } 22 ajax.setVar(option, options[option]); 23 } 24 25 try { 26 ajax.runAJAX(); 27 } catch (e) {} 28 } 29};