Changeset 1351

Show
Ignore:
Timestamp:
02/04/08 23:07:47 (17 months ago)
Author:
ddavis
Message:

js cleanup in default templates

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-29/default_templates/javascript.mtml

    r1118 r1351  
    22function hideDocumentElement(id) { 
    33    var el = document.getElementById(id); 
    4     if (el) el.style.display = 'none'; 
     4    if (el) 
     5        el.style.display = 'none'; 
    56} 
    67 
    78function showDocumentElement(id) { 
    89    var el = document.getElementById(id); 
    9     if (el) el.style.display = 'block'; 
    10 } 
    11  
     10    if (el) 
     11        el.style.display = 'block'; 
     12} 
     13 
     14var captcha_timer; 
    1215function showAnonymousForm() { 
    1316    showDocumentElement('comments-form'); 
     
    1720} 
    1821<MTIfNonEmpty tag="MTCaptchaFields"> 
    19 var captcha_timer; 
    2022function delayShowCaptcha() { 
    2123    clearInterval(captcha_timer); 
    2224    var div = document.getElementById('comments-open-captcha'); 
    23     if (div) { 
     25    if (div) 
    2426        div.innerHTML = '<$MTCaptchaFields$>'; 
    25     } 
    2627} 
    2728</MTIfNonEmpty> 
     
    7677</MTIfRegistrationAllowed> 
    7778 
    78     if (document.comments_form) { 
    79         if (!commenter_name && (document.comments_form.email != undefined) && 
     79    var cf = document.comments_form; 
     80    if (cf) { 
     81        if (!commenter_name && (cf.email != undefined) && 
    8082            (mtcmtmail = getCookie("mtcmtmail"))) 
    81             document.comments_form.email.value = mtcmtmail; 
    82         if (!commenter_name && (document.comments_form.author != undefined) && 
     83            cf.email.value = mtcmtmail; 
     84        if (!commenter_name && (cf.author != undefined) && 
    8385            (mtcmtauth = getCookie("mtcmtauth"))) 
    84             document.comments_form.author.value = mtcmtauth; 
    85         if (document.comments_form.url != undefined && 
     86            cf.author.value = mtcmtauth; 
     87        if (cf.url != undefined && 
    8688            (mtcmthome = getCookie("mtcmthome"))) 
    87             document.comments_form.url.value = mtcmthome; 
    88         if (document.comments_form["bakecookie"]) { 
     89            cf.url.value = mtcmthome; 
     90        if (cf["bakecookie"]) { 
    8991            if (mtcmtauth || mtcmthome) { 
    90                 document.comments_form.bakecookie.checked = true; 
     92                cf.bakecookie.checked = true; 
    9193            } else { 
    92                 document.comments_form.bakecookie.checked = false; 
     94                cf.bakecookie.checked = false; 
    9395            } 
    9496        } 
     
    136138 
    137139<MTIfRegistrationAllowed> 
    138 if ('<$MTCGIHost exclude_port="1"$>' != '<$MTBlogHost exclude_port="1"$>') { 
    139     document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_name_js&blog_id=<$MTBlogID$>"></script>'); 
    140 } else { 
    141     commenter_name = getCookie('commenter_name'); 
    142     ids = getCookie('commenter_id').split(':'); 
    143     commenter_id = ids[0]; 
    144     commenter_blog_ids = ids[1]; 
    145     commenter_url = getCookie('commenter_url'); 
    146 } 
     140<MTsetvarblock name="cgi_host"><$MTCGIHost exclude_port="1"></MTsetvarblock> 
     141<MTIf tag="MTBlogHost" exclude_port="1" eq="cgi_host"> 
     142commenter_name = getCookie('commenter_name'); 
     143ids = getCookie('commenter_id').split(':'); 
     144commenter_id = ids[0]; 
     145commenter_blog_ids = ids[1]; 
     146commenter_url = getCookie('commenter_url'); 
     147<MTelse> 
     148document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_name_js&blog_id=<$MTBlogID$>"></script>'); 
     149</MTIf> 
    147150</MTIfRegistrationAllowed> 
    148151