Nurutomo2

Owop Chat Tools v0.8

Mar 14th, 2018
1,276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Help:
  2. // Shift + Left Arrow - Reverse String
  3. // Shift + F2         - String to Hex
  4. // Shift + F4         - Hex to String
  5.  
  6. // This made by Nurutomo
  7. // Discord @Nurutomo #6541
  8. // Version 0.8
  9. // Chat text reverser
  10.  
  11. setTimeout(function () {
  12.     OWOP.chat.local('Chat tools by Nurutomo Activated!');
  13. },3000);
  14.  
  15. chatinput = document.getElementById('chat-input');
  16. chatinput.addEventListener("keydown", function (event) {
  17.     var keyCode = event.which || event.keyCode;
  18.     switch (keyCode) {
  19.         case 37:
  20.             // Left Arrow
  21.             if (event.shiftKey) {
  22.                 chatinput.value = reverseString(chatinput.value);
  23.             }
  24.             break;
  25.         case 113:
  26.             // F2 Key
  27.             if (event.shiftKey) {
  28.                 chatinput.value = stringToHex(chatinput.value);
  29.                 }
  30.             break;
  31.         case 115:
  32.             // F4 Key
  33.             if (event.shiftKey) {
  34.                 chatinput.value = hexToString(chatinput.value);
  35.                 }
  36.             break;
  37.     }
  38. });
  39.  
  40. // Found on Internet
  41. function reverseString(str) {
  42.     return str.split("").reverse().join("");
  43. }
  44. // By Kit
  45. // Convert String to Hex
  46. function stringToHex(str) {
  47.     return str.split("").map(c => ("00"+c.charCodeAt(0).toString(16)).substr(-2)).join("").toUpperCase();
  48. }
  49. // Convert Hex to String
  50. function hexToString(str) {
  51.     return str.match(/[a-f0-9]{2}/gi).map(x => String.fromCharCode(parseInt(x, 16))).join("");
  52. }
  53.  
  54. /* Userscript is still BETA! */
  55. // ==UserScript==
  56. // @name        OWOP Chat Tools by Nurutomo v0.8
  57. // @version     0.8
  58. // @description With this you can reverse, hex to string, and others
  59. // @copyright   2018,Nurutomo
  60. // @author      Nurutomo
  61. // @homepage    https://pastebin.com/cCv4pSXM
  62. // updateURL    https://pastebin.com/raw/cCv4pSXM
  63. // downloadURL  https://pastebin.com/raw/cCv4pSXM
  64. // @updateURL   https://pastebin.com/raw/cCv4pSXM
  65. // @downloadURL https://pastebin.com/raw/cCv4pSXM
  66. // @connect     ourworldofpixels.com/*
  67. // @match       ourworldofpixels.com/*
  68. // ==/UserScript==
  69. /* Userscript is still BETA! */
Advertisement
Add Comment
Please, Sign In to add comment