Pornhub Webpage Fullscreen

try to take over the world!

  1. // ==UserScript==
  2. // @name Pornhub Webpage Fullscreen
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description try to take over the world!
  6. // @author tgxh
  7. // @match https://www.pornhub.com/view_video.php?*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const headEle = document.querySelector('head'),
  15. style = document.createElement('style'),
  16. styleText = `
  17. .playerFlvContainer.fullscreen {
  18. position: fixed !important;
  19. z-index: 10000000;
  20. width: 100%;
  21. height: 100%;
  22. left: 0;
  23. top: 0;
  24. }`;
  25. style.innerHTML = styleText;
  26. headEle.append(style);
  27.  
  28. function poll() {
  29. const wrap = document.querySelector('.mhp1138_front');
  30. if (!wrap) return setTimeout(poll, 1000);
  31. let btn = wrap.querySelector('.fullscreen');
  32. if (!btn) {
  33. btn = document.createElement('div');
  34. btn.setAttribute('style', 'float:right; margin-top: 10px;margin-right: 8px; cursor: pointer;');
  35. btn.title = 'webpage fullscreen';
  36. btn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" id="Capa_1" enable-background="new 0 0 451.111 451.111" height="16px" viewBox="0 0 451.111 451.111" width="16px" class=""><g><path d="m290 0 56.389 56.389-88.611 88.611 48.333 48.333 88.611-88.611 56.389 56.389v-161.111z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#CCCCCC"/><path d="m145 257.778-88.611 88.611-56.389-56.389v161.111h161.111l-56.389-56.389 88.611-88.611z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#CCCCCC"/><path d="m306.111 257.778-48.333 48.333 88.611 88.611-56.389 56.389h161.111v-161.111l-56.389 56.389z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#CCCCCC"/><path d="m161.111 0h-161.111v161.111l56.389-56.389 88.611 88.611 48.333-48.333-88.611-88.611z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#CCCCCC"/><style xmlns="" id="8dca7fd2-2718-4c92-9e83-fd40994931ba" class="active-path">.select-text-inside-a-link{ -moz-user-select: text!important; }</style></g> </svg>`
  37. const player = document.querySelector('.playerFlvContainer');
  38. const header = document.querySelector('#header');
  39. btn.addEventListener('click', () => {
  40. const className = 'fullscreen';
  41. if (player.classList.contains(className)) {
  42. header.style.display = 'grid';
  43. player.classList.remove(className);
  44. } else {
  45. header.style.display = 'none';
  46. player.classList.add(className);
  47. }
  48. })
  49. wrap.append(btn);
  50. }
  51. }
  52.  
  53. poll();
  54. })();