您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
a script to remove ads in www.zhihu.com
当前为
// ==UserScript== // @name 知乎去广告、视频 // @namespace http://tampermonkey.net/ // @version 1.5 // @description a script to remove ads in www.zhihu.com // @author CoderBen // @match https://www.zhihu.com/* // @require http://code.jquery.com/jquery-1.11.0.min.js // @grant none // @icon https://tse2-mm.cn.bing.net/th/id/OIP.7D-LqgunUUDXVESZYas8GAHaHa?pid=Api&rs=1 // ==/UserScript== (function() { 'use strict'; if (window.location.href.indexOf('/people/') > -1) return try { removeHomeBar() removeAds() removeMovies() window.onscroll = throttle(function() { removeAds() removeMovies() }, 1000) document.querySelector('.Topstory-tabsLink').onclick = () => { const timer = setTimeout(() => { removeAds() removeMovies() clearTimeout(timer) }, 3000) } } catch (e) { console.error('油猴插件【知乎去广告、视频】:出现错误', e) } function removeAds () { $('.TopstoryItem--advertCard')?.each((index,elem) => elem.style.display = 'none') $('.Pc-card')?.each((index,elem) => elem.style.display = 'none') } function removeMovies() { $('.ZVideoItem')?.each((index,elem) => $(elem).parent('.TopstoryItem-isRecommend')?.context?.remove()) $('.VideoAnswerPlayer')?.each((index,elem) => $(elem).parent('.TopstoryItem-isRecommend')?.context?.remove()) } function removeHomeBar() { $('.Topstory-container').prev()?.remove() } function throttle(func, delay) { let last; return function () { const _this = this; const _args = arguments; const now = +new Date(); if (last && now < last + delay) { clearTimeout(func.tid); func.tid = setTimeout(function () { last = now; func.call(_this, [..._args]); }, delay); } else { last = now; func.call(_this, [..._args]); } } } })();