Hunger Games Teams

Script to add teams to ice poseidons hunger games map

  1. // ==UserScript==
  2. // @name Hunger Games Teams
  3. // @namespace Keir
  4. // @version 1.1
  5. // @description Script to add teams to ice poseidons hunger games map
  6. // @author KeirStarmer
  7. // @match https://map.iceposeidon.com/
  8. // @match https://hungergames.iceposeidon.com/
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=iceposeidon.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const jsonURL = 'https://cxwatcher.github.io/teams.json';
  16. fetch(jsonURL)
  17. .then(response => response.json())
  18. .then(teamColors => {
  19. const teams = {};
  20. for (const [username, color] of Object.entries(teamColors)) {
  21. if (!teams[color]) {
  22. teams[color] = [];
  23. }
  24. teams[color].push(username);
  25. }
  26. function changeUserBoxColor() {
  27. const usernames = document.querySelectorAll('.username');
  28. usernames.forEach(function(username) {
  29. const name = username.textContent.trim();
  30. if (teamColors[name]) {
  31. username.closest('.user-marker-inner').style.backgroundColor = teamColors[name];
  32. }
  33. });
  34. }
  35.  
  36. window.addEventListener('load', changeUserBoxColor);
  37. new MutationObserver(changeUserBoxColor).observe(document.body, {childList: true, subtree: true});
  38.  
  39. const gulagDiv = document.querySelector('.gulag');
  40. if (gulagDiv) {
  41. const buttonContainer = document.createElement('div');
  42. buttonContainer.style.marginTop = '10px';
  43. const buttonState = {};
  44. for (const [color, members] of Object.entries(teams)) {
  45. const teamButton = document.createElement('button');
  46. teamButton.textContent = `${color.charAt(0).toUpperCase() + color.slice(1)} Team`;
  47. teamButton.style.margin = '5px';
  48. teamButton.style.backgroundColor = color;
  49. teamButton.style.color = color === 'yellow' || color === 'white' ? 'black' : 'white';
  50. teamButton.style.border = 'none';
  51. teamButton.style.padding = '5px';
  52. teamButton.style.borderRadius = '5px';
  53. teamButton.style.display = 'block';
  54.  
  55. buttonContainer.appendChild(teamButton);
  56.  
  57. buttonState[color] = false;
  58.  
  59. teamButton.addEventListener('click', () => {
  60. const usernames = document.querySelectorAll('.username');
  61. if (!buttonState[color]) {
  62. usernames.forEach(function(username) {
  63. const name = username.textContent.trim();
  64. if (teamColors[name] === color) {
  65. username.closest('.user-marker-inner').style.display = 'block';
  66. } else {
  67. username.closest('.user-marker-inner').style.display = 'none';
  68. }
  69. });
  70. buttonState[color] = true;
  71. } else {
  72. usernames.forEach(function(username) {
  73. username.closest('.user-marker-inner').style.display = 'block';
  74. });
  75. buttonState[color] = false;
  76. }
  77. });
  78. }
  79. gulagDiv.insertAdjacentElement('afterend', buttonContainer);
  80. }
  81.  
  82. // Insert data list to the bottom left
  83. const dataListContainer = document.createElement('div');
  84. dataListContainer.style.position = 'fixed';
  85. dataListContainer.style.bottom = '10px';
  86. dataListContainer.style.left = '10px';
  87. dataListContainer.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  88. dataListContainer.style.color = 'white';
  89. dataListContainer.style.padding = '10px';
  90. dataListContainer.style.borderRadius = '5px';
  91. dataListContainer.style.zIndex = '1000';
  92. dataListContainer.style.maxHeight = '80vh';
  93. dataListContainer.style.overflowY = 'auto';
  94.  
  95. const dataList = document.createElement('ul');
  96. dataList.id = 'data-list';
  97. dataList.style.listStyleType = 'none';
  98. dataList.style.padding = '0';
  99. dataList.style.margin = '0';
  100.  
  101. dataListContainer.appendChild(dataList);
  102. document.body.appendChild(dataListContainer);
  103.  
  104. const toggledUsers = {};
  105. function updateList() {
  106. fetch('https://appapi.iceposeidon.com/public')
  107. .then(response => response.json())
  108. .then(data => {
  109. const sortedData = data.sort((a, b) => a.lives_remaining - b.lives_remaining);
  110. const list = document.getElementById('data-list');
  111. list.innerHTML = '';
  112.  
  113. sortedData.forEach(entry => {
  114. const listItem = document.createElement('li');
  115. const link = document.createElement('a');
  116. link.href = `https://kick.com/${entry.name}`;
  117. link.textContent = entry.name;
  118. link.target = '_blank';
  119. const livesText = document.createTextNode(` - ${entry.lives_remaining}`);
  120. listItem.appendChild(link);
  121. listItem.appendChild(livesText);
  122. list.appendChild(listItem);
  123. const nameLower = entry.name.toLowerCase();
  124. listItem.addEventListener('mouseover', () => {
  125. if (Object.keys(toggledUsers).length === 0) {
  126. const usernames = document.querySelectorAll('.username');
  127. usernames.forEach(function (username) {
  128. const name = username.textContent.trim().toLowerCase();
  129. if (name === nameLower) {
  130. username.closest('.user-marker-inner').style.display = 'block';
  131. } else {
  132. username.closest('.user-marker-inner').style.display = 'none';
  133. }
  134. });
  135. }
  136. });
  137.  
  138. listItem.addEventListener('mouseout', () => {
  139. if (Object.keys(toggledUsers).length === 0) {
  140. const usernames = document.querySelectorAll('.username');
  141. usernames.forEach(function (username) {
  142. username.closest('.user-marker-inner').style.display = 'block';
  143. });
  144. }
  145. });
  146. listItem.addEventListener('click', () => {
  147. const usernames = document.querySelectorAll('.username');
  148.  
  149. if (toggledUsers[nameLower]) {
  150. usernames.forEach(function (username) {
  151. if (username.textContent.trim().toLowerCase() === nameLower) {
  152. username.closest('.user-marker-inner').style.display = 'none';
  153. }
  154. });
  155. listItem.style.backgroundColor = '';
  156. delete toggledUsers[nameLower];
  157. } else {
  158. usernames.forEach(function (username) {
  159. if (username.textContent.trim().toLowerCase() === nameLower) {
  160. username.closest('.user-marker-inner').style.display = 'block';
  161. } else if (!toggledUsers[username.textContent.trim().toLowerCase()]) {
  162. username.closest('.user-marker-inner').style.display = 'none';
  163. }
  164. });
  165.  
  166. listItem.style.backgroundColor = 'green';
  167. toggledUsers[nameLower] = true;
  168. }
  169. usernames.forEach(function (username) {
  170. const name = username.textContent.trim().toLowerCase();
  171. if (toggledUsers[name]) {
  172. username.closest('.user-marker-inner').style.display = 'block';
  173. }
  174. });
  175. });
  176.  
  177. if (toggledUsers[nameLower]) {
  178. listItem.style.backgroundColor = 'green';
  179. }
  180. });
  181.  
  182. const usernames = document.querySelectorAll('.username');
  183. usernames.forEach(function (username) {
  184. const nameLower = username.textContent.trim().toLowerCase();
  185. if (toggledUsers[nameLower]) {
  186. username.closest('.user-marker-inner').style.display = 'block';
  187. }
  188. });
  189. })
  190. .catch(error => console.error('Error fetching data:', error));
  191. }
  192.  
  193. updateList();
  194. setInterval(updateList, 10000);
  195.  
  196. })
  197. .catch(error => console.error('Error fetching team colors:', error));
  198. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址