// ==UserScript== // @name Startpage Domain Filter // @namespace https://news.ycombinator.com/ // @version 1.1 // @license GPLv3 // @description Filter Startpage search results on domain // @author xdpirate // @match https://www.startpage.com/sp/search* // @match https://www.startpage.com/do/search* // @icon https://www.google.com/s2/favicons?sz=64&domain=startpage.com // @run-at document-end // @grant GM_getValue // @grant GM_setValue // @grant GM_addStyle // @downloadURL https://update.greasyfork.icu/scripts/471788/Startpage%20Domain%20Filter.user.js // @updateURL https://update.greasyfork.icu/scripts/471788/Startpage%20Domain%20Filter.meta.js // ==/UserScript== window.setTimeout(function() { GM_addStyle(` #SPDFToggleButton { cursor: pointer; } #SPDFBlacklistArea { background-color: black; color: white; font-family: monospace; } #SPDFOuterDiv { float: left; background-color: black; color: white; padding: 5px; border: 1px solid white; border-radius: 10px; z-index: 2147483647; position: absolute; top: 50px; left: 100px; } #SPDFCloseButton { cursor: pointer; } .hidden { display: none; } `); let blacklist = GM_getValue("blacklist", ["quora.com"]); let empty = false; if(blacklist.length == 0 || (blacklist.length == 1 && blacklist[0] == "") || blacklist == undefined || blacklist == null) { empty = true; } let regexStr = "^https?:\\/\\/(.+\\.)?("; if(!empty) { for(let j = 0; j < blacklist.length; j++) { // Don't start with a pipe if(j > 0) { regexStr = regexStr + "|"; } regexStr = regexStr + blacklist[j].replaceAll(".","\\."); } } regexStr = regexStr + ")\\/"; let regex = new RegExp(regexStr, "i"); let newBox = document.createElement("div"); newBox.innerHTML = `