Changeset 386 for trunk/WordPress/plugin/transposh/js/transposhcontrol.js
- Timestamp:
- 03/04/2010 02:12:58 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/transposhcontrol.js
r346 r386 16 16 */ 17 17 18 /*'function chbx_change(lang)'. 19 '{'. 20 'jQuery("#"+lang+"_edit").attr("checked",jQuery("#"+lang+"_view").attr("checked"))'. 21 '}'. 22 'jQuery(document).ready(function() {'. 23 'jQuery("#tr_anon").click(function() {'. 24 'if (jQuery("#tr_anon").attr("checked")) {'. 25 'jQuery(".tr_editable").css("display","none");'. 26 '} else {'. 27 'jQuery(".tr_editable").css("display","");'. 28 '}'. 29 '});'. 30 '});'. 31 '</script>';*/ 18 //(function ($) { // closure 32 19 jQuery(function() { 33 20 // clicking anonymous will make translatables active … … 134 121 }); 135 122 123 // backup button 124 jQuery("#transposh-backup").click(function () { 125 jQuery.get(t_jp.post_url + "?backup=" + Math.random()); 126 return false; 127 }); 128 129 // translate all button 130 do_translate_all = function () { 131 jQuery("#progress_bar_all").progressbar({ 132 value:0 133 }); 134 stop_translate_var = false; 135 // while there is a next 136 // get next post to translate 137 //var offset = "0"; 138 jQuery("#tr_loading").data("done",true); 139 jQuery.ajaxSetup({ 140 cache: false 141 }); 142 jQuery.getJSON(t_jp.post_url,{ 143 translate_all:"y" 144 }, function (data) { 145 dotimer = function(a) { 146 clearTimeout(timer2); 147 //console.log(a); 148 //console.log(jQuery("#tr_loading").data("done")); 149 if (jQuery("#tr_loading").data("done") || jQuery("#tr_loading").data("attempt")>4) { 150 jQuery("#progress_bar_all").progressbar('value' , (a+1)/data.length*100); 151 jQuery("#tr_loading").data("attempt",0); 152 translate_post(data[a]); 153 //console.log(jQuery("#tr_loading").data("done")); 154 //console.log("done translate" + a); 155 if (data[a] && !stop_translate_var) { 156 //console.log("trigger translation of " +a); 157 timer2 = setTimeout(function() { 158 dotimer(a+1) 159 },1000); 160 } 161 } else { 162 //console.log("waiting for translation to finish 60 seconds"); 163 jQuery("#tr_loading").data("attempt",jQuery("#tr_loading").data("attempt")+1); 164 timer2 = setTimeout(function() { 165 dotimer(a) 166 },60000); 167 } 168 } 169 timer2 = setTimeout(function() { 170 dotimer(0) 171 },0); 172 }); 173 jQuery("#transposh-translate").text("Stop translate") 174 jQuery("#transposh-translate").click(stop_translate); 175 return false; 176 } 177 178 stop_translate = function() { 179 clearTimeout(timer2); 180 stop_translate_var = true; 181 jQuery("#transposh-translate").text("Translate All Now") 182 jQuery("#transposh-translate").click(do_translate_all); 183 return false; 184 } 185 186 jQuery("#transposh-translate").click(do_translate_all); 187 136 188 }); 189 //}(jQuery)); // end of closure
Note: See TracChangeset
for help on using the changeset viewer.
