Greasy Fork is available in English.

Educake ChatGPT Button + Allow Pasting

Adds a ChatGPT button to Educake which copies question text and opens a ChatGPT window, allowing you to get answers quickly. This script also re-enables the pasting feature in the answer box, so you can copy answers from GPT / Google, and paste them in the answer box

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Educake ChatGPT Button + Allow Pasting
// @namespace    https://github.com/Z2r-YT/Educake-Pasting
// @version      1.0
// @description  Adds a ChatGPT button to Educake which copies question text and opens a ChatGPT window, allowing you to get answers quickly. This script also re-enables the pasting feature in the answer box, so you can copy answers from GPT / Google, and paste them in the answer box
// @author       liam @ duckwithsunglasses.com
// @match        *://*.educake.co.uk/*
// @grant        none
// @license      MIT
// @icon         data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiBpZD0iSWNvbnMiIHg9IjAiIHk9IjAiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iY3Vyc29yOiBkZWZhdWx0OyI+DQogIDxzdHlsZT4NCiAgICAuc3Qze2ZpbGw6bm9uZTtzdHJva2U6IzQ1NDEzYztzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tl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LTIgMmgtMy41Yy0uNyAwLTEuMi42LTEuMiAxLjJ2MS45YzAgLjcuNiAxLjIgMS4yIDEuMmgxMWMuNyAwIDEuMi0uNiAxLjItMS4yVjkuM2MwLS43LS42LTEuMi0xLjItMS4ySDI2eiIgY2xhc3M9InN0MyIvPg0KICAgICAgPHBhdGggaWQ9IlhNTElEXzE3NTAzXyIgZD0iTTE1LjQgMTYuM2g2LjIiIGNsYXNzPSJzdDMiLz4NCiAgICAgIDxwYXRoIGlkPSJYTUxJRF8xNzUwMl8iIGQ9Ik0xNS40IDM0LjRoNi4yIiBjbGFzcz0ic3QzIi8+DQogICAgICA8cGF0aCBpZD0iWE1MSURfMTc1MDFfIiBkPSJNMTUuNCAyMGgxNC41IiBjbGFzcz0ic3QzIi8+DQogICAgICA8cGF0aCBpZD0iWE1MSURfMTc1MDBfIiBkPSJNMTUuNCAyMy4zaDE0LjUiIGNsYXNzPSJzdDMiLz4NCiAgICAgIDxwYXRoIGlkPSJYTUxJRF8xNzQ5OV8iIGQ9Ik0xNS40IDI2LjloMTQuNSIgY2xhc3M9InN0MyIvPg0KICAgIDwvZz4NCiAgPC9nPg0KPC9zdmc+
// ==/UserScript==

(function() {
    'use strict';

    // check if GPT button exists
    function isNewButtonAdded() {
      return document.getElementById("newButton") !== null;
    }

    // inject GPT Button
    function injectGPT() {
      // Check if the button has already been added
        if (!isNewButtonAdded()) {
            var newButton = document.createElement("div");
            newButton.className = "btn bg-green-80 bg-green-hover r-bg-light r-bg-light-hover r-text-dark ml-2 lh-close mb-2 mb-sm-0 align-self-start";
            newButton.textContent = "Copy and open ChatGPT";
            newButton.id = "newButton";

            // Add event listener to copy text and open "chat.openai.com" in a new tab
            newButton.addEventListener("click", function() {
                // Copy text from elements with class ".question-text"
                var questionTextElements = document.querySelectorAll(".question-text");
                var copiedText = Array.from(questionTextElements).map(element => element.textContent).join('\n');

                // Copy text to clipboard
                var tempInput = document.createElement("textarea");
                tempInput.value = copiedText;
                document.body.appendChild(tempInput);
                tempInput.select();
                document.execCommand("copy");
                document.body.removeChild(tempInput);

                // Open "chat.openai.com" in a new tab
                window.open("https://chat.openai.com", "_blank");
            });

            // Insert the new button before the last div in the existing div
            var existingDiv = document.querySelector(".column");
            existingDiv.insertBefore(newButton, existingDiv.lastElementChild);
        }
    }

    // wait for body to click
    document.addEventListener('click', function() {
    setInterval(injectGPT, 500);
    });

    // remove retarded "onpaste" disable func
function removePaste() {
    var elements = document.querySelectorAll('.answer-text');
    elements.forEach(function(element) {
        element.removeAttribute('onpaste');
    });
}
// check every .5s for new boxess
setInterval(removePaste, 500);

})();