NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name TopicName // @namespace CrazyJeux/Daring-Do // @author CrazyJeux/Daring-Do // @match *://www.jeuxvideo.com/forums/42* // @description Remplace les liens vers les topics par les noms des topics. // @version 2 // @grant none // ==/UserScript== function isThread(url) { if (url === "#Protocole_inconnu") { return false; } var matchesThread = /(^https?\:\/\/(www.)?jeuxvideo\.com)?\/forums\/42.*\.htm/.test(url); return matchesThread; } function callMe() { var body = document.getElementsByTagName("body")[0]; var attr = body.getAttribute("data-topicname"); if (attr === null || attr === "") { body.setAttribute("data-topicname", "true"); } else { return; } var table = document.getElementById("table-liste-topic-forum"); if (table !== null) { table.style.width = "auto"; } var messages = document.querySelectorAll(".txt-msg"); for (var i = 0; i < messages.length; i++) { var links = messages[i].getElementsByTagName('a'); for (var j = 0; j < links.length; j++) { var href = links[j].getAttribute("href"); //console.log("href='" + href + "'"); var isLink = isThread(href); if (isLink === true) { //console.log("Thread: " + links[j].href); (function (link) { setTimeout(function () { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { var tempDiv = document.createElement("div"); tempDiv.innerHTML = xmlhttp.responseText; tempDiv.style.display = "none"; body.appendChild(tempDiv); var titleElement = tempDiv.querySelector("#bloc-title-forum"); if (titleElement !== null) { var title = titleElement.innerHTML; link.innerHTML = title; } else { link.innerHTML = "Ce topic n'existe plus"; } link.style.textDecoration = "underline"; tempDiv.remove(); } }; xmlhttp.open("GET", link.href, true); xmlhttp.send(); }, 0); })(links[j]); } } } } callMe(); //Respeed addEventListener('instantclick:newpage', callMe);