WHOWHERE V2

WhoWhere V2 created by ᴊᴜsᴛ ᴀʟɪᴋᴏᴏ && for GARTIC IO

  1. // ==UserScript==
  2. // @name WHOWHERE V2
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.1
  5. // @description WhoWhere V2 created by ᴊᴜsᴛ ᴀʟɪᴋᴏᴏ && for GARTIC IO
  6. // @author ᴀʟɪᴋᴏᴏ
  7. // @match *://gartic.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=gartic.io
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Sayfa yüklendiğinde betiği çalıştır
  16. console.log('Gartic.io WhoWhere hazirdir!');
  17.  
  18. // HTML yapısını ekleyelim
  19. const overlay = document.createElement('div');
  20. overlay.className = 'overlay';
  21.  
  22. const header = document.createElement('header');
  23. header.innerHTML = '<h2>WhoWhere V2 by ᴊᴜsᴛ ᴀʟɪᴋᴏᴏ</h2>';
  24. overlay.append(header);
  25.  
  26. const p = document.createElement('p');
  27. p.textContent = 'Hazırki Otağlar';
  28. overlay.append(p);
  29.  
  30. const closeButton = document.createElement('button');
  31. closeButton.textContent = 'Bağla';
  32. closeButton.style.cssText = 'position: fixed; top: 10px; right: 10px; padding: 5px 10px; background-color: darkred; color: white; border: none; border-radius: 5px; cursor: pointer;';
  33. closeButton.onclick = () => {
  34. overlay.style.display = 'none';
  35. openButton.style.display = 'block';
  36. };
  37. overlay.append(closeButton);
  38.  
  39. const openButton = document.createElement('button');
  40. openButton.textContent = 'Aç';
  41. openButton.style.cssText = 'position: fixed; bottom: 10px; right: 10px; padding: 5px 10px; background-color: darkgreen; color: white; border: none; border-radius: 5px; cursor: pointer; display: none; z-index: 9999;';
  42. openButton.onclick = () => {
  43. overlay.style.display = 'block';
  44. openButton.style.display = 'none';
  45. };
  46. document.body.append(openButton);
  47.  
  48. const select = document.createElement('select');
  49. select.id = 'lg';
  50. select.innerHTML = `
  51. <option value="23" selected>Azərbaycanca</option>
  52. <option value="45">Bahasa Indonesia</option>
  53. <option value="11"eština</option>
  54. <option value="14">Deutsch</option>
  55. <option value="2">English</option>
  56. <option value="3">Español</option>
  57. <option value="4">Français</option>
  58. <option value="6">Italiano</option>
  59. <option value="44">Magyar</option>
  60. <option value="18">Nederlands</option>
  61. <option value="10">Polski</option>
  62. <option value="1">Português</option>
  63. <option value="58">Română</option>
  64. <option value="22">Slovenčina</option>
  65. <option value="13">Tiếng Vit</option>
  66. <option value="8">Türkçe</option>
  67. <option value="21">български език</option>
  68. <option value="7">Русский</option>
  69. <option value="40">עברית</option>
  70. <option value="19">العربية</option>
  71. <option value="34">فارسی</option>
  72. <option value="12">ภาษาไทย</option>
  73. <option value="16">中文 (简化字)</option>
  74. <option value="9">中文 (臺灣)</option>
  75. <option value="17">中文 (香港)</option>
  76. <option value="15">日本語</option>
  77. <option value="20">한국어</option>
  78. <option value="26">Afrikaans</option>
  79. <option value="55">Bahasa Melayu</option>
  80. <option value="30">Català</option>
  81. <option value="31">Dansk</option>
  82. <option value="33">Eesti</option>
  83. <option value="67">Esperanto</option>
  84. <option value="36">Føroyskt</option>
  85. `;
  86. select.onchange = function() {
  87. f(this.value);
  88. };
  89. overlay.append(select);
  90.  
  91. const flexDiv = document.createElement('div');
  92. flexDiv.className = 'flex';
  93. overlay.append(flexDiv);
  94.  
  95. const footer = document.createElement('footer');
  96. footer.innerHTML = '<p>All Rights Reserved © <span>&#169;</span> <span>&#174;</span></p>';
  97. footer.style.cssText = 'position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); cursor: pointer;';
  98. footer.onclick = () => {
  99. alert('Telif Haqqları: Bu script, Gartic.io platformundaki aktiv otağları izləmək üçün @just_alikoo və tərəfindən yaradılmışdır. Bütün haqqları saxlıdır.');
  100. };
  101. overlay.append(footer);
  102.  
  103. const changelogButton = document.createElement('button');
  104. changelogButton.textContent = 'Yeniliklər';
  105. changelogButton.style.cssText = 'position: fixed; bottom: 10px; right: 90px; padding: 5px 10px; background-color: darkslateblue; color: white; border: none; border-radius: 5px; cursor: pointer;';
  106. changelogButton.onclick = () => {
  107. const changelogOverlay = document.createElement('div');
  108. changelogOverlay.style.cssText = 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 300px; padding: 20px; background-color: darkslateblue; color: black; border: 1px solid black; border-radius: 10px; z-index: 10000;';
  109.  
  110. const changelogContent = document.createElement('div');
  111. changelogContent.innerHTML = `
  112. <h3> Özəlliklər && Yeniliklər </h3>
  113. <p> WhoWhere V2 by ig: @just_alikoo:</p>
  114. <ul>
  115. <li>Translate </li>
  116. <li>Otağa daxil olma</li>
  117. <li>Otağ izləmə</li>
  118. <li>Tool links</li>
  119. <li> Yeni serverler</>
  120. </ul>
  121. <button id="closeChangelog">Mətni burdan bağla X</button>
  122. `;
  123. changelogOverlay.append(changelogContent);
  124.  
  125. document.body.append(changelogOverlay);
  126.  
  127. document.getElementById('closeChangelog').onclick = () => {
  128. document.body.removeChild(changelogOverlay);
  129. };
  130. };
  131. overlay.append(changelogButton);
  132.  
  133. // Toplam odalar ve kullanıcıları gösteren sayaç
  134. const totalCountDisplay = document.createElement('div');
  135. totalCountDisplay.style.cssText = 'position: fixed; top: 50px; left: 10px; background-color: darkslateblue; color: white; padding: 5px 10px; border-radius: 5px; z-index: 9999;';
  136. document.body.append(totalCountDisplay);
  137.  
  138. document.body.prepend(overlay);
  139.  
  140. const style = document.createElement('style');
  141. style.textContent = `
  142. body {
  143. position: relative;
  144. }
  145.  
  146. .overlay {
  147. position: fixed;
  148. top: 0;
  149. left: 0;
  150. width: 100%;
  151. height: 100%;
  152. background-color: gray;
  153. color: #f0f0f0;
  154. font-family: 'Inter', sans-serif;
  155. z-index: 9999;
  156. overflow-y: auto;
  157. text-align: center;
  158. padding: 20px;
  159. }
  160.  
  161. h3 {
  162. margin: 8px 0;
  163. border-radius: 30px;
  164. }
  165.  
  166. .flex {
  167. margin: 1rem auto;
  168. display: flex;
  169. justify-content: center;
  170. flex-wrap: wrap;
  171. gap: 8px;
  172. border-radius: 20%;
  173. }
  174.  
  175. .flex .flex-child {
  176. background-color: darkgray;
  177. padding: 8px 12px;
  178. min-width: 150px;
  179. border-radius: 30px;
  180. }
  181.  
  182. .flex .flex-child img {
  183. width: 25px;
  184. height: 25px;
  185. border-radius: 50%;
  186. border: 1px solid #666;
  187. }
  188.  
  189. .users .user-info {
  190. display: flex;
  191. align-items: center;
  192. margin-bottom: 4px;
  193. }
  194.  
  195. .users .user-info p {
  196. margin-left: 4px;
  197. font-size: 12px;
  198. overflow-wrap: anywhere;
  199. }
  200.  
  201. p {
  202. font-size: 14px;
  203. }
  204.  
  205. footer p {
  206. font-size: 80%;
  207. }
  208.  
  209. a {
  210. display: block;
  211. margin-top: 0.5rem;
  212. text-decoration: none;
  213. font-size: 14px;
  214. padding: 6px 8px;
  215. color: inherit;
  216. background-color: darkslateblue;
  217. border-radius: 30px;
  218. transition: .2s;
  219. }
  220.  
  221. a:hover {
  222. opacity: 0.9;
  223. }
  224.  
  225. a:active {
  226. opacity: 1;
  227. }
  228.  
  229. select {
  230. font-size: 16px;
  231. font-family: Nunito;
  232. padding: 5px;
  233. background-color: darkslateblue;
  234. color: inherit;
  235. border-radius: 30px;
  236. }
  237. `;
  238. document.head.append(style);
  239.  
  240. const fl = document.querySelector('.flex');
  241.  
  242. let roomIds = [];
  243.  
  244. function f(lang) {
  245. fetch('https://gartic.io/req/list?search=&language[]=' + lang)
  246. .then(res => res.json())
  247. .then(data => {
  248. const active = data.filter(room => room.quant > 0);
  249. if (active.length !== 0) {
  250. fl.innerHTML = '';
  251. for (let k = 0; k < active.length; k++) {
  252. roomIds.push(active[k].id);
  253.  
  254. const flc = document.createElement('div');
  255. flc.classList.add('flex-child');
  256. fl.appendChild(flc);
  257.  
  258. const roomTag = document.createElement('h3');
  259. const roomSubjIcon = document.createElement('img');
  260. const inRoomPlayers = document.createElement('p');
  261. const users = document.createElement('div');
  262. const viewBtn = document.createElement('a');
  263. const joinBtn = document.createElement('a');
  264.  
  265. users.classList.add('users');
  266.  
  267. roomTag.innerHTML = active[k].id.slice(1);
  268. roomSubjIcon.src = `https://gartic.io/static/images/subjects/${active[k].subject}.svg`;
  269. inRoomPlayers.innerHTML = `${active[k].quant} / ${active[k].max} ${active[k].points} / ${active[k].goal}`;
  270. viewBtn.href = `https://gartic.io/${active[k].code}/viewer`;
  271. viewBtn.innerHTML = 'Otağı izlə';
  272. viewBtn.target = '_blank';
  273.  
  274. joinBtn.href = `https://gartic.io/${active[k].code}`;
  275. joinBtn.innerHTML = 'Otağa daxil ol';
  276. joinBtn.target = '_blank';
  277.  
  278. fetch(`https://gartic.io/serverViewer?room=${active[k].code}`).then(rs => rs.text()).then(dt => {
  279. const s = dt.slice(15, 16);
  280. const ws = new WebSocket(`wss://server0${s}.gartic.io/socket.io/?EIO=3&transport=websocket`);
  281.  
  282. ws.onopen = () => {
  283. ws.send(`42["12",{"v":20000,"sala":"${roomIds[k]}"}]`);
  284. };
  285.  
  286. ws.onmessage = (m) => {
  287. try {
  288. const d = JSON.parse(m.data.slice(2));
  289. if (d[0] == 5) {
  290. for (let i = 0; i < d[5].length; i++) {
  291. const userB = document.createElement('div');
  292. userB.classList.add('user-info');
  293. users.appendChild(userB);
  294.  
  295. const userPp = document.createElement('img');
  296. const userName = document.createElement('p');
  297.  
  298. userPp.src = d[5][i].foto ? d[5][i].foto : 'https://gartic.io/static/images/avatar/svg/0.svg';
  299. userName.innerHTML = d[5][i].nick;
  300.  
  301. userB.append(userPp, userName);
  302. }
  303. }
  304. } catch (err) {
  305. console.error(err);
  306. }
  307. };
  308. });
  309.  
  310. flc.append(roomTag, roomSubjIcon, inRoomPlayers, users, viewBtn, joinBtn);
  311. }
  312.  
  313.  
  314. totalCountDisplay.textContent = `Total Otağ: ${active.length}, Total User: ${active.reduce((acc, curr) => acc + curr.quant, 0)}`;
  315.  
  316. } else {
  317. fl.innerHTML = '<h2>Seçilən dildə otağ yoxdur.</h2>';
  318. totalCountDisplay.textContent = '';
  319. }
  320. });
  321. }
  322.  
  323.  
  324. f('23');
  325.  
  326. })();
  327.  
  328.