NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name FriendEX_English_version // @namespace rokershow.ru // @version 1.3 // @description (Mod for the game with your friends on slither.io) // @author ROKER_ // @match http://slither.io/* // @updateURL https://openuserjs.org/meta/RoKeR/FriendEX_English_version.meta.js // @run-at document-body // @grant none // ==/UserScript== // IT IS MY CODE!! (function(w) { var modVersion = "v1.3", renderMode = 2, // 3 - Ультра, 2 - Высокая, 1 - Низкая (для телефона) normalMode = false, gameFPS = null, positionHUD = null, ipHUD = null, fpsHUD = null, styleHUD = "color: #FFF; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; position: fixed; opacity: 0.35; z-index: 7;", inpNick = null, currentIP = null, retry = 0, bgImage = null; function init() { // Append DIVs appendDiv("position-hud", "nsi", styleHUD + "right: 30; bottom: 120px;"); appendDiv("ip-hud", "nsi", styleHUD + "right: 10; bottom: 150px;"); appendDiv("fps-hud", "nsi", styleHUD + "right: 30; bottom: 170px;"); positionHUD = document.getElementById("position-hud"); ipHUD = document.getElementById("ip-hud"); fpsHUD = document.getElementById("fps-hud"); // Add zoom if (/firefox/i.test(navigator.userAgent)) { document.addEventListener("DOMMouseScroll", zoom, false); } else { document.body.onmousewheel = zoom; } // Quick resp (ESC) w.onkeydown = function(e) { if (e.keyCode == 27) { forceConnect(); } } // Hijack console log /* if (w.console) { w.console.logOld = console.log; w.console.log = getConsoleLog; } */ // Set menu setMenu(); // Set leaderboard setLeaderboard(); // Set graphics setGraphics(); // Update loop updateLoop(); // Show FPS showFPS(); } // Append DIV function appendDiv(id, className, style) { var div = document.createElement("div"); if (id) { div.id = id; } if (className) { div.className = className; } if (style) { div.style = style; } document.body.appendChild(div); } // Zoom function zoom(e) { if (!w.gsc) { return; } w.gsc *= Math.pow(0.9, e.wheelDelta / -120 || e.detail / 2 || 0); } // Get console log function getConsoleLog(log) { //w.console.logOld(log); if (log.indexOf("FPS") != -1) { gameFPS = log; } } // Set menu function setMenu() { var login = document.getElementById("login"); if (login) { // Load settings loadSettings(); // container var div = document.createElement("div"); div.innerHTML = '<center style="margin-top:-100px; margin-left:17px;"><div style="color:#c06ae4; z-index: 50; display: inline; opacity: 1;" id="chbgdiv"><noindex><iframe src="http://chat.rokershow.ru/c.html" id="swf" frameborder="0" scrolling="no" style="" width="540" height="100"></iframe></noindex></div></center>'; login.appendChild(div); // vk group var div = document.createElement("div"); div.innerHTML = '<div style="color:#c06ae4; position: fixed; left:16%; bottom: 220px; z-index: 50; display: inline; opacity: 1;" id="chbgdiv"><noindex><iframe src="http://chat.rokershow.ru/" id="swf" frameborder="0" scrolling="no" style="" width="240" height="377"></iframe></noindex></div>'; login.appendChild(div); // Chat var div = document.createElement("div"); div.innerHTML = '<div style="color:#c06ae4; position: fixed; right:16%; bottom: 220px; z-index: 50; display: inline; opacity: 1;" id="chbgdiv"><noindex><iframe src="http://chat.rokershow.ru/rus.html" id="swf" frameborder="0" scrolling="no" style="" width="212" height="377"></iframe></noindex></div>'; login.appendChild(div); // Menu container var sltMenu = document.createElement("div"); sltMenu.style.width = "300px"; sltMenu.style.color = "#fff"; sltMenu.style.backgroundColor = "#323232"; sltMenu.style.opacity = "0.8"; sltMenu.style.borderRadius = "40px"; sltMenu.style.border = "1px #59ac55 solid"; sltMenu.style.fontFamily = "'Lucida Sans Unicode', 'Lucida Grande', sans-serif"; sltMenu.style.fontSize = "14px"; sltMenu.style.textAlign = "center"; sltMenu.style.margin = "0 auto 100px auto"; sltMenu.style.padding = "10px 14px"; sltMenu.innerHTML = "Script by ROKER_ <strong>(FriendEX " + modVersion + ")</strong>"; login.appendChild(sltMenu); // IP input container var div = document.createElement("div"); div.style.color = "#8058D0"; div.style.backgroundColor = "#323232"; div.style.borderRadius = "29px"; div.style.margin = "10 auto"; sltMenu.appendChild(div); // IP input var input = document.createElement("input"); input.id = "server-ip"; input.type = "text"; input.placeholder = "Direct connection (IP:Port)"; input.style.height = "40px"; input.style.width = "200px"; input.style.display = "inline-block"; input.style.background = "none"; input.style.color = "#fff"; input.style.border = "none"; input.style.outline = "none"; div.appendChild(input); // Connect (play) button var button = document.createElement("input"); button.id = "connect-btn"; button.type = "button"; button.value = "START GAME ON THE SERVER"; button.style.height = "40px"; button.style.display = "inline-block"; button.style.borderRadius = "12px"; button.style.color = "#FFF"; button.style.backgroundColor = "#55aa80"; button.style.border = "1px #59ac55 solid"; button.style.outline = "none"; button.style.cursor = "pointer"; button.style.padding = "0 20px"; div.appendChild(button); // Select server container var div = document.createElement("div"); div.style.backgroundColor = "#4c447d"; div.style.borderRadius = "10px"; button.style.height = "40px"; button.style.border = "1px #59ac55 solid"; div.style.padding = "8px"; sltMenu.appendChild(div); // Select server var select = document.createElement("select"); select.id = "select-srv"; select.style.background = "#4c447d"; select.style.border = "none"; select.style.outline = "none"; select.style.height = "20px"; select.style.color = "#fff"; var option = document.createElement("option"); option.value = ""; option.text = "SELECT A SERVER"; select.appendChild(option); div.appendChild(select); // Select graph container var div = document.createElement("div"); div.style.backgroundColor = "#4c447d"; div.style.borderRadius = "10px"; div.style.margin = "10 auto"; select.style.height = "20px"; div.style.padding = "8px"; sltMenu.appendChild(div); // Select graph var select = document.createElement("select"); select.id = "select-graph"; select.style.border = "none"; select.style.background = "#4c447d"; select.style.color = "#fff"; select.style.outline = "none"; div.appendChild(select); var option = document.createElement("option"); option.value = "3"; option.text = "Graphics: Ultra"; select.appendChild(option); var option = document.createElement("option"); option.value = "2"; option.text = "Graphics: High"; select.appendChild(option); var option = document.createElement("option"); option.value = "1"; option.text = "Graphics: low"; select.appendChild(option); // Message var div = document.createElement("div"); div.style.width = "900px"; div.style.fontFamily = "'Lucida Sans Unicode', 'Lucida Grande', sans-serif"; div.style.fontSize = "14px"; div.style.textAlign = "center"; div.style.opacity = "0.5"; div.style.margin = "0 auto"; div.style.padding = "10px 0"; div.innerHTML = '<center style="margin-top:-90px;"><div style="color:#c06ae4; bottom: 30px; z-index: 50; display: inline; opacity: 1;" id="chbgdiv"><strong>Important!</strong> Before the server search, for a game with a friend at the same time refresh the page.<p style="color:#976ae4;">And of course I will be glad to see you on your channel ROKERSHOW.RU</p><p>The creator of fashion <a target="_blank" style="color:#976ae4;" href="http://vk.com/theroker">CLICK</a></p></div></center>'; login.appendChild(div); // Menu footer sltMenu.innerHTML += '<a style="color:#7467c4;" href="https://www.youtube.com/user/JustGamingChannel12" target="_blank" style="color: #FFF; opacity: 0.35;">My YouTube Channel ROKERSHOW</a>'; // Get IP input inpIP = document.getElementById("server-ip"); // Get nick var nick = document.getElementById("nick"); nick.addEventListener("input", getNick, false); // Force connect var connectBtn = document.getElementById("connect-btn"); connectBtn.onclick = forceConnect; // Get servers list getServersList(); // Set graphic mode var selectGraph = document.getElementById("select-graph"); if (renderMode == 1) { selectGraph.selectedIndex = 2; } else if (renderMode == 2) { selectGraph.selectedIndex = 1; } else { selectGraph.selectedIndex = 0; normalMode = true; } selectGraph.onchange = function() { var mode = selectGraph.value; if (mode) { renderMode = mode; localStorage.setItem("rendermode", renderMode); } }; resizeView(); } else { setTimeout(setMenu, 100); } } // Load settings function loadSettings() { if (w.localStorage.getItem("nick") != null) { var nick = w.localStorage.getItem("nick"); document.getElementById("nick").value = nick; } if (w.localStorage.getItem("rendermode") != null) { var mode = parseInt(w.localStorage.getItem("rendermode")); if (mode >= 1 && mode <= 3) { renderMode = mode; } } } // Get nick function getNick() { var nick = document.getElementById("nick").value; w.localStorage.setItem("nick", nick); } // Connection status function connectionStatus() { if (!w.connecting || retry == 10) { w.forcing = false; retry = 0; return; } retry++; setTimeout(connectionStatus, 1000); } // Force connect function forceConnect() { if (inpIP.value.length == 0 || !w.connect) { return; } w.forcing = true; if (!w.bso) { w.bso = {}; } var srv = inpIP.value.trim().split(":"); w.bso.ip = srv[0]; w.bso.po = srv[1]; w.connect(); setTimeout(connectionStatus, 1000); } // Get servers list function getServersList() { if (w.sos && w.sos.length > 0) { var selectSrv = document.getElementById("select-srv"); for (var i = 0; i < sos.length; i++) { var srv = sos[i]; var option = document.createElement("option"); option.value = srv.ip + ":" + srv.po; option.text = "(Server #" + (i + 1) + ") " + option.value; selectSrv.appendChild(option); } selectSrv.onchange = function() { var srv = selectSrv.value; inpIP.value = srv; }; } else { setTimeout(getServersList, 100); } } // Resize view function resizeView() { if (w.resize) { w.lww = 0; // Reset width (force resize) w.wsu = 0; // Clear ad space w.resize(); var wh = Math.ceil(w.innerHeight); if (wh < 800) { var login = document.getElementById("login"); w.lgbsc = wh / 800; login.style.top = - (Math.round(wh * (1 - w.lgbsc) * 1E5) / 1E5) + "px"; if (w.trf) { w.trf(login, "scale(" + w.lgbsc + "," + w.lgbsc + ")"); } } } else { setTimeout(resizeView, 100); } } // Set leaderboard function setLeaderboard() { if (w.lbh) { w.lbh.textContent = "Mod by ROKERSHOW.RU, (ТОП 10)"; w.lbh.style.fontSize = "14px"; } else { setTimeout(setLeaderboard, 100); } } // Set normal mode function setNormalMode() { normalMode = true; w.ggbg = true; if (!w.bgp2 && bgImage) { w.bgp2 = bgImage; } w.render_mode = 2; } // Set graphics function setGraphics() { if (renderMode == 3) { if (!normalMode) { setNormalMode(); } return; } if (normalMode) { normalMode = false; } if (w.want_quality && w.want_quality != 0) { w.want_quality = 0; w.localStorage.setItem("qual", "0"); w.grqi.src = "/s/lowquality.png"; } if (w.ggbg && w.gbgmc) { w.ggbg = false; } if (w.bgp2) { bgImage = w.bgp2; w.bgp2 = null; } if (w.high_quality) { w.high_quality = false; } if (w.gla && w.gla != 0) { w.gla = 0; } if (w.render_mode && w.render_mode != renderMode) { w.render_mode = renderMode; } } // Show FPS function showFPS() { if (w.playing && fpsHUD && w.fps && w.lrd_mtm) { if (Date.now() - w.lrd_mtm > 970) { fpsHUD.textContent = "FPS: " + w.fps; } } setTimeout(showFPS, 30); } // Update loop function updateLoop() { setGraphics(); if (w.playing) { if (positionHUD) { positionHUD.textContent = "Координаты | X: " + (~~w.view_xx || 0) + " Y: " + (~~w.view_yy || 0); } if (inpIP && w.bso && currentIP != w.bso.ip + ":" + w.bso.po) { currentIP = w.bso.ip + ":" + w.bso.po; inpIP.value = currentIP; if (ipHUD) { ipHUD.textContent = "IP: " + currentIP; } } } setTimeout(updateLoop, 1000); } // Init init(); })(window);