Advertisement
Guest User

Untitled

a guest
Jan 15th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 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://i.pinimg.com/originals/b7/7e/e4/b77ee4fd7ed46c0c333bd3dd5a444b48.jpg';
  31. const DAY_BG_URL = 'https://images.wallpaperscraft.com/image/lofoten_norway_mountains_lake_winter_106414_1920x1080.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