Skip to content

Commit 7bf93fd

Browse files
committed
Update
1 parent c39ba27 commit 7bf93fd

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

improve-adult-experience.js

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @name Improve Adult Experience
33
// @description Skip intros, set better default quality/duration filters, make unwanted video previews transparent, workaround load failures. Supported websites: pornhub.com, xvideos.com, spankbang.com, porntrex.com, xhamster.com
44
// @icon https://www.google.com/s2/favicons?sz=64&domain=pornhub.com
5-
// @version 0.14
5+
// @version 0.15
66
// @downloadURL https://userscripts.codonaft.com/improve-adult-experience.js
77
// @match https://spankbang.com/*
88
// @match https://www.pornhub.com/*
@@ -464,6 +464,10 @@
464464
div.${UNWANTED}:hover { opacity: 40%; }
465465
`;
466466
body.appendChild(style);
467+
468+
if (MINOR_IMPROVEMENTS) {
469+
body.querySelectorAll('div[x-data="gifPage"]').forEach(i => i.style.display = 'none');
470+
}
467471
} catch (e) {
468472
console.error(e);
469473
}
@@ -488,7 +492,7 @@
488492

489493
subscribeOnChanges(body, node => {
490494
try {
491-
if (node.matches('span[data-testid="video-item-length"]')) {
495+
if (node.matches('span[data-testid="video-item-length"], div[data-testid="video-item-length"]')) {
492496
const duration = Number(node.textContent.split('m')[0]) || 0;
493497
if (duration < MIN_DURATION_MINS) {
494498
node.closest('div[data-testid="video-item"]')?.classList.add(UNWANTED);
@@ -515,7 +519,6 @@
515519
});
516520
};
517521

518-
// TODO: unwanted
519522
const porntrex = _ => {
520523
const body = document.body;
521524
const minDuration = 'thirty-all-min';
@@ -533,20 +536,29 @@
533536
window.location.href = `${origin}/search/${query}/${ending}`;
534537
}, true);
535538

536-
/*if (MINOR_IMPROVEMENTS) {
537-
try {
538-
console.log('applying style');
539-
const style = document.createElement('style');
540-
style.innerHTML = 'div.sort-holder { display: none !important; }';
541-
body.appendChild(style);
542-
} catch (e) {
543-
console.error(e);
544-
}
545-
}*/
539+
try {
540+
console.log('applying style');
541+
const style = document.createElement('style');
542+
style.innerHTML = `
543+
div.${UNWANTED} { opacity: 10%; }
544+
div.${UNWANTED}:hover { opacity: 40%; }
545+
`;
546+
// TODO: div.sort-holder { display: none !important; } ?
547+
body.appendChild(style);
548+
} catch (e) {
549+
console.error(e);
550+
}
546551

547552
let initializedVideo = false;
548553
const processNode = node => {
549-
if (validLink(node)) {
554+
const unwanted = (node.matches('span.quality') && (Number(node.textContent.split('p')[0]) || 0) < MIN_VIDEO_HEIGHT) || (node.matches('div.durations') && timeToSeconds(node.textContent) < MIN_DURATION_MINS * 60);
555+
if (unwanted) {
556+
node.closest('div.thumb-item')?.classList.add(UNWANTED);
557+
} else if (node.matches('div.durations')) {
558+
if (timeToSeconds(node.textContent) < MIN_DURATION_MINS * 60) {
559+
node.closest('div.thumb-item')?.classList.add(UNWANTED);
560+
}
561+
} else if (validLink(node)) {
550562
const href = node.href;
551563
if (href.includes('/video/')) return;
552564
if (href.includes('/models/') && href.length === origin.length + '/models/a/'.length) return;

0 commit comments

Comments
 (0)