🏠 Home 

Twilight Heroes Autobox

This script adds a button for getting and equipping black box in the web game Twilight Heroes.


Install this script?
  1. // ==UserScript==
  2. // @name Twilight Heroes Autobox
  3. // @description This script adds a button for getting and equipping black box in the web game Twilight Heroes.
  4. // @namespace Twilight Heroes
  5. // @match https://www.twilightheroes.com/criminology.php*
  6. // @match https://twilightheroes.com/criminology.php*
  7. // @match https://www.twilightheroes.com/main.php*
  8. // @match https://twilightheroes.com/main.php*
  9. // @version 2
  10. // @history v2: The script broke when the game switched over to HTTPS. v2 fixes this issue. also replaced include with match for wider compatibility
  11. // @history v1: Initial script by Heather Robinson, whose scrips can be found here https://userscripts-mirror.org/users/110369
  12. // ==/UserScript==
  13. function zz(){
  14. var t='https://'+location.host+'/criminology.php';
  15. localStorage.setItem('gfb','true');
  16. location.href=t;}
  17. if(/main/.exec(location.href)){
  18. var c=document.getElementsByTagName('center')[0];
  19. var b=document.createElement('button');
  20. b.innerHTML='Get & Equip Black Box';
  21. c.parentNode.insertBefore(b,c);
  22. b.addEventListener('click',zz,true);}
  23. else if(localStorage.getItem('gfb')){
  24. var a=document.getElementsByTagName('form');
  25. if(a.length>3)
  26. a[2].submit();
  27. else{
  28. a=document.getElementsByTagName('a')[0];
  29. localStorage.removeItem('gfb');
  30. location.href=a.href;}}