Hướng dẫn sửa lỗi reply (trả lời) comment blogspot

Sunnybrother
0
Đây là bài viết hướng dẫn sửa lỗi từ blogger Hung1001. Cách này vừa sữa lỗi vừa tối ưu bớt Js. Các bạn cùng xem hướng dẫn nhé!

Hướng dẫn sửa lỗi reply (trả lời) comment blogspot

Đầu tiên: Tích hợp jQuery (nếu blog chưa có): dán sau thẻ <head>
<script src='//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js' type='text/javascript'></script> 

Sữa lỗi reply comment đối với Blog1 version 1

Tìm đến thẻ <b:includable id='threaded_comment_js' var='post'> và thay toàn bộ nội dung bên trong nó thành:
<script type='text/javascript'>//<![CDATA[
$(function() {
    const t = $("#comment-editor-src").attr("href");
    $(".comment-reply").each(function() {
        var e = $(this);
        e.on("click", function(n) {
            $(".comment-actions").show(), n.preventDefault();
            let r = e.parents("li").attr("id").substr(1),
                c = t.split("?");
            $("#comment-editor")[0].src = c[0] + "?parentID=" + r + "&" + c[1], e.parent().hide(), e.parents("li").append($(".comment-form")[0])
        })
    })
});
//]]></script>

Sữa lỗi reply comment đối với Blog1 version 2

Tìm đến thẻ <b:includable id='threadedCommentJs' var='post'> và thay toàn bộ nội dung bên trong nó thành:
<script>//<![CDATA[
$(function() {
    const t = $("#comment-editor-src").attr("href");
    $("a[o='r']").each(function() {
        var n = $(this);
        n.on("click", function(e) {
            $(".comment-actions").show(), e.preventDefault();
            let o = n.parents(".comment-block").attr("id").substr(1),
                c = t.split("?");
            $("#comment-editor")[0].src = c[0] + "?parentID=" + o + "&" + c[1], n.parent().hide(), n.parents("li").append($(".comment-form")[0])
        })
    })
});
//]]></script>

Áp dụng chung cho cả Version 1+2

<script type='text/javascript'>//<![CDATA[
$(window).on("load", function() {
  function n(n, t) {
    $(n).each(function() {
      var n = $(this);
      n.on("click", function(e) {
        $(".comment-actions,.cancel-comment").show(), e.preventDefault();
        let c = n.parents(t).attr("id").substr(1),
          m = o.split("?");
        $("#comment-editor")[0].src = m[0] + "?parentID=" + c + "&" + m[1], n.parent().hide(), n.parents("li").append($(".comment-form")[0])
      })
    })
  }
  $(".comment-form").append('<a class="cancel-comment" style="font-family:Roboto,sans-serif;font-weight:700;font-size:12px;color:#ff0000;cursor:pointer;">CANCEL</a>'), $(".cancel-comment").hide();
  const o = $("#comment-editor-src").attr("href");
  $(".comment-block[id]").length ? n("a[o='r']", ".comment-block") : n(".comment-reply", "li"), $(".cancel-comment").on("click", function() {
    $(".comment-actions").show(), $("#comment-editor")[0].src = o, $(".comments-content").before($(".comment-form")[0]), $(this).hide()
  })
});
//]]></script>
Chúc các bạn thành công!

Đăng nhận xét

HƯỚNG DẪN BÌNH LUẬN

0 Nhận xét

Đăng nhận xét (0)

HƯỚNG DẪN BÌNH LUẬN

Chèn link

Sử dụng công cụ Tạo link

Chèn hình ảnh

LINK_ANH - sử dụng công cụ upload ảnh. Và chỉ cần lấy link ảnh chèn vào bình luận là ảnh tự động hiển thị.

Định dạng chữ

<b>Chữ in đậm</b>
<i>Chữ in nghiêng</i>
<u>Chữ gạch chân</u>
<strike>Chữ gạch ngang</strike>

Chèn một đoạn Code

Đầu tiên sử dụng công cụ này để mã hóa đoạn code muốn chèn.
Sau đó dùng thẻ [code] CODE_ĐÃ_MÃ_HÓA [/code]

Khác

Nhập Email bạn hay dùng để nhận thông báo khi mình trả lời bình luận của bạn.
Vui lòng không nhập bất kỳ Liên kết Spam nào trong hộp nhận xét.
Tích vào ô "Thông báo cho tôi" để nhận thông báo nội dung phản hồi của bình luận.
Chèn emoji: Nhấn tổ hợp phím “Windows + . (dấu chấm)”

Đã hiểu