JVC Color Respawn

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

当前为 2014-12-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JVC Color Respawn
  3. // @namespace Krapoutchniek (Tanil) (repris du code de Matt' & Naptu)
  4. // @description Change l'icone dans la liste des topics selon le nombre de pages
  5. // @include http://www.jeuxvideo.com/forums/*
  6. // @include http://*.forumjv.com/*
  7. // @include http://www.jeuxvideo.com/forums/0-*-0-1-0-1-2-*.htm
  8. // @version 1.2
  9. // ==/UserScript==
  10.  
  11. function color() {
  12. 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.
  13. topic_epingle = "/img/forums/topic-marque-on.png", // Topic épinglé
  14. topic_epingle_verrouille = "/img/forums/topic-marque-off.png", // Topic épinglé et verrouillé
  15. topic_verrouille = "/img/forums/topic-lock.png"; // Topic verrouillé
  16. while(num_topic <= 25) {
  17. ligne_topic = document.getElementById('table-liste-topic-forum').getElementsByTagName('tr')[num_topic]; // Ordre des topic de 1 à 25
  18. image_topic = ligne_topic.getElementsByTagName('td')[0].getElementsByTagName('div')[0].getElementsByTagName('img')[0]; // td[0] = icone du topic
  19. posts_topic = parseInt(ligne_topic.getElementsByTagName('td')[2].textContent); // td[2] = nombre de posts du topic
  20. // Modification de l'icone selon le nombre de messages - aucune modification des topics épinglés et/ou verrouillés
  21. if(image_topic.getAttribute('src') != "/img/forums/topic-marque-on.png" && image_topic.getAttribute('src') != topic_epingle_verrouille && image_topic.getAttribute('src') != topic_verrouille)
  22. {
  23. // Plus de 5 pages
  24. if(posts_topic >= 100)
  25. {
  26. image_topic.src = "http://image.noelshack.com/fichiers/2013/20/1368531862-3.gif";
  27. }
  28. // Plus de 20 pages
  29. if(posts_topic >= 400)
  30. {
  31. image_topic.src = "http://image.noelshack.com/fichiers/2013/20/1368531862-4.gif";
  32. }
  33. // Plus de 100 pages
  34. if(posts_topic >= 2000)
  35. {
  36. image_topic.src = "http://image.noelshack.com/fichiers/2013/20/1368531862-5.gif";
  37. }
  38. // Plus de 1000 pages
  39. if(posts_topic >= 20000)
  40. {
  41. image_topic.src = "http://image.noelshack.com/fichiers/2013/20/1368531862-6.gif";
  42. }
  43. }
  44. num_topic++;
  45. }
  46. }
  47.  
  48. color();