EcoleDirecte Tools

Numérotation de la liste des élèves

目前為 2023-03-17 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        EcoleDirecte Tools
// @namespace   Violentmonkey Scripts
// @match       https://*.ecoledirecte.com/*
// @version     1.7
// @author      OB - Education Nationale / Académie de Bordeaux - FRANCE
// @icon        https://www.ecoledirecte.com/assets/images/logoEcoleDirecte.png
// @description Numérotation de la liste des élèves
// @license     MIT
// @date        11/03/2023
// ==/UserScript==

function ConsolePrint(message)
{
  var startTime = new Date();
  console.log('[ED-Tools] '+ startTime.toLocaleTimeString() + ' ' + message) ;
}

ConsolePrint('RUN');

function isNumeric(value) {
    return /^-?\d+$/.test(value);
}

function SetStudentsNumbers(classname) {
  var index = 1;
  var success = 0;
  var lastname = "";
  names = document.getElementsByClassName(classname)
  for (var i = 0; i < names.length; i++)
  {
    name = names[i].innerText;
    if( !isNumeric(name[0]) && name.length != 0 && name != lastname)
    {
      ConsolePrint("SET " + classname + " " + name + " INDEX " + index);
      names[i].innerHTML = "<span style='background-color: rgb(255, 255, 128);'>" + ('0000'+index).slice(-2)  + "</span> " + names[i].innerHTML;
      lastname = name;
      index++;
      success++;
    }
  }
return(success);
}

/* Problème sur les composantes, la numérotation est correcte mais doublée, à revoir*/
function SearchStudentsList() {
    if ( SetStudentsNumbers("open-eleve") == 0 ) /* Notes */
    {
      SetStudentsNumbers("nom-eleve");  /* Compétences, Appréciations, Composantes */
    }
}

/* Application */
if (self == top) { /* run only in the top frame. we do our own frame parsing */
  ConsolePrint('STARTED');
  setInterval(SearchStudentsList, 3000);
}