This commit is contained in:
ZennDev1337 2024-05-21 11:04:31 +02:00
parent 85df586b7b
commit f48b85d2ab

View file

@ -1,13 +1,44 @@
// ==UserScript== // ==UserScript==
// @name New script chatgpt.com // @name ZennGPT add new features
// @namespace Violentmonkey Scripts // @namespace zennscript
// @match https://chatgpt.com/c/* // @match https://chatgpt.com/c/*
// @grant none
// @version 1.0 // @version 1.0
// @author - // @author https://github.com/ZennDev1337/
// @description 21.5.2024, 07:19:14 // @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== // ==/UserScript==
/*- The @grant directive is needed to work around a major design
change introduced in GM 1.0. It restores the sandbox.
let hallo = document.getElementsByClassName("group/conversation-turn"); If in Tampermonkey, use "// @unwrap" to enable sandbox instead.
*/
console.log(hallo); 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);
}