Greasy Fork

Greasy Fork is available in English.

Google Classroom Mod Menu

Adds a mod menu to Google Classroom for customization options like active teacher mode, dark mode, custom background, and more.

当前为 2024-05-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Google Classroom Mod Menu
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a mod menu to Google Classroom for customization options like active teacher mode, dark mode, custom background, and more.
// @author       Iron web10
// @match        https://classroom.google.com/*
// @grant        GM_addStyle
// @license      Iron web10 2024
// ==/UserScript==

(function() {
    'use strict';

    // Dark mode styles
    const darkModeStyles = `
        body {
            background-color: #1f1f1f !important;
            color: #dcdcdc !important;
        }
        .gb_Se {
            filter: invert(100%);
        }
        .a1.k4 {
            background-color: #333 !important;
            color: #dcdcdc !important;
        }
        .EtsOFe, .YruFPd, .ndPJde, .V1Ppcd, .e1wNvd, .tISbR, .UPA8G, .Vwe4Vd, .oXZRF, .DbHTOc, .mRXlrd, .kacFif {
            background-color: #333 !important;
            border-color: #666 !important;
            color: #dcdcdc !important;
        }
    `;

    // Custom background image
    let backgroundImageURL = ''; // Add URL of custom background image

    // Function to toggle dark mode
    function toggleDarkMode() {
        const body = document.querySelector('body');
        body.classList.toggle('dark-mode');
        if (body.classList.contains('dark-mode')) {
            GM_addStyle(darkModeStyles);
        } else {
            GM_addStyle('');
        }
    }

    // Function to set custom background
    function setCustomBackground() {
        backgroundImageURL = prompt('Enter URL of custom background image:');
        const body = document.querySelector('body');
        if (backgroundImageURL) {
            body.style.backgroundImage = `url(${backgroundImageURL})`;
            body.style.backgroundSize = 'cover';
            body.style.backgroundRepeat = 'no-repeat';
        } else {
            body.style.backgroundImage = 'none';
        }
    }

    // Function to remove class value
    function removeClassValue() {
        const body = document.querySelector('body');
        if (body) {
            body.removeAttribute('class');
        }
    }

    // Function to set URL for background
    function setURLForBackground() {
        const url = prompt('Enter URL for background:');
        const div = document.querySelector('.PFLqgc.KFl4Z');
        if (div) {
            div.style.backgroundImage = `url(${url})`;
        }
    }

    // Function to save changes
    function saveChanges() {
        // You can implement your save functionality here
        alert('Changes saved!');
    }

    // Function to reset changes
    function resetChanges() {
        // You can implement your reset functionality here
        alert('Changes reset!');
    }

    // Create mod menu
    function createModMenu() {
        const modMenu = document.createElement('div');
        modMenu.setAttribute('id', 'mod-menu');
        modMenu.style.position = 'fixed';
        modMenu.style.top = '10px';
        modMenu.style.right = '10px';
        modMenu.style.zIndex = '9999';
        modMenu.style.backgroundColor = '#333';
        modMenu.style.padding = '10px';
        modMenu.style.border = '1px solid #ccc';
        modMenu.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
        modMenu.style.borderRadius = '5px';

        // Dark mode toggle button
        const darkModeBtn = document.createElement('button');
        darkModeBtn.textContent = 'Toggle Dark Mode';
        darkModeBtn.addEventListener('click', toggleDarkMode);
        darkModeBtn.style.backgroundColor = '#666';
        darkModeBtn.style.color = '#dcdcdc';
        darkModeBtn.style.border = 'none';
        darkModeBtn.style.padding = '5px 10px';
        darkModeBtn.style.marginBottom = '10px';
        darkModeBtn.style.cursor = 'pointer';
        darkModeBtn.style.borderRadius = '3px';

        // Custom background button
        const setBackgroundBtn = document.createElement('button');
        setBackgroundBtn.textContent = 'Set Custom Background';
        setBackgroundBtn.addEventListener('click', setCustomBackground);
        setBackgroundBtn.style.backgroundColor = '#666';
        setBackgroundBtn.style.color = '#dcdcdc';
        setBackgroundBtn.style.border = 'none';
        setBackgroundBtn.style.padding = '5px 10px';
        setBackgroundBtn.style.marginBottom = '10px';
        setBackgroundBtn.style.cursor = 'pointer';
        setBackgroundBtn.style.borderRadius = '3px';

        // Set Dev button
        const setDevBtn = document.createElement('button');
        setDevBtn.textContent = 'Set Dev';
        setDevBtn.addEventListener('click', removeClassValue);
        setDevBtn.style.backgroundColor = '#666';
        setDevBtn.style.color = '#dcdcdc';
        setDevBtn.style.border = 'none';
        setDevBtn.style.padding = '5px 10px';
        setDevBtn.style.marginBottom = '10px';
        setDevBtn.style.cursor = 'pointer';
        setDevBtn.style.borderRadius = '3px';

        // Set URL for background button
        const setURLBtn = document.createElement('button');
        setURLBtn.textContent = 'Set URL for Background';
        setURLBtn.addEventListener('click', setURLForBackground);
        setURLBtn.style.backgroundColor = '#666';
        setURLBtn.style.color = '#dcdcdc';
        setURLBtn.style.border = 'none';
        setURLBtn.style.padding = '5px 10px';
        setURLBtn.style.marginBottom = '10px';
        setURLBtn.style.cursor = 'pointer';
        setURLBtn.style.borderRadius = '3px';

        // Save changes button
        const saveChangesBtn = document.createElement('button');
        saveChangesBtn.textContent = 'Save Changes';
        saveChangesBtn.addEventListener('click', saveChanges);
        saveChangesBtn.style.backgroundColor = '#666';
        saveChangesBtn.style.color = '#dcdcdc';
        saveChangesBtn.style.border = 'none';
        saveChangesBtn.style.padding = '5px 10px';
        saveChangesBtn.style.marginBottom = '10px';
        saveChangesBtn.style.cursor = 'pointer';
        saveChangesBtn.style.borderRadius = '3px';

        // Reset changes button
        const resetChangesBtn = document.createElement('button');
        resetChangesBtn.textContent = 'Reset Changes';
        resetChangesBtn.addEventListener('click', resetChanges);
        resetChangesBtn.style.backgroundColor = '#666';
        resetChangesBtn.style.color = '#dcdcdc';
        resetChangesBtn.style.border = 'none';
        resetChangesBtn.style.padding = '5px 10px';
        resetChangesBtn.style.marginBottom = '10px';
        resetChangesBtn.style.cursor = 'pointer';
        resetChangesBtn.style.borderRadius = '3px';

        modMenu.appendChild(darkModeBtn);
        modMenu.appendChild(setBackgroundBtn);
        modMenu.appendChild(setDevBtn);
        modMenu.appendChild(setURLBtn);
        modMenu.appendChild(saveChangesBtn);
        modMenu.appendChild(resetChangesBtn);

        document.body.appendChild(modMenu);
    }

    // Initialize mod menu
    createModMenu();
})();