Maxouille

tamper monkey script?

Apr 15th, 2021 (edited)
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Custom commands PS!
  3. // @namespace customcommandsps
  4. // @description Utility userscript to add custom commands in PS! client
  5. // @include http://play.pokemonshowdown.com/
  6. // @include https://play.pokemonshowdown.com/
  7. // @include http://play.pokemonshowdown.com/*
  8. // @include https://play.pokemonshowdown.com/*
  9. // @include http://*.psim.us/
  10. // @include https://*.psim.us/
  11. // @include http://*.psim.us/*
  12. // @include https://*.psim.us/*
  13. // @version 1.0.3
  14. // @grant GM_xmlhttpRequest
  15. // ==/UserScript==
  16. console.log("TEST1fou")
  17.  
  18. window.addEventListener('load', function() {
  19. console.log("TEST2fou")
  20. ConsoleRoom.prototype.customCommands = {};
  21.  
  22. ConsoleRoom.prototype.parseCommandOrig = ConsoleRoom.prototype.parseCommand;
  23. ConsoleRoom.prototype.parseCommand = function(Text) {
  24. var cmd = '';
  25. var target = '';
  26. var noSpace = false;
  27. if (Text.substr(0, 2) !== '//' && Text.charAt(0) === '/') {
  28. var spaceIndex = Text.indexOf(' ');
  29. if (spaceIndex > 0) {
  30. cmd = Text.substr(1, spaceIndex - 1);
  31. console.log(cmd)
  32. target = Text.substr(spaceIndex + 1);
  33. console.log(target)
  34. } else {
  35. cmd = Text.substr(1);
  36. target = '';
  37. noSpace = true;
  38. console.log(cmd);
  39. }
  40. }
  41. if (this.customCommands[cmd.toLowerCase()]) return this.customCommands[cmd.toLowerCase()](this, target);
  42. return this.parseCommandOrig(Text);
  43. };
  44. });
Advertisement
Add Comment
Please, Sign In to add comment