删除淘宝/天猫默认评论

删除淘宝/天猫包含指定关键词的评论

安裝腳本?
作者推薦腳本

您可能也會喜歡 淘宝广告屏蔽助手

安裝腳本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         删除淘宝/天猫默认评论
// @namespace    http://tampermonkey.net/
// @version      2.1.1
// @description  删除淘宝/天猫包含指定关键词的评论
// @author       oldip
// @match        https://item.taobao.com/item.htm?*
// @match        https://detail.tmall.com/item.htm?*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  // 需要完全匹配的关键词
  const keywords = [
    "评价方未及时做出评价,系统默认好评!",
    "此用户没有填写评价。",
    "系统默认评论",
    "15天内买家未作出评价",
    "该用户未及时主动评价,系统默认好评",
    "该用户觉得商品非常好,给出好评",
    "该用户觉得商品非常好,给出5星好评",
    "该用户未填写评价内容"
  ];

  // 统一选择器(新旧类名都支持)
  const SELECTORS = {
    content: '[class^="content--"], [class*="--content--_"]',
    comment: '[class^="Comment--"], [class*="--Comment--_"]',
    photo:   '[class^="photo--"],   [class*="--photo--"]'
  };

  function removeDefaultFeedback(root = document) {
    const contentElements = root.querySelectorAll(SELECTORS.content);
    contentElements.forEach((contentEl) => {
      const text = contentEl.innerText.trim();
      if (!keywords.includes(text)) return;

      const parentComment = contentEl.closest(SELECTORS.comment);
      if (!parentComment) return;

      // 父容器里包含多个纯文本内容块(可能有追评/商家回复等),就跳过
      const contentItems = parentComment.querySelectorAll(SELECTORS.content);
      if (contentItems.length > 1) return;

      // 有图片/视频等媒体则跳过
      if (parentComment.querySelector(SELECTORS.photo)) return;

      parentComment.remove();
    });
  }

  // 处理动态加载
  const observer = new MutationObserver((mutations) => {
    for (const m of mutations) {
      for (const node of m.addedNodes) {
        if (node.nodeType === 1) removeDefaultFeedback(node);
      }
    }
  });

  observer.observe(document.body, { childList: true, subtree: true });

  // 初次执行
  removeDefaultFeedback();
})();