Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AgarB13 EXTENSION
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Bom Proveito
- // @author AgarB13
- // @match http://*agar.io/*
- // @grant none
- // ==/UserScript==
- /* jshint -W097 */
- 'use strict';
- var lastEdit = 1457530046176;
- var respawnLoop = null, ejectorLoop = null, randomMoveLoop = null;
- var overlayClosed = false, spectatorMode = false;
- var holdingKey = {};
- var canvas = document.getElementById('canvas');
- $(document).ready(function() {
- window.onbeforeunload = function() { return 'Quit game?'; };
- window.setAutoSpawn = function(e) {
- if(e) { if(!respawnLoop) respawnLoop = setInterval(startGame, 1000); }
- else { clearInterval(respawnLoop); respawnLoop = null; }
- };
- window.joinNewRoom = function() {
- var s = $('#gamemode').val();
- setGameMode(':party');
- setGameMode(s);
- };
- window.setSpectatorMode = function(e) { spectatorMode = e; };
- window.setRandomMove = function(e) {
- if(e) { if(!randomMoveLoop) randomMoveLoop = setInterval(randomMove, 5000); }
- else { clearInterval(randomMoveLoop); randomMoveLoop = null; }
- };
- window.scriptInfo = function() { $('#infoPanel').fadeToggle(); };
- window.toggleShowHide = function() {
- var az = $('#infoPanel-content a').next();
- if(az.is(':visible')) { az.slideUp('fast'); az.prev().html('Show'); }
- else { az.slideDown('fast'); az.prev().html('Hide'); }
- };
- $(document).on('keydown', function(evt) {
- var key = evt.which || evt.keyCode;
- var exKey = evt.ctrlKey || evt.shiftKey || evt.altKey;
- //console.log(key + ' ' + exKey + ' (' + evt.ctrlKey + ' ' + evt.shiftKey + ' ' + evt.altKey + ')');
- if($('#overlays').is(':hidden') && !exKey) {
- if(key == 27) { // KEY_ESC
- overlayClosed = false;
- setTimeout(function() { $('button[data-itr="spectate"]').removeAttr('disabled'); }, 100);
- }
- else if(key == 69) { // KEY_E
- if(!ejectorLoop) {
- ejectorLoop = setInterval(function() { sendEject(); }, 10);
- }
- }
- if(!holdingKey[key]) {
- if(key == 82) { // KEY_R
- for(var n = 1; n <= 7; n++) {
- setTimeout(function() { sendEject(); }, 125 * n);
- }
- }
- else if(key == 84) { // KEY_T
- for(var n = 1; n <= 4; n++) {
- setTimeout(function() { sendMitosis(); }, 60 * n);
- }
- }
- else if(key == 83) { // KEY_S
- var newPos = {clientX: innerWidth / 2, clientY: innerHeight / 2};
- canvas.onmousedown(newPos);
- }
- else if(key == 67) { // KEY_C
- var newPos = {screenX: innerWidth / 2, screenY: innerHeight / 2};
- canvas.onmousedown(newPos);
- }
- else if(key == 86) { showPanels(2); } // KEY_V
- else if(key == 66) { showPanels(1); } // KEY_B
- else if(key == 78) { showPanels(3); } // KEY_N
- else if(key == 77) { showPanels(4); } // KEY_M
- else if(key == 188) { showPanels(5); } // KEY_,
- }
- holdingKey[key] = true;
- }
- });
- $(document).on('keyup', function(evt) {
- var key = evt.which || evt.keyCode
- holdingKey[key] = false;
- if(key == 69) { // KEY_E
- clearInterval(ejectorLoop);
- ejectorLoop = null;
- }
- });
- editPanel();
- setTimeout(applyConfig, 100);
- hookOverlay();
- });
- function editPanel() {
- var btnGroup = $('#agario-main-buttons div').eq(0).children();
- btnGroup.eq(1).css('width', '230px');
- btnGroup.eq(2).css('width', '112px');
- btnGroup.eq(3).css('width', '112px').after('<button style="height: 35px; display: block; float: right;" class="btn btn-success btn-refresh" onclick="joinNewRoom(); return false;"><i class="glyphicon glyphicon-refresh"></i></button>');
- $('#helloContainer').css('height', '');
- $('#adbg').parent().hide().css('visibility', 'hidden');
- $('.agario-promo').hide().css('visibility', 'hidden');
- $('#agario-web-incentive').hide().css('visibility', 'hidden');
- $('#connecting').css({'top': '13px', 'right': '185px', 'bottom': '', 'left': '', 'font-size': '13px'});
- $('#connecting h2').css({'display': 'inline-block'}).after('<span id="connectingToInfo" style="position: absolute; top: 5px; right: 15px;"></span>');
- $('#nick').attr('name', 'nick');
- $('#quality').css({'margin': '6px 0px'});
- $('#options').append('<label style="margin-top: 7px; padding-top: 7px; border-top: 1px dashed #888; width: 188px;"><input type="checkbox" onchange="setAcid($(this).is(\':checked\'));"><span data-itr="option_acid_mode">Acid mode</span></label><label style="width: 188px;"><input type="checkbox" onchange="setAutoSpawn($(this).is(\':checked\'));"><span data-itr="option_auto_spawn">Auto respawn</span></label><label style="width: 188px;"><input type="checkbox" onchange="setSpectatorMode($(this).is(\':checked\'));"><span data-itr="option_spectator_mode">Spectate on join</span></label><label style="width: 188px;"><input type="checkbox" onchange="setRandomMove($(this).is(\':checked\'));"><span data-itr="option_random_move">Randomize movement</span></label>');
- $('#instructions center').after('<hr><div id="shortcuts" style="font-size: 85%;"><strong style="display: inline-block; width: 320px; text-align: center; padding-bottom: 10px;">Ingame Shortcuts</strong><br><span style="display: block; width: 160px; float: left;">E: Eject mass cont.</span><span style="display: block; width: 160px; float: left;">V: Skin panel</span><span style="display: block; width: 160px; float: left;">R: Eject mass 7 times</span><span style="display: block; width: 160px; float: left;">B: Shop panel</span><span style="display: block; width: 160px; float: left;">T: Split 4 times</span><span style="display: block; width: 160px; float: left;">N: XP Boost panel</span><span style="display: block; width: 160px; float: left;">S: Stop moving</span><span style="display: block; width: 160px; float: left;">M: Mass Boost panel</span><span style="display: block; width: 160px; float: left;">C: Go center of map</span><span style="display: block; width: 160px; float: left;">,: Free coins panel</span></div>');
- $('#instructions center span[class="text-muted"] b').css({'background-color': '#333', 'color': '#EEE', 'padding': '1px 5px', 'border-radius': '3px'});
- $('#instructions').append('<div id="script-info" style="font-size: 70%; float: right; margin: 23px 0px 6px 0px;">Script by condoriano. <a href="#" onclick="scriptInfo(); return false;">More Info</a></div>');
- $('#instructions').next().remove();
- $('#stats').css('height', '375px');
- $('#stats hr').remove();
- $('#socialStats').css('bottom', '65px');
- $('#statsContinue').css('bottom', '25px');
- $('#statsGraph').css('bottom', '120px').attr('height', '200px');
- $('#s300x250').css('z-index', '-10');
- addInfoPanel();
- $('footer').parent().append('<footer class="tosBox update"><a href="http://pastebin.com/raw.php?i=mkCsDgvd" target="_blank" class="text-muted" title="Last update: ' + timeSince(lastEdit) + ' ago">Source Code</a></footer>');
- $('footer').parent().append('<footer class="tosBox donate"><form id="donate-mod" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"><input name="cmd" value="_donations" type="hidden"><input name="business" value="keyzint@gmail.com" type="hidden"><input name="lc" value="US" type="hidden"><input name="item_name" value="Donation" type="hidden"><input name="no_note" value="0" type="hidden"><input name="currency_code" value="USD" type="hidden"><input name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest" type="hidden"><input name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" alt="PayPal - The safer, easier way to pay online!" border="0" type="image"><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" height="1" border="0" width="1"></form></footer>');
- $('footer.tosBox.left').removeClass('left').addClass('gamemode').css({'bottom': '30px', 'right': '0px', 'font-size': '12px', 'background-color': '#3071A9', 'border-radius': '15px 0px 0px 15px', 'padding-left': '18px'});
- $('footer.tosBox.right').removeClass('right').addClass('tos').css({'bottom': '0px', 'right': '0px', 'font-size': '12px', 'background-color': '#3071A9', 'border-radius': '15px 0px 0px 15px', 'padding-left': '18px'});
- $('footer.tosBox.update').css({'bottom': '0px', 'right': '280px', 'font-size': '12px', 'background-color': '#398439', 'border-radius': '5px 5px 0px 0px'});
- $('footer.tosBox.donate').css({'bottom': '-2px', 'right': '380px', 'font-size': '12px', 'background-color': 'transparent', 'padding': '0px'});
- $('footer.tosBox a').css('color', '#FFFFFF');
- }
- function addInfoPanel() {
- var editedDate = new Date(lastEdit);
- $('footer').eq(0).before('<div id="infoPanel"><div id="infoPanel-header"><button onclick="scriptInfo(); return false;">X</button><h2>Script Info</h2><span title="' + editedDate.toString() + '">Last update: ' + timeSince(lastEdit) + ' ago</span></div><div id="infoPanel-content"></div><div id="infoPanel-footer"></div></div>');
- $('#infoPanel').css({'display': 'none', 'width': '820px', 'height': '500px', 'padding': '0px 20px', 'position': 'absolute', 'top': '50%', 'left': '50%', 'transform': 'translate(-50%, -50%)', 'background-color': '#123', 'color': '#AAA', 'border': '1px solid #000000', 'border-radius': '12px', 'box-shadow': '0px 0px 100px #012 inset'});
- $('#infoPanel-header').css({'font-family': 'Consolas', 'color': '#EEE', 'padding': '20px 0px', 'text-align': 'center', 'border-bottom': '2px solid #28B', 'position': 'relative'});
- $('#infoPanel-header button').css({'float': 'right', 'color': '#AAA', 'border': 'none', 'background-color': 'rgba(0, 0, 0, 0.3)', 'position': 'absolute', 'top': '10', 'right': '0'});
- $('#infoPanel-header h2').css({'margin': '0px'});
- $('#infoPanel-header span').css({'font-size': '80%', 'color': '#999'});
- $('#infoPanel-content').css({'font-family': 'Tahoma, sans-serif', 'width': '780px', 'height': '338px', 'overflow': 'auto', 'margin': '20px 0px'});
- $('#infoPanel-footer').css({'font-size': '80%'});
- $('#infoPanel-content').html('<div id="infoPanel-content-features"><span style="color: #EEE;">Features</span><ul><li>Auto-save game settings<ul><li>Settings are saved automatically every time you makeachange.</li><li>Default name is ௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌ</li></ul></li><li>Auto respawn - Enabling this will also make the Score counter to show real-time mass.</li><li>Spectator Mode - Enabling this will put you into spectator mode when you join a server.</li><li>Randomize Movement - Enabling this will make your cells change direction randomly every 5 seconds. Useful when going AFK.</li><li>Acid Mode</li><li>Refresh server button</li><li>Prompt on tab close</li><li>Hide ads and promos</li><li>Various ingame keyboard shortcuts</li></ul></div>\
- <div id="infoPanel-content-changelogs"><span style="color: #EEE;">Changelog</span> <a href="#" onclick="toggleShowHide(); return false;" style="font-size: 11px;">Show</a><div style="display: none; width: 90%; background: rgba(0,0,0,0.3); font-size: 11px; padding: 10px"><ul style="padding-left: 20px;">\
- <li>2016-03-01<ul><li>Made all panels opened with the ingame shortcut to be semi-transparent</li><li>Added new feature - Press , to open free coin panel</li><li>Added new feature - Spectator Mode - You will be put into spectatormode when you join a server</li></ul></li>\
- <li>2015-02-19<ul><li>Added new feature - Press V to open skin panel</li><li>Added new feature - Press B to open shop panel</li><li>Added new feature - Press M to open mass boost panel</li><li>Added new feature - Press N to open xp panel</li><li>Removed checkboxes for ingame shortcut features - they are now not toggle-able</li><li>Reworked instruction UI</li></ul></li><li>2015-12-29<ul><li>Added new feature - Press R to eject mass 7 times</li><li>Added new fature - Press T to split 4 times</li></ul></li><li>2015-12-26<ul><li>Moved connecting panel to top right corner of the screen</li><li>Added region and gamemode info on connecting panel</li></ul></li><li>2015-12-24 - Added new feature - Acid mode</li><li>2015-12-23 - Resized stats panel to exclude ads height</li>\
- <li>2015-12-22<ul><li>Added new feature - Press S key to stop movement</li><li>Added new feature - Press C to go to the center of the map</li><li>Added new feature - Randomize movement - change direction every 5 seconds</li></ul></li><li>2015-12-18 - Added changelog into the info panel</li><li>2015-12-16 - Added info panel</li><li>2015-12-13 - Fixed gamemode not always changing to the saved value</li><li>2015-12-11 - Fixed not being able to spectate</li><li>2015-12-09 - Script is now hosted on pastebin to make updating easy</li><li>2015-12-08<ul><li>Fixed overlay not displayed on center y-axis</li><li>Updated link for update script url</li><li>Added donate button in the footer</li></ul></li>\
- <li>2015-12-06<ul><li>Added promo hiding</li><li>Stylized footer and moved it to the right</li></ul></li><li>2015-12-05<ul><li>Rewrote code to use jQuery</li><li>Fixed auto spawn not working for guest players</li><li>Added ads hiding feature</li><li>Added instruction for "hold E to W"</li><li>Added link to this page</li><li>Stylized instructions a little bit</li></ul></li><li>2015-12-02 - Added refresh server button</li><li>2015-12-01<ul><li>Fixed button style on chrome</li><li>Added "hold E to W" function</li><li>Removed debugging alert message</li></ul></li><li>2015-11-30 - Fixed auto spawn checkbox not working</li><li>2015-11-29 - Initial release</li></ul></div></div>');
- $('#infoPanel-footer').html('<a href="https://greasyfork.org/en/scripts/14297-agar-io-auto-respawn-evergreen" target="_blank">Homepage</a> - <a href="http://pastebin.com/raw.php?i=mkCsDgvd" target="_blank">Source Code</a> - <a href="#" onclick="$(\'#donate-mod input[name=submit]\').click(); return false;">Donate</a>');
- };
- function applyConfig() {
- var checkbox = $('#options input[type="checkbox"]');
- localStorage.removeItem('settings');
- checkbox.change(function() { localStorage.setItem($(this).next().attr('data-itr'), $(this).prop('checked')); });
- checkbox.each(function() { $(this).prop('checked', false); if(localStorage.getItem($(this).next().attr('data-itr')) == 'true') { $(this).click(); } });
- $('#nick, #gamemode, #region, #quality').change(function() { localStorage.setItem($(this).attr('id'), $(this).val()) })
- $('#gamemode, #region, #quality').each(function() { if(localStorage.getItem($(this).attr('id')) != null) { $(this).val(localStorage.getItem($(this).attr('id'))).change(); } });
- }
- function startGame() {
- if(overlayClosed) setNick($('#nick').val());
- }
- function randomMove() {
- var pos = {clientX: getRandomInt(0, innerWidth), clientY: getRandomInt(0, innerHeight)}
- canvas.onmousedown(pos);
- }
- function hookOverlay() {
- $('button[data-itr="play"]').click(function() { overlayClosed = true; });
- $('button[data-itr="play_as_guest"]').click(function() { overlayClosed = true; });
- $('button[data-itr="spectate"]').click(function() { overlayClosed = false; });
- $.each(['show', 'hide'], function (i, ev) { var el = $.fn[ev]; $.fn[ev] = function () { this.trigger(ev); return el.apply(this, arguments); }; });
- $('#connecting').on('show', function() { connectingInfo(); });
- $('#connecting').on('hide', function() { if(spectatorMode) $('button[data-itr="spectate"]').click(); });
- $('#openfl-content').on('hide', function() { setTimeout(function() { $('#openfl-content').css({'opacity' : '1'}); }, 10); });
- }
- function showPanels(panel) {
- $('#openfl-content').css({'opacity' : '0.15'});
- if(panel == 1) $('#openShopBtn').click();
- else if(panel == 2) $('#skinButton').click();
- else if(panel == 3) $('#boostButton').click();
- else if(panel == 4) $('#massButton').click();
- else if(panel == 5) $('#freeCoins').click();
- }
- function connectingInfo() { $('#connectingToInfo').text($('#region option:selected').text().split(' (')[0] + ' - ' + $('#gamemode option:selected').text().split(' (')[0]) }
- function timeSince(date) {
- var seconds = Math.floor((new Date() - date) / 1000);
- var interval = Math.floor(seconds / 31536000);
- if(interval > 1) return interval + ' years'; interval = Math.floor(seconds / 2592000);
- if(interval > 1) return interval + ' months'; interval = Math.floor(seconds / 86400);
- if(interval > 1) return interval + ' days'; interval = Math.floor(seconds / 3600);
- if(interval > 1) return interval + ' hours'; interval = Math.floor(seconds / 60);
- if(interval > 1) return interval + ' minutes';
- return Math.floor(seconds) + ' seconds';
- }
- function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement