XVIDEOS Plus

A kinder XVIDEOS. Because you're worth it.

  1. // ==UserScript==
  2. // @author Mr. Nope
  3. // @version 1.2
  4. // @name XVIDEOS Plus
  5. // @description A kinder XVIDEOS. Because you're worth it.
  6. // @namespace Nope
  7. // @date 2019-02-23
  8. // @include *xvideos.com*
  9. // @run-at document-start
  10. // @grant none
  11. // @license Public Domain
  12. // @icon https://seeklogo.com/images/X/xvideos-logo-77E7B4F168-seeklogo.com.png
  13. // @grant GM_addStyle
  14. // ==/UserScript==
  15.  
  16. (() => {
  17. const OPTIONS = {
  18. autoplay: JSON.parse(localStorage.getItem('plus_autoplay')) || false,
  19. cinemaMode: JSON.parse(localStorage.getItem('plus_cinemaMode')) || false
  20. }
  21. /**
  22. * Shared Styles
  23. */
  24. const sharedStyles = `
  25. /* Our own elements */
  26.  
  27. .plus-buttons {
  28. background: rgba(27, 27, 27, 0.9);
  29. box-shadow: 0px 0px 12px rgba(20, 111, 223, 0.9);
  30. font-size: 12px;
  31. position: fixed;
  32. bottom: 10px;
  33. padding: 10px 22px 8px 24px;
  34. right: 0;
  35. z-index: 100;
  36. transition: all 0.3s ease;
  37.  
  38. /* Negative margin-right calculated later based on width of buttons */
  39. }
  40.  
  41. .plus-buttons:hover {
  42. box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
  43. }
  44.  
  45. .plus-buttons .plus-button {
  46. margin: 10px 0;
  47. padding: 6px 15px;
  48. border-radius: 4px;
  49. font-weight: 700;
  50. display: block;
  51. position: relative;
  52. text-align: center;
  53. vertical-align: top;
  54. cursor: pointer;
  55. border: none;
  56. text-decoration: none;
  57. }
  58.  
  59. .plus-buttons a.plus-button {
  60. background: rgb(221, 221, 221);
  61. color: rgb(51, 51, 51);
  62. }
  63.  
  64. .plus-buttons a.plus-button:hover {
  65. background: rgb(187, 187, 187);
  66. color: rgb(51, 51, 51);
  67. }
  68.  
  69. .plus-buttons a.plus-button.plus-button-isOn {
  70. background: rgb(20, 111, 223);
  71. color: rgb(255, 255, 255);
  72. }
  73.  
  74. .plus-buttons a.plus-button.plus-button-isOn:hover {
  75. background: rgb(0, 91, 203);
  76. color: rgb(255, 255, 255);
  77. }
  78.  
  79. .plus-hidden {
  80. display: none !important;
  81. }
  82. `;
  83. /**
  84. * Color Theme
  85. */
  86. const themeStyles = `
  87. .plus-buttons {
  88. box-shadow: 0px 0px 12px rgba(255, 153, 0, 0.85);
  89. }
  90.  
  91. .plus-buttons:hover {
  92. box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
  93. }
  94.  
  95. .plus-buttons a.plus-button {
  96. background: rgb(47, 47, 47);
  97. color: rgb(172, 172, 172);
  98. }
  99.  
  100. .plus-buttons a.plus-button:hover {
  101. background: rgb(79, 79, 79);
  102. color: rgb(204, 204, 204);
  103. }
  104.  
  105. .plus-buttons a.plus-button.plus-button-isOn {
  106. background: rgb(255, 153, 0);
  107. color: rgb(0, 0, 0);
  108. }
  109.  
  110. .plus-buttons a.plus-button.plus-button-isOn:hover {
  111. background: rgb(255, 153, 0);
  112. color: rgb(255, 255, 255);
  113. }
  114. `;
  115. /**
  116. * Site-Specific Styles
  117. */
  118. const generalStyles = `
  119. /* Hide elements */
  120.  
  121. .abovePlayer,
  122. .streamatesModelsContainer,
  123. #headerUpgradePremiumBtn,
  124. #headerUploadBtn,
  125. #PornhubNetworkBar,
  126. #js-abContainterMain,
  127. #hd-rightColVideoPage > :not(#relatedVideosVPage) {
  128. display: none !important;
  129. }
  130.  
  131. #related-videos .thumb-block {
  132. opacity: 1;
  133. }
  134.  
  135. #related-videos .thumb-block:hover {
  136. opacity: 1;
  137. }
  138. `;
  139. /**
  140. * Run on page load
  141. */
  142. window.addEventListener('DOMContentLoaded', () => {
  143. const video = document.querySelector('#html5video video'); // References the HTML5 Video element
  144. /**
  145. * Create option buttons
  146. */
  147. const buttons = document.createElement('div');
  148. const scrollButton = document.createElement('a');
  149. const scrollButtonText = document.createElement('span');
  150. const autoplayButton = document.createElement('a');
  151. const autoplayButtonText = document.createElement('span');
  152. const autoplayButtonState = OPTIONS.autoplay ? 'plus-button-isOn' : 'plus-button-isOff';
  153. const cinemaModeButton = document.createElement('a');
  154. const cinemaModeButtonText = document.createElement('span');
  155. const cinemaModeButtonState = OPTIONS.cinemaMode ? 'plus-button-isOn' : 'plus-button-isOff';
  156. scrollButtonText.textContent = "Scroll to Top";
  157. scrollButtonText.classList.add('text');
  158. scrollButton.appendChild(scrollButtonText);
  159. scrollButton.classList.add('plus-button');
  160. scrollButton.addEventListener('click', () => {
  161. window.scrollTo({ top: 0 });
  162. });
  163. cinemaModeButtonText.textContent = 'Cinema Mode';
  164. cinemaModeButtonText.classList.add('text');
  165. cinemaModeButton.appendChild(cinemaModeButtonText);
  166. cinemaModeButton.classList.add(cinemaModeButtonState, 'plus-button');
  167. cinemaModeButton.addEventListener('click', () => {
  168. OPTIONS.cinemaMode = !OPTIONS.cinemaMode;
  169. localStorage.setItem('plus_cinemaMode', OPTIONS.cinemaMode);
  170. if (OPTIONS.cinemaMode) {
  171. cinemaModeButton.classList.replace('plus-button-isOff', 'plus-button-isOn');
  172. } else {
  173. cinemaModeButton.classList.replace('plus-button-isOn', 'plus-button-isOff');
  174. }
  175. });
  176. autoplayButtonText.textContent = 'Autoplay';
  177. autoplayButtonText.classList.add('text');
  178. autoplayButton.appendChild(autoplayButtonText);
  179. autoplayButton.classList.add(autoplayButtonState, 'plus-button');
  180. autoplayButton.addEventListener('click', () => {
  181. OPTIONS.autoplay = !OPTIONS.autoplay;
  182. localStorage.setItem('plus_autoplay', OPTIONS.autoplay);
  183. if (OPTIONS.autoplay) {
  184. autoplayButton.classList.replace('plus-button-isOff', 'plus-button-isOn');
  185. } else {
  186. autoplayButton.classList.replace('plus-button-isOn', 'plus-button-isOff');
  187. }
  188. });
  189. buttons.classList.add('plus-buttons');
  190. buttons.appendChild(scrollButton);
  191. buttons.appendChild(autoplayButton);
  192. buttons.appendChild(cinemaModeButton);
  193. document.body.appendChild(buttons);
  194. /**
  195. * Initialize video pages containing valid video element
  196. */
  197. if (/^http[s]*:\/\/[www.]*xvideos\.com\/video/.test(window.location.href) && video) {
  198. /**
  199. * Auto-enable cinema mode if enabled
  200. */
  201. if (OPTIONS.cinemaMode) {
  202. document.querySelector('.buttons-bar img[src*="icon-screen-expand"]').dispatchEvent(new MouseEvent('click'));
  203. }
  204. /**
  205. * Autoplay video if enabled
  206. */
  207. if (OPTIONS.autoplay) {
  208. document.querySelector('.buttons-bar img[src*="icon-play"]').dispatchEvent(new MouseEvent('click'));
  209. }
  210. }
  211. /**
  212. * Add styles
  213. */
  214. GM_addStyle(sharedStyles);
  215. GM_addStyle(themeStyles);
  216. GM_addStyle(generalStyles);
  217. /**
  218. * Add dynamic styles
  219. */
  220. const dynamicStyles = `
  221. .plus-buttons {
  222. margin-right: -${buttons.getBoundingClientRect().width - 23}px;
  223. }
  224.  
  225. .plus-buttons:hover {
  226. margin-right: 0;
  227. }
  228. `;
  229. GM_addStyle(dynamicStyles);
  230. });
  231. })();