正在加载...

(本文暂无中文版)

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");
    }
还没找到您要的东西?Google试试看吧,
Google更注重原创、时效性好的文章:


本文相关评论: 才 19 条评论
  1. 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 05:06:52

          确实不错。

          • aileenguan 2008-03-31 09:39:55

            非常不错

            (评论已经达到最大深度!)
          • aileenguan 2008-03-31 10:26:25

            测试一下。

            (评论已经达到最大深度!)
          • tony 2008-05-08 11:55:03

            我来试一下.

            (评论已经达到最大深度!)
          • stephen 2008-05-31 08:56:04

            测试一下。。。

            (评论已经达到最大深度!)
          • 光合作用 2008-07-26 09:25:57

            我也测试一下

            (评论已经达到最大深度!)
  2. 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”.

  3. Kola 2007-10-01 02:50:52

    It’s so powerful!!

  4. pplive 2007-10-01 03:36:46

    Thanks for share

  5. Jesse 2008-01-09 01:41:58

    testing testing…

  6. westwind 2008-01-20 06:21:58

    研究一下

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

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

  8. Alex 2008-02-29 10:27:12

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

  9. TT 2008-03-20 07:49:25

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

  10. BlueDrifter 2008-06-13 12:03:25

    好东西啊,虽然不懂编程语言,也要好好研究下。

    谢谢aw分享~

[支持Ctrl+Enter]为了我们大家和家人的安全,留言请慎重!
声明:
1、本站仅与见过面的个人博客交换链接,见此文
2、留言时的头像是Gravatar提供的服务。如果您有兴趣并且有闲暇时间,可以看看这里的介绍