您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
some cool features
当前为
// ==UserScript== // @name Snay.io + // @namespace http://tampermonkey.net/ // @version 0.1 // @description some cool features // @author GravityG // @match https://www.snay.io/* // @license MIT // @icon https://i.postimg.cc/dtDCj3h6/Logo.png // @grant none // ==/UserScript== (function() { 'use strict'; function createElementFromHTML(htmlString, id) { var div = document.createElement('div'); div.innerHTML = htmlString.trim(); var element = div.firstChild; element.id = id; // Set the ID return element; } // HTML strings for the new elements var htmlStrings = [ {html: '<h3 class="settings-subtitle" style="margin: 1em; padding: 0px; font-size: 2em;">Script Dev</h3>', id: 'newElement1'}, {html: '<hr style="color: rgb(99, 99, 99); height: 0.1vw; background-color: rgb(99, 99, 99); width: 58em; margin-bottom: 1vw; margin-left: 2em;">', id: 'newElement2'}, {html: '<li style="margin-right: 0.5em; margin-left: 0.5em; margin-bottom: 0.5em; padding: 0px; color: rgb(99, 99, 99); background-color: rgb(242, 242, 242); border: 0.05em solid rgb(211, 211, 211); border-radius: 0.5em; display: flex; align-items: center; width: 30em; height: 3em; font-size: 2em;"><img src="https://i.pinimg.com/originals/23/51/bc/2351bc65b2b5d75cef146b7edddf805b.gif" style="border-radius: 100%; margin-right: 0.5em; margin-left: 0.5em; width: 2.5em; height: 2.5em;"><span style="width: 14em;">GravityG </span><img src="/assets/img/DiscordIcone.png" style="margin-right: 0.5em; margin-left: 0.5em; width: 2.5em; height: 2.5em;"><span>hw_e</span></li>', id: 'newElement3'} ]; // Get the settings button var settingsBtn = document.getElementById('settings-btn'); // Add the click event listener settingsBtn.addEventListener('click', function() { // Get the MoreButtons element var moreButtons = document.getElementById('MoreButtons'); // Reverse the array to maintain the order when using insertBefore htmlStrings.reverse().forEach(function(elementData) { // Check if the element has already been added if (!document.getElementById(elementData.id)) { var newElement = createElementFromHTML(elementData.html, elementData.id); moreButtons.insertBefore(newElement, moreButtons.firstChild); } }); }); // Function to apply custom CSS function applyCustomCSS() { var modMenu = document.getElementById('modmenu'); if (modMenu) { modMenu.style.borderRadius = '15px'; modMenu.style.zIndex = '20'; modMenu.style.top = '1vw'; modMenu.style.width = '20vw'; modMenu.style.height = '30vw'; modMenu.style.borderStyle = 'solid'; modMenu.style.borderColor = 'transparent'; modMenu.style.backgroundColor = 'rgb(34 34 34)'; modMenu.style.position = 'absolute'; modMenu.style.right = '1vw'; var modMenuChildren = modMenu.querySelectorAll('*'); modMenuChildren.forEach(function(child) { child.style.borderColor = 'transparent'; }); var modMenuInputs = modMenu.querySelectorAll('input'); modMenuInputs.forEach(function(input) { input.style.width = '85%'; input.style.position = 'relative'; input.style.display = 'block'; input.style.color = 'green'; input.style.height = '0.2vw'; input.style.marginTop = '2vw'; input.style.marginBottom = '2vw'; input.style.borderRadius = '1vw'; input.style.borderColor = 'transparent'; }); var modMenuTitle = document.getElementById('modmenutitle'); if (modMenuTitle) { modMenuTitle.style.fontSize = '1.8vw'; modMenuTitle.style.fontWeight = 'bold'; modMenuTitle.style.margin = '0'; modMenuTitle.style.padding = '0'; modMenuTitle.style.position = 'relative'; modMenuTitle.style.display = 'block'; modMenuTitle.style.height = '3vw'; modMenuTitle.style.textAlign = 'center'; modMenuTitle.style.color = 'white'; modMenuTitle.style.zIndex = '-1'; modMenuTitle.style.borderColor = 'transparent'; } var modMenuSubtitles = document.querySelectorAll('.modmenusubtitle'); modMenuSubtitles.forEach(function(subtitle) { subtitle.style.fontSize = '1.2vw'; subtitle.style.position = 'relative'; subtitle.style.display = 'block'; subtitle.style.width = '100%'; subtitle.style.height = '1vw'; subtitle.style.textAlign = 'center'; subtitle.style.color = 'white'; subtitle.style.borderColor = 'transparent'; }); var modMenuValues = document.querySelectorAll('.modmenuvalue'); modMenuValues.forEach(function(value) { value.style.position = 'relative'; value.style.display = 'block'; value.style.color = 'white'; value.style.width = '15%'; value.style.paddingTop = '0'; value.style.fontSize = '2vw'; value.style.lineHeight = '1vw'; value.style.borderColor = 'transparent'; }); } } window.addEventListener('load', applyCustomCSS); var checkGameOver; document.getElementById('play-btn').addEventListener('click', function() { checkGameOver = setInterval(function() { var overlays = document.getElementById('overlays'); if (overlays && overlays.classList.contains('fade-out')) { var gameOver = document.getElementById('game-over'); var respawnButton = document.getElementById('respawn-button'); var overlay = document.querySelector('.swal-overlay.swal-overlay--show-modal'); var modal = overlay ? overlay.querySelector('.swal-modal') : null; var buttonContainers = modal ? modal.querySelectorAll('.swal-button-container') : []; var stopButton = buttonContainers.length > 1 ? buttonContainers[1].querySelector('.swal-button.swal-button--confirm.fs40.swal-button--danger') : null; if (gameOver && gameOver.style.display !== 'none' && respawnButton) { respawnButton.click(); } if (stopButton) { clearInterval(checkGameOver); stopButton.addEventListener('click', function() { clearInterval(checkGameOver); }); } } else { clearInterval(checkGameOver); } }, 700); }); document.getElementById('spectate-btn').addEventListener('click', function() { clearInterval(checkGameOver); }); document.getElementById('settings-btn').addEventListener('click', function() { clearInterval(checkGameOver); // Your new code let element = document.getElementById('keys'); if (element && document.getElementById('settings-content') && !document.getElementById('respawnKeybind')) { let newSpan = document.createElement('span'); newSpan.textContent = 'Respawn'; let newB = document.createElement('b'); newB.textContent = localStorage.getItem('respawnKeybind') || 'V'; newB.className = 'selectable'; newB.id = 'respawnKeybind'; element.insertBefore(newB, element.firstChild); element.insertBefore(newSpan, element.firstChild); let respawnKeybindElement = document.getElementById('respawnKeybind'); respawnKeybindElement.addEventListener('mouseover', function() { window.onkeydown = function(event) { event.preventDefault(); let key = event.key.toUpperCase(); respawnKeybindElement.textContent = key; localStorage.setItem('respawnKeybind', key); }; }); respawnKeybindElement.addEventListener('mouseout', function() { window.onkeydown = null; }); } }); // Function to apply your changes function applyChanges() { var Background = 'url("https://images5.alphacoders.com/135/thumb-1920-1351143.png' // Get the title element var logo = document.getElementById('title'); if (logo) { // Hide the title element logo.style.display = 'none'; } var bgseasons = document.getElementById('seasons'); if (bgseasons) { // Hide the title element bgseasons.style.backgroundImage = Background; } var bgstore = document.getElementById('store'); if (bgstore) { // Hide the title element bgstore.style.backgroundImage = Background; } var bgaccount = document.getElementById('account'); if (bgaccount) { // Hide the title element bgaccount.style.backgroundImage = Background; } var bgsettings = document.getElementById('settings'); if (bgsettings) { // Hide the title element bgsettings.style.backgroundImage = Background; } // Get the overlays element var overlaysElement = document.getElementById('overlays'); if (overlaysElement) { // Set the background-image style overlaysElement.style.backgroundImage = Background; } } // Apply your changes when the page has finished loading window.onload = applyChanges; // Create a MutationObserver to monitor changes var observer3 = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // If the addedNodes property has one or more nodes if (mutation.addedNodes.length) { // Apply your changes again applyChanges(); } }); }); // Start observing the document with the configured parameters observer3.observe(document, { childList: true, subtree: true }); function removeAds() { let ads = document.querySelectorAll('.ads'); ads.forEach(ad => ad.remove()); } removeAds(); let observer = new MutationObserver(removeAds); observer.observe(document, { childList: true, subtree: true }); document.addEventListener('keydown', function(event) { let respawnKeybindElement = document.getElementById('respawnKeybind'); if (respawnKeybindElement && event.key.toUpperCase() === respawnKeybindElement.textContent.toUpperCase()) { var leaveBtn = document.getElementById('leaveBtn'); if (leaveBtn) { leaveBtn.click(); } setTimeout(function() { var overlay1 = document.querySelector('.swal-overlay.swal-overlay--show-modal'); var modal2 = overlay1 ? overlay1.querySelector('.swal-modal') : null; var buttonContainers3 = modal2 ? modal2.querySelectorAll('.swal-button-container') : []; var stopButton4 = buttonContainers3.length > 1 ? buttonContainers3[1].querySelector('.swal-button.swal-button--confirm.fs40.swal-button--danger') : null; if (stopButton4) { stopButton4.click(); } setTimeout(function() { var playBtn = document.getElementById('play-btn'); if (playBtn) { playBtn.click(); } }, 200); }, 200); } }); // Create a new observer var observer2 = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { // If the addedNodes property has one or more nodes if (mutation.addedNodes.length) { var video = document.querySelector('video'); if (video) { video.onloadedmetadata = function() { video.currentTime = video.duration; // skip to the end of the video }; video.onplay = function() { if (video.currentTime < video.duration) { video.currentTime = video.duration; // skip to the end of the video } }; } } }); }); // Start observing observer2.observe(document, { childList: true, subtree: true }); })();