Skip to content

Instantly share code, notes, and snippets.

@AshConnolly
Last active May 6, 2023 01:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshConnolly/d6d12d3fc75a0f9764b0d74a3b4a84d2 to your computer and use it in GitHub Desktop.
Save AshConnolly/d6d12d3fc75a0f9764b0d74a3b4a84d2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://chat.openai.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// @grant none
// ==/UserScript==
const updateInputAndSubmit = () => {
const textInput = document.querySelector("textarea");
const urlQuery = new URLSearchParams(window.location.search).get("customQuery");
const submitButton = document.querySelector("form button")
if(!urlQuery) return
textInput.value = urlQuery;
submitButton.removeAttribute("disabled");
submitButton.click()
}
const observer = new MutationObserver(function (
mutations,
mutationInstance
) {
if (document.getElementsByTagName("h1")[0]) {
updateInputAndSubmit()
mutationInstance.disconnect();
}
});
observer.observe(document, {
childList: true,
subtree: true,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment