Last active
December 6, 2024 05:17
-
-
Save meain/9b0eb40feed5477cb21390091d251bd0 to your computer and use it in GitHub Desktop.
Script to add links to other search engines or LLMs in DDG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inject via gresemonkey to add other search engine links in DDG | |
// search. This is useful for quickly switching between search engines | |
// or even asking tools like ChatGPT or Perplexity. | |
const ss = { | |
Google: "https://www.google.com/search?q={}", | |
Perplexity: "https://www.perplexity.ai/?q={}", | |
ChatGPT: "https://chatgpt.com/?q={}&hints=search", | |
Bing: "https://www.bing.com/search?q={}", | |
// DuckDuckGo: "https://duckduckgo.com/?q={}", // already on it | |
Yahoo: "https://search.yahoo.com/search?p={}", | |
// Ask: "https://www.ask.com/web?q={}", | |
// AOL: "https://search.aol.com/aol/search?q={}", | |
Yandex: "https://yandex.com/search/?text={}", | |
// Baidu: "https://www.baidu.com/s?wd={}", | |
}; | |
document.addEventListener("DOMContentLoaded", function() { | |
const sinput = document.getElementById("search_form_input"); | |
const alternates = document.createElement("div"); | |
alternates.style.position = "fixed"; | |
alternates.style.top = "50%"; | |
alternates.style.right = "0"; | |
alternates.style.transform = "translateY(-50%)"; | |
alternates.style.display = "flex"; | |
alternates.style.flexDirection = "column"; | |
alternates.style.alignItems = "flex-end"; | |
alternates.style.marginRight = "10px"; | |
alternates.style.paddingRight = "10px"; | |
alternates.style.borderRight = "3px solid lightgray"; | |
for (let key of Object.keys(ss)) { | |
const link = document.createElement("a"); | |
link.style.margin = "2px"; | |
link.href = ss[key].replace("{}", sinput.value); | |
link.innerText = key; | |
alternates.appendChild(link); | |
} | |
document.body.appendChild(alternates); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of how it looks like. Adds links to other places in the middle right of the page.