您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
删除知乎中包含视频回答和盐选/电子书节选的内容块
// ==UserScript== // @name 删除知乎视频回答和盐选/电子书节选回答 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 删除知乎中包含视频回答和盐选/电子书节选的内容块 // @author walterscott123 // @match *://www.zhihu.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to remove nodes function removeVideoAnswers() { // Select all elements with class "VideoAnswerPlayer" const videoPlayers = document.querySelectorAll('.VideoAnswerPlayer'); videoPlayers.forEach(player => { // Find the closest parent with class "feed" const feedDiv = player.closest('.Feed'); if (feedDiv) { // Remove the parent node from the DOM feedDiv.remove(); } }); const another = document.querySelectorAll('.ZVideoItem-video'); another.forEach(player => { // Find the closest parent with class "feed" const feedDiv = player.closest('.Feed'); if (feedDiv) { // Remove the parent node from the DOM feedDiv.remove(); } }); const anwser_from_some_book = document.querySelectorAll('.KfeCollection-OrdinaryLabel-content'); anwser_from_some_book.forEach(player => { // Find the closest parent with class "feed" const feedDiv = player.closest('.AnswerItem'); if (feedDiv) { // Remove the parent node from the DOM feedDiv.remove(); } }); } // Run the function initially removeVideoAnswers(); // Observe for dynamic changes on the page (useful for infinite scrolling) const observer = new MutationObserver(() => { removeVideoAnswers(); }); // Observe changes to the body observer.observe(document.body, { childList: true, subtree: true }); })();