Google Classroom Dark Mode

Enables dark mode for Google Classroom.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Google Classroom Dark Mode
// @description  Enables dark mode for Google Classroom.
// @version      1.0
// @icon         https://www.google.com/favicon.ico
// @author       blank
// @namespace    https://google.com
// @match        https://classroom.google.com/*
// @run-at       document-start
// @license      MIT
// ==/UserScript==
(function() {
    "use strict";
 
    const log = console.log;
 
    // Get the dark mode setting.
    const darkModeSetting = localStorage.getItem("darkMode");
 
    // If the dark mode setting is enabled, set the dark mode property of the document to true.
    if (darkModeSetting === "true") {
        document.documentElement.classList.add("dark");
    }
 
    // Listen for the change event on the dark mode setting.
    document.querySelector("#darkMode").addEventListener("change", () => {
 
        // Get the new value of the dark mode setting.
        const newDarkModeSetting = document.querySelector("#darkMode").checked;
 
        // Set the dark mode property of the document to the new value.
        document.documentElement.classList.toggle("dark", newDarkModeSetting);
 
        // Save the new value of the dark mode setting.
        localStorage.setItem("darkMode", newDarkModeSetting);
    });
})();