|
2 | 2 | // @name Improve Adult Experience |
3 | 3 | // @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 |
4 | 4 | // @icon https://www.google.com/s2/favicons?sz=64&domain=pornhub.com |
5 | | -// @version 0.14 |
| 5 | +// @version 0.15 |
6 | 6 | // @downloadURL https://userscripts.codonaft.com/improve-adult-experience.js |
7 | 7 | // @match https://spankbang.com/* |
8 | 8 | // @match https://www.pornhub.com/* |
|
533 | 533 | window.location.href = `${origin}/search/${query}/${ending}`; |
534 | 534 | }, true); |
535 | 535 |
|
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 | + } |
546 | 548 |
|
547 | 549 | let initializedVideo = false; |
548 | 550 | 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)) { |
550 | 559 | const href = node.href; |
551 | 560 | if (href.includes('/video/')) return; |
552 | 561 | if (href.includes('/models/') && href.length === origin.length + '/models/a/'.length) return; |
|
0 commit comments