Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. let user_s;
  2. let osoba=0;
  3.  
  4. let div=document.createElement('div');
  5. div.id='divek';
  6. div.style.fontSize='12px';
  7. document.body.appendChild(div)
  8.  
  9. function syk(){
  10.  
  11.  
  12. function getPlayersOnline(world, callback) {
  13. fetch(`https://cors.io/?https://www.margonem.pl/?task=stats`).then((res) => {
  14. return res.text();
  15. }).then((data) => {
  16. let parse = new DOMParser().parseFromString(data, 'text/html');
  17. let players = parse.body.querySelector(`#online_${world} p`);
  18. let list = players.textContent;
  19. callback(list);
  20. });
  21. }
  22.  
  23. getPlayersOnline(g.worldname, (e) => {
  24. user_s=e.split(', ');
  25. console.log(`Załadowno,na serwerze jest : ${user_s.length} osób.`);
  26.  
  27. gengar();
  28. });
  29.  
  30. setTimeout(() => {
  31. syk();
  32. },10000);
  33. }syk();
  34.  
  35. function gengar(){
  36. div.innerHTML=`${user_s} (${user_s.length} osoby)`;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement