ChatGPT-Addon/chatgpt-addon.user.js
2024-05-21 11:04:31 +02:00

44 lines
1.4 KiB
JavaScript

// ==UserScript==
// @name ZennGPT add new features
// @namespace zennscript
// @match https://chatgpt.com/c/*
// @version 1.0
// @author https://github.com/ZennDev1337/
// @description LoL XD
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a major design
change introduced in GM 1.0. It restores the sandbox.
If in Tampermonkey, use "// @unwrap" to enable sandbox instead.
*/
waitForKeyElements(".agent-turn", actionFunction, true);
function actionFunction(jNode) {
let agentHTMLElement = $(".agent-turn");
for (let elm of agentHTMLElement.toArray()) {
chatMessages.push($(elm).find(".text-message"));
$(elm)
.find(".flex.items-center")
.find("button.rounded-lg.text-token-text-secondary")
.children()
.eq(1)
.off("click")
.on("click", copyTextValidator);
}
}
function copyTextValidator(e) {
let text = $(this)
.closest("div.agent-turn")
.find(".text-message")[0].innerText;
let result = text.replace(/ß/g, "ss");
let regex = /(.*\n)Code kopieren\n/g;
result = text.replace(regex, "$1\n");
navigator.clipboard.writeText(result);
console.log(result);
}