// ==UserScript== // @name 屏蔽谷歌搜索站点 // @namespace https://greasyfork.org/zh-CN/users/1169082 // @version 0.0.1.29 // @description 在google搜索屏蔽指定站点 // @license MIT // @author 人民的勤务员 // @include /^https?://(www|cse)\.google(\.\w+)+/search\?.*$/ // @run-at document-start // @grant GM_registerMenuCommand // @compatible chrome >= 49 // @compatible firefox >= 29 // @compatible opera >= 46 // @compatible safari >= 10.1 // @icon https://github.com/ChinaGodMan/UserScripts/raw/main/docs/icon/Scripts%20Icons/icons8-google-96.png // @supportURL https://github.com/ChinaGodMan/UserScripts/issues // @homepageURL https://github.com/ChinaGodMan/UserScripts // @downloadURL none // ==/UserScript== (function () { 'use strict' // 初始化默认屏蔽站点 const DEFAULT_BLOCKED_SITES = "csdn" // 获取存储的屏蔽站点列表 function getBlockedSites() { return localStorage.getItem("blockedSites") || DEFAULT_BLOCKED_SITES } // 设置屏蔽站点列表 function setBlockedSites(sites) { localStorage.setItem("blockedSites", sites) } // 注册油猴菜单命令 GM_registerMenuCommand("❌编辑屏蔽站点", function () { showEditDialog(getBlockedSites()) }) // 显示编辑对话框 function showEditDialog(currentSites) { const overlay = document.createElement('div') overlay.id = 'overlay' overlay.style = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9998;' const dialog = document.createElement('div') dialog.id = 'editDialog' dialog.style = 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border: 1px solid #ccc; box-shadow: 3px 3px 5px rgba(0,0,0,0.3); z-index: 9999; width: 60%; max-width: 600px; resize: both; overflow: auto;' dialog.innerHTML = `
请输入用英文逗号分隔的站点: