A L Z E~WHOWHERE Gartic.io

Odalardaki kullanıcıları gösterir (AZE)

  1. // ==UserScript==
  2. // @name A L Z E~WHOWHERE Gartic.io
  3. // @description Odalardaki kullanıcıları gösterir (AZE)
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.1
  6. // @author A L Z E
  7. // @match *://gartic.io/*
  8. // @license MIT
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=gartic.io
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. window.addEventListener('load', function() {
  17. const panel = document.createElement('div');
  18. panel.style.position = 'fixed';
  19. panel.style.top = '10px';
  20. panel.style.right = '10px';
  21. panel.style.width = '400px';
  22. panel.style.height = 'auto';
  23. panel.style.backgroundColor = 'gris';
  24. panel.style.color = 'black';
  25. panel.style.padding = '15px';
  26. panel.style.borderRadius = '8px';
  27. panel.style.zIndex = '9999';
  28. panel.style.maxHeight = '80vh';
  29. panel.style.overflowY = 'auto';
  30. panel.style.transition = 'all 0.3s ease-in-out';
  31.  
  32. if(localStorage.getItem('panelOpen') === 'true') {
  33. panel.style.display = 'block';
  34. } else {
  35. panel.style.display = 'none';
  36. }
  37.  
  38. const toggleButton = document.createElement('button');
  39. toggleButton.innerText = '▶';
  40. toggleButton.style.backgroundColor = 'transparent';
  41. toggleButton.style.border = 'none';
  42. toggleButton.style.color = 'white';
  43. toggleButton.style.fontSize = '20px';
  44. toggleButton.style.cursor = 'pointer';
  45. toggleButton.style.position = 'absolute';
  46. toggleButton.style.top = '10px';
  47. toggleButton.style.right = '10px';
  48. toggleButton.style.zIndex = '10000';
  49.  
  50. toggleButton.onclick = () => {
  51. if (panel.style.display === 'none') {
  52. panel.style.display = 'block';
  53. toggleButton.innerText = '▶';
  54.  
  55. localStorage.setItem('panelOpen', 'true');
  56. } else {
  57. panel.style.display = 'none';
  58. toggleButton.innerText = '◀';
  59.  
  60. localStorage.setItem('panelOpen', 'false');
  61. }
  62. };
  63.  
  64. document.body.appendChild(toggleButton);
  65. document.body.appendChild(panel);
  66.  
  67. const style = document.createElement('style');
  68. style.textContent = `
  69. @keyframes rgb-glow {
  70. 0% { box-shadow: 0 0 25px 10px blue; }
  71. 33% { box-shadow: 0 0 25px 10px red; }
  72. 66% { box-shadow: 0 0 25px 10px green; }
  73. 100% { box-shadow: 0 0 25px 10px blue; }
  74. }
  75. .rgb-led-effect {
  76. animation: rgb-glow 2s infinite;
  77. }
  78. @media (max-width: 768px) {
  79. .responsive-panel {
  80. width: 90%;
  81. right: 5%;
  82. padding: 10px;
  83. }
  84. .responsive-title {
  85. font-size: 20px;
  86. }
  87. }
  88.  
  89. .responsive-panel {
  90. width: 90%;
  91. right: 5%;
  92. padding: 10px;
  93. }
  94.  
  95. ::-webkit-scrollbar {
  96. width: 10px;
  97. }
  98. ::-webkit-scrollbar-track {
  99. background: #gris;
  100. }
  101.  
  102. ::-webkit-scrollbar-thumb {
  103. background: #888;
  104. border-radius: 10px;
  105. }
  106. ::-webkit-scrollbar-thumb:hover {
  107. background: #555;
  108. }
  109. `;
  110. document.head.appendChild(style);
  111.  
  112. panel.classList.add('rgb-led-effect', 'responsive-panel');
  113. document.body.appendChild(panel);
  114.  
  115. const alzeTitle = document.createElement('h2');
  116. alzeTitle.innerText = '🅰 🅻 🆉 🅴';
  117. alzeTitle.style.textAlign = 'center';
  118. alzeTitle.style.marginBottom = '10px';
  119. alzeTitle.style.color = 'white';
  120. alzeTitle.classList.add('wihite');
  121. panel.appendChild(alzeTitle);
  122.  
  123. const title = document.createElement('div');
  124. title.innerText = 'Çevrimiçi Kullanıcılar';
  125. title.style.textAlign = 'center';
  126. title.style.color = 'white';
  127. panel.appendChild(title);
  128.  
  129. const totalCountDisplay = document.createElement('div');
  130. totalCountDisplay.style.marginTop = '10px';
  131. panel.appendChild(totalCountDisplay);
  132.  
  133. const fl = document.createElement('div');
  134. fl.style.display = 'flex';
  135. fl.style.flexDirection = 'column';
  136. fl.style.gap = '10px';
  137. panel.appendChild(fl);
  138.  
  139. let roomIds = [];
  140.  
  141. function f(lang) {
  142. fetch('https://gartic.io/req/list?search=&language[]=' + lang)
  143. .then(res => res.json())
  144. .then(data => {
  145. const active = data.filter(room => room.quant > 0);
  146. if (active.length !== 0) {
  147. fl.innerHTML = '';
  148. for (let k = 0; k < active.length; k++) {
  149. roomIds.push(active[k].id);
  150.  
  151. const flc = document.createElement('div');
  152. flc.style.backgroundColor = 'gris';
  153. flc.style.padding = '10px';
  154. flc.style.borderRadius = '8px';
  155. flc.style.border = '1px solid #666';
  156. fl.appendChild(flc);
  157.  
  158. const roomTag = document.createElement('div');
  159. roomTag.style.color = 'white';
  160. roomTag.style.fontSize = '18px';
  161. const roomSubjIcon = document.createElement('img');
  162. roomSubjIcon.style.width = '50px';
  163. roomSubjIcon.style.height = '50px';
  164. const inRoomPlayers = document.createElement('p');
  165. const users = document.createElement('div');
  166. const viewBtn = document.createElement('button');
  167. const joinBtn = document.createElement('button');
  168.  
  169. users.style.backgroundColor = 'gris';
  170. users.style.color = 'white';
  171. users.style.padding = '10px';
  172. users.style.borderRadius = '8px';
  173. users.style.marginTop = '10px';
  174.  
  175. users.classList.add('users');
  176.  
  177. roomTag.innerHTML = active[k].id.slice(1);
  178. roomSubjIcon.src = `https://gartic.io/static/images/subjects/${active[k].subject}.svg`;
  179. inRoomPlayers.innerHTML = `${active[k].quant} / ${active[k].max} ${active[k].points} / ${active[k].goal}`;
  180. inRoomPlayers.style.color = 'white';
  181. viewBtn.innerHTML = 'Otağı izlə';
  182. viewBtn.style.backgroundColor = 'blue';
  183. viewBtn.style.color = 'white';
  184. viewBtn.style.border = 'none';
  185. viewBtn.style.padding = '8px 15px';
  186. viewBtn.style.borderRadius = '8px';
  187. viewBtn.style.cursor = 'pointer';
  188. viewBtn.onclick = () => window.open(`https://gartic.io/${active[k].code}/viewer`, '_blank');
  189.  
  190. joinBtn.innerHTML = 'Otağa daxil ol';
  191. joinBtn.style.backgroundColor = 'red';
  192. joinBtn.style.color = 'white';
  193. joinBtn.style.border = 'none';
  194. joinBtn.style.padding = '8px 15px';
  195. joinBtn.style.borderRadius = '8px';
  196. joinBtn.style.cursor = 'pointer';
  197. joinBtn.onclick = () => window.open(`https://gartic.io/${active[k].code}`, '_blank');
  198.  
  199. fetch(`https://gartic.io/serverViewer?room=${active[k].code}`).then(rs => rs.text()).then(dt => {
  200. const s = dt.slice(15, 16);
  201. const ws = new WebSocket(`wss://server0${s}.gartic.io/socket.io/?EIO=3&transport=websocket`);
  202.  
  203. ws.onopen = () => {
  204. ws.send(`42["12",{"v":20000,"sala":"${roomIds[k]}"}]`);
  205. };
  206.  
  207. ws.onmessage = (m) => {
  208. try {
  209. const d = JSON.parse(m.data.slice(2));
  210. if (d[0] == 5) {
  211. users.innerHTML = '';
  212. for (let i = 0; i < d[5].length; i++) {
  213. const userB = document.createElement('div');
  214. userB.classList.add('user-info');
  215. users.appendChild(userB);
  216.  
  217. const userPp = document.createElement('img');
  218. const userName = document.createElement('p');
  219.  
  220. userPp.src = d[5][i].foto ? d[5][i].foto : 'https://gartic.io/static/images/avatar/svg/0.svg';
  221. userPp.style.width = '40px';
  222. userPp.style.height = '40px';
  223. userPp.style.borderRadius = '50%';
  224.  
  225. userName.innerHTML = d[5][i].nick;
  226. userName.style.color = 'white';
  227.  
  228. userB.append(userPp, userName);
  229. }
  230. }
  231. } catch (err) {
  232. console.error("Kullanıcılar alınırken hata oluştu: ", err);
  233. }
  234. };
  235. });
  236.  
  237. flc.append(roomTag, roomSubjIcon, inRoomPlayers, users, viewBtn, joinBtn);
  238. }
  239.  
  240. totalCountDisplay.textContent = `Toplam Oda: ${active.length}, Toplam Kullanıcı: ${active.reduce((acc, curr) => acc + curr.quant, 0)}`;
  241. panel.style.display = 'block';
  242. totalCountDisplay.style.color = 'white';
  243. } else {
  244. fl.innerHTML = '<h4>Seçilən dildə oda yok.</h4>';
  245. totalCountDisplay.textContent = 'white';
  246. }
  247. });
  248. }
  249.  
  250. f('23');
  251. });
  252. })();