E-Better

Custom menu for Evades with improved styles

Per 19-03-2024. Zie de nieuwste versie.

// ==UserScript==
// @name         E-Better
// @version      0.1.4
// @description  Custom menu for Evades with improved styles
// @author       Alertix(aka Failure), thanks to EtherCD(aka ✺Mistake✺) for helping and for making Map Filling for Beauty (https://github.com/EtherCD). thanks to waterfowlgeneral for drawing the evades t-shirt "got res?"
// @match        https://evades.online/*
// @match        https://evades.io/*
// @icon         https://u.cubeupload.com/FailureEvades/evadesactions.png
// @grant        none
// @run-at       document-idle
// @license      @license
// @namespace http://tampermonkey.net/
// ==/UserScript==

const initEBetter = () => {
	const menu = document.createElement('div')
	menu.setAttribute('id', 'customMenu')
	menu.style.position = 'fixed'
	menu.style.top = '50%'
	menu.style.left = '0'
	menu.style.transform = 'translateY(-50%)'
	menu.style.background = 'rgba(0, 0, 0, 0.7)'
	menu.style.width = '50px'
	menu.style.height = '100vh'
	menu.style.display = 'block'
	menu.style.transition = 'width 0.5s'

	const settingsButton = document.createElement('img')
	settingsButton.src = 'https://evades.io/options.8b56ab3c.png'
	settingsButton.alt = 'Settings'
	settingsButton.style.position = 'absolute'
	settingsButton.style.top = '10px'
	settingsButton.style.left = '10px'
	settingsButton.style.width = '30px'
	settingsButton.style.height = 'auto'
	settingsButton.style.cursor = 'pointer'
	settingsButton.addEventListener('click', function () {
		toggleSubMenu()
	})

	const cursorChangerButton = document.createElement('img')
	cursorChangerButton.src =
		'https://u.cubeupload.com/FailureEvades/CursorChanger.png'
	cursorChangerButton.alt = 'Cursor Changer'
	cursorChangerButton.style.position = 'absolute'
	cursorChangerButton.style.top = '55px'
	cursorChangerButton.style.left = '10px'
	cursorChangerButton.style.width = '30px'
	cursorChangerButton.style.height = 'auto'
	cursorChangerButton.style.cursor = 'pointer'
	cursorChangerButton.addEventListener('click', function () {
		toggleCursorChangerSubMenu()
	})

	const cursorChangerSubMenu = document.createElement('div')
	cursorChangerSubMenu.setAttribute('id', 'cursorChangerSubMenu')
	cursorChangerSubMenu.style.position = 'absolute'
	cursorChangerSubMenu.style.top = '55px'
	cursorChangerSubMenu.style.left = '50px'
	cursorChangerSubMenu.style.width = '0'
	cursorChangerSubMenu.style.height = '70px'
	cursorChangerSubMenu.style.background = 'rgba(0, 0, 0, 0.7)'
	cursorChangerSubMenu.style.transition = 'width 0.5s'
	cursorChangerSubMenu.style.overflow = 'hidden'

	const changeCursorButton = document.createElement('img')
	changeCursorButton.src =
		'https://u.cubeupload.com/FailureEvades/arrowIcon.png'
	changeCursorButton.alt = 'Change Cursor'
	changeCursorButton.style.color = '#ffffff'
	changeCursorButton.style.position = 'absolute'
	changeCursorButton.style.top = '5px'
	changeCursorButton.style.left = '20px'
	changeCursorButton.style.width = '20px'
	changeCursorButton.style.height = 'auto'
	changeCursorButton.style.cursor = 'pointer'
	changeCursorButton.addEventListener('click', function () {
		changeCursor()
	})

	const currentCursorText = document.createElement('div')
	currentCursorText.textContent = 'Current Cursor: Normal'
	currentCursorText.style.color = '#ffffff'
	currentCursorText.style.position = 'absolute'
	currentCursorText.style.top = '5px'
	currentCursorText.style.left = '50px'
	currentCursorText.style.padding = '5px'
	currentCursorText.style.display = 'inline-block'

	let currentCursor = 'normal'

	cursorChangerSubMenu.appendChild(currentCursorText)
	cursorChangerSubMenu.appendChild(changeCursorButton)

	function changeCursor() {
		const body = document.querySelector('body')
		if (currentCursor === 'normal') {
			body.style.cursor = 'crosshair'
			currentCursorText.textContent = 'Current Cursor: Crosshair'
			currentCursor = 'crosshair'
		} else {
			body.style.cursor = 'auto'
			currentCursorText.textContent = 'Current Cursor: Normal'
			currentCursor = 'normal'
		}
	}

	menu.appendChild(cursorChangerButton)
	document.body.appendChild(cursorChangerSubMenu)

	function toggleCursorChangerSubMenu() {
		if (cursorChangerSubMenu.style.width === '0px') {
			cursorChangerSubMenu.style.width = '200px'
		} else {
			cursorChangerSubMenu.style.width = '0'
		}
	}

	const creditsButton = document.createElement('img')
	creditsButton.src = 'https://evades.io/question.bc02e04b.png'
	creditsButton.alt = 'Credits'
	creditsButton.style.position = 'absolute'
	creditsButton.style.top = '100px'
	creditsButton.style.left = '10px'
	creditsButton.style.width = '30px'
	creditsButton.style.height = 'auto'
	creditsButton.style.cursor = 'pointer'
	creditsButton.addEventListener('click', function () {
		toggleCreditsSubMenu()
	})

	const creditsSubMenu = document.createElement('div')
	creditsSubMenu.setAttribute('id', 'creditsSubMenu')
	creditsSubMenu.style.position = 'absolute'
	creditsSubMenu.style.top = '100px'
	creditsSubMenu.style.left = '50px'
	creditsSubMenu.style.width = '0px'
	creditsSubMenu.style.height = '150px'
	creditsSubMenu.style.background = 'rgba(0, 0, 0, 0.7)'
	creditsSubMenu.style.transition = 'width 1.5s'
	creditsSubMenu.style.overflow = 'hidden'

	const currentCreditsText = document.createElement('div')
	currentCreditsText.textContent = 'Thanks to: EtherCD(aka ✺Mistake✺)'
	currentCreditsText.style.color = '#ffffff'
	currentCreditsText.style.position = 'absolute'
	currentCreditsText.style.top = '5px'
	currentCreditsText.style.left = '10px'
	currentCreditsText.style.padding = '5px'
	currentCreditsText.style.display = 'inline-block'

	creditsSubMenu.appendChild(currentCreditsText)

	menu.appendChild(creditsButton)
	document.body.appendChild(creditsSubMenu)

	function toggleCreditsSubMenu() {
		if (creditsSubMenu.style.width === '0px') {
			creditsSubMenu.style.width = '200px'
		} else {
			creditsSubMenu.style.width = '0'
		}
	}

	const osuButton = document.createElement('img')
	osuButton.src =
		'https://images.spasibovsem.ru/catalog/original/osu-otzyvy-1470068147.png'
	osuButton.alt = 'Osu'
	osuButton.style.position = 'absolute'
	osuButton.style.top = '145px'
	osuButton.style.left = '10px'
	osuButton.style.width = '30px'
	osuButton.style.height = 'auto'
	osuButton.style.cursor = 'crosshair'
	osuButton.addEventListener('click', function () {
		window.location.href = 'https://osu.ppy.sh/users/35576054'
	})

	menu.appendChild(osuButton)

	const friendsButton = document.createElement('img')
	friendsButton.src =
		'https://cdn0.iconfinder.com/data/icons/simple-seo-and-internet-icons/512/social_media_marketing-1024.png'
	friendsButton.alt = 'Friends'
	friendsButton.style.position = 'absolute'
	friendsButton.style.top = '190px'
	friendsButton.style.left = '10px'
	friendsButton.style.width = '30px'
	friendsButton.style.height = 'auto'
	friendsButton.style.cursor = 'pointer'
	friendsButton.addEventListener('click', function () {
		alert('Sorry, but this Feature Works in Progress!')
	})

	menu.appendChild(friendsButton)

	const subMenu = document.createElement('div')
	subMenu.setAttribute('id', 'subMenu')
	subMenu.style.position = 'absolute'
	subMenu.style.top = '0'
	subMenu.style.left = '50px'
	subMenu.style.width = '0'
	subMenu.style.height = '67px'
	subMenu.style.background = 'rgba(0, 0, 0, 0.7)'
	subMenu.style.transition = 'width 0.5s'
	subMenu.style.overflow = 'hidden'

	const colorPickerButton = document.createElement('div')
	colorPickerButton.style.display = 'flex'
	colorPickerButton.style.alignItems = 'center'
	colorPickerButton.style.cursor = 'pointer'
	colorPickerButton.style.padding = '5px'
	colorPickerButton.style.borderBottom = '1px solid #ccc'
	colorPickerButton.textContent = "Change everybody's nick color (clientside)"
	colorPickerButton.style.color = '#ffffff'

	const colorPicker = document.createElement('input')
	colorPicker.setAttribute('type', 'color')
	colorPicker.style.width = '30px'
	colorPicker.style.height = '30px'
	colorPicker.style.border = 'none'
	colorPicker.style.borderRadius = '0'
	colorPicker.style.marginLeft = '10px'

	colorPicker.addEventListener('change', function (event) {
		const newColor = event.target.value
		changeNickColor(newColor)
	})

	colorPickerButton.appendChild(colorPicker)

	subMenu.appendChild(colorPickerButton)

	menu.appendChild(settingsButton)
	document.body.appendChild(menu)
	document.body.appendChild(subMenu)

	function toggleSubMenu() {
		if (subMenu.style.width === '0px') {
			subMenu.style.width = '200px'
		} else {
			subMenu.style.width = '0'
		}
	}

	function changeNickColor(newColor) {
		const chatMessages = document.querySelectorAll('.chat-message-sender')
		chatMessages.forEach(function (message) {
			message.style.color = newColor
		})
	}

	document.addEventListener('mousemove', function (event) {
		if (event.clientX < 20) {
			menu.style.display = 'block'
			menu.style.width = '150px'
		} else {
			menu.style.width = '50px'
		}
	})
}

// EtherCD's Map Filling for Beauty
window.EvadesME = {
	vars: {
		worlds: {
			'Central Core': ['#425a6d', 0.1],
			//'Catastrophic Core': ['#B00B1E', 0.1, () => Math.abs(Math.sin(Date.now() / 1000) * 0.15)],
			'Haunted Halls': ['#664B00', 0.1],
			'Peculiar Pyramid': ['#666600', 0.1],
			'Wacky Wonderland': ['#870080', 0.1],
			'Glacial Gorge': ['#005668', 0.1],
			'Vicious Valley': ['#4d6b40', 0.1],
			'Humongous Hollow': ['#663900', 0.1],
			'Elite Expanse': ['#2a3b4f', 0.1],
			'Endless Echo': ['#4168c4', 0.1],
			'Dangerous District': ['#680000', 0.1],
			'Quiet Quarry': ['#425a6d', 0.1],
			'Monumental Migration': ['#470066', 0.1],
			'Ominous Occult': ['#63838e', 0.1],
			'Frozen Fjord': ['#27494f', 0.1],
			'Restless Ridge': ['#a88b64', 0.1],
			'Toxic Territory': ['#5c5c5c', 0.1],
			'Magnetic Monopole': ['#bf00ff', 0.1],
			'Burning Bunker': ['#cc0000', 0.1],
			'Grand Garden': ['#6a9c49', 0.1],
			'Mysterious Mansion': ['#9c0ec7', 0.1],
			'Cyber Castle': ['#21bad9', 0.1],
			'Shifting Sands': ['#c88241', 0.1],
			'Infinite Inferno': ['#9b0606', 0.1],
			'Coupled Corridors': ['#bcad59', 0.1],
			'Withering Wasteland': ['#c45945', 0.1],
			'Dusty Depths': ['#825B37', 0.1],
		},
		worldsKeys: [],
	},

	replaces: [],

	addReplace(a, b) {
		this.replaces.push([a, b])
	},

	addReplaces() {
		this.addReplace(
			/prepareCanvas\(\w\)\{[\w\d\$="'.,;#?:\s\(\)]+\}/,
			`prepareCanvas(e) {
                  this.chat.style.visibility = 'visible';
                  this.leaderboard.style.visibility = 'visible';
                  this.context.fillStyle = '#333';
                  this.context.fillRect(0, 0, this.context.canvas.width, this.context.canvas.height);
                  if (window.EvadesME.vars.worldsKeys.includes(e.area.regionName)) {
                    this.context.fillStyle = window.EvadesME.vars.worlds[e.area.regionName][0];
                    this.context.globalAlpha = window.EvadesME.vars.worlds[e.area.regionName][2]
                      ? window.EvadesME.vars.worlds[e.area.regionName][2]()
                      : window.EvadesME.vars.worlds[e.area.regionName][1];
                    this.context.fillRect(0, 0, this.context.canvas.width, this.context.canvas.height);
                    this.context.globalAlpha = 1;
                  }
                  this.camera.centerOn(e.self.entity);
                }`
		)
		// this.addReplace(/=['"]#006b2c['"]/, `="#6B0063"`); // #006b66
		// this.addReplace(/=['"]#00ff6b['"]/, `="#e500ff"`); // #00fff4
	},

	init() {
		this.vars.worldsKeys = Object.keys(this.vars.worlds)
		this.addReplaces()
	},

	insertCode() {
		// From script by @Irudis: Evades Helper
		// commenting from alertix: HMMMM????? hacker??🤨
		let elem = Array.from(document.querySelectorAll('script')).filter(
			a => a.type === 'module' && a.src.match(/\/index\.[0-9a-f]{8}\.js/)
		)[0]
		if (!elem) return
		if (!navigator.userAgent.includes('Firefox')) elem.remove()
		let src = elem.src

		let req = new XMLHttpRequest()
		req.open('GET', src, false)
		req.send()
		let code = req.response
		for (const r in this.replaces)
			code = code.replace(this.replaces[r][0], this.replaces[r][1])

		let nScr = document.createElement('script')
		nScr.setAttribute('type', 'module')
		nScr.innerHTML = code
		document.body.appendChild(nScr)
		console.log('E-Better was loaded!')
		initEBetter()
	},

	// idk why did ethercd put that
	asAddonForTSMod() {
		console.log('Sorry, E-Better is not working with TS-Mod')
	},
}

window.EvadesME.init()
if (!window.tsmod) window.EvadesME.insertCode()
else window.EvadesME.asAddonForTSMod()
function setZoomTo100() {
	document.body.style.zoom = '100%'
}
长期地址
遇到问题?请前往 GitHub 提 Issues。