Daymap Graphics

Some better graphics for QASMT Daymap. Allows for much more customisation.

目前為 2022-06-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Daymap Graphics
// @namespace    mailto:[email protected]
// @version      7.0.0
// @description  Some better graphics for QASMT Daymap. Allows for much more customisation.
// @author       apate98
// @match        https://*.daymap.net/*
// @icon         https://www.google.com/s2/favicons?domain=daymap.net
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==

// Changelog
// 6.0.0: Added changelog and introduced compatibility for Daymap's timetable view.
// 6.0.1: Fixed a problem where opacity is reversed in timetable view.
// 6.0.2: Changed the manual background change to apply to underlay rather than body. Increased speed of underlay rainbow.
// 6.0.3: Allowed manual changing of the attendance indicator colour to anything, replacing the old background-color with background.
// 6.1.0: Allows blurring behind the foreground cards, giving a glassy effect.
// 6.1.1: Made header also change opacity and made logo transparent.
// 7.0.0: Removed all jQuery usage to enable compatibility with new Daymap. Also basically rewrote a bunch of code to work with new Daymap.

// Credits and thanks:
// Special thanks to Kelvin for troubleshooting many issues when transferring to the new Daymap, whom without I could not have solved any of the problems.

// Compatible pages:
// Feed View
// Timetable
// Mobile Daymap
// My Details

// Tips:
// Change the Daymap.Web_DaymapIdentityCookie cookie expiry date to 2038-01-18T18:14:07.000Z every time you log into Daymap. Daymap Graphics cannot do this automatically as the cookie is HTTP only, and creating another cookie witht the same data can lock a person out of Daymap.

// Known issues:
// When changing messages pages, the messages are opaque.

// TODO:
// Presets
// Change homework page opacity
// Change summary/portfolio page opacity
// Make diary look a bit nicer
// Change class list opacity
// Change task finder opacity
// Change results page opacity
// Change schedule page opacity
// Change my messages page opacity
// Change my calendars page opacity
// Add option to revert Daymap to original layout


//jshint esversion:6

// Local storage functions by DY on Khan Academy
var storage;
(function() {
    storage = localStorage;
})();

function getItem(key) {
    if(storage != undefined) {
        return storage.getItem(key);
    }
    storage = this.localStorage;
    return null;
}

function setItem(key, value) {
    if(storage != undefined) {
        storage.setItem(key, value);
    } else {
        storage = this.localStorage;
    }
}

function rainbowMove(val1, val2, val3, val4, val5, speed) {
    speed = speed ? speed : 1;
    val1 += (Math.random() - val4) * speed;
    val2 += (Math.random() - val5) * speed;
    val1 = val1 < 0 ? 0 : val1 > 410 ? 410 : val1;
    val2 = val2 < 0 ? 0 : val2 > 410 ? 410 : val2;
    return [val1, val2, val3, val4, val5];
}

function constrain(num, min, max) {
    return num < min ? min : num > max ? max : num;
}


var lessonStart;
var lessonEnd;

function timeOfDiaryEl(lessonEl) {
    if(lessonEl.innerText.substr(1, 1) === ":" && lessonEl.innerText.substr(12, 1) !== ":") {
        lessonStart = lessonEl.innerText.substr(0, 1) + lessonEl.innerText.substr(2, 2);
        lessonEnd = lessonEl.innerText.substr(11, 2) + lessonEl.innerText.substr(14, 2);
        if(lessonEl.innerText.substr(5, 1) === "P") {
            lessonStart = Number(lessonStart) + 1200;
        }
    }
    if(lessonEl.innerText.substr(1, 1) === ":" && lessonEl.innerText.substr(12, 1) === ":") {
        lessonStart = lessonEl.innerText.substr(0, 1) + lessonEl.innerText.substr(2, 2);
        lessonEnd = lessonEl.innerText.substr(11, 1) + lessonEl.innerText.substr(13, 2);
        if(lessonEl.innerText.substr(5, 1) === "P") {
            lessonStart = Number(lessonStart) + 1200;
        }
        if(lessonEl.innerText.substr(16, 1) === "P") {
            lessonEnd = Number(lessonEnd) + 1200;
        }
    }
    if(lessonEl.innerText.substr(1, 1) !== ":" && lessonEl.innerText.substr(13, 1) !== ":") {
        lessonStart = lessonEl.innerText.substr(0, 2) + lessonEl.innerText.substr(3, 2);
        lessonEnd = lessonEl.innerText.substr(12, 2) + lessonEl.innerText.substr(15, 2);
    }
    if(lessonEl.innerText.substr(1, 1) !== ":" && lessonEl.innerText.substr(13, 1) === ":") {
        lessonStart = lessonEl.innerText.substr(0, 2) + lessonEl.innerText.substr(3, 2);
        lessonEnd = lessonEl.innerText.substr(12, 1) + lessonEl.innerText.substr(14, 2);
        if(lessonEl.innerText.substr(17, 1) === "P") {
            lessonEnd = Number(lessonEnd) + 1200;
        }
    }
    return [lessonStart, lessonEnd];
}

// By joshuacockrell based on a post by Maxwell Collard and edited by Mahdi
function randn_bm() {
    let u = 0, v = 0;
    while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
    while(v === 0) v = Math.random();
    let num = Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
    num = num / 10.0 + 0.5; // Translate to 0 -> 1
    if (num > 1 || num < 0) return randn_bm(); // resample between 0 and 1
    return num;
}

var attendanceColour = "#7FFFD4";
var bodyColour = "#ABCDEF";
var cardColour = "#E6E6E6";
var date;
var classEls = [];
var i;
var anything = [];
const animatedPhotoLinks = [5097557231353856, 6056784221388800, 5537046336684032];
const animatedPhotoLinks2 = [5097557231353856, 6056784221388800, 4617381095718912];
var r50d = [];



(function() {
    'use strict';
    document.querySelector("body").style.fontFamily='Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif';
    document.querySelector("head").innerHTML += `<style>
            #toolbox {
                top: 15vh;
                left: 20vw;
                background-color: rgba(229, 229, 229, 0.8);
                position: fixed;
                width: 60vw;
                height: 70vh;
                padding: 50px;
                border-width: 50px;
                border-image: linear-gradient(red, yellow);
            }
            #closeToolbox {
                float: right;
                color: rgb(200, 200, 200);
                font-size: 2.5vw;
                cursor: pointer;
                background-color: rgba(255, 255, 255, 0.6);
                border-radius: 50%;
                width: 2.5vw;
                height: 2.5vw;
                text-align: center;
                vertical-align: baseline;
                line-height: 2.3vw;
            }
            #reloadBtn {
                position: absolute;
                bottom: 2vw;
                background-image: radial-gradient(100% 100% at 100% 0, #5adaff 0, #5468ff 100%);
                border: 0;
                border-radius: 4.25%;
                width: 15vw;
                height: 4vh;
                color: white;
                cursor: pointer;
            }
            #bodyBackground, #additionalCSS {
                display:inline-block;
                width:100%;
            }
       </style>`;
    {
        let toolbox = document.createElement("div");
        toolbox.innerHTML = `<div id='closeToolbox'>×</div>
            <div>
                <form oninput='blurAmount.value=parseFloat(blur.value)'>
                    Opacity: <input id='translucent' type='range' min='0' max='1' step='0.001'></input><br/>
                    Blur amount: <input id='blur' type='range' min='0' max='50' step='0.1' name='blur'></input>
                    <input id='blurAmount' name='blurAmount' readonly='true' style='background-color:light-gray;'></input><br/>
                    Auto animated photo:<input id='autoAnimatedPhoto' type='checkbox'></input><br/>
                    Auto attendance rainbow:<input id='autoAttendanceRainbow' type='checkbox'></input><br/>
                    Animated profile project id:&nbsp;<input id='animatedProfileProjectId' type='number'></input><br/>
                    Auto body background:<input id='autoBackground' type='checkbox'/><br/>
                    Body background CSS property (value only):<input type='text' id='bodyBackground'/><br/>
                    Additional CSS (CSS style declaration):<textarea id='additionalCSS' rows='3'></textarea>
                </form>
            </div>
            <button id='reloadBtn'>&nbsp;Apply changes and reload page</button>`;
        toolbox.setAttribute("id","toolbox");
        toolbox.style.display = "none";
        document.querySelector(".main-layout").appendChild(toolbox);
    }
    document.querySelector("head").innerHTML += "<style id='customStyles'></style>";
    var tools = setInterval(function() {if(document.querySelector("li[menu-id='60']")) {document.querySelector("li[menu-id='60']").parentNode.innerHTML = "<tr><div class='tools' style='border-left: 2px solid #a0d7f1; text-align: left; padding: 7px 11px;' onclick='document.getElementById(`toolbox`).style.display = `block`;'>Daymap Graphics Command Center</div></div></tr><style>.tools:hover{background-color:#e5e5e5}</style>"; clearInterval(tools);}}, 50);
    {
        let bodyUnderlay = document.createElement("div");
        bodyUnderlay.setAttribute("id", "bodyUnderlay");
        document.querySelector("head").innerHTML += "<style>#bodyUnderlay {position: fixed; width: 100%; height: 100%; top: 0; z-index: -2147483647;}</style>";
        document.querySelector("#ctl00_mainBody").appendChild(bodyUnderlay);
    }
    document.querySelector("#reloadBtn").innerHTML = '<svg width="0.75vw" height="0.75vw" viewBox="0 0 24 24" class="_18zn2ntb"><path fill="currentColor" d="M18.071 18.644c-3.532 3.232-9.025 3.13-12.452-.297a9.014 9.014 0 0 1-2.636-6.866 1 1 0 0 1 1.997.105 7.014 7.014 0 0 0 2.053 5.346c2.642 2.642 6.856 2.747 9.606.31h-1.81a1 1 0 1 1 0-2h4.242a1 1 0 0 1 1 1v4.243a1 1 0 0 1-2 0v-1.84zM7.361 6.757h1.81a1 1 0 0 1 0 2H4.93a1 1 0 0 1-1-1V3.515a1 1 0 1 1 2 0v1.84c3.532-3.231 9.025-3.13 12.452.298a9.014 9.014 0 0 1 2.636 6.866 1 1 0 1 1-1.997-.105 7.014 7.014 0 0 0-2.053-5.346c-2.642-2.642-6.856-2.747-9.606-.31z"></path></svg>' + document.querySelector("#reloadBtn").innerHTML;
    document.querySelector("#blurAmount").value = getItem("blurAmount");
    document.querySelector("#animatedProfileProjectId").value = getItem("animatedProfileProjectId");
    document.querySelector("#bodyBackground").value = getItem("bodyBackground");
    document.querySelector("#translucent").setAttribute("value", getItem("translucentMode"));
    document.querySelector("#blur").setAttribute("value", getItem("blurAmount"));
    if(getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto")) {
        document.querySelector("#autoAnimatedPhoto").setAttribute("checked", 1);
    }
    if(getItem("autoAttendanceRainbow") != 0 && getItem("autoAttendanceRainbow")) {
        document.querySelector("#autoAttendanceRainbow").setAttribute("checked", 1);
    }
    if(getItem("autoBackground") != 0 && getItem("autoBackground")) {
        document.querySelector("#autoBackground").setAttribute("checked", 1);
        if(getItem("bodyBackground") != "" && getItem("bodyBackground") != undefined) {
            document.querySelector("#bodyUnderlay").style.background=getItem("bodyBackground");
            if(getItem("bodyBackground") === "linear-gradient(to bottom right, yellow, black, black, black)") {
                document.querySelector("#bodyUnderlay").innerHTML += "<style></style>";
                for(i = 0; i < 500; i ++) {
                    anything[0] = Math.random() * 7.5;
                    anything[1] = randn_bm() * 255;
                    anything[2] = Math.random() * 100;
                    anything[3] = Math.random() * 100;
                    anything[4] = Math.random() + 1;
                    anything[5] = (Math.random() - 0.5) * 90;
                    if(anything[2] < 37.5 && anything[3] < 37.5) {
                        continue;
                    }
                    document.querySelector("#bodyUnderlay").innerHTML += "<div class='r50d' style='width:" + anything[0] + "px;height:" + anything[0] + "px;top:" + anything[2] + "vh;left:" + anything[3] + "vw;position:absolute;border-radius:" + constrain(randn_bm() * 50, 0, 50) + "%;background-color:rgba(" + constrain(anything[1] * anything[4], 0, 255) + ", " + constrain((anything[1] > 127.5 ? (127.5 - anything[1]) : anything[1]) * anything[4], 0, 255) + ", " + constrain((255 - anything[1]) * anything[4], 0, 255) + ", " + Math.random() / 1.5 +");transform:rotate("+ anything[5] + "deg);'></div>";
                    r50d.push("1," + Math.random() / 100 + "," + anything[5] + "," + (randn_bm() - 0.5) * 15);
                }
            }
            if(getItem("bodyBackground") === "url('https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB_p0PncTtkrhaNDZtntrE3gKkoYw')") {
                setItem("bodyBackground", "black url('https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB_p0PncTtkrhaNDZtntrE3gKkoYw')");
                window.location.href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
            }
        }
    }
    document.querySelector("#customStyles").innerText = getItem("additionalCSS");
    document.querySelector("#additionalCSS").value = getItem("additionalCSS");
    i = 0;

    setInterval(function() {
        for(i = 0; i < document.querySelectorAll(".r50d").length; i++) {
            document.querySelectorAll(".r50d")[i].style.transform = "scale(" + r50d[i].split(",")[0] + ", " + r50d[i].split(",")[0] + ") rotate(" + r50d[i].split(",")[2] + "deg)";
            r50d[i] = (parseFloat(r50d[i].split(",")[0]) + parseFloat(r50d[i].split(",")[1])) + "," + (parseFloat(r50d[i].split(",")[0]) >= 1.1 ? Math.abs(parseFloat(r50d[i].split(",")[1])) * -1 : parseFloat(r50d[i].split(",")[0]) <= 0.9 ? Math.abs(r50d[i].split(",")[1]) : parseFloat(r50d[i].split(",")[1])) + "," + (parseFloat(r50d[i].split(",")[2]) + parseFloat(r50d[i].split(",")[3])) + "," + parseFloat(r50d[i].split(",")[3]); i = i >= r50d.length - 1 ? 0 : i + 1;
        }
    }, 30);

    document.querySelector("#closeToolbox").addEventListener("click", function() {
        document.querySelector("#toolbox").style.display = "none";
    });
    document.querySelector("#reloadBtn").addEventListener("click", function() {
        setItem("animatedProfileProjectId", document.querySelector("#animatedProfileProjectId").value);
        setItem("bodyBackground", document.querySelector("#bodyBackground").value);
        setItem("translucentMode", document.querySelector("#translucent").value);
        setItem("additionalCSS", document.querySelector("#additionalCSS").value);
        setItem("blurAmount", document.querySelector("#blur").value);
    });
    document.querySelector("#autoAnimatedPhoto").addEventListener("click", function() {setItem("autoAnimatedPhoto", getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto") ? 0 : 1);});
    document.querySelector("#autoAttendanceRainbow").addEventListener("click", function() {setItem("autoAttendanceRainbow", getItem("autoAttendanceRainbow") != 0 ? 0 : 1);});
    document.querySelector("#autoBackground").addEventListener("click", function() {setItem("autoBackground", getItem("autoBackground") != 0 && getItem("autoBackground") ? 0 : 1);});
    if (!document.querySelector(".sdIndicator")) {
        document.querySelector(".StudentBox > table > tbody").innerHTML += ('<tr><td colspan="3"><div id="divIndicators"><div><div class="sdIndicator" title="Term" style="background-color:#65EC0B">100</div><div class="sdCap">Attendance Tracking</div></div></div></td></tr>');
        document.querySelector(".sdIndicator").innerHTML += ("<style>.sdIndicator{color: #302F46;font-size: 16pt;width: 50px;height: 50px;border-radius: 25px;text-align: center;vertical-align: baseline;margin-left: auto;margin-right: auto;line-height: 50px;}</style>");
    }
    for(i = 0; i < document.querySelectorAll(".itm .Error").length; i ++) {
        document.querySelectorAll(".itm .Error")[i].innerText = "Uh did you submit on Turnitin or something?";
    }
    var attendanceEl = document.querySelector(".sdIndicator");
    attendanceEl.classList.add("attendance");
    var cardEl = document.querySelector(".diaryDay");
    var attendanceRainbow = [0, 0, 0, 0.5, 0.5];
    var attendanceRainbow1 = [400, 5, 0, 0.5, 0.5];
    var attendanceRainbow2 = [210, 350, 0, 0.5, 0.5];
    var bodyRainbow = [200, 200, 0, 0.5, 0.5];
    var cardRainbow = [200, 200, 0, 0.5, 0.5];
    // Colour from numbers function by Weather on Khan Academy
    setInterval(function(){attendanceRainbow = rainbowMove(attendanceRainbow[0], attendanceRainbow[1], attendanceRainbow[2], attendanceRainbow[3], attendanceRainbow[4] , 15); attendanceRainbow1 = rainbowMove(attendanceRainbow1[0], attendanceRainbow1[1], attendanceRainbow1[2], attendanceRainbow1[3], attendanceRainbow1[4] , 15); attendanceRainbow2 = rainbowMove(attendanceRainbow2[0], attendanceRainbow2[1], attendanceRainbow2[2], attendanceRainbow2[3], attendanceRainbow2[4] , 15)}, 10);
    setInterval(function(){if(attendanceRainbow[2]) {document.querySelector(".attendance").style.backgroundImage = "linear-gradient(" + attendanceRainbow[0] + "deg, rgb(" + bodyRainbow[0] + "," + (400 - attendanceRainbow1[0] + attendanceRainbow1[1]) / 2.5 + "," + (400 - attendanceRainbow1[1]) + ") -75%, rgb(" + attendanceRainbow[0] + "," + (400 - attendanceRainbow[0] + attendanceRainbow[1]) / 2.5 + "," + (400 - attendanceRainbow[1]) + ") 50%, rgb(" + attendanceRainbow2[0] + "," + (400 - attendanceRainbow2[0] + attendanceRainbow2[1]) / 2.5 + "," + (400 - attendanceRainbow2[1]) + ") 175%)";}}, 10);
    setInterval(function(){attendanceRainbow[3] = Math.random() / 2 + 0.25; attendanceRainbow[4] = Math.random() / 2 + 0.25; attendanceRainbow1[3] = Math.random() / 2 + 0.25; attendanceRainbow1[4] = Math.random() / 2 + 0.25; attendanceRainbow2[3] = Math.random() / 2 + 0.25; attendanceRainbow2[4] = Math.random() / 2 + 0.25;}, 5000);
    setInterval(function(){bodyRainbow = rainbowMove(bodyRainbow[0], bodyRainbow[1], bodyRainbow[2], bodyRainbow[3], bodyRainbow[4] , 10)}, 10);
    setInterval(function(){if(bodyRainbow[2]) {document.querySelector("#bodyUnderlay").style.backgroundColor = "rgb(" + bodyRainbow[0] + "," + (400 - bodyRainbow[0] + bodyRainbow[1]) / 2.5 + "," + (400 - bodyRainbow[1]) + ")";}}, 10);
    setInterval(function(){bodyRainbow[3] = Math.random() / 2 + 0.25; bodyRainbow[4] = Math.random() / 2 + 0.25;}, 2000);
    setInterval(function(){cardRainbow = rainbowMove(cardRainbow[0], cardRainbow[1], cardRainbow[2], cardRainbow[3], cardRainbow[4] , 10)}, 10);
    setInterval(function(){if(cardRainbow[2]) {cardEl.style.backgroundColor = "rgb(" + cardRainbow[0] + "," + (400 - cardRainbow[0] + cardRainbow[1]) / 2.5 + "," + (400 - cardRainbow[1]) + ")";}}, 10);
    setInterval(function(){cardRainbow[3] = Math.random() / 2 + 0.25; cardRainbow[4] = Math.random() / 2 + 0.25;}, 5000);
    attendanceRainbow[2] = getItem("autoAttendanceRainbow") != 0 && getItem("autoAttendanceRainbow") ? 1 : 0;
    attendanceEl.addEventListener("click", function() {
        attendanceColour = prompt("Please enter a colour", "#7FFFD4");
        if (attendanceColour && attendanceColour != "RAINBOW") {
            attendanceRainbow[2] = 0;
            attendanceEl.style.backgroundImage = "";
            attendanceEl.style.background = attendanceColour;
        } else if (attendanceColour === "RAINBOW") {
            attendanceRainbow[2] = 1;
        }
    });
    if(cardEl) {
        cardEl.addEventListener("click", function() {
            cardColour = prompt("Please enter a colour", "#7FFFD4");
            if (cardColour && cardColour != "RAINBOW") {
                cardRainbow[2] = 0;
                cardEl.style.backgroundColor = cardColour;
            } else if (cardColour === "RAINBOW") {
                cardRainbow[2] = 1;
            }
        });
    }
    if(document.querySelector(".diaryWeek")) {
        document.querySelector(".diaryWeek").addEventListener("click", function() {
            alert("rgb(" + attendanceRainbow[0] + "," + (400 - attendanceRainbow[0] + attendanceRainbow[1]) / 2.5 + "," + (400 - attendanceRainbow[1]) + ")");
        });
    }
    if(document.querySelector(".diaryDay")) {
        switch(Date().substr(4, 3)) {
            case "Jan":
                date = Date().substr(11, 4) + "-01-" + Date().substr(8, 2);
                break;
            case "Feb":
                date = Date().substr(11, 4) + "-02-" + Date().substr(8, 2);
                break;
            case "Mar":
                date = Date().substr(11, 4) + "-03-" + Date().substr(8, 2);
                break;
            case "Apr":
                date = Date().substr(11, 4) + "-04-" + Date().substr(8, 2);
                break;
            case "May":
                date = Date().substr(11, 4) + "-05-" + Date().substr(8, 2);
                break;
            case "Jun":
                date = Date().substr(11, 4) + "-06-" + Date().substr(8, 2);
                break;
            case "Jul":
                date = Date().substr(11, 4) + "-07-" + Date().substr(8, 2);
                break;
            case "Aug":
                date = Date().substr(11, 4) + "-08-" + Date().substr(8, 2);
                break;
            case "Sep":
                date = Date().substr(11, 4) + "-09-" + Date().substr(8, 2);
                break;
            case "Oct":
                date = Date().substr(11, 4) + "-10-" + Date().substr(8, 2);
                break;
            case "Nov":
                date = Date().substr(11, 4) + "-11-" + Date().substr(8, 2);
                break;
            case "Dec":
                date = Date().substr(11, 4) + "-12-" + Date().substr(8, 2);
                break;
        }
        var time = Number(Date().substr(16, 2) + Date().substr(19, 2));
        var lessonEls = [document.querySelector(".diaryDay[data-date='"+date+"']").nextSibling, document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[1], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[2], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[3], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[4], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[5]];
        var lessonEl;

        i = 0;
        while (!lessonEl && i < 10) {
            if (lessonEls[i]) {
                if (timeOfDiaryEl(lessonEls[i])[0] < time && timeOfDiaryEl(lessonEls[i])[1] >= time) {
                    lessonEl = lessonEls[i];
                }
            }
            i ++;
        }
        var evilEl;
        for(var i = 0; i < document.querySelectorAll(".L").length; i++) {
            let something = document.querySelectorAll(".L")[i];
            if(something.childNodes[1].childNodes[0].innerText.substr(0, 3) === "ENG") {
                something.classList.add("evil");
            }
        }
        if(lessonEl != undefined) {
            lessonEl.style.transformOrigin = "50% 50%";
            lessonEl.style.borderRadius = "5px";

            lessonEl.innerHTML += "<style>@keyframes lessonAnimation {from, to {} 50% {}} .lessonEl {animation: lessonAnimation 15s infinite;}</style>";
            lessonEl.classList.add("lessonEl");
            document.querySelector(".lessonEl .t").addEventListener("click", function() {
                lessonEl.style.borderRadius = prompt("Enter the radius", "5px");
            });
        }
        document.querySelector(".evil .t").addEventListener("click", function() {
            if(confirm("Are you sure you would like to enable evil mode? You will need to refresh the page to revert this.")) {
                document.querySelector("daymap-menu div").style.backgroundColor = "rgb(85, 2, 2)";
                document.querySelector(".menu-list li").style.backgroundColor = "rgb(85, 2, 2)";
                document.querySelector(".logo-img").remove();
                document.querySelector("daymap-menu div").style.borderBottom = "rgb(0, 0, 0)";
                document.querySelector("#bodyUnderlay").style.backgroundColor = "rgb(85, 10, 10)";
                {
                    let something = document.createElement("div");
                    something.setAttribute("class", "bodyOverlay");
                    something.setAttribute("style", "background-color:rgba(113,13,13,0.5);width:100vw; height: 100vh; position:fixed;");
                    document.querySelector(".main-layout").appendChild(something);
                    document.querySelector("head").innerHTML += "<style>.bodyOverlay {background-color:rgba(113,13,13,0.5);width:100vw; height: 100vh; position:fixed;}</style>";
                }
                document.querySelector(".Toolbar").style.background = "rgb(100, 20, 20)";
                for (i = 0; i < document.querySelectorAll(".grid div").length; i++) {
                    document.querySelectorAll(".grid div")[i].style.backgroundColor = "rgb(100, 20, 40)";
                }
                for (i = 0; i < document.querySelectorAll(".msgHead .icon").length; i++) {
                    document.querySelectorAll(".msgHead icon")[i].innerText("Mua ha ha ha!");
                }
                for (i = 0; i < document.querySelectorAll(".msgHead .icon").length; i++) {
                    document.querySelectorAll(".msgHead icon")[i].nextSibling.nextSibling.innerText("Always.");
                }
                for (i = 0; i < document.querySelectorAll(".msg table tbody tr:nth-child(2) td").length; i++) {
                    document.querySelectorAll(".msg table tbody tr:nth-child(2) td")[i].innerText("Daymap bows down to my power.");
                }
            }
        });
        document.querySelector(".MasterContent table tbody tr td .Header").addEventListener("click", function() {
            bodyColour = prompt("Please enter a background", "#ABCDEF");
            if (bodyColour && bodyColour != "RAINBOW") {
                bodyRainbow[2] = 0;
                document.querySelector("#bodyUnderlay").style.background = bodyColour;
            } else if (bodyColour === "RAINBOW") {
                bodyRainbow[2] = 1;
            }
        });
    }
    if(getItem("autoBodyRainbow") && getItem("autoBodyRainbow")) {
        setTimeout(bodyRainbow[2]=1,1);
    }
    if(getItem("autoCardRainbow")) {
        setTimeout(cardRainbow[2]=1,1);
    }
    if(document.querySelector(".photoThumb, .imgProfile")) {
        if(getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto")) {
            if(getItem("animatedProfileProjectId") != 0 && getItem("animatedProfileProjectId") != "" && getItem("animatedProfileProjectId")) {
                document.querySelector(".photoThumb, .imgProfile").outerHTML = '<iframe id="programThumb"src="https://www.khanacademy.org/computer-programming/new-program/' + getItem("animatedProfileProjectId") + '/embedded?id=1631784173750-0.47024163734957236&origin=https%3A%2F%2Fqasmt.eq.daymap.net&buttons=no&embed=yes&editor=no&author=no" frameborder="0" scrolling="no" style="border: 0px; width: 120px; height: 120px;"></iframe>';
            } else {
                document.querySelector(".photoThumb, .imgProfile").outerHTML = '<iframe id="programThumb"src="https://www.khanacademy.org/computer-programming/new-program/' + animatedPhotoLinks[Math.floor(Math.random() * animatedPhotoLinks.length)] + '/embedded?id=1631784173750-0.47024163734957236&origin=https%3A%2F%2Fqasmt.eq.daymap.net&buttons=no&embed=yes&editor=no&author=no" frameborder="0" scrolling="no" style="border: 0px; width: 120px; height: 120px;"></iframe>';
            }
        }
    }

    if(getItem("translucentMode") && getItem("translucentMode") < 1) {
        for(i = 0; i < document.querySelectorAll(".card, .msg, .ditm, .Toolbar").length; i ++) {
            document.querySelectorAll(".card, .msg, .ditm, .Toolbar")[i].style.background = "rgba(255, 255, 255, " + getItem("translucentMode") + ")";
        }
        for(i = 0; i < document.querySelectorAll(".item-container").length; i ++) {
            document.querySelectorAll(".item-container")[i].style.background = "rgba(255, 255, 255, 0)";
        }
        for(i = 0; i < document.querySelectorAll(".hasDatepicker").length; i ++) {
            document.querySelectorAll(".hasDatepicker")[i].style.backgroundColor = "rgba(255, 255, 255, " + getItem("translucentMode") * 0.7 + ")";
        }
        document.querySelector(".ditm, .Toolbar").style.outline = "3px solid rgba(250, 250, 250, " + getItem("translucentMode") * 0.45 + ")";
        for(i = 0; i < document.querySelectorAll(".msg").length; i ++) {
            document.querySelector(".msg").style.border = "3px solid rgba(220, 220, 220, " + getItem("translucentMode") * 0.45 + ")";
        }
        document.querySelector("#bCalendar").style.backgroundColor = "rgba(31, 157, 217, " + getItem("translucentMode") * 1.6 + ")";
        document.querySelector("#btnDiary").style.backgroundColor = "rgba(31, 157, 217, " + getItem("translucentMode") * 1.6 + ")";

        for(i = 0; i < document.querySelectorAll(".card, .msg, .ditm, .Toolbar, .ditm .t, .ditm .c, .hasDatepicker, #tblTt tbody tr td, #tblTt tbody tr td .ttCell, .msg, #bCalendar, #btnDiary").length; i ++) {
            document.querySelectorAll(".card, .msg, .ditm, .Toolbar, .ditm .t, .ditm .c, .hasDatepicker, #tblTt tbody tr td, #tblTt tbody tr td .ttCell, .msg, #bCalendar, #btnDiary")[i].style.backdropFilter = "blur(" + getItem("blurAmount") + "px)";
        }
            window.setTimeout(function() {
            document.querySelector(".logo-img").style.marginTop = "-1.5px";
            document.querySelector(".logo-img").style.marginLeft = "43px";
            document.querySelector(".logo-img").style.width = "122px";
        }, 510);
        window.setTimeout(function() {
            document.querySelector("daymap-header").style.backgroundColor = "rgba(255, 255, 255, " + getItem("translucentMode") * 1.2 + ")";
            document.querySelector("daymap-header").style.backdropFilter = "blur(" + getItem("blurAmount") * 3 + "px)";
            for(i = 0; document.querySelector("daymap-header div ul li"); i++) {
                document.querySelectorAll("daymap-header div ul li")[i].style.backgroundColor = "rgba(255, 255, 255, " + getItem("translucentMode") * 0.8 + ")";
            }
            document.querySelector(".logo-img").setAttribute("src", "https://portal-beta.daymap.net/daymapidentity/logo.png");
        }, 500);
    }
    document.querySelector("#customStyles").innerHTML = getItem("additionalCSS");
    window.setInterval(function() {
        let length = document.querySelectorAll(".fa-mail-bulk").length;
        for(i = 0; i < length; i++) {
            document.querySelector(".fa-mail-bulk").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/post32.png'/>";
        }
        length = document.querySelectorAll(".img-container .fa-comment-alt").length;
        for(i = 0; i < length; i++) {
            document.querySelector(".img-container .fa-comment-alt").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/newmsg.png'/>";
        }
        length = document.querySelectorAll(".fa-comment-alt-dots").length;
        for(i = 0; i < length; i++) {
            document.querySelector(".fa-comment-alt-dots").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/newmsg.png'/>";
        }
        length = document.querySelectorAll(".fa-paperclip").length;
        for(i = 0; i < length; i++) {
            document.querySelector(".fa-paperclip").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/buttons/attachment.gif'/>";
        }
        for(i = 0; i < document.querySelectorAll(".msg"); i ++) {
            document.querySelectorAll(".msg")[i].style.backdropFilter = "blur(" + getItem("blurAmount") + "px)";
        }
        for(i = 0; i < document.querySelectorAll(".msg").length; i ++) {
            document.querySelectorAll(".msg")[i].style.background = "rgba(255, 255, 255, " + getItem("translucentMode") + ")";
        }
    }, 1000);
})();