WordPress.org

Make WordPress Core

Changeset 9082


Ignore:
Timestamp:
10/04/2008 06:11:33 AM (10 years ago)
Author:
azaozz
Message:

Move all of comment-reply.js to jQuery + trim filesize in half, props Viper007Bond, see #7635

File:
1 edited

Legend:

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

    r9037 r9082  
    1 function moveAddCommentForm(theId, threadId, respondId) {
    2     var addComment = document.getElementById(respondId);
    3     var comment = document.getElementById(theId);
    4     addComment.parentNode.removeChild(addComment);
    5 
    6     comment.appendChild(addComment);
    7 //  if(comment.className.indexOf("alt")>-1) {
    8 //      addComment.className = addComment.className.replace(" alt", "");                   
    9 //  } else {
    10 //      addComment.className += " alt";
    11 //  }
    12     var replyId = document.getElementById("comment-parent");
    13     replyId.value = threadId;
    14     var reRootElement = document.getElementById("cancel-comment-reply");
    15     reRootElement.style.display = "block";
    16     var aTags = comment.getElementsByTagName("A");
    17     var anc = aTags.item(0).id;
    18     //document.location.href = "#"+anc;
    19     document.getElementById("comment").focus();
     1function moveAddCommentForm(theId,threadId,respondId){
     2    jQuery("#"+respondId).appendTo("#"+theId);
     3    jQuery("#comment-parent").val(threadId);
     4    jQuery("#cancel-comment-reply").show();
     5    jQuery("#comment").focus();
    206}
    21 
    22 function cancelCommentReply(respondId, respondRoot) {
    23     var addComment = document.getElementById(respondId);           
    24     var reRootElement = document.getElementById("cancel-comment-reply");
    25     reRootElement.style.display = "none";
    26     var content = document.getElementById(respondRoot);
    27     if( content ) {
    28         addComment.parentNode.removeChild(addComment);
    29         content.appendChild(addComment);
    30     }
    31 //  addComment.className = addComment.className.replace(" alt", "");
    32     document.location.href = "#respond";
    33     document.getElementById("comment").focus();             
    34     document.getElementById("comment-parent").value = "0";
     7function cancelCommentReply(respondId,respondRoot){
     8    jQuery("#cancel-comment-reply").hide();
     9    jQuery("#"+respondId).appendTo("#"+respondRoot);
     10    document.location.href="#respond";
     11    jQuery("#comment").focus();
     12    jQuery("#comment-parent").val("0");
    3513}
    36 
    3714jQuery(document).ready(function($){
    38     $(".thread-odd").find("div.reply").css("display", "block");
    39     $(".thread-even").find("div.reply").css("display", "block");
     15    $(".thread-odd").find("div.reply").show();
     16    $(".thread-even").find("div.reply").show();
    4017});
Note: See TracChangeset for help on using the changeset viewer.