CodeHS Cheat

Funny

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         CodeHS Cheat
// @namespace    http://tampermonkey.net/
// @version      2024-05-29 v6 skibidi version
// @description  Funny
// @author       Anghel sefu la bani
// @match        https://codehs.com/student/*/assignment/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=codehs.com
// @grant    GM_setClipboard
// @license MIT
// ==/UserScript==

(function() {

    function cleanHTMLString(htmlString) {
    // Remove comments
    htmlString = htmlString.replace(/<!--[\s\S]*?-->/g, '');

    // Remove <noscript> tags and their content
    htmlString = htmlString.replace(/<noscript[\s\S]*?<\/noscript>/gi, '');

    // Remove <script> tags inside the <head> section
    htmlString = htmlString.replace(/(<head[\s\S]*?>[\s\S]*?)<script[\s\S]*?<\/script>/gi, (match, p1) => {
        // Remove <script> tags from the <head> section content
        return p1.replace(/<script[\s\S]*?<\/script>/gi, '');
    });

    // Clean com

    return `<!DOCTYPE html>\n` + htmlString;
}
    'use strict';
    let htmlc;

    console.log("FUNNY SKIBIDI LOADED");

    const textField = document.querySelector('.ace_text');
    const ace_content = document.querySelector('.ace_content');
    const text_area = document.querySelector('.ace_text-input');
    const xbutton = document.querySelector('.start-ex-button');
    const iframe = document.querySelector('.sample-sols');

    window.addEventListener('load', function () {

        const secondHTML = iframe.contentDocument || iframe.contentWindow.document;

        console.log(secondHTML.children[0]);
        const HTMLCode = secondHTML.children[0].outerHTML;
        htmlc = cleanHTMLString(HTMLCode);
        console.log(htmlc);
        GM_setClipboard (htmlc);
        console.log("CODE COPIED");
        xbutton.click();

        setTimeout(part2, 500);
    });

    function part2() {
        text_area.focus();
    }
})();