Advertisement
Guest User

#nofilter

a guest
Apr 25th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  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 GAME_CONTAINER = 'game-container';
  23.  
  24. const TIME_INDEX = 3;
  25. const NIGHT = 'night';
  26. const DAY = 'day';
  27.  
  28. // put a URL for a background here
  29. // it's
  30. const NIGHT_BG_URL = 'https://66.media.tumblr.com/3c55d05bebcae8e750f4317af406bf39/tumblr_p32mxlxZw91wxdq3zo1_1280.jpg';
  31. const DAY_BG_URL = 'https://i.imgur.com/Z3zN1dH.jpg';
  32.  
  33. function setBackground(container, time) {
  34. let bg;
  35. if(time === NIGHT) {
  36. bg = NIGHT_BG_URL;
  37. } else if(time === DAY) {
  38. bg = DAY_BG_URL;
  39. } else {
  40. return;
  41. }
  42. container.style.background = `url("${bg}") repeat bottom center #222`;
  43. const props = Array.prototype.slice.call(document.getElementsByClassName('prop'));
  44. props.map(element => {
  45. element.parentNode.removeChild(element);
  46. });
  47. }
  48.  
  49. const container = document.getElementById(GAME_CONTAINER);
  50. let time;
  51.  
  52. setInterval(() => {
  53. if(!container.classList.contains(time)) {
  54. time = container.classList[TIME_INDEX];
  55. setBackground(container, time);
  56. }
  57. }, 50);
  58.  
  59. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement