您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
只保留评论内容,其余一律屏蔽
// ==UserScript== // @name CSDN论坛去评论流广告 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 只保留评论内容,其余一律屏蔽 // @author You // @match https://bbs.csdn.net/topics/* // @grant none // ==/UserScript== (function() { 'use strict'; function removeNodesByClass(className){ var nodeList = document.getElementsByClassName(className); for (var i=0;i<nodeList.length;i++) { var node = nodeList[i]; removeNode(node); i--; } } function removeNodeById(eleId){ var node = document.getElementById(eleId); removeNode(node); } function removeRecAd(){ var recList = document.getElementsByClassName("mod_topic_wrap"); for (var i=0;i<recList.length;i++) { var rec = recList[i]; if(rec.getAttribute("data-topic-id") == null){ removeNode(rec); i--; } } } function removeNode(node){ node.parentNode.removeChild(node); } //移除顶栏 removeNodeById("csdn-toolbar"); removeNodesByClass("news-nav"); //移除顶栏广告 var topAd = document.getElementsByClassName("owner_top clearfix")[0].nextElementSibling; removeNode(topAd); //去除评论无关链接 removeNodesByClass("recom_b"); //去除大图片广告 removeNodesByClass("mediav_ad"); //去除评论中夹杂的csdn推荐 removeRecAd(); //去除页面底栏 removeNodesByClass("pub_fo"); })();