|
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/* |
|
464 | 464 | div.${UNWANTED}:hover { opacity: 40%; } |
465 | 465 | `; |
466 | 466 | body.appendChild(style); |
| 467 | + |
| 468 | + if (MINOR_IMPROVEMENTS) { |
| 469 | + body.querySelectorAll('div[x-data="gifPage"]').forEach(i => i.style.display = 'none'); |
| 470 | + } |
467 | 471 | } catch (e) { |
468 | 472 | console.error(e); |
469 | 473 | } |
|
488 | 492 |
|
489 | 493 | subscribeOnChanges(body, node => { |
490 | 494 | 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"]')) { |
492 | 496 | const duration = Number(node.textContent.split('m')[0]) || 0; |
493 | 497 | if (duration < MIN_DURATION_MINS) { |
494 | 498 | node.closest('div[data-testid="video-item"]')?.classList.add(UNWANTED); |
|
515 | 519 | }); |
516 | 520 | }; |
517 | 521 |
|
518 | | - // TODO: unwanted |
519 | 522 | const porntrex = _ => { |
520 | 523 | const body = document.body; |
521 | 524 | const minDuration = 'thirty-all-min'; |
|
533 | 536 | window.location.href = `${origin}/search/${query}/${ending}`; |
534 | 537 | }, true); |
535 | 538 |
|
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 | + } |
546 | 551 |
|
547 | 552 | let initializedVideo = false; |
548 | 553 | 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)) { |
550 | 562 | const href = node.href; |
551 | 563 | if (href.includes('/video/')) return; |
552 | 564 | if (href.includes('/models/') && href.length === origin.length + '/models/a/'.length) return; |
|
0 commit comments