理智地、负责任地、透明地推广Firefox

(本文暂无中文版)

Well, Brians Threaded Comments(BTC) from Brian Meidell is really a great plugin. Many famous WordPress blogger such as John Chow is a user of BTC.

I am going to integrate it into another blog ( actually a pure English blog with Chinese authors ). And this blog has already got BTC installed.

However, After installing and using it, there seems to be something strange. Or I may say, some bugs found :(

First, in IE6, the collapse icon is not shown. I am sure it's due to the foolish,old IE6, but we must know that lots of people are still using IE6.

Then, once you click "Reply to this comments", the collapse icon doesn't display correctly. I guess it's due to the JavaScript code that handles the implementation of "class" related jobs.

So, I've just made some simple change to Brian's code, and it seems working correctly now.

I even made some further changes to get some more improvement, for example, I killed the code that fix IE's CSS bugs by using the "clearfix-solution", I make the whole "title" be clickable to make the "collapse-job" more easy. You can see the Demo @ ifgogo.com (English) or just this blog (Chinese)

I will lately pub all these code with my WordPress Theme "TES" if you want it :)

( Attention: It needs jQuery, so if you don't like jQuery, I am sorry that i cannot help )

Here is the changes:

  1. Use an image-file instead of Brian's PNG-binary-output by PHP.
    First, download this image to your current-theme's image folder ( we assume it's called "image", in fact, you can put it anywhere you want)
    Then, remove the CSS declaration from briansthreadedcomments.php and add them into your current theme' CSS file:

    .comment .collapseicon, .collapsed .collapseicon
    {
    width:      11px;
    height:     11px;
    overflow:   hidden;
    background: transparent url(image/icons.png) no-repeat scroll 0 0;
    cursor:     pointer;
    margin:     4px 6px 0 0;
    }
    .collapsed .collapseicon
    {
    background: transparent url(image/icons.png) no-repeat scroll 0 -11px;
    }
  2. Use jQuery to handle all the JavaScript works. Here is the new functions rewritten with jQuery by me, you just need to include a jQuery.js(1.2.1) and then overwrite the old code between <script> and </script> in briansthreadedcomments.php
    function collapseThread(theId) {$("#"+theId).toggleClass("collapsed")}
    function expandThread(theId)   {$("#"+theId).removeClass("collapsed")}
    function onAddComment() {
    if (checkDocumentIntegrity()) $("#commentform").submit();
    }
    function moveAddCommentBelow(theId, threadId, collapse)
    {
    expandThread(theId);
    var $addComment = $("#addcomment");
    var $comment = $("#"+theId);
    if(!$addComment.length){alert("Sorry, the comment is currently closed"); return}
    if(collapse)
    $comment.children(".comment").addClass("collapsed");
    $addComment.appendTo($comment);
    $("#comment_reply_ID").val(threadId);
    $("#reroot").show();
    $("#comment").focus();
    }
    function checkDocumentIntegrity()
    {
    if($("#reroot").length &&
    $("#addcomment").length &&
    $("#comment_reply_ID").length &&
    $(".commentlist").length &&
    $("#comment").length &&
    $("#addcommentanchor").length)
    {
    return true
    }
    return false;
    }
    function reRoot()
    {
    $("#reroot").hide();
    $("#addcomment").appendTo($(".commentlist"));
    document.location.href="#addcommentanchor";
    $("#comment").focus();
    $("#comment_reply_ID").val("0");
    }

: http://www.awflasher.com/blog/archives/1071

哇!跟我一样,您也是一名Firefox用户,这些话题您可能感兴趣:

RSS feed

才 16 条评论 ( 展开所有评论 | 收起所有评论 ) 立刻发表评论 »

aw测试一下BTC
2007-10-01 03:30:55

This is just a test from aw.

aw
2007-10-01 03:31:35

嘿嘿,看起来还不错。

好人
2007-10-01 03:33:38

果然不错,嘿嘿

北极冰仔
2007-11-23 17:06:52

确实不错。

aileenguan
2008-03-31 09:39:55

非常不错

aileenguan
2008-03-31 10:26:25

测试一下。

tony
2008-05-08 23:55:03

我来试一下.

Cat Chen
2007-10-01 09:54:03

"So, I've just made some simple change to Brain's code, and it seems working correctly now." => actually, it's "Brian", not "Brain".

aw
2007-10-01 11:14:23

whooo... Thanks! Let me fix it.

Kola
2007-10-01 14:50:52

It's so powerful!!

pplive
2007-10-01 15:36:46

Thanks for share

Jesse
2008-01-09 01:41:58

testing testing...

westwind
2008-01-20 18:21:58

研究一下

Ai.Freedom
2008-02-13 01:01:33

我按照这个说明做的, 可能有地方没做对, 最后的效果不是我想要的.. 郁闷.. 给你写了邮件询问详细步骤了.

Alex
2008-02-29 10:27:12

Thanks for sharing. Although you link to icon.png is no longer working ...

TT
2008-03-20 19:49:25

那个PNG文件现在无法下载?