Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Keyboard Shortcuts for Omerta
  3. // @namespace keyboardshortcuts.barafranca.com
  4. // @version 0.2
  5. // @description Omerta Keyboard Shortcuts for Chrome and Firefox
  6. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
  7. // @include http://barafranca.com/*
  8. // @include http://www.barafranca.com/*
  9. // @include https://barafranca.com/*
  10. // @include https://www.barafranca.com/*
  11. // @include http://barafranca.nl/*
  12. // @include *barafranca.nl/*
  13. // @include https://omerta.dm/*
  14. // @include https://omerta.pt/*
  15. // @include https://www.omerta.dm/*
  16. // @include https://www.omerta.pt/*
  17. // @copyright 2016, Merciless
  18. // @grant unsafeWindow
  19. // ==/UserScript==
  20.  
  21. var shortcutKeys = {
  22. "74": "J",
  23. "65": "A",
  24. "67": "C",
  25. "78": "N",
  26. "83": "S",
  27. "84": "T",
  28. "71": "G",
  29. "77": "M",
  30. "66": "B"
  31. };
  32.  
  33. function shortCut(e) {
  34. if (e.keyCode == 192) {
  35. $("input[name='buymeout']").click();
  36. }
  37.  
  38. if ($(e.target).is('input[type=text], input[type=password], textarea') || e.ctrlKey || e.metaKey) {
  39. return;
  40. }
  41.  
  42. if (shortcutKeys[e.keyCode]) {
  43. unsafeWindow.$("a[accesskey='" + shortcutKeys[e.keyCode] + "']").click();
  44. e.preventDefault();
  45. }
  46.  
  47. if (e.keyCode == 81) {
  48. $("input[name='buymeout']").click();
  49. }
  50.  
  51. if (e.keyCode == 88) {
  52. unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
  53. }
  54.  
  55. if (e.keyCode == 90) {
  56. unsafeWindow.omerta.GUI.container.loadPage('/races.php');
  57. }
  58.  
  59. if (e.keyCode == 82) {
  60. $(".menu-item-actions").click();
  61. }
  62. }
  63.  
  64. if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
  65. window.onkeydown = shortCut;
  66. } else {
  67. unsafeWindow.onkeydown = shortCut;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement