您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Give survev.io better experience
// ==UserScript== // @name Survev.io Counters // @namespace http://tampermonkey.net/ // @license MIT // @version 2.0.0 // @description Give survev.io better experience // @author asultra and wzld // @match https://survev.io/ // @icon https://cdn.discordapp.com/icons/947128006030282792/c80363d8d6dea22ef392c4d325e0c9f4.png?size=64 // @grant GM_addStyle // ==/UserScript== ! function() { const c = "position:absolute;left:10px;transform:translateY(-50%);color:white;font-size:14px;font-family:'roboto condensed', sans-serif;font-weight:bold;background-color:rgba(0,0,0,0.3);padding:3px 5px;border-radius:5px;z-index:10000;"; const fpsDisplay = document.createElement('div'); fpsDisplay.style.cssText = c + "top:60%;"; fpsDisplay.innerHTML = `0 FPS`; document.body.appendChild(fpsDisplay); let times = []; const getFPS = () => { window.requestAnimationFrame(() => { const now = performance.now(); while (times.length > 0 && times[0] <= now - 1000) times.shift(); times.push(now); fpsDisplay.innerHTML = `${times.length} FPS`; if (times.length <= 50) { fpsDisplay.style.color = "red"; } else { fpsDisplay.style.color = "white"; } getFPS(); }); } getFPS(); const pingDisplay = document.createElement('div'); pingDisplay.style.cssText = c + "top:calc(60% + 25px);"; pingDisplay.innerHTML = `Waiting for a game start...`; document.body.appendChild(pingDisplay); var sendTime, receiveTime, timeout, region, DOM_observer, ws; var teamJoined = document.getElementById("msg-wait-reason"), endBtn = document.getElementById("ui-stats-options"); window.onload = () => { var strtBtn = document.getElementsByClassName("btn-green btn-darken menu-option"); var strtBtnArray = [strtBtn[0], strtBtn[1], strtBtn[2]]; strtBtnArray.forEach((btn) => { btn.onclick = () => { region = document.getElementById("server-select-main").value; getPing(); }; }); strtBtn[3].onclick = () => { region = document.getElementById("team-server-select").value; getPing(); }; }; document.getElementById("btn-game-quit").onclick = () => { ws.close() }; document.getElementById("btn-spectate-quit").onclick = () => { ws.close() }; DOM_observer = new MutationObserver((mutations) => { if (mutations[0].addedNodes.length === 1) { endBtn.getElementsByTagName("a")[0].onclick = () => { ws.close() }; } else if (mutations[0].addedNodes.length === 3) { region = document.getElementById("team-server-select").value; delayConnect(); }; }); DOM_observer.observe(endBtn, { childList: true }); DOM_observer.observe(teamJoined, { childList: true }); function wsUrl() { var wsUrl, wsRegion; if (region === 'na') { wsRegion = 'usr'; } else if (region === 'eu') { wsRegion = 'eur'; } else if (region === 'asia') { wsRegion = 'asr'; } else if (region === 'sa') { wsRegion = 'sa'; } else if (region === 'ru') { wsRegion = 'russia'; }; wsUrl = `wss://${wsRegion}.mathsiscoolfun.com:8001/ptc`; return wsUrl; }; function delayConnect() { timeout = setTimeout(getPing, 2500); }; function doSend(message) { if (ws.readyState === 1) { sendTime = Date.now(); ws.send(message); }; }; function getPing() { var ping, url = wsUrl(); ws = new WebSocket(url); ws.onopen = () => { clearTimeout(timeout); doSend(new ArrayBuffer(1)); }; ws.onclose = (evt) => { if (evt.code === 1005) { pingDisplay.innerHTML = `Waiting for a game start...`; pingDisplay.style.color = "white"; } else if (evt.code === 1006) { ws = null; delayConnect(); }; }; ws.onmessage = () => { receiveTime = Date.now(); ping = receiveTime - sendTime; if (ping >= 120) { pingDisplay.style.color = "red"; } else if (ping >= 90 && ping < 120) { pingDisplay.style.color = "orange"; } else if (ping >= 60 && ping < 90) { pingDisplay.style.color = "yellow"; } else { pingDisplay.style.color = "white"; } pingDisplay.innerHTML = `${ping} ms`; setTimeout(() => { doSend(new ArrayBuffer(1)) }, 1000); }; ws.onerror = () => { pingDisplay.innerHTML = `NaN`; pingDisplay.style.color = "gray"; }; }; var e = 0, t = document.createElement("span"); t.style = "display:block;position:fixed;z-index: 2;margin:6px 0 0 0;right: 15px;mix-blend-mode: difference;font-weight: bold;font-size:large;"; document.querySelector("#ui-health-container").appendChild(t); var n = document.createElement("span"); n.style = "display:block;position:fixed;z-index: 2;margin:6px 0 0 0;left: 15px;mix-blend-mode: difference;font-weight: bold;font-size: large;"; document.querySelector("#ui-health-container").appendChild(n); setInterval((function() { var i = document.getElementById("ui-health-actual").style.width.slice(0, -1); e !== i && (e = i, t.innerHTML = Number.parseFloat(i).toFixed(1)); var o = 25 * document.getElementById("ui-boost-counter-0").querySelector(".ui-bar-inner").style.width.slice(0, -1) / 100 + 25 * document.getElementById("ui-boost-counter-1").querySelector(".ui-bar-inner").style.width.slice(0, -1) / 100 + 37.5 * document.getElementById("ui-boost-counter-2").querySelector(".ui-bar-inner").style.width.slice(0, -1) / 100 + 12.5 * document.getElementById("ui-boost-counter-3").querySelector(".ui-bar-inner").style.width.slice(0, -1) / 100; n.innerHTML = Math.round(o) })) }(); /*Make things easy xlibizitoynetly*/ function delAds(e) { document.getElementById(e) && document.getElementById(e).remove() } setInterval(function() { var adsA = document.getElementsByClassName("ad-block-leaderboard-bottom")[0]; delAds("leaderboard-front"); delAds("adunit"); delAds("ui-stats-ad-container-desktop"); adsA && adsA.remove(); }, 1000); /* #Credits - Asphixia: LAT counter - Asultra: FPS counter based on NARS code - SamerKizi: Creator of HP&AD counter - Blubbled: Creator of Uncap FPS - https://greasyfork.org/en/scripts/493862-uncap-fps-for-suroi */