Simplistic Caleb - Light

The Only Caleb Theme

// ==UserScript==
// @name         Simplistic Caleb - Light
// @namespace    http://tampermonkey.net/
// @version      1.6.2
// @description  The Only Caleb Theme
// @author       Crjase
// @match        https://caleb.btac.nsw.edu.au/*
// @grant        none
// ==/UserScript==




let near_due_date = 0;


function myLinks()
{
    // Button CSS
    const buttonStyle = `
  .button-30 {
    align-items: center;
    appearance: none;
    background-color: #FCFCFD;
    border-radius: 4px;
    border-width: 0;
    box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px,rgba(45, 35, 66, 0.3) 0 7px 13px -3px,#D6D6E7 0 -3px 0 inset;
    box-sizing: border-box;
    color: #36395A;
    cursor: pointer;
    display: inline-flex;
    font-family: "JetBrains Mono",monospace;
    height: 48px;
    justify-content: center;
    line-height: 1;
    list-style: none;
    overflow: hidden;
    padding-left: 16px;
    padding-right: 16px;
    position: relative;
    text-align: left;
    text-decoration: none;
    transition: box-shadow .15s,transform .15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    white-space: nowrap;
    will-change: box-shadow,transform;
    font-size: 18px;
  }

  .button-30:focus {
    box-shadow: #D6D6E7 0 0 0 1.5px inset, rgba(45, 35, 66, 0.4) 0 2px 4px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #D6D6E7 0 -3px 0 inset;
  }

  .button-30:hover {
    box-shadow: rgba(45, 35, 66, 0.4) 0 4px 8px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #D6D6E7 0 -3px 0 inset;
    transform: translateY(-2px);
  }

  .button-30:active {
    box-shadow: #D6D6E7 0 3px 7px inset;
    transform: translateY(2px);
  }
`
    // Creating the button stylesheet
    let stylesheet = document.createElement("style");
    stylesheet.innerHTML = buttonStyle;
    document.head.appendChild(stylesheet);

    const island = document.getElementsByClassName("small-12 island");

    // Iterate through all specific class
    for (let i=0; i<island.length; i++)
    {
        // Find the container needed
        if (island[i].innerHTML.includes("Daily Prayer"))
        {
            var linkBoard = island[i];

            // Get rid of Daily Prayer
            island[i].innerHTML = "";

            // -------- island style --------
            island[i].style.textAlign = "center";
            island[i].style.backgroundColor = "white";
            island[i].style.padding = "20px";
            // island[i].style.outline = "1px solid black";
            island[i].style.position = "relative";

            // -------->  SubHeader  <--------
            let subHeader = document.createElement("h2");
            subHeader.setAttribute("class", "subheader");
            subHeader.innerHTML = "My Link Board";
            subHeader.style.textDecoration = "underline";
            subHeader.style.fontSize = "1.5em";
            subHeader.style.fontWeight = "bold";
            linkBoard.appendChild(subHeader);
            linkBoard.appendChild(document.createElement("br"));
            linkBoard.appendChild(document.createElement("br"));

            // -------->  Add-Button  <--------
            let addButton = document.createElement("button");
            addButton.innerHTML = "+";
            addButton.style.fontWeight = "bold";
            addButton.style.fontSize = "2em";
            addButton.style.background = "none";
            addButton.style.borderRadius = "50%";
            addButton.style.width = "4vw";
            addButton.style.height = "9vh";
            addButton.style.position = "absolute";
            addButton.style.top = "0px";
            addButton.style.left = "0px";

            addButton.onmouseover = function() {
              addButton.style.backgroundColor = "white";
            }

            addButton.onmouseout = function() {
              addButton.style.backgroundColor = "transparent";
            }

            // Create a whole iframe on-top, because I like putting my self through pain
            addButton.onclick = function() {
              let container = document.createElement("div");
              container.style.position = "fixed";
              container.style.top = "0";
              container.style.left = "0";
              container.style.width = "100vw";
              container.style.height = "100vh";
              container.style.backgroundColor = "rgba(0,0,0,0.5)";
              container.style.zIndex = "10000";
              container.style.cursor = "pointer";

              container.onclick = function()
              {
                container.remove();
                window.location.reload();
              }

              let iframeContainer = document.createElement("div");
              iframeContainer.style.border = "1px solid whitesmoke";
              iframeContainer.style.backgroundColor = "rgb(255, 255, 255)";
              iframeContainer.style.width = "80%";
              iframeContainer.style.height = "80%";
              iframeContainer.style.padding = "10px";
              iframeContainer.style.position = "fixed";
              iframeContainer.style.top = "50%";
              iframeContainer.style.left = "50%";
              iframeContainer.style.transform = "translate(-50%, -50%)";
              container.appendChild(iframeContainer);

              let iframe = document.createElement("iframe");
              iframe.src = "https://caleb.btac.nsw.edu.au/cms/myLinks";
              iframe.style.width = "100%";
              iframe.style.height = "100%";
              iframeContainer.appendChild(iframe);

              // ---- Append Container to DOM ----
              document.body.appendChild(container);
            }

            linkBoard.appendChild(addButton);

            // ---- Replace it with something better ----
            let linkContainer = document.getElementById("side-menu-mylinks");
            let offCanvasList = linkContainer.querySelector(".my-links").querySelector(".off-canvas-list");
            let hyperLinkList = offCanvasList.querySelectorAll("li")

            links = [];

            // Get all links and append to links[]
            for (let i = 0; i < hyperLinkList.length; i++)
            {
              let link = hyperLinkList[i].querySelector("a");
              links.push(link);
            }

            // Remove MyLinks from the sidebar
            linkContainer.remove();

            // Create button on the DOM for each link
            for (const a of links)
            {
              let button = document.createElement("button");

              button.onclick = function() {
                window.open(a.href);
              }

              button.innerHTML = a.innerHTML;

              button.setAttribute("class", "button-30");
              button.style = "margin-left: 10px; margin-right: 10px;";

              linkBoard.appendChild(button);
            }
        }
    }
}

function leftMenu()
{
    // Local Variables
    const container = document.getElementById("left-menu");
    const subMenu = document.querySelectorAll(".left-submenu");
    const logo = document.querySelector("img[src='/images/logo.php?logo=skin_logo_large&size=normal']");

    // Sleep Method
    function sleep(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    }

    async function menuLoop() {
        // Each individual link on the container
        const elements = container.getElementsByTagName("a");
        const menuTitle = container.getElementsByTagName("h3")[0];

        // Cold Colours
        const coldColours = [
            "magenta", "blue", "purple", "navy",
            "royal", "space", "iceberg", "sapphire",
            "denim", "vivid cerulean", "lapis lazuli",
            "maya blue"]

        // Void Colours
        const voidColours = ["#000000", "#696969", "#808080", "#A9A9A9"]

        // One-Time-Applied text CSS
        for (let i=0; i<elements.length ; i++)
        {
            // This makes a calm fade effect
            elements[i].style.transition = "1s"
            // Set light-theme colour for the menu
            container.style.backgroundColor = "white";
            // Make sure the menu has no image overlay
            container.style.backgroundImage = "none";
            // Set logo image to inverted colours
            logo.style = "filter: invert(1);";
            // Set H3 font weight
            if (elements[i].parentNode.tagName == "H3")
            {elements[i].style.fontWeight = "700";}
            // Set menu title css
            menuTitle.style.color = "black";
            menuTitle.style.fontSize = "large";
            menuTitle.style.letterSpacing = "2px";
            menuTitle.innerHTML = "Caleb";
        }

        // One-Time-Applied subMenu CSS
        for (let i=0; i<subMenu.length ; i++)
        {
            // Make sure the subMenu has no image overlay
            subMenu[i].style.backgroundImage = "none";
            // Set light-theme for the subMenu
            subMenu[i].style.backgroundColor = "white";
        }

        while (true)
        {
            await sleep(100);

            for (var i=0; i<elements.length; i++)
            {
                // Select a random cold colour
                let coldColour = coldColours[Math.floor(Math.random()*coldColours.length)];
                // Select a random hot colour
                let voidColour = voidColours[Math.floor(Math.random()*voidColours.length)];

                if (! (elements[i].parentNode.tagName == "H3"))
                {
                    elements[i].style.color = coldColour
                } else
                {
                    elements[i].style.color = voidColour
                }
            }
        }
    }

    let worker = new Worker(menuLoop());
}

function dueWorkContainer()
{
    const island = document.getElementsByClassName("small-12 island");

    // Iterate through all specific class
    for (let i=0; i<island.length; i++)
    {
        const elem = island[i];

        // Find the correct container
        if (elem.innerHTML.includes("Upcoming Due Work"))
        {
            // Parent node of elem
            // const elemP = elem.parentNode;

            // -------- Apply Custom Style --------
            // elem.style.outline = "1px solid black";
            elem.style.padding = "10px";
            elem.style.backgroundColor = "white";

            // ---- Make the due work highlighted ----
            const infoList = elem.querySelector("section>ul.information-list").querySelectorAll("li");

            for (let i = 0; i < infoList.length; i++) {
                let info = infoList[i];

                // Get the link for later
                const link = info.querySelector("div>h3>a.title");

                //info.style.backgroundColor = "whitesmoke";
                info.style.margin = "10px";
                info.style.cursor = "pointer";


                // ---- Determine if something is near the due date ----
                const due = info.querySelector("div").querySelectorAll("p");

                // Array of tasks near due date
                let dueTasks = [];

                for (let i = 0; i < due.length; i++) {
                    if (due[i].outerText.includes("Due")) {
                        let date = due[i].outerText;

                        let split_date = date.split(" ")

                        /* For Debugging */
                        //console.log(split_date);

                        let index;
                        var day = "Failed to Get";
                        var hours = "Failed to Get";
                        // Get the due date using the more complex method.
                        if (split_date[2] != "at" && !(split_date[2].includes("("))) {
                            index = `${split_date[1]} ${split_date[2]} ${split_date[3]}`;

                            date = split_date.join(" ");

                            let date_1 = new Date(index);
                            let date_2 = new Date();

                            const days = (date_1, date_2) =>{
                                let difference = date_1.getTime() - date_2.getTime();
                                let TotalDays = Math.ceil(difference / (1000 * 3600 * 24));
                                return TotalDays;
                            };
                            day = days(date_1, date_2);
                        }
                        // If there is less than 6 days left, 'at' will be present.
                        if (split_date.includes("at") && split_date[5] && !(split_date[5].includes("hours"))) {
                            index = split_date[2];
                            day = index.replace("(", "");
                        };
                        // There is no 'at', but [2] includes '(<int>'. This is around a few days left.
                        if (split_date[2] && split_date[2].includes("(")) {
                            index = split_date[2];
                            day = index.replace("(", "");
                        };
                        if (split_date[5] && split_date[5].includes("hours")) {
                            index = split_date[4];
                            hours = index.replace("(", "");
                        };

                        // I'm not sure why the position is relative? Forgot???
                        info.style.position = "relative";

                        // Globalize (p), so it can be accessed by infoTheme
                        var p = document.createElement("p");

                        if (day != "Failed to Get") {
                            let height = info.height;
                            p.innerHTML = `${day} Days`;
                            p.style.fontSize = "1em";
                            p.style.position = "absolute";
                            p.style.right = "0";
                            p.style.top = "50%";
                            p.style.transform = "translate(-50%, -50%)";

                            info.appendChild(p);
                        }
                        else if (hours != "Failed to Get") {
                            let height = info.height;
                            p.innerHTML = `${hours} Hours`;
                            p.style.fontSize = "1em";
                            p.style.position = "absolute";
                            p.style.right = "0";
                            p.style.top = "50%";
                            p.style.transform = "translate(-50%, -50%)";

                            info.appendChild(p);
                        }
                        else {
                            let height = info.height;
                            p.innerHTML = "Failed to Get Time";
                            p.style.fontSize = "1em";
                            p.style.position = "absolute";
                            p.style.right = "0";
                            p.style.top = "50%";
                            p.style.transform = "translate(-50%, -50%)";

                            info.appendChild(p);
                        };
                    };

                    function infoTheme(info, { bg_over, bg_leave, img_over, img_leave, fg_over, fg_leave, fg_weight, img_transition, bg_transition, audio }) {

                        // Make the div also a link to the task
                        info.onclick = () => {
                            location.href = link;
                        };

                        if (fg_weight)
                            p.style.fontWeight = fg_weight;

                        // Replace background with image on mouse leave
                        if (img_leave)
                            info.style.backgroundImage = img_leave;

                        // Set the foreground colour
                        if (fg_leave)
                            info.style.color = fg_leave;

                        // Replace background with colour on mouse leave
                        if (bg_leave)
                            info.style.backgroundColor = bg_leave;

                        // Highlight it
                        info.onmouseover = () => {

                            if (audio) {
                                let aud = new Audio(audio);
                                aud.play();
                            };

                            if (fg_over)
                                info.style.transition = "0s";
                                info.style.color = fg_over;

                            if (img_over && bg_over) {
                                console.warn("You cannot have both over events, Priortising img_over...");

                                // Transition Time
                                if (img_transition)
                                    info.style.transition = img_transition;

                                info.style.backgroundImage = `url("${img_leave}")`;
                                info.style.backgroundSize = "100%";
                                info.style.backgroundRepeat = "no-repeat";
                                info.style.backgroundPosition = "center";

                                if (bg_leave)
                                    info.style.removeProperty("background-color");

                                return;
                            };

                            if (img_over) {

                                // Transition Time
                                if (img_transition)
                                    info.style.transition = img_transition;

                                info.style.backgroundImage = `url("${img_over}")`;
                                info.style.backgroundSize = "100%";
                                info.style.backgroundRepeat = "no-repeat";
                                info.style.backgroundPosition = "center";

                                if (bg_leave)
                                    info.style.removeProperty("background-color");
                            };

                            if (bg_over) {

                                // Transition Time
                                if (bg_transition)
                                    info.style.transition = bg_transition;

                                info.style.backgroundColor = bg_over;

                                if (img_leave)
                                    info.style.removeProperty("background-image");
                                    info.style.removeProperty("background-size");
                                    info.style.removeProperty("background-position");
                                    info.style.removeProperty("background-repeat");
                            };
                        };

                        // Don't Highlight it
                        info.onmouseleave = () => {

                            if (fg_leave)
                                info.style.transition = "0s";
                                info.style.color = fg_leave;

                            if (img_leave && bg_leave) {
                                console.warn("You cannot have both leave events, Priortising img_leave...");

                                // Transition Time
                                if (img_transition)
                                    info.style.transition = img_transition;

                                info.style.backgroundImage = `url("${img_leave}")`;
                                info.style.backgroundSize = "100%";
                                info.style.backgroundRepeat = "no-repeat";
                                info.style.backgroundPosition = "center";

                                // Remove background-color even though the image covers it
                                if (bg_over)
                                    info.style.removeProperty("background-color");

                                return;
                            };

                            if (img_leave) {

                                // Transition Time
                                if (img_transition)
                                    info.style.transition = img_transition;

                                info.style.backgroundImage = `url("${img_leave}")`;
                                info.style.backgroundSize = "100%";
                                info.style.backgroundRepeat = "no-repeat";
                                info.style.backgroundPosition = "center";

                                // Remove background-color even though the image covers it
                                if (bg_over)
                                    info.style.removeProperty("background-color");
                            };

                            if (bg_leave) {

                                // Transition Time
                                if (bg_transition)
                                    info.style.transition = bg_transition;

                                if (img_over)
                                    info.style.removeProperty("background-image");
                                    info.style.removeProperty("background-size");
                                    info.style.removeProperty("background-position");
                                    info.style.removeProperty("background-repeat");

                                info.style.backgroundColor = bg_leave;
                            };
                        };

                    };

                    // Find how close something is to be submitted and apply themes
                    if (due[i].innerHTML.includes("Due")) {

                        // Error Occured
                        if (day == "Failed to Get") {
                            const url = "https://rare-gallery.com/uploads/posts/336764-Anime-Scenery-Horizon-Shooting-Star-Sunset-4K-3840x2160.jpg";
                            infoTheme(info, { img_over : url, bg_leave : "#01031A", fg_leave : "red", img_transition: "2.4s", bg_transition: "0s" });
                        }

                        // No Warning
                        if (day > 20) {
                            infoTheme(info, { bg_over : "whitesmoke", bg_leave : "white"} );
                        }

                        // Warning
                        if (day <= 20) {
                            infoTheme(info, { bg_over : "orange", bg_leave : "#FFDFBF" });
                        }

                        // Critical Warning
                        if (day <= 10) {
                            // Append this task to the dueTasks array
                            const url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARwAAACxCAMAAAAh3/JWAAAA21BMVEXaVlL////bVVLZV1PbVVT7///YWFTYV1HZVVDcVVHaVlXVV1LZUEzaU1DbVU7bT03/9PTYQj7TOznaTU/aTEn34uDWRUTojYrQSUfYXljZlJjVgoHgUkvZVVffU1XOOT3RYmDy4+LVSkLbqKHzxsPrysLOVljpsajUYGbeaGbhoJ3kqKj00tXOPznnt7PXhoX42tbOd3XPkY3W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Uyqovas3fPd8+rPTN+WaE8lWaN8uZkf4lQ6hmSG/8Hfc16mkTqGF/am9pkd7frfmIm/s6xyDO4kP3QrOL8HU0ctZrporNZh3xVmPV+E/w1LH8pWs9ru9b3bloy9/5P68C/1wT0f7L0e0vIP17dZYUaeY5/lKfyjqOed1xEDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVfgT4JxBo65puKYAAAAASUVORK5CYII=";
                            infoTheme(info, {
                                img_over : url,
                                bg_leave : "#ffcccb",
                                img_transition : "0.4s",
                                bg_transition : "0s",
                                fg_over : "whitesmoke",
                                fg_leave: "black"
                            });
                            // Getting near due date
                            near_due_date += 1;
                        };

                        // Galactically-Critical Warning
                        if (hours != "Failed to Get") {
                            const url = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBUWFRgWFhUZGBgaHBwaHBwcGhocHB4cGhoaHB4cHBocIS4nHB4rHxwaJjgnKy8xNTU1HCQ7QDs0Py40NTEBDAwMEA8QHxISHzQrJCs2NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NP/AABEIAUIAnAMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAADBAECBQAGB//EADcQAAEDAgQDBgUEAgIDAQAAAAEAAhEhMQMSQVEEYXEigZGhsfAFE8HR4TJCUvEUYgYVcoKSI//EABkBAAMBAQEAAAAAAAAAAAAAAAECAwAEBf/EACQRAAICAgMBAAICAwAAAAAAAAABAhESIQMxUUETYSIyBIGx/9oADAMBAAIRAxEAPwD5pnmw131RW6g6XtvEztOvRU+Y4hrS4lrJyg0DcxkwOZqVOE0kkzBgxfaCKDUEhe5FuyDRIqY9j7BEc6JAAJ3FeoB2VXt/aPK9fyh/L/Co5Na+gWzi0msUFyBQVpO3erANkRIFNQ4zroOcbDe6sQuaptBBltBB/CtnJMkySZkkkz1P1R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Bs4HGyIcQDQdUYhYFSijinAZc1PeqvD/IpVID4vDXfAEkwOaWxeMaLVPl4rNLybqA7ktLnvoK4w7+Lcf3R0oqOxSRUlUBVTKhKTbodRQXCxi00MfXuUYmMSZlDaFbKhb6s1IIGc1OT/YeaFK6UXIwUMG481V1NZVJUJG14ZIgrgFdpUE+4G4QbGoqCuL1J9+C736oWbEqXKRChyhCzUWJqoKhctYaLSuBXBcSgajs6kgc/H8KATuVyaJqOkDQ+P4U5hsfH8KpConyaNQUvGx8fwozjY+P4VFEIWahmF2VFyLsifEnYHKuLUbIocxBxCmBAXR77wijDUhnvwQxDkLlvvuVsvvxTHylb5S2DNkJOauyJp2Go+WtgbIXyrsqZGGp+WjgbIWDF2VM/LXfLWwNkKlqnKmCxQWLKJsgGVQWoxYoyLOIbAZV2VGyqMqFGscXLlyqSOUFcuWAiFLVy5YLCBSuXJhGQVy5csFHBSuXLGIClcuWMVKo5cuQYUUKqFK5Ix0SoXLkDH//Z";
                            infoTheme(info, { img_over : url, bg_leave : "#0B135E", fg_leave : "red", fg_over : "white", img_transition: "2.4s", bg_transition: "0s", fg_weight : "600" });
                        }
                    };
                }
            }
        }
    }
}

function specialNameTag()
{
    // ahhh, old code.
    // Find container easily, as it's at the top of the page.
    const welcoming = document.querySelector("div.small-12.columns>h1")
    const nameLabel = document.querySelector("div.small-12.columns>h1>strong")

    nameLabel.style.color = "cornflowerblue";
    nameLabel.style.fontWeight = "600";

    // ahhh, new code.
    welcoming.style.marginBottom = "0";

    let due = document.createElement("p");
    due.innerHTML = `You have ${near_due_date} near due tasks.`;
    due.style.marginBottom = "2rem";
    if (near_due_date > 0) {
        due.style.color = "red";
    }
    const aaaaa = welcoming.parentNode;
    aaaaa.appendChild(due);
}

function importFont(url)
{
    // Open Sans
    let font = document.createElement("link")
    font.href = url;
    font.rel = "stylesheet";
    font.type = "text/css";

    document.head.appendChild(font);
}

function notificationBox()
{
  const boxWide = document.getElementsByClassName("right-menu-dock");
  const boxClass = document.getElementsByClassName("icon-notifications");

  for (let i = 0; i < boxWide.length; i++)
  {
    boxWide[i].style.backgroundColor = "green";
    boxWide[i].style.outline = "1px solid black";
  }
  for (let i = 0; i < boxClass.length; i++)
  {
    boxClass[i].style.backgroundColor = "green";
    boxClass[i].style.outline = "1px solid black";
  }
}

// This function replaces the "student printing" text with
// what subjects I should focus for, to learn mechatronics.
function subjectFocus() {
    const SUBJECTS = `
    Education & Training for a Mechatronic Engineer
    Prerequisite subjects,
    or assumed knowledge,
    in one or more of <span style="font-weight: bold;">English</span>,
    <span style="font-weight: bold;">mathematics</span>,
    <span style="font-weight: bold;">chemistry</span> and <span style="font-weight: bold;">physics</span> are normally required.
    `

    // Iterate through small-12 island
    for (let i=0; i < document.getElementsByClassName("small-12 island").length; i++)
    {
        let island = document.getElementsByClassName("small-12 island")[i];

        // Find the correct container
        if (island.innerHTML.includes("STUDENT PRINTING IS NOW AVAILABLE"))
        {
            // ---------- Replace all text with subjectFocus ----------
            //
            const textDict = island.querySelector("section>article>p").querySelectorAll("span");
            const container = island.querySelector("section");

            // Remove all text
            for (let i = 0; i < textDict.length; i++) {
                let text = textDict[i];
                text.remove();
            }

            // Add my own text
            const sp = document.createElement("span");
            sp.innerHTML = SUBJECTS;

            // Append text
            island.querySelector("section>article>p").appendChild(sp);

            // -------- Container Style --------
            container.style.backgroundColor = "#FDFD96";
        }
    }
}


// Main Method
(function() {
    'use strict';

    // Call Methods
    leftMenu();
    myLinks();
    dueWorkContainer();
    specialNameTag();
    // notificationBox();
    subjectFocus();
})();