Khóa mõm - Chặn bình luận theo ID Blogger

7.10.25 | 29 nhận xét | lượt xem
Nội Dung Chính
    Bài này hướng dẫn anh em "khóa mõm" của một số tài khoản nhất định dựa theo Profile ID Blogger.
    Tự động thay avatar thành biểu tượng cấm, đổi tên thành Blocked User, thay nội dung và làm mờ khung bình luận.

    Code

    <!-- khóa mõm -->
    <script>
    document.addEventListener("DOMContentLoaded", function () {
      const blockedUsers = [
        "07681083261644181883",
        "01234567891011121314",
        "01234567891011121314"
      ];
    
      function getProfileIdFromLink(href) {
        const m = href && href.match(/\/profile\/(\d+)/);
        return m ? m[1] : null;
      }
    
      function blockOneComment(block) {
        if (!block) return;
    
        const userLink = block.querySelector(".comment-header .user a[href*='blogger.com/profile/']");
        if (!userLink) return;
    
        const uid = getProfileIdFromLink(userLink.href);
        if (!uid || !blockedUsers.includes(uid)) return;
    
        const comment = block.closest(".comment");
    
        const avatarBox = comment?.querySelector(".avatar-image-container");
        if (avatarBox) {
          avatarBox.innerHTML = `
            <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"
              width="45" height="45" fill="#d32f2f" title="Người dùng bị chặn">
              <circle cx="256" cy="256" r="200" fill="none" stroke="#d32f2f" stroke-width="40"/>
              <line x1="120" y1="392" x2="392" y2="120" stroke="#d32f2f" stroke-width="40"/>
            </svg>
          `;
        }
    
        userLink.textContent = "Blocked User";
        userLink.removeAttribute("href");
        userLink.removeAttribute("target");
        userLink.removeAttribute("rel");
        userLink.style.pointerEvents = "none";
    
        const content = block.querySelector(".comment-content");
        if (content) {
          content.textContent = "Nội dung cho người dùng bị cấm đăng lên vì vậy không hiển thị";
        }
    
        block.style.opacity = "0.7";
        block.style.pointerEvents = "none";
      }
    
      document.querySelectorAll(".comment-block").forEach(blockOneComment);
    
      const holder = document.querySelector("#comment-holder") || document.body;
      const mo = new MutationObserver(() => {
        document.querySelectorAll(".comment-block").forEach(blockOneComment);
      });
      mo.observe(holder, { childList: true, subtree: true });
    });
    </script>
    <!-- khóa mõm -->

    Lưu ý

    Cách lấy Profile ID
    1. Mở trang bình luận nơi người đó đã comment.
    2. Nhấp vào tên người dùng (liên kết thường có dạng https://www.blogger.com/profile/xxxxxxxxxxxxxxxxxxx).
    3. Sao chép dãy số sau /profile/ và thêm vào mảng blockedUsers trong script.
    Nếu vẫn thấy bình luận của người bị chặn?
    1. ID đã đúng (khớp dãy số trong URL profile).
    2. Template có đúng selector: .comment-block, .avatar-image-container, .comment-header .user a, .comment-content. Nếu khác, hãy đổi selector tương ứng.
    Tùy chọn hiển thị
    • Ẩn hoàn toàn bình luận: thay hai dòng cuối trong hàm blockOneComment bằng:
      block.closest(".comment")?.remove();
    • Đổi biểu tượng: thay đoạn SVG trong avatarBox.innerHTML bằng SVG khác tùy ý.
    • Đổi thông điệp: sửa chuỗi “Nội dung cho người dùng bị cấm…” theo ý bạn.

    Kết luận

    • Nên khóa hết mõm mấy thằng hay spam cho đỡ rác
    • Để lại bình luận nếu bạn cần hỗ trợ
    Bạn đang xem bài viết "Khóa mõm - Chặn bình luận theo ID Blogger" tại chuyên mục: Blogspot , Javascript

    29

    nhận xét
    Mới nhất ⇅

    Bình luận

    Chèn hình ảnh: Chỉ cần dán link hình ảnh - Upload ảnh

    Chèn code: [pre]Code đã mã hóa [/pre]

    Chèn emoji: Nhấn tổ hợp phím “Windows + . (dấu chấm)”

    Chèn link: Click để chèn link