JVC Color Respawn

Change l'icone dans la liste des topics selon le nombre de pages

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name                        JVC Color Respawn
// @namespace                   Krapoutchniek (Tanil) (repris du code de Matt' & Naptu)
// @description                 Change l'icone dans la liste des topics selon le nombre de pages
// @include                     http://www.jeuxvideo.com/forums/*
// @include                     http://*.forumjv.com/*
// @include                     http://www.jeuxvideo.com/forums/0-*-0-1-0-1-2-*.htm
// @version                     1.3
// ==/UserScript==

function color() {
    var num_topic = 1, ligne_topic, image_topic, posts_topic,				// num_topic = ligne du topic concerné, commence à 1 pour passer la ligne SUJET AUTEUR NB etc.
		topic_epingle = "/img/forums/topic-marque-on.png",					// Topic épinglé
        topic_epingle_verrouille = "/img/forums/topic-marque-off.png",		// Topic épinglé et verrouillé
        topic_verrouille = "/img/forums/topic-lock.png";					// Topic verrouillé
		
    while(num_topic <= 25) {
		ligne_topic = document.getElementById('table-liste-topic-forum').getElementsByTagName('tr')[num_topic];					// Ordre des topic de 1 à 25
		
		image_topic = ligne_topic.getElementsByTagName('td')[0].getElementsByTagName('div')[0].getElementsByTagName('img')[0];	// td[0] = icone du topic
		posts_topic = parseInt(ligne_topic.getElementsByTagName('td')[2].textContent);											// td[2] = nombre de posts du topic
		
		// Modification de l'icone selon le nombre de messages - aucune modification des topics épinglés et/ou verrouillés
		if(image_topic.getAttribute('src') != "/img/forums/topic-marque-on.png" && image_topic.getAttribute('src') != topic_epingle_verrouille && image_topic.getAttribute('src') != topic_verrouille)
		{
			// Plus de 5 pages
			if(posts_topic >= 100)
			{
				image_topic.src = "http://image.noelshack.com/fichiers/2014/50/1418342681-topic-5.png";
			}
			
			// Plus de 20 pages
			if(posts_topic >= 400)
			{
				image_topic.src = "http://image.noelshack.com/fichiers/2014/50/1418342681-topic-20.png";
			}
			
			// Plus de 100 pages
			if(posts_topic >= 2000)
			{
				image_topic.src = "http://image.noelshack.com/fichiers/2014/50/1418342681-topic-100.png";
			}
			
			// Plus de 1000 pages
			if(posts_topic >= 20000)
			{
				image_topic.src = "http://image.noelshack.com/fichiers/2014/50/1418342681-topic-1000.png";
			}
		}
		
        num_topic++;
    }
}

color();