Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Rabbit unfuckerupper
  3. // @namespace Acevpd3 + Lucci Gang
  4. // @version 0.0.1
  5. // @description keeps joining a new lobby until it gets in the right one thhats such a shitty description but ok.
  6. // @author Acevpd3 + Lucci Gang
  7. // @match *://www.rabb.it/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. let styleElement;
  12. let hidden;
  13.  
  14. window.addEventListener('click', clickHandler);
  15. window.addEventListener("fullscreenchange", fsHandler);
  16.  
  17. function clickHandler(e) {
  18. let classList = Array.prototype.slice.call(e.target.classList, 0);
  19.  
  20. if (classList.includes('enter')) hideTheStuff();
  21. if (classList.includes('exit')) unhideTheStuff();
  22. }
  23.  
  24. function hideTheStuff() {
  25. document.querySelector('div.tray.screencast').style.display = 'none';
  26. document.querySelector('.normalControls').style.display = 'none';
  27.  
  28. window.addEventListener('mousemove', mousemoveHandler);
  29.  
  30. hidden = true;
  31. }
  32.  
  33. function unhideTheStuff() {
  34. document.querySelector('div.tray.screencast').style.display = '';
  35. document.querySelector('.normalControls').style.display = '';
  36.  
  37. window.removeEventListener('mousemove', mousemoveHandler);
  38.  
  39. hidden = false;
  40. }
  41.  
  42. function mousemoveHandler(e) {
  43. let mouseAtBottom = Boolean(window.innerHeight - e.clientY < window.innerHeight / 10);
  44. let mouseAtTopRight = Boolean(e.clientY < window.innerHeight / 10 && e.clientX > window.innerWidth / 30);
  45.  
  46. document.querySelector('.normalControls').style.display = mouseAtBottom ? '' : 'none';
  47. styleElement.innerHTML = mouseAtTopRight ? '' : '.rightToggle {display: none !important;}';
  48. }
  49.  
  50. function fsHandler(e) {
  51. if (!document.webkitIsFullScreen && !document.mozFullScreen && !document.msFullscreenElement && hidden) {
  52. unhideTheStuff();
  53. }
  54. }
  55.  
  56. function stylize() {
  57. let style = document.createElement('style');
  58.  
  59. style.innerHTML = '.rightToggle {display: none !important;}';
  60.  
  61. let ref = document.querySelector('script');
  62.  
  63. ref.parentNode.insertBefore(style, ref);
  64.  
  65. styleElement = style;
  66.  
  67. let style_ = document.createElement('style');
  68.  
  69. style_.innerHTML = '.desktop .roomLayout .mainRoom .videoChatView.chatOpen.fullscreen .chatLayout{height: 100%; background-color: transparent; background-image: linear-gradient(90deg,#000000a8,#000);}';
  70. style_.innerHTML += '.screencastRequestPopup .popup{display: none;}'
  71.  
  72. ref.parentNode.insertBefore(style_, ref);
  73. }
  74.  
  75. stylize();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement