Last active
May 6, 2023 01:56
-
-
Save AshConnolly/d6d12d3fc75a0f9764b0d74a3b4a84d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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