Last active
December 3, 2024 22:25
-
-
Save Emilelaflemme/1337caa16c9bcaf481fec10a0cabac55 to your computer and use it in GitHub Desktop.
Mention OP JVC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name OP Mention pour JVC | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2024-09-23 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://jeuxvideo.com/* | |
| // @match https://*.jeuxvideo.com/* | |
| // @require https://code.jquery.com/jquery-3.6.0.min.js | |
| // @grant none | |
| // ==/UserScript== | |
| let OP_Pseudo = localStorage.getItem('OP_Pseudo'); | |
| if (!OP_Pseudo) { | |
| OP_Pseudo = document.querySelector(".xXx.bloc-pseudo-msg.text-user").textContent.trim(); | |
| localStorage.setItem('OP_Pseudo', OP_Pseudo); | |
| } | |
| (async function() { | |
| 'use strict'; | |
| const divElement = document.querySelector("#bloc-formulaire-forum"); | |
| const topicId = divElement.getAttribute("data-topic-id"); | |
| console.log("Topic ID:", topicId); | |
| const url = window.location.href; | |
| console.log(url); | |
| function checkForumsPart(url) { | |
| if (url.includes("/forums/42-")) { | |
| console.log("La chaîne '42' est présente dans l'URL"); | |
| } else { | |
| console.log("La chaîne '42' n'est pas présente dans l'URL"); | |
| localStorage.removeItem('OP_Pseudo'); | |
| } | |
| } | |
| checkForumsPart(url); | |
| const PseudoAll = document.querySelectorAll(".xXx.bloc-pseudo-msg.text-user"); | |
| const Pageactuelle = document.querySelector(".page-active"); | |
| const Page = Pageactuelle.childNodes[0].textContent; | |
| console.log("Page actuelle : ", Page); | |
| const pageActuelle = window.location.href; | |
| for (let pseudoliste of PseudoAll) { | |
| const pseudo = pseudoliste.childNodes[0].textContent.trim(); | |
| console.log('OP_Pseudo:', OP_Pseudo); | |
| if (pseudo === OP_Pseudo) { | |
| const MentionOP = document.createElement('div'); | |
| MentionOP.textContent = 'OP'; | |
| MentionOP.style.backgroundColor = 'white'; | |
| MentionOP.style.color = '#4285f4'; | |
| MentionOP.style.fontSize = '.8125rem'; | |
| MentionOP.style.display = 'inline-block'; | |
| MentionOP.style.verticalAlign = 'top'; | |
| MentionOP.style.fontWeight = '500'; | |
| MentionOP.style.marginLeft = '5px'; | |
| MentionOP.style.borderWidth = '2px'; | |
| MentionOP.style.borderStyle = 'solid'; | |
| MentionOP.style.borderRadius = '4px'; | |
| MentionOP.style.padding = '1px 2px'; | |
| MentionOP.style.borderColor = '#4285f4'; | |
| pseudoliste.appendChild(MentionOP); | |
| } | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment