No Usernames

A userscript to remove all usernames from ingame

目前为 2022-03-28 提交的版本。查看 最新版本

// ==UserScript==
// @name         No Usernames
// @version      1.0.0
// @author       Blu
// @description  A userscript to remove all usernames from ingame
// @match        https://bonk.io/gameframe-release.html
// @run-at       document-start
// @grant        none
// @namespace https://greasyfork.org/users/826975
// ==/UserScript==

// for use as a userscript ensure you have Excigma's code injector userscript
// https://greasyfork.org/en/scripts/433861-code-injector-bonk-io

const injectorName = `NoUsernames`;
const errorMsg = `Whoops! ${injectorName} was unable to load.
This may be due to an update to Bonk.io. If so, please report this error!
This could also be because you have an extension that is incompatible with \
${injectorName}`;

function injector(src){
  let newSrc = src;
  
  // o1k[8] = this.playerObject.userName    =>    o1k[8] = ""
  newSrc = newSrc.replace(`o1k[8]=this[o1k[7][1576]][o1k[7][568]];`, `o1k[8]="";`);
  
  if(src === newSrc) throw "Injection failed!";
  console.log(injectorName+" injector run");
  return newSrc;
}

// Compatibility with Excigma's code injector userscript
if(!window.bonkCodeInjectors) window.bonkCodeInjectors = [];
window.bonkCodeInjectors.push(bonkCode => {
	try {
		return injector(bonkCode);
	} catch (error) {
		alert(errorMsg);
		throw error;
	}
});

console.log(injectorName+" injector loaded");