Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TagPro No-Script Key Remapper
- // @description Key remapper for no-script groups
- // @version 0.1
- // @author Some Ball -1
- // @match *://*.koalabeast.com/game
- // @include http://tagpro-test.koalabeast.com/*
- // @include http://tagpro-*.koalabeast.com:*
- // @include http://tagpro-*.koalabeast.com/textures/
- // @include http://tagpro-*.koalabeast.com:*
- // @include http://tagpro-test.koalabeast.com/game
- // @match *://*.koalabeast.com/game
- // @include http://*.koalabeast.com:*
- // @include http://tangent.jukejuice.com:*
- // @include http://tagpro-radius.koalabeast.com/*
- // @include http://tagpro-pi.koalabeast.com/*
- // @include http://tagpro-sphere.koalabeast.com/*
- // @include http://tagpro-origin.koalabeast.com/*
- // @include http://tagpro-newyork.koalabeast.com/*
- // @include http://tagpro-test.koalabeast.com/*
- // @include http://*.newcompte.fr:*
- // @match *://*.koalabeast.com/game
- // @include http://tagpro-*.koalabeast.com/textures/
- // @include http://tagpro-*.koalabeast.com:*
- // @include http://tagpro-test.koalabeast.com/game
- // @match *://*.koalabeast.com/game
- // @run-at document-end
- // @grant unsafeWindow
- // ==/UserScript==
- (function(window) {
- 'use strict';
- if(!window.tagpro) {
- // Number on left side is the keyCode of the key you want to use
- // Number on the right side is the keyCode of the key you want to remap/replace
- // Get keyCodes from here: http://keycode.info/
- // For example: 73 and 87 are the keyCodes for I and W, respectively
- // 73: 87 would remap the I key to W so pressing I would act the same as if you pressed W
- const remap = {
- 83: 87, // S acts like W
- 90: 65, // Z acts like A
- 88: 83, // X acts like S
- 67: 68, // C acts like D
- };
- /////////////////////////////////////////////////////
- $(document).on('keydown keyup keypress',function(e) { //probably don't even need to handle keypress here
- if(!e.fake && remap.hasOwnProperty(e.keyCode)) { //check fake to not get triggered by macro script keypresses
- e.keyCode = remap[e.keyCode];
- }
- });
- //move our listener events from the back to the front so they're triggered before all other listeners
- $._data(document).events.keydown.unshift($._data(document).events.keydown.pop());
- $._data(document).events.keyup.unshift($._data(document).events.keyup.pop());
- $._data(document).events.keypress.unshift($._data(document).events.keypress.pop());
- }
- })(unsafeWindow);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement