mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
fix(userscripts/kagi-for-safer): redirect from DuckDuckGo again
Turns out using Yahoo for this doesn't quite work across the board on all with different userscript injectors due to some security policy headers that Yahoo sends. So back to DuckDuckGo it is :P
This commit is contained in:
@@ -1,23 +1,23 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Kagi Search (Yahoo redirect)
|
// @name Kagi Search (DuckDuckGo redirect)
|
||||||
// @description Redirects Yahoo searches to Kagi.com. Only relevant for desktop Safari users.
|
// @description Redirects DuckDuckGo searches to Kagi.com. Only relevant for desktop Safari users.
|
||||||
// @version 0.0.3
|
// @version 0.0.4
|
||||||
// @namespace jimeh.me
|
// @namespace jimeh.me
|
||||||
// @doanloadURL https://github.com/jimeh/dotfiles/raw/main/userscripts/kagi-for-safari.user.js
|
// @downloadURL https://github.com/jimeh/dotfiles/raw/main/userscripts/kagi-for-safari.user.js
|
||||||
// @run-at document-start
|
// @updateURL https://github.com/jimeh/dotfiles/raw/main/userscripts/kagi-for-safari.user.js
|
||||||
// @match https://yahoo.com/search*
|
// @inject-into auto
|
||||||
// @match https://search.yahoo.com/search*
|
// @run-at document-start
|
||||||
// @match https://*.search.yahoo.com/search*
|
// @match https://duckduckgo.com/*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
(function () {
|
(function () {
|
||||||
if (
|
if (
|
||||||
navigator.vendor.match(/apple/i) && // Only activate in Safari.
|
navigator.vendor.match(/apple/i) && // Only activate in Safari.
|
||||||
window.location.hostname.slice(-16) == "search.yahoo.com" &&
|
window.location.hostname == "duckduckgo.com" &&
|
||||||
window.location.pathname == "/search"
|
window.location.pathname == "/"
|
||||||
) {
|
) {
|
||||||
let q = (new URL(window.location)).searchParams.get("p");
|
let q = (new URL(window.location)).searchParams.get("q");
|
||||||
if (q) {
|
if (q) {
|
||||||
console.log("Redirecting Yahoo search to Kagi.com");
|
console.log("Redirecting DuckDuckGo search to Kagi.com");
|
||||||
window.location.href = "https://kagi.com/search?q=" + q;
|
window.location.href = "https://kagi.com/search?q=" + q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user