// ==UserScript== // @name DigDig.IO Minimap // @namespace http://tampermonkey.net/ // @version 0.0.1 // @description Fully functional minimap for digdig.io! // @author Zertalious (Zert) // @match *://digdig.io/* // @icon https://www.google.com/s2/favicons?domain=digdig.io // @require https://cdn.jsdelivr.net/gh/Qwokka/WAIL@9ed21abc43045e19f9b3756de109a6e361fb9292/wail.js // @downloadURL none // ==/UserScript== WebAssembly.instantiateStreaming = async function ( request, imports ) { const response = await request; const buffer = await response.arrayBuffer(); return WebAssembly.instantiate( buffer, imports ); } WebAssembly.instantiate = new Proxy( WebAssembly.instantiate, { apply( target, thisArgs, args ) { const array = new Uint8Array( args[ 0 ] ); find( array, [ OP_SELECT, OP_F64_PROMOTE_F32, OP_TEE_LOCAL, 'any', OP_GET_LOCAL, 'any', OP_F64_MUL, OP_F64_ADD, OP_F64_GE, OP_BR_IF, 0 ], function ( start, end ) { array[ end - 1 ] = OP_DROP; array[ end ] = OP_NOP; } ); args[ 0 ] = array; return Reflect.apply( ...arguments ); } } ); function find( array, search, callback ) { main: for ( let i = 0; i < array.length; i ++ ) { for ( let j = 0; j < search.length; j ++ ) { if ( search[ j ] === 'any' ? false : array[ i + j ] !== search[ j ] ) { continue main; } } callback( i, i + search.length - 1 ); } } const CTX = CanvasRenderingContext2D.prototype; let temp; CTX.arc = new Proxy( CTX.arc, { apply( target, ctx, args ) { if ( [ 25, 28, 3, 50, 9 ].indexOf( args[ 2 ] ) === - 1 && ctx.fillStyle === '#222222' ) { temp = args; } return Reflect.apply( ...arguments ); } } ); CTX.fill = new Proxy( CTX.fill, { apply( target, ctx, args ) { Reflect.apply( ...arguments ); if ( temp ) { const [ x, y, r ] = temp; temp = null; const size = 50; const pointSize = 2; ctx.save(); ctx.globalAlpha = 0.8; ctx.translate( 10 + size, ctx.canvas.height - 10 - size ); ctx.beginPath(); ctx.arc( 0, 0, size, 0, Math.PI * 2 ); ctx.fillStyle = '#111'; ctx.fill(); ctx.beginPath(); const a = size - pointSize; ctx.arc( ( window.innerWidth / 2 - x ) / r * a, ( window.innerHeight / 2 - y ) / r * a, 2, 0, Math.PI * 2 ); ctx.fillStyle = '#fff'; ctx.fill(); ctx.restore(); ctx.beginPath(); } } } );