Culearn Cleanup

Make culearn cleaner

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Culearn Cleanup
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Make culearn cleaner
// @author       Ehren Julien-Neitzert
// @match        https://culearn.carleton.ca/moodle/my/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.getElementById('block-region-side-pre').remove();
    document.getElementById('block-region-side-post').remove();
    document.getElementById('inst1061014').remove();
    document.getElementById('page-header').remove();

    var courses = document.getElementsByClassName('category_label');
    for (let c = 1; c < courses.length; c++) { //close all the class views except the first one
        courses[c].click();
    }

    var currentCourses = document.getElementsByClassName('courses')[0].childNodes; //the classes from the current semester
    //var courseName = /] (.+? \([A-Z]{3}\))/ //regex to find course names
    var courseName = /([A-Z]+?\d+?\w+?) /; //regex to find course names
    for (let c = 0; c < currentCourses.length; c++) {
        var link = currentCourses[c].getElementsByTagName('a')[0];
        var linkText = link.innerText;
        link.innerText = linkText.match(courseName)[1]; //change link text to just the course name
    }
})();