Elzero Courses Time Calculator

This script tries to calculate the duration of each week from elzero.org course and the total duration of the playlist

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Elzero Courses Time Calculator
// @namespace    http://tampermonkey.net/
// @version      2024-08-11
// @description  This script tries to calculate the duration of each week from elzero.org course and the total duration of the playlist
// @author       Yasser Salah
// @match        https://elzero.org/study/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=elzero.org
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    weeks =document.getElementsByClassName("week-box");
    report = "";
    totalMinutes = 0
    for (i=0;i<weeks.length - 1;i++){
        content =weeks[i].getElementsByClassName("week-step")[0].getElementsByClassName("week-lessons")[0];
        minutes = 0;
        seconds = 0;
        for (j=0;j<content.getElementsByTagName("li").length;j++){
            text = content.getElementsByTagName("li")[j].getElementsByTagName("div")[0].getElementsByTagName("span")[0].innerText;
            minute = text.split(":")[0];
            second = text.split(":")[1];
            minutes += parseInt(minute);
            seconds += parseInt(second);
        }
        minutes += parseInt(seconds / 60);
        seconds = seconds % 60;
        totalMinutes += minutes
        report += "Week No. " + (i+1) + " -> " + minutes + " minutes " + seconds + " seconds.\n";
    }
    totalHours = parseInt(totalMinutes / 60);
    totalMinutes = totalMinutes % 60;
    report += "\nTotal Hours: " + totalHours + "\nTotal Minutes: " + totalMinutes;
    alert(report)
})();