PornHub Improved (Senza UI e Logo)figuccio

Scorrimento infinito.accetta cookie

  1. // ==UserScript==
  2. // @name PornHub Improved (Senza UI e Logo)figuccio
  3. // @namespace https://greasyfork.org/users/237458
  4. // @version 0.1
  5. // @license MIT
  6. // @description Scorrimento infinito.accetta cookie
  7. // @author figuccio
  8. // @match https://*.pornhub.com/*
  9. // @exclude https://*.pornhub.com/embed/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=pornhub.com
  11. // @grant GM_addStyle
  12. // @require https://cdn.jsdelivr.net/npm/billy-herrington-utils@1.1.8/dist/billy-herrington-utils.umd.js
  13. // @require https://cdn.jsdelivr.net/npm/jabroni-outfit@1.4.9/dist/jabroni-outfit.umd.js
  14. // @require https://update.greasyfork.org/scripts/494204/data-manager.user.js?version=1458190
  15. // @require https://update.greasyfork.org/scripts/494205/pagination-manager.user.js?version=1459738
  16. // @run-at document-idle
  17. // ==/UserScript==
  18. /* globals $ DataManager PaginationManager */
  19. (function() {
  20. 'use strict';
  21.  
  22. setTimeout(function(){document.querySelector("#modalWrapMTubes > div > div > button").click();}, 4000);//18anni consenso
  23. setTimeout(function(){document.querySelector("#cookieBannerWrapper > button.cbPrimaryCTA.cbButton.gtm-event-cookie-banner") .click();}, 5000);//accetta tutti cookie
  24.  
  25.  
  26. const { watchElementChildrenCount, getAllUniqueParents, timeToSeconds, sanitizeStr, findNextSibling } = window.bhutils;
  27. Object.assign(unsafeWindow, { bhutils: window.bhutils });
  28. const { JabroniOutfitStore, defaultStateWithDuration } = window.jabronioutfit;
  29.  
  30. class PORNHUB_RULES {
  31. constructor() {
  32. const { pathname } = window.location;
  33.  
  34. this.IS_MODEL_PAGE = pathname.startsWith('/model/');
  35. this.IS_VIDEO_PAGE = pathname.startsWith('/view_video.php');
  36. this.IS_PLAYLIST_PAGE = pathname.startsWith('/playlist/');
  37.  
  38. this.PAGINATION = document.querySelector('.paginationGated');
  39. this.PAGINATION_LAST = parseInt(document.querySelector('.page_next')?.previousElementSibling.innerText) || 1;
  40.  
  41. this.CONTAINER = document.querySelector('ul.videos.row-5-thumbs, ul.videos.nf-videos, ul#singleFeedSection, ul#videoSearchResult, ul#singleFeedSection');
  42.  
  43. this.INTERSECTION_OBSERVABLE = this.CONTAINER && findNextSibling(this.CONTAINER);
  44. }
  45.  
  46. THUMB_URL(thumb) {
  47. return thumb.querySelector('.linkVideoThumb').href;
  48. }
  49.  
  50. GET_THUMBS(html) {
  51. const parent = html.querySelector(this.IS_MODEL_PAGE ? '.videos.row-5-thumbs' : 'ul.videos.nf-videos') || html;
  52. return parent.querySelectorAll('li.videoBox.videoblock, li.videoblock');
  53. }
  54.  
  55. THUMB_IMG_DATA(thumb) {
  56. const img = thumb.querySelector('.js-videoThumb.thumb.js-videoPreview');
  57. const imgSrc = img?.getAttribute('data-mediumthumb') || img?.getAttribute('data-path').replace('{index}', '1');
  58. if (!img?.complete || img.naturalWidth === 0) { return ({}); }
  59. return { img, imgSrc };
  60. }
  61.  
  62. THUMB_DATA(thumb) {
  63. const title = sanitizeStr(thumb.querySelector('span.title')?.innerText);
  64. const duration = timeToSeconds(thumb.querySelector('.duration')?.innerText);
  65. return { title, duration };
  66. }
  67.  
  68. URL_DATA() {
  69. const url = new URL(window.location.href);
  70. const offset = parseInt(url.searchParams.get('page')) || 1;
  71.  
  72. const iteratable_url = n => {
  73. url.searchParams.set('page', n);
  74. return url.href;
  75. }
  76.  
  77. return { offset, iteratable_url }
  78. }
  79. }
  80.  
  81. const RULES = new PORNHUB_RULES();
  82.  
  83. //====================================================================================================
  84.  
  85. const SCROLL_RESET_DELAY = 350;
  86.  
  87. const store = new JabroniOutfitStore(defaultStateWithDuration);
  88. const { state, stateLocale } = store;
  89. const { applyFilters, handleLoadedHTML } = new DataManager(RULES, state);
  90. store.subscribe(applyFilters);
  91.  
  92. if (RULES.IS_VIDEO_PAGE) {
  93. const containers = getAllUniqueParents(document.querySelectorAll('li.pcVideoListItem.js-pop.videoBox')).slice(2);
  94. containers.forEach(c => handleLoadedHTML(c, c));
  95. }
  96.  
  97. if (RULES.CONTAINER) {
  98. handleLoadedHTML(RULES.CONTAINER);
  99. }
  100.  
  101. if (RULES.IS_PLAYLIST_PAGE) {
  102. handleLoadedHTML(RULES.CONTAINER);
  103. watchElementChildrenCount(RULES.CONTAINER, () => handleLoadedHTML(RULES.CONTAINER));
  104. }
  105.  
  106. if (RULES.PAGINATION) {
  107. new PaginationManager(state, stateLocale, RULES, handleLoadedHTML, SCROLL_RESET_DELAY);
  108. }
  109. })();