From 90792c9a3d96a369d617a07b5c9e140130763de3 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sat, 4 Oct 2008 06:11:33 +0000 Subject: [PATCH] Move all of comment-reply.js to jQuery + trim filesize in half, props Viper007Bond, see #7635 git-svn-id: http://svn.automattic.com/wordpress/trunk@9082 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/comment-reply.js | 51 +++++++++------------------------ 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/wp-includes/js/comment-reply.js b/wp-includes/js/comment-reply.js index 6f302274f..66a5373d5 100644 --- a/wp-includes/js/comment-reply.js +++ b/wp-includes/js/comment-reply.js @@ -1,40 +1,17 @@ -function moveAddCommentForm(theId, threadId, respondId) { - var addComment = document.getElementById(respondId); - var comment = document.getElementById(theId); - addComment.parentNode.removeChild(addComment); - - comment.appendChild(addComment); -// if(comment.className.indexOf("alt")>-1) { -// addComment.className = addComment.className.replace(" alt", ""); -// } else { -// addComment.className += " alt"; -// } - var replyId = document.getElementById("comment-parent"); - replyId.value = threadId; - var reRootElement = document.getElementById("cancel-comment-reply"); - reRootElement.style.display = "block"; - var aTags = comment.getElementsByTagName("A"); - var anc = aTags.item(0).id; - //document.location.href = "#"+anc; - document.getElementById("comment").focus(); +function moveAddCommentForm(theId,threadId,respondId){ + jQuery("#"+respondId).appendTo("#"+theId); + jQuery("#comment-parent").val(threadId); + jQuery("#cancel-comment-reply").show(); + jQuery("#comment").focus(); } - -function cancelCommentReply(respondId, respondRoot) { - var addComment = document.getElementById(respondId); - var reRootElement = document.getElementById("cancel-comment-reply"); - reRootElement.style.display = "none"; - var content = document.getElementById(respondRoot); - if( content ) { - addComment.parentNode.removeChild(addComment); - content.appendChild(addComment); - } -// addComment.className = addComment.className.replace(" alt", ""); - document.location.href = "#respond"; - document.getElementById("comment").focus(); - document.getElementById("comment-parent").value = "0"; +function cancelCommentReply(respondId,respondRoot){ + jQuery("#cancel-comment-reply").hide(); + jQuery("#"+respondId).appendTo("#"+respondRoot); + document.location.href="#respond"; + jQuery("#comment").focus(); + jQuery("#comment-parent").val("0"); } - jQuery(document).ready(function($){ - $(".thread-odd").find("div.reply").css("display", "block"); - $(".thread-even").find("div.reply").css("display", "block"); -}); \ No newline at end of file + $(".thread-odd").find("div.reply").show(); + $(".thread-even").find("div.reply").show(); +});