mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 10:46:40 +00:00
feat(userscripts/kagi-for-safer): minor update/improvement
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Kagi Search (DuckDuckGo redirect)
|
// @name Kagi Search (DuckDuckGo redirect)
|
||||||
// @description Redirects DuckDuckGo 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.1
|
// @version 0.0.2
|
||||||
// @namespace jimeh.me
|
// @namespace jimeh.me
|
||||||
// @downloadURL https://github.com/jimeh/dotfiles/blob/main/userscripts/kagi-for-safari.user.js
|
// @downloadURL https://github.com/jimeh/dotfiles/blob/main/userscripts/kagi-for-safari.user.js
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
@@ -9,11 +9,13 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
(function () {
|
(function () {
|
||||||
if (
|
if (
|
||||||
|
navigator.vendor.match(/apple/i) && // Only activate in Safari.
|
||||||
window.location.hostname == "duckduckgo.com" &&
|
window.location.hostname == "duckduckgo.com" &&
|
||||||
window.location.pathname == "/"
|
window.location.pathname == "/"
|
||||||
) {
|
) {
|
||||||
let q = (new URL(window.location)).searchParams.get("q");
|
let q = (new URL(window.location)).searchParams.get("q");
|
||||||
if (q) {
|
if (q) {
|
||||||
|
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