Music Menu For Sploop.io

Press P for Menu

  1. // ==UserScript==
  2. // @name Music Menu For Sploop.io
  3. // @version 1
  4. // @description Press P for Menu
  5. // @author RektByMateX
  6. // @match *://sploop.io/*
  7. // @icon https://sploop.io/img/ui/favicon.png
  8. // @grant none
  9. // @namespace https://gf.qytechs.cn/users/1037154
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. const menu = document.createElement('div');
  16. menu.id = 'music-menu';
  17. menu.style.position = 'fixed';
  18. menu.style.top = '0';
  19. menu.style.right = '-300px';
  20. menu.style.width = '300px';
  21. menu.style.height = '100%';
  22. menu.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  23. menu.style.color = '#fff';
  24. menu.style.fontFamily = 'Arial, sans-serif';
  25. menu.style.padding = '20px';
  26. menu.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
  27. menu.style.transition = 'right 0.5s ease';
  28. menu.style.zIndex = '10000';
  29. menu.innerHTML = `
  30. <h2 style="text-align: center;" id="music-menu-title">Hudební menu</h2>
  31. <label for="music-url" id="music-url-label">URL písničky (YouTube):</label>
  32. <input id="music-url" type="text" style="width: 100%; margin-bottom: 10px; padding: 5px;" placeholder="Paste YouTube URL...">
  33. <label for="start-time" id="start-time-label">Start Time Seconds...):</label>
  34. <input id="start-time" type="number" style="width: 100%; margin-bottom: 10px; padding: 5px;" placeholder="Seconds...">
  35. <button id="play-music" style="width: 100%; padding: 10px; margin-bottom: 10px; background-color: #4CAF50; color: white; border: none; cursor: pointer; font-size: 16px; font-weight: bold; border-radius: 5px;">Přehrát písničku</button>
  36. <button id="start-video" style="width: 100%; padding: 10px; margin-bottom: 10px; background-color: #2196F3; color: white; border: none; cursor: pointer; font-size: 16px; font-weight: bold; border-radius: 5px;">START VIDEO</button>
  37. <button id="stop-music" style="width: 100%; padding: 10px; background-color: #f44336; color: white; border: none; cursor: pointer; font-size: 16px; font-weight: bold; border-radius: 5px;">Zastavit</button>
  38. <div id="video-container" style="margin-top: 20px; display: none;">
  39. <iframe id="video-frame" width="100%" height="200" style="border: none;" src="" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
  40. </div>
  41. <div id="player" style="margin-top: 20px; display: none;"></div>
  42. <div id="warning" style="margin-top: 20px; color: red; font-weight: bold;">
  43. <p id="adblock-warning">POUŽITÍ ADBLOCKU VEDE K NEFUNKČNOSTI VYPNITE HO</p>
  44. <label for="language-select" style="color: white;">Language:</label>
  45. <select id="language-select" style="width: 100%; padding: 5px;">
  46. <option value="cz"eština</option>
  47. <option value="en">English</option>
  48. <option value="ru">Русский</option>
  49. <option value="vi">Tiếng Vit</option>
  50. <option value="ar">العربية</option>
  51. </select>
  52. </div>
  53. <div style="margin-top: 20px; text-align: center; font-weight: bold; color: #FFEB3B;">
  54. Script By <a href="https://www.youtube.com/@RektByMateX" target="_blank" style="color: #FF4081; font-weight: bold; text-decoration: underline;">RektByMateX</a>
  55. </div>
  56. `;
  57. document.body.appendChild(menu);
  58.  
  59. let menuVisible = false;
  60. function toggleMenu() {
  61. menu.style.right = menuVisible ? '-300px' : '0';
  62. menuVisible = !menuVisible;
  63. console.log('Menu visible:', menuVisible); // Debugging line
  64. }
  65.  
  66. let player;
  67. function createYouTubePlayer(videoId, startTime) {
  68. if (!player) {
  69. player = new YT.Player('player', {
  70. height: '0',
  71. width: '0',
  72. videoId: videoId,
  73. playerVars: { autoplay: 1, start: startTime },
  74. events: {
  75. onReady: (event) => {
  76. event.target.playVideo();
  77. }
  78. }
  79. });
  80. } else {
  81. player.loadVideoById(videoId, startTime);
  82. }
  83. }
  84.  
  85. function stopYouTubePlayer() {
  86. if (player) {
  87. player.stopVideo();
  88. }
  89. const iframe = document.getElementById('video-frame');
  90. iframe.src = '';
  91. document.getElementById('player').style.display = 'none';
  92. document.getElementById('video-container').style.display = 'none';
  93. }
  94.  
  95. document.getElementById('play-music').addEventListener('click', () => {
  96. const url = document.getElementById('music-url').value;
  97. const startTime = parseInt(document.getElementById('start-time').value) || 0;
  98. const videoId = extractYouTubeVideoId(url);
  99. if (videoId) {
  100. createYouTubePlayer(videoId, startTime);
  101. document.getElementById('player').style.display = 'block';
  102. document.getElementById('video-container').style.display = 'none';
  103. } else {
  104. alert('Neplatný YouTube odkaz.');
  105. }
  106. });
  107.  
  108. document.getElementById('start-video').addEventListener('click', () => {
  109. const url = document.getElementById('music-url').value;
  110. const startTime = parseInt(document.getElementById('start-time').value) || 0;
  111. const videoId = extractYouTubeVideoId(url);
  112. if (videoId) {
  113. const iframe = document.getElementById('video-frame');
  114. iframe.src = `https://www.youtube.com/embed/${videoId}?start=${startTime}&autoplay=1`;
  115. document.getElementById('video-container').style.display = 'block';
  116. document.getElementById('player').style.display = 'none';
  117. } else {
  118. alert('Neplatný YouTube odkaz.');
  119. }
  120. });
  121.  
  122. document.getElementById('stop-music').addEventListener('click', () => {
  123. stopYouTubePlayer();
  124. });
  125.  
  126. document.addEventListener('keydown', (e) => {
  127. if (e.key.toLowerCase() === 'p') {
  128. toggleMenu();
  129. }
  130. });
  131.  
  132. function extractYouTubeVideoId(url) {
  133. const match = url.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
  134. return match ? match[1] : null;
  135. }
  136.  
  137. const script = document.createElement('script');
  138. script.src = 'https://www.youtube.com/iframe_api';
  139. document.head.appendChild(script);
  140.  
  141. document.getElementById('language-select').addEventListener('change', (e) => {
  142. changeLanguage(e.target.value);
  143. });
  144.  
  145. function changeLanguage(language) {
  146. const translations = {
  147. cz: {
  148. 'music-menu-title': 'Hudební menu',
  149. 'music-url-label': 'URL písničky (YouTube):',
  150. 'start-time-label': 'Začátek (sekundy):',
  151. 'play-music': 'Přehrát písničku',
  152. 'start-video': 'Spustit Video',
  153. 'stop-music': 'Zastavit',
  154. 'adblock-warning': 'POUŽITÍ ADBLOCKU VEDE K NEFUNKČNOSTI VYPNITE HO',
  155. 'language-btn': 'Vyberte jazyk'
  156. },
  157. en: {
  158. 'music-menu-title': 'Music Menu',
  159. 'music-url-label': 'Song URL (YouTube):',
  160. 'start-time-label': 'Start time (seconds):',
  161. 'play-music': 'Play Song',
  162. 'start-video': 'START VIDEO',
  163. 'stop-music': 'Stop',
  164. 'adblock-warning': 'USING ADBLOCK CAUSES FAILURE, PLEASE DISABLE IT',
  165. 'language-btn': 'Languages'
  166. },
  167. ru: {
  168. 'music-menu-title': 'Музыкальное меню',
  169. 'music-url-label': 'URL песни (YouTube):',
  170. 'start-time-label': 'Время начала (секунды):',
  171. 'play-music': 'Воспроизвести песню',
  172. 'start-video': 'Запустить видео',
  173. 'stop-music': 'Остановить',
  174. 'adblock-warning': 'Использование Adblock вызывает сбой, пожалуйста, отключите его',
  175. 'language-btn': 'Языки'
  176. },
  177. vi: {
  178. 'music-menu-title': 'Menu Nhạc',
  179. 'music-url-label': 'URL bài hát (YouTube):',
  180. 'start-time-label': 'Thời gian bắt đầu (giây):',
  181. 'play-music': 'Phát bài hát',
  182. 'start-video': 'Bắt đầu Video',
  183. 'stop-music': 'Dừng',
  184. 'adblock-warning': 'SỬ DỤNG ADBLOCK GÂY LỖI, VUI LÒNG TẮT NÓ',
  185. 'language-btn': 'Ngôn ngữ'
  186. },
  187. ar: {
  188. 'music-menu-title': 'قائمة الموسيقى',
  189. 'music-url-label': 'رابط الأغنية (YouTube):',
  190. 'start-time-label': 'وقت البداية (ثواني):',
  191. 'play-music': 'تشغيل الأغنية',
  192. 'start-video': 'تشغيل الفيديو',
  193. 'stop-music': 'إيقاف',
  194. 'adblock-warning': 'استخدام Adblock يؤدي إلى عطل ، يرجى تعطيله',
  195. 'language-btn': 'اللغات'
  196. }
  197. };
  198.  
  199. const text = translations[language] || translations.en;
  200. document.getElementById('music-menu-title').textContent = text['music-menu-title'];
  201. document.getElementById('music-url-label').textContent = text['music-url-label'];
  202. document.getElementById('start-time-label').textContent = text['start-time-label'];
  203. document.getElementById('play-music').textContent = text['play-music'];
  204. document.getElementById('start-video').textContent = text['start-video'];
  205. document.getElementById('stop-music').textContent = text['stop-music'];
  206. document.getElementById('adblock-warning').textContent = text['adblock-warning'];
  207. document.getElementById('language-btn').textContent = text['language-btn'];
  208. }
  209. })();

QingJ © 2025

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