Agar.io Gold

The smash hit game!

目前为 2016-07-27 提交的版本。查看 最新版本

// ==UserScript==
// @name			Agar.io Gold
// @namespace		agar.io/gold
// @version			0.1
// @description		The smash hit game!
// @match			http://agar.io/*
// @require			https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// @connect			agar.io
// @run-at			document-start
// @grant			none
// ==/UserScript==

document.title = 'Agar.io Gold';

var profile = 0,
skinURL = [null, null, null, null, null, null, null, null, null, null],
settings = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false],
commands = [null, null, null, null, null, null, null, null, null];

function removeElements(){
	$(document.body.childNodes).each(function(){
		if(this.nodeName != 'SCRIPT')
			this.remove();
	});
}

function loadNewContent(){
	var home_panelId = ['skinsPanel', 'partyPanel', 'mainPanel'],
	home_panelText = ['Skins', 'Party', 'Agar.io Gold'],
	menu_iconSrc = ['http://i.imgur.com/7eiGkwT.png', 'http://i.imgur.com/0QZpM5k.png', 'http://i.imgur.com/ny1SwTc.png', 'http://i.imgur.com/NTiAjWl.png'],
	tab_panelId = ['profilePanel', 'settingsPanel', 'commandsPanel', 'themePanel'],
	tab_panelText = ['Profile', 'Settings', 'Commands', 'Theme'],
	regionValue = ['US-Atlanta', 'BR-Brazil', 'EU-London', 'RU-Russia', 'TK-Turkey', 'JP-Tokyo', 'CN-China', 'SG-Singapore'],
	regionText = ['North America', 'South America', 'Europe', 'Russia', 'Turkey', 'East Asia', 'China', 'Oceania'],
	settingText = ['No skins', 'No colors', 'No names', 'Show mass', 'Custom skins', 'Transparent skins', 'Transparent cells', 'Hide own name', 'Auto hide names and mass', 'Auto hide food', 'Game stats', 'Show indicators', 'Show background selectors', 'Show map borders', 'Show minimap', 'Enable chat', 'Enable Mouse controls', 'Invert mouse controls', 'Disable commands'],
	commandText = ['Toggle skins', 'Toggle colors', 'Toggle names', 'Toggle mass', 'Toggle indicators', 'Toggle background selectors', 'Toggle map borders', 'Toggle minimap', 'Toggle chat'],
	themeText = ['Classic', 'Gold', 'Custom'],
	newElement, i, newText;
//	<div id='home'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'home');
	$('body').append(newElement);
	for(i = 0; i < home_panelId.length; i++){
//		<div class='panel'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'panel');
		newElement.setAttribute('id', home_panelId[i]);
		newText = document.createTextNode(home_panelText[i]);
		$(newElement).append(newText);
		$('#home').append(newElement);
//		</div>
	}
//		<div class='panel' id='skinsPanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#skinsPanel').append(newElement);
//				<div id='skin'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'skin');
	$('.container').last().append(newElement);
//				</div>
//				<div id='previous'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'previous');
	$('.container').last().append(newElement);
//					<img />
	newElement = document.createElement('img');
	newElement.src = 'http://i.imgur.com/yMOpYxj.png';
	$('#previous').append(newElement);
//				</div>
//				<div id='next'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'next');
	$('.container').last().append(newElement);
//					<img />
	newElement = document.createElement('img');
	newElement.src = 'http://i.imgur.com/NuIdOb3.png';
	$('#next').append(newElement);
//				</div>
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#skinsPanel').append(newElement);
//				<input type='text' class='formControl' id='skinURL'/>
	newElement = document.createElement('input');
	newElement.setAttribute('type', 'text');
	newElement.setAttribute('class', 'formControl');
	newElement.setAttribute('id', 'skinURL');
	newElement.placeholder = 'Skin URL';
	$('.container').last().append(newElement);
//			</div>
//		</div>
//		<div class='panel' id='partyPanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	newElement.innerHTML = 'Play with your friends in the same map';
	$('#partyPanel').append(newElement);
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#partyPanel').append(newElement);
//				<select class='formControl' id='region'>
	newElement = document.createElement('select');
	newElement.setAttribute('class', 'formControl');
	newElement.setAttribute('id', 'region');
	$('.container').last().append(newElement);
	for(i = 0; i < regionValue.length; i++){
//					<option>
		newElement = document.createElement('option');
		newElement.value = regionValue[i];
		newText = document.createTextNode(regionText[i]);
		$(newElement).append(newText);
		$('#region').append(newElement);
//					</option>
	}
//				</select>
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '6px';
	$('#partyPanel').append(newElement);
//				<input type='text' class='formControl' id='partyToken'/>
	newElement = document.createElement('input');
	newElement.setAttribute('type', 'text');
	newElement.setAttribute('class', 'formControl');
	newElement.setAttribute('id', 'partyToken');
	newElement.placeholder = 'Party Token';
	$('.container').last().append(newElement);
//				<div id='createParty'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'createParty');
	$('.container').last().append(newElement);
//					<img />
	newElement = document.createElement('img');
	newElement.src = 'http://i.imgur.com/Vb1cSKP.png';
	$('#createParty').append(newElement);
//				</div>
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#partyPanel').append(newElement);
//				<button class='button' id='joinPartyButton'>
	newElement = document.createElement('button');
	newElement.setAttribute('class', 'button');
	newElement.setAttribute('id', 'joinPartyButton');
	newText = document.createTextNode('JOIN');
	$(newElement).append(newText);
	$('.container').last().append(newElement);
//				</button>
//			</div>
//		</div>
//		<div class='panel' id='mainPanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '28px';
	$('#mainPanel').append(newElement);
//				<input type='text' class='formControl' id='playerName'/>
	newElement = document.createElement('input');
	newElement.setAttribute('type', 'text');
	newElement.setAttribute('class', 'formControl');
	newElement.setAttribute('id', 'playerName');
	newElement.placeholder = 'Nickname';
	newElement.maxLength = 15;
	$('.container').last().append(newElement);
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '28px';
	$('#mainPanel').append(newElement);
//				<button class='button' id='playButton'>
	newElement = document.createElement('button');
	newElement.setAttribute('class', 'button');
	newElement.setAttribute('id', 'playButton');
	newText = document.createTextNode('PLAY');
	$(newElement).append(newText);
	$('.container').last().append(newElement);
//				</button>
//			</div>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '28px';
	newElement.innerHTML = 'Move your mouse to control your cell<br/>Press <b>Space</b> to split<br/>Press <b>W</b> to eject some mass';
	$('#mainPanel').append(newElement);
//			</div>
//		</div>
//	</div>
//	<div id='sidePanel'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'sidePanel');
	$('body').append(newElement);
//		<div id='menu'>
	newElement = document.createElement('div');
	newElement.setAttribute('id', 'menu');
	$('#sidePanel').append(newElement);
	for(i = 0; i < menu_iconSrc.length; i++){
//			<div class='icon'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'icon');
		$('#menu').append(newElement);
//				<img />
		newElement = document.createElement('img');
		newElement.src = menu_iconSrc[i];
		$('.icon').last().append(newElement);
//			</div>
	}
//		</div>
//	</div>
	for(i = 0; i < tab_panelId.length; i++){
//	<div class='tab'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'tab');
		$('body').append(newElement);
//		<div class='panel'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'panel');
		newElement.setAttribute('id', tab_panelId[i]);
		newText = document.createTextNode(tab_panelText[i]);
		$(newElement).append(newText);
		$('.tab').last().append(newElement);
//			<div class='close'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'close');
		$('.panel').last().append(newElement);
//				<img />
		newElement = document.createElement('img');
		newElement.src = 'http://i.imgur.com/qiFAg2E.png';
		$('.close').last().append(newElement);
//			</div>
//		</div>
//	</div>
	}
//	<div class='tab'>
//		<div class='panel' id='settingsPanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#settingsPanel').append(newElement);
	for(i = 0; i < settingText.length; i++){
//				<div class='ground settings'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'ground settings');
		newText = document.createTextNode(settingText[i]);
		$(newElement).append(newText);
		$('.container').last().append(newElement);
//					<div class='switchOff'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'switchOff');
		$('.ground').last().append(newElement);
//					</div>
//				</div>
	}
//			</div>
//		</div>
//	</div>
//	<div class='tab'>
//		<div class='panel' id='commandsPanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#commandsPanel').append(newElement);
	for(i = 0; i < commandText.length; i++){
//				<div class='ground commands'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'ground commands');
		newText = document.createTextNode(commandText[i]);
		$(newElement).append(newText);
		$('.container').last().append(newElement);
//					<input type='button' class='key'/>
		newElement = document.createElement('input');
		newElement.setAttribute('type', 'button');
		newElement.setAttribute('class', 'key');
		$('.ground').last().append(newElement);
//				</div>
	}
//			</div>
//		</div>
//	</div>
//	<div class='tab'>
//		<div class='panel' id='themePanel'>
//			<div class='container'>
	newElement = document.createElement('div');
	newElement.setAttribute('class', 'container');
	newElement.style.marginTop = '14px';
	$('#themePanel').append(newElement);
	for(i = 0; i < themeText.length; i++){
//				<div class='ground settings'>
		newElement = document.createElement('div');
		newElement.setAttribute('class', 'ground theme');
		newText = document.createTextNode(themeText[i]);
		$(newElement).append(newText);
		$('.container').last().append(newElement);
//				</div>
	}
//			</div>
//		</div>
//	</div>
//	<style>
	newElement = document.createElement('style');
	$(newElement).append("*{margin: 0; padding: 0; font-family: Calibri; font-size: 18px; color: #646464; text-align: left;}body{background-image: url('http://i.imgur.com/3TK0Zti.png'); background-position: center; background-attachment: fixed; background-size: cover;}::-webkit-scrollbar{display: none;}#home{z-index: 1; position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);}#sidePanel{z-index: 2; display: none; position: absolute; height: 100%; background-color: #000000; text-align: center;}#menu{position: relative; top: 50%; margin-top: -254px; text-align: center;}.icon{position: relative; margin-top: 24px; padding: 14px;}.icon:hover{background-color: rgba(255, 255, 255, 0.2);}.tab{z-index: 3; display: none; position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4);}.panel{padding: 14px; background-color: #ffffff; border-radius: 14px; font-weight: bold; text-align: center;}#skinsPanel{position: absolute; top: 50%; right: 50%; margin: -243px 153px; width: 180px; font-size: 24px;}#partyPanel{position: absolute; top: 50%; right: 50%; margin: -16px 153px; width: 180px; font-size: 24px;}#mainPanel{position: absolute; top: 50%; right: 50%; margin: -243px -361px; width: 480px; height: 400px; padding-top: 72px; font-size: 72px;}#profilePanel, #settingsPanel, #commandsPanel, #themePanel{position: absolute; top: 50%; left: 50%; margin: -254px -314px; width: 600px; height: 480px; overflow: auto; font-size: 36px;}.close{position: absolute; top: 0; right: 0; margin: 6px; opacity: 0.2;}.close:hover{opacity: 0.4;}.container{position: relative; overflow: hidden; font-weight: normal; text-align: center;}.ground{position: relative; margin: 1px; padding: 14px; font-weight: normal;}.ground:hover{background-color: rgba(0, 0, 0, 0.1);}#skin{position: relative; left: 50%; margin-left: -50px; width: 100px; height: 100px; background-image: url('http://i.imgur.com/Xny8hRU.png'); background-position: center; background-size: cover; border-radius: 100px;}#previous{position: absolute; left: 0; bottom: 0; opacity: 0.2;}#previous:hover{opacity: 0.4;}#next{position: absolute; bottom: 0; right: 0; opacity: 0.2;}#next:hover{opacity: 0.4;}.formControl{padding: 6px; font-weight: normal;}#playerName{position: relative; width: 240px; border: 2px solid rgba(0, 0, 0, 0.4); border-radius: 8px; font-size: 24px;}#skinURL{position: relative; width: 166px; border: 1px solid rgba(0, 0, 0, 0.4); border-radius: 4px;}#region{position: relative; width: 100%; border: 1px solid rgba(0, 0, 0, 0.4); border-radius: 4px;}#partyToken{position: relative; width: 140px; padding-right: 32px; border: 1px solid rgba(0, 0, 0, 0.4); border-radius: 4px;}.button{padding: 6px; font-weight: bold; text-align: center;}#playButton{position: relative; width: 120px; background-color: #ff7400; border: 2px solid rgba(0, 0, 0, 0.1); border-radius: 8px; font-size: 24px; color: #ffffff;}#playButton:hover{background-color: #f46f00;}#joinPartyButton{position: relative; width: 96px; background-color: #0074ff; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 4px; color: #ffffff;}#joinPartyButton:hover{background-color: #006ff4;}#createParty{position: absolute; top: 50%; right: 0; margin: -16px 1px; opacity: 0.2;}#createParty:hover{opacity: 0.4;}.switchOff{position: absolute; top: 50%; right: 14px; margin-top: -12px; width: 46px; height: 24px; background-color: #c4c4c4; border-radius: 24px;}.switchOff:after{content: ''; position: relative; float: left; margin: 1px; width: 22px; height: 22px; background-color: #ffffff; border-radius: 22px;}.switchOn{position: absolute; top: 50%; right: 14px; margin-top: -12px; width: 46px; height: 24px; background-color: #94cc40; border-radius: 24px;}.switchOn:after{content: ''; position: relative; float: right; margin: 1px; width: 22px; height: 22px; background-color: #ffffff; border-radius: 22px;}.key{position: absolute; top: 0; right: 0; width: 50px; height: 50px; background: none; border: none; font-weight: normal; color: #a4a4a4; text-align: center;}");
	$('body').append(newElement);
//	</style>
}

function getSkin(){
	var img = document.createElement('img');
	img.src = document.getElementById('skinURL').value;
	img.onload = (function(){
		document.getElementById('skin').style.backgroundImage = 'url(' + img.src + ')';
		skinURL[profile] = img.src;
	});
	img.onerror = (function(){
		document.getElementById('skin').style.backgroundImage = "url('http://i.imgur.com/Xny8hRU.png')";
		document.getElementById('skinURL').value = null;
		skinURL[profile] = null;
	});
}

function changeProfile(i){
	if(i == 'previous'){
		if(profile > 0)
			profile--;
		else
			profile = 9;
	}
	else if(i == 'next'){
		if(profile < 9)
			profile++;
		else
			profile = 0;
	}
	document.getElementById('skin').style.backgroundImage = skinURL[profile]? 'url(' + skinURL[profile] + ')': "url('http://i.imgur.com/Xny8hRU.png')";
	document.getElementById('skinURL').value = skinURL[profile];

}

function toggleSetting(i){
	if(settings[i] === false){
		settings[i] = true;
		$('.settings')[i].children[0].className = 'switchOn';
	}
	else if(settings[i] === true){
		settings[i] = false;
		$('.settings')[i].children[0].className = 'switchOff';
	}
}

function changeKey(i, key){
	var n;
	for(n = 0; n < commands.length; n++)
		if(key == commands[n])
			return;
	commands[i] = key;
	$('.key')[i].value = String.fromCharCode(commands[i]);
}

$(function(){
	removeElements();
	loadNewContent();
	$(document).on('mousemove', function(e){
		if($('#home').is(e.target) && e.pageX === 0)
			$('#sidePanel').show();
		else if($('.tab').is(e.target) || e.pageX > 92)
			$('#sidePanel').hide();
	});
	$(document).on('keypress', function(e){
		switch(e.keyCode){
			case commands[0]:
			toggleSetting(0);
			break;
			case commands[1]:
			toggleSetting(1);
			break;
			case commands[2]:
			toggleSetting(2);
			break;
			case commands[3]:
			toggleSetting(3);
			break;
			case commands[4]:
			toggleSetting(11);
			break;
			case commands[5]:
			toggleSetting(12);
			break;
			case commands[6]:
			toggleSetting(13);
			break;
			case commands[7]:
			toggleSetting(14);
			break;
			case commands[8]:
			toggleSetting(15);
			break;
		}
	});
	$('#skinURL').on('change', function(){
		getSkin();
	});
	$('#skin').on('click', function(){
		$('#skinURL').select();
	});
	$('#previous').on('click', function(){
		changeProfile('previous');
	});
	$('#next').on('click', function(){
		changeProfile('next');
	});
	$('#region').on('change', function(){
		MC.setRegion($(this).val());
	});
	$('#playButton').on('click', function(){
		MC.setNick(document.getElementById('playerName').value);
	});
	$('.icon').on('click', function(){
		var i = $(this).index();
		$($('.tab')[i]).show();
	});
	$('.tab').on('click', function(e){
		if(!$(this).has(e.target).length)
			$(this).hide();
	});
	$('.close').on('click', function(){
		$(this).parents('.tab').hide();
	});
	$('.settings').on('click', function(){
		var i = $(this).index();
		toggleSetting(i);
	});
	$('.commands').on('click', function(){
		var i = $(this).index();
		$($('.key')[i]).focus();
		$(this).on('keypress', function(e){
			changeKey(i, e.keyCode);
			$($('.key')[i]).blur();
		});
	});
});

QingJ © 2025

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