Paste Essays(editable) (Acellus)

Essays are kinda dead to me

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Paste Essays(editable) (Acellus)
// @namespace    https://github.com/YeesterPlus
// @version      1.0
// @description  Essays are kinda dead to me
// @author       YeesterPlus
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=acellus.com
// @match        https://admin192a.acellus.com/student/*
// @grant        none
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @run-at       document-end
// ==/UserScript==
(function() {
    'use strict';

    // Define the text to be typed
    var textToType = "Paste here";

     // Function to simulate typing as a user
    function typeTextAsUser(element, text) {
        var index = 0;
        var event = new KeyboardEvent('keydown', { key: '', code: '' });
        var inputEvent = new Event('input', { bubbles: true });

        var interval = setInterval(function() {
            // Simulate typing one character at a time
            element.textContent += text.charAt(index);
            element.dispatchEvent(inputEvent);
            element.dispatchEvent(event);
            index++;

            // Stop typing when text is fully typed
            if (index >= text.length) {
                clearInterval(interval);
            }
        }, 5); // Very fast typing speed
    }

    // Function to open the popup
    async function openPopup() {
        typeTextAsUser(document.activeElement, await navigator.clipboard.readText());
    }

    // Add event listener for when text inputs gain focus
    document.onkeydown = function interceptKeys(evt) {
    evt = evt||window.event // IE support
    var c = evt.keyCode
    var ctrlDown = evt.ctrlKey||evt.metaKey // Mac support

    // Check for Alt+Gr (http://en.wikipedia.org/wiki/AltGr_key)
    if (ctrlDown && evt.altKey) return true

    // Check for ctrl+c, v and x
    if (ctrlDown && c==86) openPopup() // v

    // Otherwise allow
    return true
} // Use capture phase to ensure event is caught before any other handlers

})();