mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
There's legit reasons why I might want to search with DuckDuckGo, and no reason why I might want to search with Yahoo. Specially as Yahoo now uses Bing to provide search results. Also, in my very basic testing, Yahoo actually produces a smaller and faster to load results page. So I might as well use that for the sake of performance, though I doubt it makes much of a difference, as the redirect logic runs immediately as the page starts loading.
25 lines
908 B
JavaScript
25 lines
908 B
JavaScript
// ==UserScript==
|
|
// @name Kagi Search (Yahoo redirect)
|
|
// @description Redirects Yahoo searches to Kagi.com. Only relevant for desktop Safari users.
|
|
// @version 0.0.3
|
|
// @namespace jimeh.me
|
|
// @downloadURL https://github.com/jimeh/dotfiles/blob/main/userscripts/kagi-for-safari.user.js
|
|
// @run-at document-start
|
|
// @match https://yahoo.com/search*
|
|
// @match https://search.yahoo.com/search*
|
|
// @match https://*.search.yahoo.com/search*
|
|
// ==/UserScript==
|
|
(function () {
|
|
if (
|
|
navigator.vendor.match(/apple/i) && // Only activate in Safari.
|
|
window.location.hostname.slice(-16) == "search.yahoo.com" &&
|
|
window.location.pathname == "/search"
|
|
) {
|
|
let q = (new URL(window.location)).searchParams.get("p");
|
|
if (q) {
|
|
console.log("Redirecting Yahoo search to Kagi.com");
|
|
window.location.href = "https://kagi.com/search?q=" + q;
|
|
}
|
|
}
|
|
})();
|