Changeset 367


Ignore:
Timestamp:
01/26/2010 11:28:10 PM (2 years ago)
Author:
ofer
Message:

Attempt to reduce size by using temp var

File:
1 edited

Legend:

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

    r364 r367  
    2323    possibly_translateable, 
    2424    // ids of progress bars 
    25     progressbar_id = t_jp.prefix + "pbar", 
     25    t_jp_prefix = t_jp.prefix, 
     26    progressbar_id = t_jp_prefix + "pbar", 
    2627    progressbar_posted_id = progressbar_id + "_s", 
    2728    source = 1, 
     
    4748        var fix_image = function () { // handle the image changes 
    4849            var img_segment_id = jQuery(this).attr('id').substr(jQuery(this).attr('id').lastIndexOf('_') + 1), 
    49             img = jQuery("#" + t_jp.prefix + "img_" + img_segment_id); 
    50             jQuery("#" + t_jp.prefix + img_segment_id).attr('source', 1); // source is 1 
     50            img = jQuery("#" + t_jp_prefix + "img_" + img_segment_id); 
     51            jQuery("#" + t_jp_prefix + img_segment_id).attr('source', 1); // source is 1 
    5152            img.removeClass('tr-icon-yellow').removeClass('tr-icon-green').addClass('tr-icon-yellow'); 
    5253        }; 
     
    109110    function create_progress_bar() { 
    110111        // progress bar is for alteast 5 items 
    111         jQuery("#" + t_jp.prefix + "credit").css({ 
     112        jQuery("#" + t_jp_prefix + "credit").css({ 
    112113            'overflow': 'auto' 
    113114        }).append('<div style="float: left;width: 90%;height: 10px" id="' + progressbar_id + '"/><div style="margin-bottom:10px;float:left;width: 90%;height: 10px" id="' + progressbar_posted_id + '"/>'); 
     
    129130        // auto_translated_previously... 
    130131        var auto_translated_phrases = [], binglang = t_jp.lang; 
    131         jQuery("." + t_jp.prefix + '[source=""]').each(function (i) { 
     132        jQuery("." + t_jp_prefix + '[source=""]').each(function (i) { 
    132133            // not needed! 
    133134            //var translated_id = jQuery(this).attr('id'), 
     
    151152                        Microsoft.Translator.translate(to_trans, "", binglang, function (translation) { 
    152153                            ajax_translate(token, jQuery("<div>" + translation + "</div>").text()); 
    153                             jQuery('#' + progressbar_id).progressbar('value', (possibly_translateable - jQuery("." + t_jp.prefix + '[source=""]').size()) / possibly_translateable * 100); 
     154                            jQuery('#' + progressbar_id).progressbar('value', (possibly_translateable - jQuery("." + t_jp_prefix + '[source=""]').size()) / possibly_translateable * 100); 
    154155                        }); 
    155156                    } 
     
    171172                            ajax_translate(token, jQuery("<div>" + result.translation + "</div>").text()); 
    172173                            // update the regular progress bar 
    173                             // done = possibly_translateable - jQuery("." + t_jp.prefix + '[source=""]').size(); 
    174                             jQuery('#' + progressbar_id).progressbar('value', (possibly_translateable - jQuery("." + t_jp.prefix + '[source=""]').size()) / possibly_translateable * 100); 
     174                            // done = possibly_translateable - jQuery("." + t_jp_prefix + '[source=""]').size(); 
     175                            jQuery('#' + progressbar_id).progressbar('value', (possibly_translateable - jQuery("." + t_jp_prefix + '[source=""]').size()) / possibly_translateable * 100); 
    175176                        } 
    176177                    }); 
     
    193194            // this is the set_default_language function 
    194195            // attach a function to the set_default_language link if its there 
    195             jQuery('#' + t_jp.prefix + 'setdeflang').click(function () { 
     196            jQuery('#' + t_jp_prefix + 'setdeflang').click(function () { 
    196197                jQuery.get(t_jp.post_url + "?tr_cookie=" + Math.random()); 
    197198                jQuery(this).hide("slow"); 
     
    224225            //if (translationstats !== undefined) { 
    225226            //possibly_translateable = (translationstats.total_phrases - translationstats.translated_phrases - (translationstats.meta_phrases - translationstats.meta_translated_phrases)); 
    226             possibly_translateable = jQuery("." + t_jp.prefix + '[source=""]').size(); 
     227            possibly_translateable = jQuery("." + t_jp_prefix + '[source=""]').size(); 
    227228 
    228229            now = new Date(); 
Note: See TracChangeset for help on using the changeset viewer.