Skip to content

Instantly share code, notes, and snippets.

@meain
Last active December 6, 2024 05:17
Show Gist options
  • Select an option

  • Save meain/9b0eb40feed5477cb21390091d251bd0 to your computer and use it in GitHub Desktop.

Select an option

Save meain/9b0eb40feed5477cb21390091d251bd0 to your computer and use it in GitHub Desktop.
Script to add links to other search engines or LLMs in DDG
// 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);
});
@meain
Copy link
Copy Markdown
Author

meain commented Dec 6, 2024

Example of how it looks like. Adds links to other places in the middle right of the page.

Screenshot 2024-12-06 at 10 39 25 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment