Skip to content

Instantly share code, notes, and snippets.

@masonwan
Last active April 11, 2025 23:24
Show Gist options
  • Save masonwan/123e4e9cb5c4dc425efb5235df27407c to your computer and use it in GitHub Desktop.
Save masonwan/123e4e9cb5c4dc425efb5235df27407c to your computer and use it in GitHub Desktop.

Copy the following code into the URL of your bookmark.

javascript:openAiTabs();function openAiTabs(){const t=URL.parse(location.href);let e=t.searchParams.get("q");e==null&&(e=`tldr ${t}`),search(e)}function search(e){const t=["https://www.google.com/search?udm=50&q=%s","https://chatgpt.com/?hints=search&q=%s","https://grok.com/?q=%s","https://www.perplexity.ai/search/?copilot=false&q=%s"];t.forEach(t=>{window.open(t.replace("%s",e),"_blank")})}

The unminified version

// It opens popular AI search with the query parameter in the URL (`?q=`).
// Need to allow pop-ups in browser sercurity settings.

openAiTabs()

function openAiTabs() {
  const url = URL.parse(location.href)

  let query = url.searchParams.get('q')
  if (query == null) {
    query = `tldr ${url}`
  }
  search(query)
}

function search(query) {
  const searchUrls = [
    'https://www.google.com/search?udm=50&q=%s',
    'https://chatgpt.com/?hints=search&q=%s',
    'https://grok.com/?q=%s',
    'https://www.perplexity.ai/search/?copilot=false&q=%s',
  ]
  searchUrls.forEach(url => {
    window.open(url.replace('%s', query), '_blank')
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment