OnTake / EcoleDirecte Skin

// ==UserScript==
// @name         EcoleDirecte Skin
// @namespace    http://example.com
// @version      2.034
// @description  Fixed EcoleDirecte's shitty looks. Use in conjunction to Dark Reader (https://darkreader.org/).
// @author       Louis Dalibard
// @match        https://www.ecoledirecte.com/*
// @grant        none
// @copyright 2020-2022, OnTake (https://openuserjs.org/users/OnTake)
// @downloadURL https://openuserjs.org/install/OnTake/EcoleDirecte_Skin.user.js
// @updateURL https://openuserjs.org/meta/OnTake/EcoleDirecte_Skin.meta.js
// @license MIT
// ==/UserScript==

//Customisation variables

//Customisation Text
const textfont = "\"Exo 2\""; // Yusei Magic ; Goldman ; Roboto Mono ; Noto Sans ; Open Sans ; Roboto ; Ubuntu ; Space Grotesk ; Noto Sans JP ; Source Sans Pro ; Anton ; Libre Baskerville ; Exo 2 ; Advent Pro ; Space Mono

//Customisation colors
//Note: Palette can be picked from here: https://imagecolorpicker.com/
const bgcolor = "#00000050";
const secondarybgcolor = "#00000078";
const lightprimarycolor = "#415654"; 
const darkprimarycolor = "#636756";
const accountlinkcolor = "#ffffff";

//Customisation background image
const bgimageurl = "https://cdn.lewd.host/KumAu9ZI.jpg"; // https://ontake.reeee.ee/w5Vkp1.jpeg https://ontake.reeee.ee/w5Vkp1.jpeg https://ontake.reeee.ee/LceGu8.jpeg https://ontake.reeee.ee/HeXg87.jpeg https://ontake.reeee.ee/Jxpo0w.jpeg https://imgur.com/ixomNfl.png https://imgur.com/aUD2l56.png
const bgimagescale = "cover";
const bgimageoffsetx = "0px";
const bgimageoffsety = "0px";

//Customisation parallax effect
const parallaxyoffset=-200;
const parallaxpower = 400;
const refreshdelay = 0.1;

//Customisation misc
const cornerradius = "10px";
const cornerradiussmall = "10px";
const titleshadow = "-1px 0 #00000066, 0 1px #00000066, 1px 0 #00000066, 0 -1px #00000066";
const classiddict = {
    47: "3301",
    48: "3302",
    49: "3303",
    50: "3304",
    51: "3305",
    52: "3306",
    53: "3307",
    54: "3308",
    56: "3401",
    57: "3402",
    58: "3403",
    59: "3404",
    60: "3405",
    61: "3406",
    62: "3407",
    63: "3408"
}

//System
parallaxpos = 0;

function setcss() {
    var csselement = document.createElement("style");
    csselement.className = "ecoledirecte-skin-css";
    // CSS Imports
    csselement.innerHTML = "@import url('https://fonts.googleapis.com/css2?family=Goldman&family=Noto+Sans&family=Yusei+Magic&family=Open+Sans&family=Roboto&family=Roboto+Mono&family=Space+Grotesk&family=Ubuntu&family=Noto+Sans+JP&family=Source+Sans+Pro&family=Anton&family=Libre+Baskerville&family=Exo+2&family=Advent+Pro&family=Space+Mono&display=swap');";
    // Set CDT CSS
    csselement.innerHTML += ".cdtnavigation{";
    csselement.innerHTML += "background:" + bgcolor + ";";
    csselement.innerHTML += "border-radius:" + cornerradius + ";";
    csselement.innerHTML += "}";
    csselement.innerHTML += ".picker-day.picker-selected, .picker-day:not(.picker-off):not(.picker-empty):hover {";
    csselement.innerHTML += "background-image: initial;";
    csselement.innerHTML += "background-color: rgb(76 76 76);";
    csselement.innerHTML += "}";
    csselement.innerHTML += ".text-center.picker-day.today {"
    csselement.innerHTML += "color: var(--light-primary-color) !important;"
    csselement.innerHTML += "}"
    csselement.innerHTML += ".alert-danger {"
    csselement.innerHTML += "background-color: var(--light-primary-color) !important;"
    csselement.innerHTML += "}"
    // Set Body CSS
    csselement.innerHTML += "body{"
    csselement.innerHTML += "font-family:" + textfont + ";"
    csselement.innerHTML += "color:#fff;"
    csselement.innerHTML += "background-image:url(\"" + bgimageurl + "\");";
    csselement.innerHTML += "background-size:" + bgimagescale + ";";
    csselement.innerHTML += "background-position-x:" + bgimageoffsetx + ";";
    csselement.innerHTML += "background-position-y:" + bgimageoffsety + ";";
    csselement.innerHTML += "background-attachment:fixed;";
    csselement.innerHTML += "transition: background-position-y "+ refreshdelay +"s linear;";
    csselement.innerHTML += "}";
    // Set Navbar CSS
    csselement.innerHTML += ".navbar{"
    csselement.innerHTML += "background:" + bgcolor + ";";
    csselement.innerHTML += "}";
    csselement.innerHTML += "#header-commun .navbar {"
    csselement.innerHTML += "background:" + bgcolor + ";";
    csselement.innerHTML += "backdrop-filter:blur(10px);"
    csselement.innerHTML += "}";
    csselement.innerHTML += "#user-account-link{"
    csselement.innerHTML += "color:" + accountlinkcolor + ";";
    csselement.innerHTML += "}";
    csselement.innerHTML += "a.logout{"
    csselement.innerHTML += "background-color: var(--light-primary-color)!important;"
    csselement.innerHTML += "}";
    // Sidebar CSS
    csselement.innerHTML += "#menu-part, .ed-menu{"
    csselement.innerHTML += "background:" + bgcolor + ";";
    csselement.innerHTML += "backdrop-filter:blur(10px);"
    csselement.innerHTML += "}";
    csselement.innerHTML += ".ed-menu-image-wrapper>div {"
    csselement.innerHTML += "min-height: 0;"
    csselement.innerHTML += "}";
    // Login CSS
    csselement.innerHTML += ".login-container{"
    csselement.innerHTML += "backdrop-filter:blur(10px);"
    csselement.innerHTML += "}";
    csselement.innerHTML += ".info-container{"
    csselement.innerHTML += "opacity: 0;";
    csselement.innerHTML += "}";
    // Calendar CSS
    csselement.innerHTML += ".dhx_scale_holder_now,.dhx_scale_holder ,.dhx_cal_data,.dhx_scale_hour,.dhx_scale_bar{";
    csselement.innerHTML += "background: transparent;"
    csselement.innerHTML += "overflow-y: hidden;"
    csselement.innerHTML += "backdrop-filter: blur(10px);"
    csselement.innerHTML += "font-family:" + textfont + ";"
    csselement.innerHTML += "}";
    csselement.innerHTML += ".dhx_cal_event .dhx_body, .dhx_cal_event_line {";
    csselement.innerHTML += "font-family:" + textfont + ";"
    csselement.innerHTML += "}";
    csselement.innerHTML += ".dhx_cal_data{"
    csselement.innerHTML += "scrollbar-width:none;"
    csselement.innerHTML += "}"
    csselement.innerHTML += ".dhx_scale_holder, .dhx_cal_header,.dhx_scale_hour{"
    csselement.innerHTML += "border-radius:" + cornerradiussmall + ";"
    csselement.innerHTML += "}"
    // Cloud CSS
    csselement.innerHTML += ".cloud .bloc-right {";
    csselement.innerHTML += "border-radius:" + cornerradius + ";";
    csselement.innerHTML += "}"
    // Misc CSS
    csselement.innerHTML += ".ed-card{";
    csselement.innerHTML += "border-radius: " + cornerradiussmall + ";"
    csselement.innerHTML += "}"
    csselement.innerHTML += ".container-bg{"
    csselement.innerHTML += "backdrop-filter:blur(10px);"
    csselement.innerHTML += "background:" + bgcolor + ";"
    csselement.innerHTML += "border-radius:" + cornerradius + ";"
    csselement.innerHTML += "}"
    csselement.innerHTML += ".indicator{";
    csselement.innerHTML += "background:white;"
    csselement.innerHTML += "position:absolute;"
    csselement.innerHTML += "filter: invert(1);"
    csselement.innerHTML += "width:5px;"
    csselement.innerHTML += "height:5px;"
    csselement.innerHTML += "}"
    // Vie Scolaire CSS
    csselement.innerHTML += ".viescolaire.absence{"
    csselement.innerHTML += "background:" + lightprimarycolor + ";"
    csselement.innerHTML += "}"
    // Variables
    csselement.innerHTML += "body{"
    csselement.innerHTML += "--light-primary-color:"+lightprimarycolor+ ";"
    csselement.innerHTML += "--dark-primary-color:"+ darkprimarycolor+ ";"
    csselement.innerHTML += "}"
    // Add stylesheet to HTML document
    document.head.appendChild(csselement);
}

function removeprofileimage() {
    try {
        //Remove profile image
        var elements = document.getElementsByClassName('ed-card');
        try {
            imagewrapper = document.getElementsByClassName("ed-menu-image-wrapper")[0];
            imagewrapper.removeChild(imagewrapper.lastElementChild);
        } catch (e) {}
        try {
            //Set Text Shadow
            document.getElementsByTagName("h2")[0].remove();
            elements[0].style.removeProperty("border-color");
        } catch (e) {}

    } catch (e) {
        setTimeout(function() {
            removeprofileimage();
        }, 1000);
    }
}

(function() {
    'use strict';

    //Remove name of school on page type 1
    try {
        document.getElementById("nom-etb")
            .remove();
    } catch (e) {}
    try {
        document.getElementsByClassName("info-container")[0].remove();
    } catch (e) {}

    //Set CSS
    setcss();
    //Verify page integrity and fix issues every 5s
    setInterval(function() {
        //Remove School's Name
        try {
            document.getElementById("nom-etb")
                .remove();
        } catch (e) {}
        try {
            document.getElementsByClassName("info-container")[0].remove();
        } catch (e) {}
        try {
            var spanelement = document.getElementsByClassName("site-ppfe")[0].children[0];
            var jsonsessionstorage = JSON.parse(sessionStorage.getItem('ngStorage-user'))[0]
            //Styling Top Bar
            spanelement.style.fontSize = "13.5px";
            spanelement.style.fontFamily = textfont;
            spanelement.style.textShadow = "black 1px 1px 1px";
            //Info
            var sexsymbol = "⚥"
            if (jsonsessionstorage.profile.sexe == "M") {
                sexsymbol = "♂"
            }
            if (jsonsessionstorage.profile.sexe == "F") {
                sexsymbol = "♀"
            }
            spanelement.innerHTML = jsonsessionstorage.prenom + " " + jsonsessionstorage.nom + ", " + sexsymbol + ", " + jsonsessionstorage.profile.classe.code
            // Display Eating Patterns
            /*
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:0px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_1/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:5px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_2/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:10px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_3/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:15px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_4/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:20px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_5/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:25px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_6/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:0px;left:30px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repasmidi_7/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:0px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_1/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:5px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_2/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:10px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_3/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:15px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_4/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:20px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_5/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:25px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_6/2)+";\"></div>"
            spanelement.innerHTML += "<div aria-hidden=\"true\" class=\"indicator\" style=\"top:5px;left:30px;opacity:"+(0.5+jsonsessionstorage.modules[10].params.repassoir_7/2)+";\"></div>"
            */
            //Remove Name
            document.getElementById("user-account-link")
                .innerHTML = "<span class=\"icon-ed_user\"></span>"
        } catch (e) {
            console.log("They patched it, those fuckers!");
        }
        //Remove profile image.
        //removeprofileimage()
    }, 5000);
  // Parallax
  setInterval(function(){
      var body = document.body,
    html = document.documentElement;

var height = Math.max( body.scrollHeight, body.offsetHeight, 
                       html.clientHeight, html.scrollHeight, html.offsetHeight );
    parallaxpos -= (parallaxpos-(window.scrollY/height))/2;
    document.getElementsByTagName("body")[0].style = "background-position-y: "+(parallaxyoffset+parallaxpos*parallaxpower)+"px;";
  },refreshdelay*1000)
  
})();