Changeset 2486

Show
Ignore:
Timestamp:
06/02/08 19:24:51 (6 months ago)
Author:
bchoate
Message:

Javascript-escape trans phrases placed in strings. BugId:80004

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-39/default_templates/javascript.mtml

    r2397 r2486  
    8484    var str; 
    8585    if (delta < 60) { 
    86         str = '<__trans phrase="moments ago">'; 
     86        str = '<__trans phrase="moments ago" escape="js">'; 
    8787    } else if (delta <= 86400) { 
    8888        // less than 1 day 
     
    9090        var min = Math.floor((delta % 3600) / 60); 
    9191        if (hours == 1) 
    92             str = '<__trans phrase="[quant,_1,hour,hours] ago" params="1">'; 
     92            str = '<__trans phrase="[quant,_1,hour,hours] ago" params="1" escape="js">'; 
    9393        else if (hours > 1) 
    94             str = '<__trans phrase="[quant,_1,hour,hours] ago" params="2">'.replace(/2/, hours); 
     94            str = '<__trans phrase="[quant,_1,hour,hours] ago" params="2" escape="js">'.replace(/2/, hours); 
    9595        else if (min == 1) 
    96             str = '<__trans phrase="[quant,_1,minute,minutes] ago" params="1">'; 
     96            str = '<__trans phrase="[quant,_1,minute,minutes] ago" params="1" escape="js">'; 
    9797        else 
    98             str = '<__trans phrase="[quant,_1,minute,minutes] ago" params="2">'.replace(/2/, min); 
     98            str = '<__trans phrase="[quant,_1,minute,minutes] ago" params="2" escape="js">'.replace(/2/, min); 
    9999    } else if (delta <= 604800) { 
    100100        // less than 1 week 
     
    102102        var hours = Math.floor((delta % 86400) / 3600); 
    103103        if (days == 1) 
    104             str = '<__trans phrase="[quant,_1,day,days] ago" params="1">'; 
     104            str = '<__trans phrase="[quant,_1,day,days] ago" params="1" escape="js">'; 
    105105        else if (days > 1) 
    106             str = '<__trans phrase="[quant,_1,day,days] ago" params="2">'.replace(/2/, days); 
     106            str = '<__trans phrase="[quant,_1,day,days] ago" params="2" escape="js">'.replace(/2/, days); 
    107107        else if (hours == 1) 
    108             str = '<__trans phrase="[quant,_1,hour,hours] ago" params="1">'; 
     108            str = '<__trans phrase="[quant,_1,hour,hours] ago" params="1" escape="js">'; 
    109109        else 
    110             str = '<__trans phrase="[quant,_1,hour,hours] ago" params="2">'.replace(/2/, hours); 
     110            str = '<__trans phrase="[quant,_1,hour,hours] ago" params="2" escape="js">'.replace(/2/, hours); 
    111111    } 
    112112    return str ? str : fds; 
     
    124124    if (! author_id) return; 
    125125    if (u.id != author_id) return; 
    126     var link = '<__trans phrase='<a href="[_1]">Edit</a>' params="<$mt:AdminScript$>?__mode=view&amp;_type=entry&amp;id=' + entry_id + '">'; 
     126    var link = '<__trans phrase='<a href="[_1]">Edit</a>' params="<$mt:AdminScript$>?__mode=view&amp;_type=entry&amp;id=' + entry_id + '" escape="js">'; 
    127127    document.write(link); 
    128128} 
     
    477477    } 
    478478    if (el) 
    479         el.innerHTML = '<__trans phrase="Signing in..."> <img src="<$mt:StaticWebPath$>images/indicator.white.gif" height="16" width="16" alt="" />'; 
     479        el.innerHTML = '<__trans phrase="Signing in..." escape="js"> <img src="<$mt:StaticWebPath$>images/indicator.white.gif" height="16" width="16" alt="" />'; 
    480480 
    481481    mtClearUser(); // clear any 'anonymous' user cookie to allow sign in 
     
    555555    if ( u && u.is_authenticated ) { 
    556556        if ( u.is_banned ) { 
    557             phrase = '<__trans phrase="You do not have permission to comment on this blog. ([_1]sign out[_2])" params="<a href="javascript:void(0);" onclick="return mtSignOutOnClick();">%%</a>">'; 
     557            phrase = '<__trans phrase="You do not have permission to comment on this blog. ([_1]sign out[_2])" params="<a href="javascript:void(0);" onclick="return mtSignOutOnClick();">%%</a>" escape="js">'; 
    558558        } else { 
    559559            var user_link; 
     
    571571            } 
    572572            // TBD: supplement phrase with userpic if one is available. 
    573             phrase = '<__trans phrase="Thanks for signing in, [_1]. ([_2]sign out[_3])" params="' + user_link + '%%<a href="javascript:void(0)" onclick="return mtSignOutOnClick();">%%</a>">'; 
     573            phrase = '<__trans phrase="Thanks for signing in, [_1]. ([_2]sign out[_3])" params="' + user_link + '%%<a href="javascript:void(0)" onclick="return mtSignOutOnClick();">%%</a>" escape="js">'; 
    574574        } 
    575575    } else { 
    576576        if (reg_reqd) { 
    577             phrase = '<__trans phrase="[_1]Sign in[_2] to comment." params="<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'comment-greeting\')">%%</a>">'; 
     577            phrase = '<__trans phrase="[_1]Sign in[_2] to comment." params="<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'comment-greeting\')">%%</a>" escape="js">'; 
    578578        } else { 
    579             phrase = '<__trans phrase="[_1]Sign in[_2] to comment, or comment anonymously." params="<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'comment-greeting\')">%%</a>">'; 
     579            phrase = '<__trans phrase="[_1]Sign in[_2] to comment, or comment anonymously." params="<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'comment-greeting\')">%%</a>" escape="js">'; 
    580580        } 
    581581    } 
     
    599599 
    600600    // Populate label with new values 
    601     var reply_text = '<__trans phrase="Replying to <a href="[_1]" onclick="[_2]">comment from [_3]</a>" params="#comment-'+ parent_id +'%%location.href=this.href; return false%%'+ author +'">'; 
     601    var reply_text = '<__trans phrase="Replying to <a href="[_1]" onclick="[_2]">comment from [_3]</a>" params="#comment-'+ parent_id +'%%location.href=this.href; return false%%'+ author +'" escape="js">'; 
    602602    label.innerHTML = reply_text; 
    603603