OWOT Extras

Improves & Adds more stuff to the menu (rainbow,paint,paste,teleport,js) and fixes a bug

  1. // 0.2: Obfuscation removed (-4500 bytes), improved menu options
  2. // 0.3: Added zoom seekbar, fix teleport X and Y being inverted
  3. // 0.4: Added rainbow mode, fixed trackpad history scroll bug (an OWOP bug)
  4. // 0.5.0: Switched to semantic versioning (semver)
  5. // 0.5.1: Removed zoom (added to OWOT itself), added warning for execute code
  6.  
  7. // ==UserScript==
  8. // @name OWOT Extras
  9. // @namespace https://greasyfork.org/users/200700
  10. // @version 0.5.1
  11. // @description Improves & Adds more stuff to the menu (rainbow,paint,paste,teleport,js) and fixes a bug
  12. // @author SuperOP535
  13. // @match *.ourworldoftext.com/*
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. window.addEventListener('wheel', function (e) { e.preventDefault(); });
  19. var _writeChar = writeChar;
  20. function getRandomInt(min, max) {return Math.floor(Math.random() * (max - min)) + min;}
  21. writeChar = function(a, b) {
  22. if(rainbowmode) YourWorld.Color = getRandomInt(0, 16777216);
  23. _writeChar(a, b);
  24. };
  25. var paintmode = false, rainbowmode = false;
  26. var char = '█';
  27. document.addEventListener('mouseup', function(e) {
  28. if(!paintmode) return;
  29. writeChar(char, true);
  30. });
  31. var nav = document.getElementById('nav');
  32. nav.style.width = '150px';
  33. nav.style.textAlign = 'center';
  34. menu.addCheckboxOption(' Allow paste', function(){Permissions.can_paste = function(){return true;};},
  35. function(){Permissions.can_paste = function(){return false;};});
  36. menu.addCheckboxOption(' Paint mode', function(){paintmode = true;}, function(){paintmode = false;});
  37. menu.addCheckboxOption(' Rainbow mode', function(){rainbowmode = true;}, function(){rainbowmode = false;});
  38. menu.addOption('Change paint char', function() {
  39. var c = prompt('Enter character', char);
  40. char = c.slice(0,1) || char;
  41. });
  42. menu.addOption('Teleport', function() {
  43. var x = +prompt('Enter X coordinate'), y = +prompt('Enter Y coordinate');
  44. if(isNaN(x)) return alert('Invalid X coordinate');
  45. if(isNaN(y)) return alert('Invalid Y coordinate');
  46. w.doGoToCoord(y, x);
  47. });
  48. menu.addOption('Execute code', function() {
  49. var code = prompt('Enter JavaScript code. **Don\'t paste anything random!**');
  50. if(!code) return;
  51. try {
  52. alert(eval(code));
  53. } catch(e) {
  54. alert('Error: ' + e);
  55. }
  56. });
  57. })();