Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PincongBot/320313386c83e9fc02611e81a1247d92 to your computer and use it in GitHub Desktop.
Save PincongBot/320313386c83e9fc02611e81a1247d92 to your computer and use it in GitHub Desktop.
在google搜索结果中一劳永逸地屏蔽所有知乎结果
// ==UserScript==
// @name 在google搜索结果中屏蔽所有知乎结果
// @version 0.0.1
// @description 在google搜索结果中一劳永逸地屏蔽所有知乎结果
// @license MIT
// @author PincongBot
// @include /^https?://(www|cse)\.google(\.\w+)+/search\?.*$/
// @run-at document-start
// @grant none
// @compatible chrome >= 49
// @compatible firefox >= 29
// @compatible opera >= 46
// @compatible safari >= 10.1
// ==/UserScript==
(function () {
'use strict';
var params = new URLSearchParams(location.search),
q = params.get("q");
if (q && q.indexOf("-site:zhihu.com") === -1) {
params.set("q", q + " -site:zhihu.com");
location.search = "?" + params.toString();
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment