Show
Ignore:
Timestamp:
10/09/08 20:27:39 (2 months ago)
Author:
azaozz
Message:

Use no-js reply on error in comment-reply.js, see #7635

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/js/comment-reply.js

    r9113 r9114  
    22addComment = { 
    33    moveForm : function(commId, parentId, respondId) { 
    4         var t = this, div, comm = t.I(commId), respond = t.I(respondId); 
    5          
     4        var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'); 
     5 
     6        if ( ! comm || ! respond || ! cancel || ! parent ) 
     7            return; 
     8 
    69        t.respondId = respondId; 
    7          
     10 
    811        if ( ! t.I('wp-temp-form-div') ) { 
    912            div = document.createElement('div'); 
     
    1417 
    1518        comm.parentNode.insertBefore(respond, comm.nextSibling); 
    16          
    17         t.I('comment_parent').value = parentId; 
    18          
    19         t.I('cancel-comment-reply-link').style.display = ''; 
    20         t.I('cancel-comment-reply-link').onclick = function() { 
     19        parent.value = parentId; 
     20        cancel.style.display = ''; 
     21 
     22        cancel.onclick = function() { 
    2123            var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId); 
    22              
     24 
     25            if ( ! temp || ! respond ) 
     26                return; 
     27 
    2328            t.I('comment_parent').value = '0'; 
    2429            temp.parentNode.insertBefore(respond, temp); 
    2530            temp.parentNode.removeChild(temp); 
    26             t.I('cancel-comment-reply-link').style.display = 'none'; 
    27             t.I('cancel-comment-reply-link').onclick = null; 
     31            this.style.display = 'none'; 
     32            this.onclick = null; 
    2833            return false; 
    2934        } 
    30         t.I('comment').focus(); 
     35 
     36        try { t.I('comment').focus(); } 
     37        catch(e) {} 
     38 
     39        return false; 
    3140    }, 
    32      
     41 
    3342    I : function(e) { 
    3443        return document.getElementById(e);