您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Affiche la différence de temps entre l'heure actuelle et l'heure saisie dans une textbox spécifique sur la page http://mvptracker.net/tracker/
当前为
// ==UserScript== // @name Better MVPtracker.net // @namespace http://tampermonkey.net/ // @version 1.2 // @description Affiche la différence de temps entre l'heure actuelle et l'heure saisie dans une textbox spécifique sur la page http://mvptracker.net/tracker/ // @match http://mvptracker.net/tracker/* // @license MIT // @grant GM_getValue // @grant GM_setValue // ==/UserScript== let checkboxAutoConnexion; let nomDuServerInput; let pseudoInput; function calculerDifferenceTemps(heureSaisie) { const heureActuelle = new Date(); const heureSaisieSplit = heureSaisie.split("h"); const heureSaisieHeure = parseInt(heureSaisieSplit[0]); const heureSaisieMinute = parseInt(heureSaisieSplit[1]); const dateAvecHeureSaisie = new Date( heureActuelle.getFullYear(), heureActuelle.getMonth(), heureActuelle.getDate(), heureSaisieHeure, heureSaisieMinute ); if (dateAvecHeureSaisie > heureActuelle) { dateAvecHeureSaisie.setDate(dateAvecHeureSaisie.getDate() - 1); } const differenceMinutes = Math.round( (heureActuelle - dateAvecHeureSaisie) / (1000 * 60) ); return differenceMinutes; } function ajouterTextBoxEtCalculerDifference() { const boutons = document.querySelectorAll( 'button.killMVPButton.killMVPButtonNormal' ); boutons.forEach((bouton) => { const textBoxExistante = bouton.nextElementSibling; if (textBoxExistante && textBoxExistante.nodeName === "INPUT") { return; } const textBox = document.createElement("input"); textBox.type = "text"; textBox.size = "3"; textBox.classList.add("custom-textbox"); textBox.style.position = "absolute"; textBox.style.marginLeft = "5px"; textBox.style.marginTop = "0px"; textBox.addEventListener("input", function () { const heureSaisie = this.value; const differenceMinutes = calculerDifferenceTemps(heureSaisie); const textBoxKilled = this.parentNode.parentNode.querySelector( 'input[name^="killed"]' ); if (textBoxKilled) { textBoxKilled.value = differenceMinutes; } }); bouton.parentNode.insertBefore(textBox, bouton.nextSibling); }); } function ConnexionAutomatique() { if (GM_getValue("AutoConnexion", true)) { document.getElementById("txtPass").setAttribute("value", GM_getValue("NomDuServer", "")); var boutonImage1 = document.getElementById('btnSubmit'); boutonImage1.click(); setTimeout(function() { document.getElementById("txtDName").setAttribute("value", GM_getValue("Pseudo", "")); var boutonImage2 = document.getElementById('btnLogin'); boutonImage2.click(); }, 300); } } function afficherFenetreConfiguration() { const html = ` <h2>Configuration</h2> <input type="checkbox" id="checkboxAutoConnexion" ${GM_getValue( "AutoConnexion", false ) ? "checked" : ""}> <label for="checkboxAutoConnexion">Activer la connexion automatique</label> <br><br> <label for="nomDuServer">Nom du serveur :</label> <input type="text" id="nomDuServerInput" name="nomDuServer" value="${GM_getValue( "NomDuServer", "" )}"> <br><br> <label for="pseudo">Pseudo :</label> <input type="text" id="pseudoInput" name="pseudo" value="${GM_getValue( "Pseudo", "" )}"> <br><br> <button id="sauvegarderConfig">Sauvegarder</button> <div style="position: absolute; bottom: 3px; right: 3px; text-align: right;"> <div>Développé par Fri</div> <div>Discord: .fri.</div> </div> `; const container = document.createElement("div"); container.innerHTML = html; container.style.position = "fixed"; container.style.top = "20px"; container.style.left = "20px"; container.style.padding = "10px"; container.style.backgroundColor = "white"; container.style.border = "1px solid black"; container.style.zIndex = "9999"; document.body.appendChild(container); checkboxAutoConnexion = document.getElementById("checkboxAutoConnexion"); nomDuServerInput = document.getElementById("nomDuServerInput"); pseudoInput = document.getElementById("pseudoInput"); checkboxAutoConnexion.addEventListener("change", function() { if (this.checked) { nomDuServerInput.disabled = false; pseudoInput.disabled = false; } else { nomDuServerInput.disabled = true; pseudoInput.disabled = true; } }); const sauvegarderBtn = document.getElementById("sauvegarderConfig"); sauvegarderBtn.addEventListener("click", function() { GM_setValue("AutoConnexion", checkboxAutoConnexion.checked); GM_setValue("NomDuServer", nomDuServerInput.value); GM_setValue("Pseudo", pseudoInput.value); container.remove(); NomDuServer = GM_getValue("NomDuServer", "0"); Pseudo = GM_getValue("Pseudo", "0"); ConnexionAutomatique(); }); } window.addEventListener("load", function () { ajouterTextBoxEtCalculerDifference(); ConnexionAutomatique(); }); function observerMutations(mutationsList) { for (let mutation of mutationsList) { if (mutation.type === "childList") { observer.disconnect(); ajouterTextBoxEtCalculerDifference(); observer.observe(document.body, config); break; } } } // Options de configuration pour l'observateur de mutations const config = { childList: true, subtree: true }; const observer = new MutationObserver(observerMutations); observer.observe(document.body, config); const configBtn = document.createElement("img"); configBtn.src = "https://cdn-icons-png.flaticon.com/512/2099/2099058.png"; configBtn.style.position = "fixed"; configBtn.style.top = "30px"; configBtn.style.left = "30px"; configBtn.style.zIndex = "9999"; configBtn.style.width = "50px"; configBtn.style.height = "50px"; configBtn.style.cursor = "pointer"; // Modifier le curseur au survol configBtn.addEventListener("click", afficherFenetreConfiguration); document.body.appendChild(configBtn);