Skip to content

Instantly share code, notes, and snippets.

@Far-Se
Last active October 25, 2025 15:01
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 and Claude Url Query Script
// ==UserScript==
// @name ChatBots Query
// @namespace http://tampermonkey.net/
// @version 0.1
// @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=*
// @match https://claude.ai/new*
// @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'))
{
let timer = setInterval(() => {
const textarea = document.querySelector('ms-autosize-textarea textarea'); // Adjust the selector
if (textarea) {
clearInterval(timer);
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);
}
}, 500);
}else if(window.location.hostname.includes('google'))
{
let timer = setInterval(() => {
if(!document.querySelector("rich-textarea p"))return;
document.querySelector("rich-textarea p").textContent = `${query.q}`;
clearInterval(timer);
setTimeout(() => document.querySelector(".send-button").click(), 400);
}, 500);
}else if(window.location.hostname.includes('deepseek'))
{
let timer = setInterval(() => {
const textarea =document.querySelector('textarea');
if(!textarea)return;
clearInterval(timer);
textarea.textContent = `${query.q}`;
textarea.dispatchEvent(new Event('input', { bubbles: true }));
textarea.dispatchEvent(new Event('change', { bubbles: true }));
setTimeout(() => document.querySelector(`input+ div[role="button"]`).click(), 400);
}, 500);
}else if(window.location.hostname.includes('claude'))
{
// Wait for ProseMirror editor to be available
function waitForEditor() {
const editor = document.querySelector('[contenteditable="true"]');
if (editor) {
insertTextAndSubmit(editor, query);
} else {
setTimeout(waitForEditor, 100);
}
}
function insertTextAndSubmit(editor, text) {
// Focus the editor
editor.focus();
// Use execCommand to insert text (more reliable with ProseMirror)
document.execCommand('insertText', false, text);
// Alternative method if execCommand doesn't work
// editor.textContent = text;
// editor.dispatchEvent(new Event('input', { bubbles: true }));
// Wait a moment for the text to be processed
setTimeout(() => {
// Find and click the submit button
const submitButton = document.querySelector('button[aria-label*="Send"], button[type="submit"]');
if (submitButton) {
submitButton.click();
} else {
// Fallback: simulate Enter key press
const enterEvent = new KeyboardEvent('keydown', {
key: 'Enter',
code: 'Enter',
keyCode: 13,
which: 13,
bubbles: true,
cancelable: true
});
editor.dispatchEvent(enterEvent);
}
}, 500);
}
// Start waiting for the editor
waitForEditor();
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment