// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description Script pour ajouter un bouton KICK à côté des pseudos // @author RogerduGhetto // @match https://redsky.fr/ // @grant GM_addStyle // ==/UserScript== class button { constructor(pseudo, section) { this.pseudo = pseudo; this.button = document.createElement('button'); this.button.innerHTML = 'KICK'; this.button.id = this.pseudo; this.button.classList.add('kick-button'); this.button.addEventListener("click", function(){ kick(this.pseudo); }); section.getElementsByClassName('skychat_user_profile_moto')[0].appendChild(this.button); } } async function kick(pseudo) { await SkyWindow.client.sendMessage(`/kick ${pseudo}`); console.log(`${pseudo} a été kické`) } async function createButtons() { const connected = document.getElementsByClassName('skychat_pseudo_data'); for (let i = 0; i<=connected.length; i++) { let section = connected[i]; let regex = new RegExp('profil\/([^\/]+)'); let pseudo = regex.exec(connected[i].innerHTML)[1]; new button(pseudo, section); } } (function() { window.addEventListener('load', function() { setInterval(function() { let buttonsExists = document.getElementsByClassName('kick-button'); if (buttonsExists.length == 0){ createButtons(); }; clearInterval(interval); }, 50); }, false); })(); GM_addStyle('.kick-button { background-color : black; color: white; margin : 5px; border : none; border-radius : 20%;}');