From 3304bf1b4977c3adb316bb3fc7c9212fcfbee88f Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 4 Jan 2021 21:57:02 +0100 Subject: [PATCH] Remove startpage user script --- startpage.user.js | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 startpage.user.js diff --git a/startpage.user.js b/startpage.user.js deleted file mode 100644 index 247694b..0000000 --- a/startpage.user.js +++ /dev/null @@ -1,38 +0,0 @@ -// ==UserScript== -// @name Startpage Bangs -// @version 1 -// @grant none -// @run-at document-start -// @include https://*.startpage.com/* -// ==/UserScript== - -fetch('https://s3.sbruder.de/cdn/bangs/bangs.json') - .then(text => text.json()) - .then(bangs => { - const urlParams = new URLSearchParams(window.location.search) - const searchQuery = urlParams.get('query') - - let matchBang = null - let parsedBang = null - - matchBang = searchQuery.match(/(.*) \!(.*)/) - if (matchBang !== null) { - parsedBang = { - 'bang': matchBang[2].toLowerCase(), - 'query': matchBang[1] - } - } - - matchBang = searchQuery.match(/\!(.*) (.*)/) - if (matchBang !== null) { - parsedBang = { - 'bang': matchBang[1].toLowerCase(), - 'query': matchBang[2] - } - } - - if (parsedBang !== null) { - redirectURL = bangs[parsedBang.bang].replace('%s', encodeURI(parsedBang.query)).replace('%S', parsedBang.query) - window.location.replace(redirectURL); - } -})