{"size": 1129, "ext": "js", "max_stars_repo_path": "src/main/resources/static/js/moduleStudentValidation.js", "max_stars_repo_name": "LeaRain/Studentrack", "max_stars_repo_stars_event_min_datetime": "2022-03-09T08:39:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-09T08:39:18.000Z", "max_issues_repo_path": "src/main/resources/static/js/moduleStudentValidation.js", "max_issues_repo_name": "LeaRain/Studentrack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/resources/static/js/moduleStudentValidation.js", "max_forks_repo_name": "LeaRain/Studentrack", "max_forks_repo_forks_event_min_datetime": "2022-03-09T08:39:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-09T08:39:58.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 31.3611111111, "max_line_length": 73, "alphanum_fraction": 0.684676705}
document.addEventListener("DOMContentLoaded", function(){
    validateStudentModule();
});

function validateStudentModule() {
    registerStudentModuleEventListener();
    showSelectedModule();
}

function registerStudentModuleEventListener() {
    let moduleSelect = document.getElementById("selectModule");
    moduleSelect.addEventListener("click", showSelectedModule);
}

function showSelectedModule() {
    let moduleLegends = document.getElementsByClassName("module-legend");
    let moduleTable = document.getElementsByClassName("module-table");
    let moduleSelection = document.getElementById("selectModule");
    let selectedModule = moduleSelection.value;

    for (let i = 0; i < moduleLegends.length; i++) {
        let legendElement = moduleLegends[i];
        let tableElement = moduleTable[i];
        let legendValue = legendElement.getAttribute("value");

        if (legendValue !== selectedModule) {
            legendElement.hidden = true;
            tableElement.hidden = true;
        }

        else {
            legendElement.hidden = false;
            tableElement.hidden = false;
        }
    }
}