LoultGetId2

try to take over the world!

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         LoultGetId2
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://loult.family/*
// @grant        none
// ==/UserScript==

function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
}



var CheminComplet = document.location.href;
var NomDuFichier     = CheminComplet.substring(CheminComplet.lastIndexOf( "/" )+1 );
var FirstMessage = true ; 

 socket = new WebSocket('wss://loult.family/socket/'+NomDuFichier);
 



 socket.onmessage = function(e){
   var server_message = e.data;

if (typeof event.data === "string") {
var jsonObject = JSON.parse(e.data) ; 
    
    
if(FirstMessage){      // si premier message du socket 
    
var length = jsonObject.users.length ;      // taille du tableau des utilisateurs  et nombre pokemon connecté 
for (var i = 0 ; i<length; i++) {
    
if( jsonObject.users[i].params.you === true) {
    
    
    console.log( "nom :" +  jsonObject.users[i].params.name  +" "+  jsonObject.users[i].params.adjective  );
    console.log( "cookie :" + getCookie("id") );
    document.cookie = "id"+ '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 
}
    
    
FirstMessage=false ;  // sortir du if 
}
    

 }

    


}
 
                                }