Skip to content

Commit 6e340f5

Browse files
committed
Update
1 parent fd839df commit 6e340f5

9 files changed

+67
-39
lines changed

bypass-various-popups.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Bypass Various Popups
3-
// @version 0.2
3+
// @version 0.3
44
// @downloadURL https://userscripts.codonaft.com/bypass-various-popups.js
55
// @match https://*.archive.org/*
66
// @match https://chat.qwen.ai/*
@@ -11,23 +11,23 @@
1111
// @match https://xhamster.com/*
1212
// ==/UserScript==
1313

14-
(() => {
14+
(_ => {
1515
'use strict';
1616

1717
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;
1818

19-
const randomPause = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
19+
const randomPause = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
2020

2121
const process = (node, observer) => {
2222
if (node.nodeType !== 1) return;
2323

2424
if (['A', 'BUTTON'].includes(node.tagName) && node.innerText.includes('Stay logged out')) {
25-
setTimeout(() => node.click(), randomPause(1000, 1500));
25+
setTimeout(_ => node.click(), randomPause(1000, 1500));
2626
return;
2727
}
2828

2929
if (node.matches?.('div[role=dialog]')) {
30-
setTimeout(() => {
30+
setTimeout(_ => {
3131
node.querySelectorAll('button[aria-label="close"]').forEach(i => i.click());
3232
node.querySelectorAll('button.btn').forEach(i => {
3333
if (i.innerText.includes('Not now')) {
@@ -51,7 +51,7 @@
5151
}
5252

5353
if (node.tagName === 'BUTTON' && node.getAttribute('data-role') === 'parental-control-confirm-button') {
54-
setTimeout(() => node.click(), randomPause(1000, 1500));
54+
setTimeout(_ => node.click(), randomPause(1000, 1500));
5555
return;
5656
}
5757

@@ -63,9 +63,9 @@
6363

6464
if (node.matches?.('#modalWrapMTubes')) {
6565
observer.disconnect();
66-
setTimeout(() => {
66+
setTimeout(_ => {
6767
document.body.querySelectorAll('#modalWrapMTubes > div > div > button').forEach(i => i.click());
68-
}, randomPause(1000, 1500));
68+
}, randomPause(100, 400));
6969
return;
7070
}
7171

bypass-youtube-popups.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,37 @@
66
// @match https://www.youtube.com/*
77
// ==/UserScript==
88

9-
(() => {
9+
(_ => {
1010
'use strict';
1111

1212
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;
1313

14-
const randomPause = () => {
14+
const randomPause = _ => {
1515
const min = 3000;
1616
const max = 5000;
17-
return Math.floor(Math.random() * (max - min + 1)) + min;
17+
return Math.floor(Math.random() * (max - min + 1) + min);
1818
};
1919

2020
const process = (node, observer) => {
2121
if (node.nodeType !== 1) return;
2222

2323
if (node.classList.contains('yt-spec-button-shape-next')) {
24-
setTimeout(() => {
24+
setTimeout(_ => {
2525
if (node.getAttribute('aria-label')?.includes('No thanks')) {
2626
node.click();
2727
}
2828
}, randomPause());
2929
observer.disconnect();
3030
return;
3131
} else if (node.classList.contains('ytd-single-option-survey-renderer')) {
32-
setTimeout(() => {
32+
setTimeout(_ => {
3333
if (node.getAttribute('icon')?.includes('yt-icons:close')) {
3434
node.click();
3535
}
3636
}, randomPause());
3737
return;
3838
} else if (node.tagName === 'DIV' && node.textContent.includes('My Ad Center')) {
39-
setTimeout(() => {
39+
setTimeout(_ => {
4040
node.querySelectorAll('button').forEach(i => {
4141
if (i.getAttribute('aria-label')?.includes('Close')) {
4242
i.click();

disable-youtube-channel-intro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @match https://www.youtube.com/channel/*
88
// ==/UserScript==
99

10-
(() => {
10+
(_ => {
1111
'use strict';
1212

1313
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;

force-browser-language.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// @match https://*.google.com/*
66
// ==/UserScript==
77

8-
(() => {
8+
(_ => {
99
'use strict';
1010

1111
const first = lang => lang.split('-')[0]

improve-adult-experience.js

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name Improve Adult Experience
33
// @description Skip intros, set best quality and duration filters by default, make unrelated video previews transparent
4-
// @version 0.3
4+
// @version 0.5
55
// @downloadURL https://userscripts.codonaft.com/improve-adult-experience.js
66
// @exclude-match https://spankbang.com/*/video/*
77
// @match https://spankbang.com/*
@@ -15,7 +15,7 @@
1515
// @match https://xhamster.com/search/*
1616
// ==/UserScript==
1717

18-
(() => {
18+
(_ => {
1919
'use strict';
2020

2121
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;
@@ -26,57 +26,85 @@
2626
const p = url.pathname;
2727
let newUrl;
2828

29-
const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
29+
const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
3030

3131
const timeToSeconds = time => (time || '').split(':').map(Number).reduceRight((total, value, index, parts) => total + value * 60 ** (parts.length - 1 - index), 0);
3232

33-
const pornhub = () => {
33+
const simulateClick = (document, node) => {
34+
console.log('simulateClick');
35+
const rect = node.getBoundingClientRect();
36+
const clientX = rect.x + rect.width / 2;
37+
const clientY = rect.y + rect.height / 2;
38+
const target = document.elementFromPoint(clientX, clientY);
39+
['mouseover', 'mousemove', 'mousedown', 'mouseup', 'click']
40+
.forEach(i => target.dispatchEvent(new MouseEvent(i, { clientX, clientY, bubbles: true })))
41+
};
42+
43+
const pornhub = _ => {
3444
// TODO: never redirect, just update the URLs
3545

3646
const processEmbedded = document => {
3747
const style = document.createElement('style');
3848
style.innerHTML = `
39-
div.mgp_eventCatcher { display: none !important; }
4049
div.mgp_topBar { display: none !important; }
4150
div.mgp_thumbnailsGrid { display: none !important; }
4251
img.mgp_pornhub { display: none !important; }
4352
`;
4453
document.body.appendChild(style);
54+
4555
const video = document.body.querySelector('video');
46-
video?.addEventListener('loadedmetadata', _ => video.currentTime = random(video.duration / 4, video.duration / 3));
56+
if (!video) return;
57+
58+
video.addEventListener('loadstart', _ => simulateClick(document, document.querySelector('div.mgp_playIcon')));
59+
video.addEventListener('loadedmetadata', _ => video.currentTime = random(video.duration / 4, video.duration / 3));
60+
document.querySelector('div.mgp_gridMenu')?.addEventListener('click', _ => setTimeout(_ => {
61+
if (video.paused) {
62+
console.log('paused on grid menu');
63+
const button = document.querySelector('div.mgp_playIcon');
64+
simulateClick(document, button);
65+
setTimeout(_ => {
66+
if (video.paused) {
67+
console.log('still paused');
68+
simulateClick(document, button);
69+
}
70+
}, 500);
71+
}
72+
}, 100));
73+
74+
video.load();
4775
};
4876

4977
const style = document.createElement('style');
5078
style.innerHTML = `
51-
div.unrelatedcontent { opacity: 10%; }
52-
div.unrelatedcontent:hover { opacity: 40%; }
79+
div.boringcontent { opacity: 10%; }
80+
div.boringcontent:hover { opacity: 40%; }
5381
`;
54-
document.querySelector('div#main-container')?.appendChild(style);
82+
document.body.appendChild(style);
5583

5684
[...document.body.querySelectorAll('var.duration')].forEach(i => {
5785
const duration = timeToSeconds(i.innerText);
58-
const t = random(Math.floor(duration / 4), Math.floor(duration / 3));
86+
const t = random(duration / 4, duration / 3);
5987
const link = i.closest('a');
6088
if (link) {
6189
link.href += `&t=${t}`;
6290
}
6391

6492
const div = i.closest('a').closest('div.phimage')?.parentNode;
65-
if (duration < 20 * 60) { // TODO: check quality
66-
div?.classList.add('unrelatedcontent');
93+
if (duration < 20 * 60) { // TODO: check quality and non-free-premiumness
94+
div?.classList.add('boringcontent');
6795
}
6896
});
6997

7098
if (p.startsWith('/embed/')) {
71-
// happens for both iframed and redirected embedded player here
99+
// this branch gets selected for both iframed and redirected embedded player
72100
console.log('processing embed');
73101
processEmbedded(document); // document is a part of iframe here
74102
} else if (p === '/view_video.php') {
75103
const durationFromNormalPlayer = timeToSeconds(document.body.querySelector('span.mgp_total')?.innerText);
76104
if (durationFromNormalPlayer) {
77105
if (!params.has('t') || Number(params.get('t')) >= durationFromNormalPlayer) {
78106
window.stop();
79-
params.set('t', random(Math.floor(durationFromNormalPlayer / 4), Math.floor(durationFromNormalPlayer / 3)));
107+
params.set('t', random(durationFromNormalPlayer / 4, durationFromNormalPlayer / 3));
80108
window.location.replace(url.toString());
81109
}
82110
} else {
@@ -85,7 +113,7 @@
85113
const container = document.body.querySelector('div.playerFlvContainer');
86114
if (container) {
87115
const iframe = document.createElement('iframe');
88-
/*iframe.onload = () => {
116+
/*iframe.onload = _ => {
89117
console.log('iframe onload');
90118
processEmbedded(iframe.contentWindow.document);
91119
};*/
@@ -110,7 +138,7 @@
110138
}
111139
};
112140

113-
const xvideos = () => {
141+
const xvideos = _ => {
114142
// TODO: never redirect, just update the URLs
115143

116144
if (p === '/' && params.has('k') && !params.has('quality')) {
@@ -127,7 +155,7 @@
127155
}
128156
};
129157

130-
const spankbang = () => {
158+
const spankbang = _ => {
131159
// TODO: never redirect, just update the URLs
132160

133161
if (!p.endsWith('/tags') && !p.includes('/playlist/') && !(params.has('q') && params.has('d'))) {
@@ -140,7 +168,7 @@
140168
}
141169
};
142170

143-
const porntrex = () => {
171+
const porntrex = _ => {
144172
const expectedPage = (page, href) => href.startsWith(`https://www.porntrex.com/${page}/`) && (page === 'top-rated' || href.split('/').length > 5);
145173

146174
[...document.body.querySelectorAll('a')]
@@ -160,7 +188,7 @@
160188
});
161189
};
162190

163-
const xhamster = () => {
191+
const xhamster = _ => {
164192
// TODO: never redirect, just update the URLs
165193

166194
if (p.startsWith('/search/')) {

improve-privacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @downloadURL https://userscripts.codonaft.com/improve-privacy.js
55
// ==/UserScript==
66

7-
(() => {
7+
(_ => {
88
'use strict';
99

1010
const cleanup = node => {

jitsi-podcaster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// @downloadURL https://userscripts.codonaft.com/jitsi-podcaster.js
66
// ==/UserScript==
77

8-
(() => {
8+
(_ => {
99
'use strict';
1010

1111
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;

remove-pseudocensorship.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @downloadURL https://userscripts.codonaft.com/remove-pseudocensorship.js
55
// ==/UserScript==
66

7-
(() => {
7+
(_ => {
88
'use strict';
99

1010
const process = node => {

searxng-redirect-on-failure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// @downloadURL https://userscripts.codonaft.com/searxng-redirect-on-failure.js
66
// ==/UserScript==
77

8-
(() => {
8+
(_ => {
99
'use strict';
1010

1111
if (performance.getEntriesByType('navigation')[0]?.responseStatus !== 200) return;

0 commit comments

Comments
 (0)