Guest User

Untitled

a guest
Jan 22nd, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* eslint-disable */
  2. // ==UserScript==
  3. // @name         just em stuff
  4. // @namespace    http://tampermonkey.net/
  5. // @version      0.1
  6. // @description  try to take over the world!
  7. // @author       You
  8. // @match        https://epicmafia.com/game/*
  9. // @exclude      https://epicmafia.com/game/new/*
  10. // @grant        none
  11. // ==/UserScript==
  12.  
  13. //
  14. //
  15. //
  16.  
  17. // ==/UserScript==
  18.  
  19. (function() {
  20.     'use strict';
  21.  
  22.     const CHANGE_BACKGROUND = false;
  23.     const ENABLE_RIGHT_CLICK = true;
  24.  
  25.     const GAME_CONTAINER = 'game-container';
  26.  
  27.     const TIME_INDEX = 3;
  28.     const NIGHT = 'night';
  29.     const DAY = 'day';
  30.  
  31.     // put a URL for a background here
  32.     // it's
  33.     const NIGHT_BG_URL = 'https://i.pinimg.com/originals/b7/7e/e4/b77ee4fd7ed46c0c333bd3dd5a444b48.jpg';
  34.     const DAY_BG_URL = 'https://i.imgur.com/4pwlwZn.jpg';
  35.  
  36.     function setBackground(container, time) {
  37.         let bg;
  38.         if(time === NIGHT) {
  39.             bg = NIGHT_BG_URL;
  40.         } else if(time === DAY) {
  41.             bg = DAY_BG_URL;
  42.         } else {
  43.             return;
  44.         }
  45.         container.style.background = `url("${bg}") repeat bottom center #222`;
  46.         const props = Array.prototype.slice.call(document.getElementsByClassName('prop'));
  47.         props.map(element => {
  48.             element.parentNode.removeChild(element);
  49.         });
  50.     }
  51.  
  52.     const container = document.getElementById(GAME_CONTAINER);
  53.     let time;
  54.  
  55.     if(CHANGE_BACKGROUND) {
  56.         setInterval(() => {
  57.             if(!container.classList.contains(time)) {
  58.                 time = container.classList[TIME_INDEX];
  59.                 setBackground(container, time);
  60.             }
  61.         }, 50);
  62.     }
  63.  
  64.     if(ENABLE_RIGHT_CLICK) {
  65.         $(window).off("contextmenu");
  66.         document.body.oncontextmenu = false;
  67.     }
  68.  
  69. })();
Advertisement
Add Comment
Please, Sign In to add comment