Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Custom commands PS!
- // @namespace customcommandsps
- // @description Utility userscript to add custom commands in PS! client
- // @include http://play.pokemonshowdown.com/
- // @include https://play.pokemonshowdown.com/
- // @include http://play.pokemonshowdown.com/*
- // @include https://play.pokemonshowdown.com/*
- // @include http://*.psim.us/
- // @include https://*.psim.us/
- // @include http://*.psim.us/*
- // @include https://*.psim.us/*
- // @version 1.0.3
- // @grant GM_xmlhttpRequest
- // ==/UserScript==
- console.log("TEST1fou")
- window.addEventListener('load', function() {
- console.log("TEST2fou")
- ConsoleRoom.prototype.customCommands = {};
- ConsoleRoom.prototype.parseCommandOrig = ConsoleRoom.prototype.parseCommand;
- ConsoleRoom.prototype.parseCommand = function(Text) {
- var cmd = '';
- var target = '';
- var noSpace = false;
- if (Text.substr(0, 2) !== '//' && Text.charAt(0) === '/') {
- var spaceIndex = Text.indexOf(' ');
- if (spaceIndex > 0) {
- cmd = Text.substr(1, spaceIndex - 1);
- console.log(cmd)
- target = Text.substr(spaceIndex + 1);
- console.log(target)
- } else {
- cmd = Text.substr(1);
- target = '';
- noSpace = true;
- console.log(cmd);
- }
- }
- if (this.customCommands[cmd.toLowerCase()]) return this.customCommands[cmd.toLowerCase()](this, target);
- return this.parseCommandOrig(Text);
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment