Pjfry2184575

Untitled

Nov 17th, 2023
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Hide Mug Option
  3. // @namespace    https://www.torn.com/profiles.php?XID=1936821
  4. // @version      1.0
  5. // @description  Hide mug option after attack.
  6. // @author       TheFoxMan
  7. // @match        https://www.torn.com/loader.php?sid=attack*
  8. // @run-at       document-start
  9. // ==/UserScript==
  10.  
  11. // Made for Phillip_J_Fry [2184575].
  12. // DO NOT EDIT.
  13.  
  14. if (!Document.prototype.find)
  15.     Object.defineProperties(Document.prototype, {
  16.         find: {
  17.             value(selector) {
  18.                 return document.querySelector(selector);
  19.             },
  20.             enumerable: false
  21.         },
  22.         findAll: {
  23.             value(selector) {
  24.                 return document.querySelectorAll(selector);
  25.             },
  26.             enumerable: false
  27.         }
  28.     });
  29.  
  30. if (!Element.prototype.find)
  31.     Object.defineProperties(Element.prototype, {
  32.         find: {
  33.             value(selector) {
  34.                 return this.querySelector(selector);
  35.             },
  36.             enumerable: false
  37.         },
  38.         findAll: {
  39.             value(selector) {
  40.                 return this.querySelectorAll(selector);
  41.             },
  42.             enumerable: false
  43.         }
  44.     });
  45.  
  46. async function waitFor(sel, parent = document) {
  47.     return new Promise((resolve) => {
  48.         const intervalID = setInterval(() => {
  49.             const el = parent.find(sel);
  50.             if (el) {
  51.                 resolve(el);
  52.                 clearInterval(intervalID);
  53.             }
  54.         }, 500);
  55.     });
  56. }
  57.  
  58. (async () => {
  59.     await waitFor("head");
  60.  
  61.     document.head.insertAdjacentHTML(
  62.         "beforeend",
  63.         `<style>
  64.             [class*="playerArea__"] [class*="playerWindow__"] button:nth-child(2) {
  65.                 display: none;
  66.             }
  67.         </style>`
  68.     );
  69. })();
Advertisement
Add Comment
Please, Sign In to add comment