Skip to content

Commit 78df196

Browse files
committed
Update
1 parent c39ba27 commit 78df196

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

improve-adult-experience.js

Lines changed: 21 additions & 12 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/*
@@ -533,20 +533,29 @@
533533
window.location.href = `${origin}/search/${query}/${ending}`;
534534
}, true);
535535

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

547549
let initializedVideo = false;
548550
const processNode = node => {
549-
if (validLink(node)) {
551+
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);
552+
if (unwanted) {
553+
node.closest('div.thumb-item')?.classList.add(UNWANTED);
554+
} else if (node.matches('div.durations')) {
555+
if (timeToSeconds(node.textContent) < MIN_DURATION_MINS * 60) {
556+
node.closest('div.thumb-item')?.classList.add(UNWANTED);
557+
}
558+
} else if (validLink(node)) {
550559
const href = node.href;
551560
if (href.includes('/video/')) return;
552561
if (href.includes('/models/') && href.length === origin.length + '/models/a/'.length) return;

0 commit comments

Comments
 (0)