|
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, make input more consistent across the websites, remove spammy elements. Usually affects every media player it can find, designed to be used on a separate browser profile. Supported websites: anysex.com, beeg.com, bingato.com, drtuber.com, hqporner.com, hdzog.tube, hypnotube.com, incestporno.vip, inporn.com, manysex.com, mat6tube.com, pmvhaven.com, porn00.tv, pornhits.com, pornhub.com, porno365.best, porntrex.com, pornxp.com, redtube.com, spankbang.com, taboodude.com, tnaflix.com, tube8.com, txxx.com, veporn.com, vxxx.com, whoreshub.com, xgroovy.com, xhamster.com, xnxx.com, xvideos.com, xxxbp.tv, youporn.com, рус-порно.tv |
4 | 4 | // @icon https://external-content.duckduckgo.com/ip3/pornhub.com.ico |
5 | | -// @version 0.62 |
| 5 | +// @version 0.63 |
6 | 6 | // @downloadURL https://userscripts.codonaft.com/improve-adult-experience.user.js |
7 | 7 | // @grant GM_addStyle |
8 | 8 | // ==/UserScript== |
@@ -210,6 +210,7 @@ const init = (args = {}) => { |
210 | 210 | isVideoUrl, |
211 | 211 | hideSelector, |
212 | 212 | nodeChangeSelector, |
| 213 | + onStartPlayback, |
213 | 214 | onNodeChange, |
214 | 215 | } = { ...defaultArgs, ...args }; |
215 | 216 |
|
@@ -237,6 +238,7 @@ const init = (args = {}) => { |
237 | 238 | const strategies = [ |
238 | 239 | _ => button?.click(), |
239 | 240 | _ => simulateMouse(document, video), |
| 241 | + _ => video.play?.(), |
240 | 242 | ]; |
241 | 243 |
|
242 | 244 | let attempt = 0; |
@@ -466,6 +468,7 @@ const init = (args = {}) => { |
466 | 468 | console.log('playback is started') |
467 | 469 | playbackStarted = true; |
468 | 470 | focus(video); |
| 471 | + onStartPlayback(video); |
469 | 472 | }, { once: true }); |
470 | 473 |
|
471 | 474 | video.addEventListener('stalled', _ => { |
@@ -1253,6 +1256,13 @@ const sites = { |
1253 | 1256 | durationSelector: 'span[data-testid="video-item-length"], div[data-testid="video-item-length"]', |
1254 | 1257 | isVideoUrl: href => href.includes('/video/'), |
1255 | 1258 | hideSelector: 'div[x-data="gifPage"], section.timeline, div.positions-wrapper', |
| 1259 | + onStartPlayback: video => { |
| 1260 | + body.querySelector('button.vjs-control[title="Unmute"]')?.click(); |
| 1261 | + // FIXME |
| 1262 | + //if ([...body.querySelectorAll('div#video_container, .play_cover.loading')].find(i => i.style?.display === 'block')) return; |
| 1263 | + //console.log('fixing invisible player'); |
| 1264 | + //simulateMouse(document, video); |
| 1265 | + }, |
1256 | 1266 | onNodeChange: node => { |
1257 | 1267 | if (!validLink(node)) return; |
1258 | 1268 |
|
@@ -1499,6 +1509,7 @@ const sites = { |
1499 | 1509 |
|
1500 | 1510 | 'xhamster.com': _ => { |
1501 | 1511 | // TODO: <iframe src="https://xhamster.com/embed/xhHw7V9" scrolling="no" allowfullscreen="" width="640" height="480" frameborder="0"></iframe><p></p> |
| 1512 | + const qualityKey = 'quality'; |
1502 | 1513 | const hd = '/hd/'; |
1503 | 1514 | const best = `${hd}full-length/best`; |
1504 | 1515 | const quality = `${MIN_VIDEO_HEIGHT}p`; |
@@ -1526,20 +1537,22 @@ const sites = { |
1526 | 1537 | const url = new URL(node.href.replace(/\/hd$/, '/')); |
1527 | 1538 | const params = url.searchParams; |
1528 | 1539 | const p = url.pathname; |
| 1540 | + if (params.has(qualityKey)) return; |
| 1541 | + |
1529 | 1542 | if (p.startsWith('/search/') && params.get('length') !== 'full') { |
1530 | 1543 | applySearchFilter(searchFilterParams, url); |
1531 | 1544 | updateUrl(node, url); |
1532 | 1545 | } else if (p === '/' || (['/categories/', '/channels/'].find(i => p.startsWith(i)) && !p.includes(best))) { |
1533 | 1546 | url.pathname += `${best}/monthly`; |
1534 | | - params.set('quality', quality); |
| 1547 | + params.set(qualityKey, quality); |
1535 | 1548 | updateUrl(node, url); |
1536 | 1549 | } else if (parts(p).length > 1 && p.startsWith('/creators/') && !['/all/', '/awards', '/contest/', '/videos/', hd].find(i => p.includes(i))) { |
1537 | 1550 | url.pathname += hd; |
1538 | | - params.set('quality', quality); |
| 1551 | + params.set(qualityKey, quality); |
1539 | 1552 | updateUrl(node, url); |
1540 | 1553 | } else if (parts(p).length > 1 && p.startsWith('/pornstars/') && !['/all/', best].find(i => p.includes(i))) { |
1541 | 1554 | url.pathname += best; |
1542 | | - params.set('quality', quality); |
| 1555 | + params.set(qualityKey, quality); |
1543 | 1556 | updateUrl(node, url); |
1544 | 1557 | } |
1545 | 1558 | }, |
|
0 commit comments