Changeset 162


Ignore:
Timestamp:
04/22/2009 04:13:54 AM (3 years ago)
Author:
ofer
Message:

Add progressbar for auto-translation in edit mode (where jquery-ui is avail)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/js/transposh.js

    r161 r162  
    6161                        }); 
    6262                 
    63             //close dialog 
    64                 if (typeof cClick == 'function' && source == 0) { 
     63            //TODO: fix close dialog 
     64                /*if (typeof cClick == 'function' && source == 0) { 
    6565                        cClick(); 
    66                 } 
     66                }*/ 
    6767        }, 
    6868                 
     
    7777//function for auto translation 
    7878function do_auto_translate() { 
     79    if (transposh_params['edit']) { 
     80        var togo = jQuery("."+transposh_params['prefix']+"u").size(); 
     81        if (togo) { 
     82            jQuery("#credit").after('<div style="width: 90%; height: 10px" id="progress_bar"/>') 
     83            jQuery("#progress_bar").progressbar({ 
     84                value: 0 
     85            }); 
     86        } 
     87        var done = 0; 
     88    } 
    7989        jQuery("."+transposh_params['prefix']+"u").each(function (i) { 
    8090                var translated_id = jQuery(this).attr('id'); 
     
    8494                        ajax_translate(jQuery("#"+translated_id).text(),jQuery("<div>"+result.translation+"</div>").text(),1,segment_id); 
    8595                        jQuery("#"+translated_id).addClass(transposh_params['prefix']+"t").removeClass(transposh_params['prefix']+"u"); 
     96                if (transposh_params['edit']) { 
     97                    done = togo - jQuery("."+transposh_params['prefix']+"u").size(); 
     98                    if (togo) { 
     99                        //alert (done/togo*100); 
     100                        jQuery("#progress_bar").progressbar('value' , done/togo*100); 
     101                    } 
     102                } 
    86103                        }  
    87104                }); 
     
    202219//read parameters 
    203220var transposh_params = new Array();  
    204 jQuery("script[src*='transposh.js']").each(function (i) { 
     221jQuery("script[src*='transposh.js']").each(function (j) { 
    205222        var query_string = unescape(this.src.substring(this.src.indexOf('?')+1)); 
    206223        var parms = query_string.split('&'); 
Note: See TracChangeset for help on using the changeset viewer.