mirror of
https://github.com/goodtube4u/goodtube.git
synced 2025-11-22 10:16:11 +00:00
Fix
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name GoodTube
|
// @name GoodTube
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 4.528
|
// @version 4.529
|
||||||
// @description Loads Youtube videos from different sources. Also removes ads, shorts, etc.
|
// @description Loads Youtube videos from different sources. Also removes ads, shorts, etc.
|
||||||
// @author GoodTube
|
// @author GoodTube
|
||||||
// @match https://*.youtube.com/*
|
// @match https://*.youtube.com/*
|
||||||
@@ -99,10 +99,10 @@
|
|||||||
style.textContent = `
|
style.textContent = `
|
||||||
.goodTube_hidden {
|
.goodTube_hidden {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
pointer-events: none !important;
|
top: -9999px !important;
|
||||||
top: -999px !important;
|
left: -9999px !important;
|
||||||
left: -999px !important;
|
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
|
pointer-events: none !important;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -340,7 +340,6 @@
|
|||||||
if (youtubeVideo) {
|
if (youtubeVideo) {
|
||||||
youtubeVideo.muted = true;
|
youtubeVideo.muted = true;
|
||||||
youtubeVideo.volume = 0;
|
youtubeVideo.volume = 0;
|
||||||
youtubeVideo.playbackRate = 16;
|
|
||||||
|
|
||||||
if (!goodTube_youtube_syncing) {
|
if (!goodTube_youtube_syncing) {
|
||||||
youtubeVideo.pause();
|
youtubeVideo.pause();
|
||||||
@@ -358,10 +357,6 @@
|
|||||||
youtubeFrameApi.setVolume(0);
|
youtubeFrameApi.setVolume(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof youtubeFrameApi.setPlaybackRate === 'function') {
|
|
||||||
youtubeFrameApi.setPlaybackRate(16);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!goodTube_youtube_syncing && typeof youtubeFrameApi.pauseVideo === 'function') {
|
if (!goodTube_youtube_syncing && typeof youtubeFrameApi.pauseVideo === 'function') {
|
||||||
youtubeFrameApi.pauseVideo();
|
youtubeFrameApi.pauseVideo();
|
||||||
}
|
}
|
||||||
@@ -389,6 +384,7 @@
|
|||||||
let goodTube_youtube_syncing = true;
|
let goodTube_youtube_syncing = true;
|
||||||
let goodTube_youtube_previousSyncTime = 0;
|
let goodTube_youtube_previousSyncTime = 0;
|
||||||
function goodTube_youtube_syncPlayers() {
|
function goodTube_youtube_syncPlayers() {
|
||||||
|
console.log('SYNC');
|
||||||
let youtubeVideo = document.querySelector('#movie_player video');
|
let youtubeVideo = document.querySelector('#movie_player video');
|
||||||
|
|
||||||
// If the youtube player exists, our player is loaded and we're viewing a video
|
// If the youtube player exists, our player is loaded and we're viewing a video
|
||||||
@@ -409,7 +405,6 @@
|
|||||||
goodTube_youtube_syncing = true;
|
goodTube_youtube_syncing = true;
|
||||||
|
|
||||||
// Play for 10ms to make history work via JS
|
// Play for 10ms to make history work via JS
|
||||||
youtubeVideo.playbackRate = 1;
|
|
||||||
youtubeVideo.play();
|
youtubeVideo.play();
|
||||||
youtubeVideo.muted = true;
|
youtubeVideo.muted = true;
|
||||||
youtubeVideo.volume = 0;
|
youtubeVideo.volume = 0;
|
||||||
@@ -417,10 +412,6 @@
|
|||||||
// Play for 10ms to make history work via the frame API
|
// Play for 10ms to make history work via the frame API
|
||||||
let youtubeFrameApi = document.querySelector('#movie_player');
|
let youtubeFrameApi = document.querySelector('#movie_player');
|
||||||
if (youtubeFrameApi) {
|
if (youtubeFrameApi) {
|
||||||
if (typeof youtubeFrameApi.setPlaybackRate === 'function') {
|
|
||||||
youtubeFrameApi.setPlaybackRate(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof youtubeFrameApi.playVideo === 'function') {
|
if (typeof youtubeFrameApi.playVideo === 'function') {
|
||||||
youtubeFrameApi.playVideo();
|
youtubeFrameApi.playVideo();
|
||||||
}
|
}
|
||||||
@@ -3386,6 +3377,9 @@
|
|||||||
goodTube_videojs_player.on('ready', function() {
|
goodTube_videojs_player.on('ready', function() {
|
||||||
goodTube_videojs_player_loaded = true;
|
goodTube_videojs_player_loaded = true;
|
||||||
|
|
||||||
|
// Sync the Youtube player for watch history
|
||||||
|
goodTube_youtube_syncPlayers();
|
||||||
|
|
||||||
// Enable the qualities API
|
// Enable the qualities API
|
||||||
goodTube_qualityApi = goodTube_videojs_player.hlsQualitySelector();
|
goodTube_qualityApi = goodTube_videojs_player.hlsQualitySelector();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user