-
Notifications
You must be signed in to change notification settings - Fork 1
/
Motherless Plus.user.js
542 lines (438 loc) · 13.3 KB
/
Motherless Plus.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
// ==UserScript==
// @author Mr. Nope
// @version 2023-05-25
// @name Motherless Plus
// @match *://*.motherless.com/*
// @description A kinder Motherless. Because you're worth it.
// @run-at document_end
// @date 2023-05-25
// @license MIT
// ==/UserScript==
'use strict';
setTimeout(() => {
const OPTIONS = {
cinemaMode: JSON.parse(localStorage.getItem('plus_cinemaMode')) || false
};
// const playerSettings = JSON.parse(localStorage.getItem('mgp_player'));
// Change default quality from 720p to 1080p
// playerSettings.quality = 1080;
// Prevent problem with videos not loading unless clearing cache and reloading.
// localStorage.setItem('mgp_player', JSON.stringify(playerSettings));
/**
* Shared styles
*/
const sharedStyles = `
/* Our own elements */
.plus-buttons {
background: rgba(27, 27, 27, 0.9);
box-shadow: 0px 0px 12px rgba(20, 111, 223, 0.9);
font-size: 12px;
position: fixed;
bottom: 10px;
padding: 10px 22px 8px 24px;
right: 0;
z-index: 100;
transition: all 0.2s ease;
/* Negative margin-right calculated later based on width of buttons */
}
.plus-buttons:hover {
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
}
.plus-buttons .plus-button {
margin: 10px 0;
padding: 6px 15px;
border-radius: 4px;
font-weight: 700;
display: block;
position: relative;
text-align: center;
vertical-align: top;
cursor: pointer;
border: none;
text-decoration: none;
}
.plus-buttons a.plus-button {
background: rgb(221, 221, 221);
color: rgb(51, 51, 51);
}
.plus-buttons a.plus-button:hover {
background: rgb(187, 187, 187);
color: rgb(51, 51, 51);
}
.plus-buttons a.plus-button.plus-button-isOn {
background: rgb(20, 111, 223);
color: rgb(255, 255, 255);
}
.plus-buttons a.plus-button.plus-button-isOn:hover {
background: rgb(0, 91, 203);
color: rgb(255, 255, 255);
}
.plus-hidden {
display: none !important;
}
.plus-letters {
align-items: center;
color: #ccc;
display: flex;
justify-content: space-between;
margin: 0 22px 18px;
text-transform: uppercase;
}
.plus-letters span {
cursor: pointer;
}
`;
/**
* Color Theme
*/
const themeStyles = `
.plus-buttons {
box-shadow: 0px 0px 12px rgba(236, 86, 124, 0.85);
}
.plus-buttons:hover {
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
}
.plus-buttons a.plus-button {
background: rgb(47, 47, 47);
color: rgb(172, 172, 172);
}
.plus-buttons a.plus-button:hover {
background: rgb(79, 79, 79);
color: rgb(204, 204, 204);
}
.plus-buttons a.plus-button.plus-button-isOn {
background: rgb(236, 86, 124);
color: rgb(235, 235, 235);
}
.plus-buttons a.plus-button.plus-button-isOn:hover {
background: rgb(236, 86, 124);
color: rgb(255, 255, 255);
}
`;
/**
* Site-Specific Styles
*/
const generalStyles = `
/* Hide elements */
.realsex,
.mhp1138_cinemaState,
.networkBar,
.sniperModeEngaged,
.footer,
.footer-title,
.ad-link,
.removeAdLink,
.removeAdLink + iframe,
.abovePlayer,
.streamatesModelsContainer,
#welcome,
#welcomePremium,
#headerUpgradePremiumBtn,
#PornhubNetworkBar,
#js-abContainterMain,
#hd-rightColVideoPage > :not(#relatedVideosVPage),
.bottomNotification,
.trailerUnderplayerPreview,
.sectionCarousel {
display: none !important;
visibility: hidden !important;
opacity: 0 !important;
height: 0 !important;
width: 0 !important;
}
/* Allow narrower page width */
html.supportsGridLayout.fluidContainer .container,
html.supportsGridLayout.fluidContainer .section_wrapper {
min-width: 700px !important;
}
/* Hide tricky ads with obfuscated tag names */
.adLinks + *,
.adLinks + * + *,
.wrapper.hd + * {
display: none !important;
}
/* Full-width video */
#vpContentContainer {
display: block !important;
}
/* Recommended videos */
#recommendedVideosVPage {
text-align: center !important;
}
/* "Recommended Porn" heading */
#recommendedVideosVPage h3 {
text-align: center !important;
display: block !important;
float: unset !important;
}
/* Recommended videos layout */
#recommendedVideos {
list-style: none !important;
display: flex !important;
flex-direction: row !important;
align-items: flex-start !important;
justify-content: space-between !important;
text-align: left !important;
}
/* Thumbnail wrapper */
#recommendedVideosPage .videoBox {
font-size: 0.813rem !important; /* 13px/16px = 0.813rem */
color: #a6adc8 !important; /* Mocha -> Subtext0 */
margin: 0 5px !important;
}
/* Thumbnail wrapper */
#recommendedVideos .videoBox .phimage {
width: auto !important;
border-radius: 4px !important;
}
/* Thumbnail info wrapper */
.thumbnail-info-wrapper {
color: #a6adc8 !important; /* Mocha -> Subtext0 */
font-size: 0.813rem !important; /* 13px/16px = 0.813rem */
float: none !important;
width: auto !important;
}
/* Title of video or playlist */
.thumbnail-info-wrapper .title {
font-size: 0.813rem !important;
font-weight: 700 !important;
margin: 12px 0 3px !important;
}
/* The user/channel name wrapper */
.thumbnail-info-wrapper .usernameWrap {
margin-top: -1px; /* Fixes slight off-center text */
}
/* The user/channel name link */
.thumbnail-info-wrapper .usernameWrap a {
font-size: 0.813rem !important; /* 13px/16px = 0.813rem */
color: #a6adc8 !important;
}
/* The verified badge and user/channel name wrapper */
.thumbnail-info-wrapper .videoUploaderBlock {
margin-bottom: 5px !important;
}
/* The verified badge */
.thumbnail-info-wrapper .own-video-thumbnail {
margin-right: 2px !important;
}
/* The views and likes wrapper */
.thumbnail-info-wrapper .videoDetailsBlock {
margin-bottom: 5px !important;
}
/* The views */
.thumbnail-info-wrapper .videoDetailsBlock .views {
font-size: 0.813rem !important; /* 13px/16px = 0.813rem */
}
/* The rating */
.thumbnail-info-wrapper .videoDetailsBlock .rating-container i,
.thumbnail-info-wrapper .videoDetailsBlock .rating-container .value {
font-size: 0.813rem !important; /* 13px/16px = 0.813rem */
}
/* The "load more" button */
.more_recommended_btn {
margin: 2rem 0 !important;
}
/* Make "HD" icon more visible on thumbnails */
.hd-thumbnail {
color: #f90 !important;
}
/* Show all playlists without scrolling in "add to" */
.slimScrollDiv {
height: auto !important;
}
#scrollbar_watch {
max-height: unset !important;
}
/* Hide premium video from related videos sidebar */
#relateRecommendedItems li:nth-of-type(5) {
display: none !important;
}
/* Prevent animating player size change on each page load */
#main-container .video-wrapper #player.wide {
transition: none !important;
}
/* Allow narrower player */
#player {
min-width: 0 !important;
}
/* Fit more playlists into "add to" popup */
.playlist-menu-addTo {
display: none;
}
.add-to-playlist-menu #scrollThumbs,
.playlist-option-menu #scrollThumbs {
height: 320px !important;
max-height: 35vh !important;
}
.add-to-playlist-menu ul.custom-playlist li {
font-size: 12px;
height: 24px;
}
.add-to-playlist-menu .playlist-menu-createNew {
font-size: 12px !important;
height: 38px !important;
}
.add-to-playlist-menu .playlist-menu-createNew a {
padding-top: 8px !important;
font-weight: 400 !important;
}
/* Hide playlist bar if disabled in options */
.playlist-bar {
display: ${OPTIONS.hidePlaylistBar ? 'none' : 'block'};
}
/**
* Improve loading indicator lines on thumbnails
*
* Using colors from the Catppuccin palette available at https://github.com/catppuccin.
*/
.preloadLine {
background: #81c8be; /* Mocha -> Teal */
box-shadow: 0 0 3px #1e1e2e; /* Mocha -> Base */
}
/* Fade in and out semitransparent elements */
.tab-menu-item {
opacity: 0.4 !important;
padding: 0 16px !important;
transition: all 0.2s ease !important;
}
.tab-menu-item.active {
opacity: 0.5 !important;
}
.tab-menu-wrapper-cell:hover .tab-menu-item {
opacity: 1 !important;
}
.votes-fav-wrap .icon-wrapper:hover,
.votes-fav-wrap .icon-wrapper.active:hover {
opacity: 1 !important;
}
.votes-fav-wrap .icon-wrapper {
opacity: 0.4 !important;
transition: all 0.2s ease !important;
}
.votes-fav-wrap .icon-wrapper.active {
opacity: 0.7 !important;
}
`;
/**
* References to video element and container if they exist on the page
*/
const videoContainer = document.querySelector('#ml-main-video');
const video = document.querySelector('#ml-main-video_html5_api');
const distractions = [
'header'
];
const isOnVideoPage =
/^http[s]*:\/\/(www\.)*motherless\.com\/watch\//.test(window.location.href) && !!videoContainer;
const handleDistractions = () => {
distractions.forEach((distraction) => {
console.log(distraction);
const element = document.querySelector(distraction);
if (element) {
const handleMouseOver = () => {
element.style.opacity = 1;
};
const handleMouseOut = () => {
element.style.opacity = 0.2;
};
if (OPTIONS.cinemaMode) {
element.style.transition = 'all 0.2s ease';
element.style.opacity = 0.2;
element.addEventListener('mouseover', handleMouseOver, false);
element.addEventListener('mouseout', handleMouseOut, false);
} else {
element.style.opacity = 1;
element.removeEventListener('mouseover', handleMouseOver, false);
element.removeEventListener('mouseout', handleMouseOut, false);
}
}
});
};
/**
* Returns an `on` or `off` CSS class name based on the boolean evaluation
* of the `state` parameter, as convenience method when setting UI state.
*/
const getButtonState = state => {
return state ? 'plus-button-isOn' : 'plus-button-isOff';
};
/**
* Option buttons
*/
const cinemaButton = document.createElement('a');
const cinemaButtonText = document.createElement('span');
const cinemaButtonState = getButtonState(OPTIONS.cinemaMode);
const scrollButton = document.createElement('a');
const scrollButtonText = document.createElement('span');
cinemaButtonText.textContent = 'Cinema mode';
cinemaButtonText.classList.add('text');
cinemaButton.appendChild(cinemaButtonText);
cinemaButton.classList.add(cinemaButtonState, 'plus-button');
cinemaButton.addEventListener('click', () => {
OPTIONS.cinemaMode = !OPTIONS.cinemaMode;
localStorage.setItem('plus_cinemaMode', OPTIONS.cinemaMode);
if (OPTIONS.cinemaMode) {
cinemaButton.classList.replace('plus-button-isOff', 'plus-button-isOn');
} else {
cinemaButton.classList.replace('plus-button-isOn', 'plus-button-isOff');
}
if (isOnVideoPage) {
video.addEventListener('click', () => {
const playButton = document.querySelector('.vjs-big-play-button');
if (playButton.offsetParent !== null) {
const event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true,
});
playButton.dispatchEvent(event);
}
});
handleDistractions();
}
});
scrollButtonText.textContent = "Scroll to video";
scrollButtonText.classList.add('text');
scrollButton.appendChild(scrollButtonText);
scrollButton.classList.add('plus-button');
scrollButton.addEventListener('click', () => {
const container = document.querySelector('.main_content');
const header = document.querySelector('header');
if (container && header) {
const destination = {
left: container.scrollX,
top: container.offsetTop - header.scrollHeight,
behavior: 'smooth'
};
window.scroll(destination);
}
});
/**
* Order option buttons in a container
*/
const buttons = document.createElement('div');
buttons.classList.add('plus-buttons');
buttons.appendChild(cinemaButton);
buttons.appendChild(scrollButton);
document.body.appendChild(buttons); // Button container ready and added to page
if (isOnVideoPage) {
}
/*
* Add styles
*/
GM_addStyle(sharedStyles);
GM_addStyle(themeStyles);
GM_addStyle(generalStyles);
/*
* Add dynamic styles
*/
const dynamicStyles = `
.plus-buttons {
margin-right: -${buttons.getBoundingClientRect().width - 18}px;
margin-top: -${buttons.getBoundingClientRect().height - 18}px;
}
.plus-buttons:hover {
margin-right: 0;
margin-left: 0;
}
`;
GM_addStyle(dynamicStyles);
}, 1000);