Skip to content

Instantly share code, notes, and snippets.

@Far-Se
Last active December 15, 2024 09:55
Show Gist options
  • Save Far-Se/565b4668886732fec16b8b41afdd3048 to your computer and use it in GitHub Desktop.
Save Far-Se/565b4668886732fec16b8b41afdd3048 to your computer and use it in GitHub Desktop.
Gemini Query Tampermonkey Script
// ==UserScript==
// @name ChatBots Query
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://gemini.google.com/app?q=*
// @match https://chat.deepseek.com/?q=*
// @match https://aistudio.google.com/prompts/new_chat?q=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// @run-at document-start
// ==/UserScript==
(() => {
document.addEventListener("DOMContentLoaded", function () {
let query = Object.fromEntries(new URLSearchParams(location.search));
if (!query.hasOwnProperty('q')) return;
if(window.location.hostname.includes('aistudio.google'))
{
setTimeout(() => {
const textarea = document.querySelector('ms-autosize-textarea textarea'); // Adjust the selector
if (textarea) {
textarea.value = `${query.q}`; // Set the initial text
textarea.dispatchEvent(new Event('input', { bubbles: true }));
textarea.dispatchEvent(new Event('change', { bubbles: true }));
setTimeout(() => document.querySelector('button[aria-label="Run"]').click(), 500);
}
}, 1500);
}else if(window.location.hostname.includes('google'))
{
setTimeout(() => {
document.querySelector("rich-textarea p").textContent = `${query.q}`;
setTimeout(() => document.querySelector(".send-button").click(), 400);
}, 1400);
}else if(window.location.hostname.includes('deepseek'))
{
setTimeout(() => {
document.querySelector("#chat-input").textContent = `${query.q}`;
setTimeout(() => document.querySelector(`input+ div[role="button"]`).click(), 400);
}, 1400);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment