-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEWC_Team_tracker.js
More file actions
62 lines (52 loc) · 2.54 KB
/
Copy pathEWC_Team_tracker.js
File metadata and controls
62 lines (52 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// ==UserScript==
// @name EWC Team tracker
// @namespace damda58
// @downloadURL https://raw.githubusercontent.com/damda58/exped_script/master/EWC_Team_tracker.js
// @updateURL https://raw.githubusercontent.com/damda58/exped_script/master/EWC_Team_tracker.js
// @version 0.3
// @description Mettre en surbrillance la team choisi dans les live timing
// @author Damien Cebrian
// @match https://www.its-live.net/
// @icon https://www.google.com/s2/favicons?sz=64&domain=its-live.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Fonction pour mettre en surbrillance la ligne correspondant à la moto #24
function highlightBike24Row() {
console.log("Début de la recherche de la ligne de la moto #24");
// Fonction pour vérifier et mettre en surbrillance les lignes
function checkAndHighlight() {
// Sélectionner tous les tr dans les tables
const rows = document.querySelectorAll('table.ng-star-inserted tr');
for (let i = 0; i < rows.length; i++) {
// Chercher le span avec la classe "value" à l'intérieur de ce tr
const valueSpan = rows[i].querySelector('span.value');
if (valueSpan && valueSpan.textContent.trim() === '#24') {
console.log("Moto #24 trouvée ! Mettant en surbrillance la ligne...");
rows[i].style.backgroundColor = 'yellow'; // Fond jaune
rows[i].style.color = 'black'; // Police en noir
rows[i].style.fontWeight = 'bold'; // Police en gras
// Scrolling vers l'élément pour qu'il soit visible
rows[i].scrollIntoView({ behavior: 'smooth', block: 'center' });
break;
}
}
}
// Exécuter immédiatement une première fois
setTimeout(checkAndHighlight, 2000);
// Puis mettre en place un observateur pour détecter les changements dans le DOM
const observer = new MutationObserver(function(mutations) {
checkAndHighlight();
});
// Options de configuration de l'observateur
const config = {
childList: true,
subtree: true
};
// Commencer à observer le document avec les options configurées
observer.observe(document.body, config);
}
// Appel de la fonction highlightBike24Row
highlightBike24Row();
})();