Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Keyboard Shortcuts for Omerta on Chrome
  3. // @namespace    keyboardshortcuts.barafranca.com
  4. // @version      0.5
  5. // @description  Adds keyboard shortcuts to Omerta, including busting out for v5
  6. // @require      https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
  7. // @include      http://*.barafranca.com/*
  8. // @include      https://*.barafranca.com/*
  9. // @include      http://barafranca.com/*
  10. // @include      https://barafranca.com/*
  11. // @include      http://*.barafranca.nl/*
  12. // @include      https://*.barafranca.nl/*
  13. // @include      http://barafranca.nl/*
  14. // @include      https://barafranca.nl/*
  15. // @include      http://*.barafranca.us/*
  16. // @include      https://*.barafranca.us/*
  17. // @include      http://barafranca.us/*
  18. // @include      https://barafranca.us/*
  19. // @include      http://*.barafranca.gen.tr/*
  20. // @include      https://*.barafranca.gen.tr/*
  21. // @include      http://barafranca.gen.tr/*
  22. // @include      https://barafranca.gen.tr/*
  23. // @include      http://omerta.com.tr/*
  24. // @include      https://omerta.com.tr/*
  25. // @include      http://*.omerta.com.tr/*
  26. // @include      https://*.omerta.com.tr/*
  27. // @include      http://*.omerta.dm/*
  28. // @include      https://*.omerta.dm/*
  29. // @include      http://omerta.dm/*
  30. // @include      https://omerta.dm/*
  31. // @include      http://*.omerta.pt/*
  32. // @include      https://*.omerta.pt/*
  33. // @include      http://omerta.pt/*
  34. // @include      https://omerta.pt/*
  35. // @include      https://*.omerta.land*
  36. // @copyright    2017, MurderInc, Critycal
  37. // @grant        unsafeWindow
  38. // ==/UserScript==
  39.  
  40. var shortcutKeys = {
  41.     "74": "J",
  42.     "65": "A",
  43.     "67": "C",
  44.     "78": "N",
  45.     "83": "S",
  46.     "84": "T",
  47.     "71": "G",
  48.     "77": "M",
  49.     "66": "B"
  50. };
  51. function shortCut(e) {
  52.     if (e.keyCode == 192) {
  53.         $("input[name='buymeout']").click();
  54.     }
  55.  
  56.     if ($(e.target).is('input[type=text], input[type=password], textarea') || e.ctrlKey || e.metaKey) {
  57.         return;
  58.     }
  59.  
  60.     if (shortcutKeys[e.keyCode]) {
  61.         unsafeWindow.$("a[accesskey='" + shortcutKeys[e.keyCode] + "']").click();
  62.         e.preventDefault();
  63.     }
  64.  
  65.     if (e.keyCode == 81) {
  66.         $("input[name='buymeout']").click();
  67.     }
  68.     if (e.keyCode == 88) {
  69.         unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
  70.     }
  71.      if (e.keyCode == 80) {
  72.         unsafeWindow.omerta.GUI.container.loadPage('/garage.php');
  73.     }
  74.  
  75.     if (e.keyCode == 82) {
  76.         unsafeWindow.omerta.GUI.container.loadPage('/races.php');
  77.  
  78.     }
  79.     if (e.keyCode == 85) {
  80.         unsafeWindow.omerta.GUI.container.loadPage('allusers.php?start=0&order=lastrank&sort=DESC&dead=HIDE');
  81.  
  82.     }
  83.      if (e.keyCode == 86) {
  84.         unsafeWindow.omerta.GUI.container.loadPage('index.php?module=Spots');
  85.  
  86.     }
  87.     if (e.keyCode == 89) {
  88.         unsafeWindow.omerta.GUI.container.loadPage('/BeO/webroot/index.php?module=Bodyguards');
  89.     }
  90.     if (e.keyCode == 76) {
  91.         unsafeWindow.omerta.GUI.container.loadPage('/?module=Lackeys');
  92.     }
  93.      if (e.keyCode == 79) {
  94.         unsafeWindow.omerta.GUI.container.loadPage('/obay.php');
  95.     }
  96.  
  97.     if (e.keyCode == 75) {
  98.         unsafeWindow.omerta.GUI.container.loadPage('/BeO/webroot/index.php?module=Detectives');
  99.     }
  100.     if (e.keyCode == 87) {
  101.         if ($("input[value='Bust out']").length > 0) {
  102.             $("input[value='Bust out']").click();
  103.         }
  104.         if ($("input[value=' Try it ']").length > 0) {
  105.             $("input[value=' Try it ']").click();
  106.         }
  107.     }
  108.  
  109.     /** Key Z : Click on Scratch! button */
  110.     if (e.keyCode == 90) {
  111.         let btn = $("input[value='Scratch!']");
  112.         if (btn.length > 0) {
  113.             btn.click();
  114.         }
  115.     }
  116.  
  117.     /** Key Space : Click on first Scratch! code: button */
  118.     if (e.keyCode == 32) {
  119.         let btns = $("input[value^='Scratch! code:']");
  120.         if (btns.length > 0) {
  121.             btns.first().click();
  122.         }
  123.     }
  124.  
  125.     /** Key delete : Click on go back */
  126.     if (e.keyCode == 8) {
  127.         let btn = $("input[value='Go Back']");
  128.         if (btn.length > 0) {
  129.             btn.click();
  130.         }
  131.     }
  132.  
  133. }
  134. if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
  135.     window.onkeydown = shortCut;
  136. } else {
  137.     unsafeWindow.onkeydown = shortCut;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement