Make lighter

This commit is contained in:
unknown
2025-08-20 12:55:45 +10:00
parent 6b1c3e7fea
commit d988fdaa2b

View File

@@ -286,9 +286,13 @@
} }
// Hide shorts (real time) // Hide shorts (real time)
function goodTube_youtube_hideShorts() { function goodTube_youtube_hideShortsRealtime() {
// Don't do this if shorts are enabled // If shorts are enabled
if (goodTube_shorts === 'true') { if (goodTube_shorts === 'true') {
// Loop this function
setInterval(goodTube_youtube_hideShortsRealtime, 100);
// Don't hide shorts
return; return;
} }
@@ -316,6 +320,9 @@
// Mark this element as checked to save on resources // Mark this element as checked to save on resources
element.classList.add('goodTube_checked'); element.classList.add('goodTube_checked');
}); });
// Loop this function
setInterval(goodTube_youtube_hideShortsRealtime, 100);
} }
// Support timestamp links in comments // Support timestamp links in comments
@@ -345,6 +352,10 @@
function goodTube_youtube_hidePlayers() { function goodTube_youtube_hidePlayers() {
// Don't do this if shorts are enabled and we're viewing a short // Don't do this if shorts are enabled and we're viewing a short
if (goodTube_shorts === 'true' && window.location.href.indexOf('/shorts') !== -1) { if (goodTube_shorts === 'true' && window.location.href.indexOf('/shorts') !== -1) {
// Loop this function
setInterval(goodTube_youtube_hidePlayers, 100);
// Don't hide the players
return; return;
} }
@@ -355,22 +366,25 @@
} }
// Hide the normal Youtube player // Hide the normal Youtube player
let regularPlayers = document.querySelectorAll('#player:not(.ytd-channel-video-player-renderer)'); let regularPlayers = document.querySelectorAll('#player:not(.ytd-channel-video-player-renderer):not(.goodTube_hidden)');
regularPlayers.forEach((element) => { regularPlayers.forEach((element) => {
goodTube_helper_hideYoutubePlayer(element); goodTube_helper_hideYoutubePlayer(element);
}); });
// Remove the full screen and theater Youtube player // Remove the full screen and theater Youtube player
let fullscreenPlayers = document.querySelectorAll('#full-bleed-container'); let fullscreenPlayers = document.querySelectorAll('#full-bleed-container:not(.goodTube_hidden)');
fullscreenPlayers.forEach((element) => { fullscreenPlayers.forEach((element) => {
goodTube_helper_hideYoutubePlayer(element); goodTube_helper_hideYoutubePlayer(element);
}); });
// Hide the Youtube miniplayer // Hide the Youtube miniplayer
let miniPlayers = document.querySelectorAll('ytd-miniplayer'); let miniPlayers = document.querySelectorAll('ytd-miniplayer:not(.goodTube_hidden)');
miniPlayers.forEach((element) => { miniPlayers.forEach((element) => {
goodTube_helper_hideElement(element); goodTube_helper_hideElement(element);
}); });
// Loop this function
setInterval(goodTube_youtube_hidePlayers, 100);
} }
// Mute and pause all Youtube videos // Mute and pause all Youtube videos
@@ -382,6 +396,9 @@
|| ||
window.location.href.indexOf('/watch?') === -1 window.location.href.indexOf('/watch?') === -1
) { ) {
// Loop this function
setInterval(goodTube_youtube_pauseMuteVideos, 1);
// Don't pause or mute videos // Don't pause or mute videos
return; return;
} }
@@ -398,6 +415,9 @@
video.pause(); video.pause();
} }
}); });
// Loop this function
setInterval(goodTube_youtube_pauseMuteVideos, 1);
} }
@@ -978,20 +998,18 @@
-------------------------------------------------- */ -------------------------------------------------- */
// Mute and pause all Youtube videos // Mute and pause all Youtube videos
goodTube_youtube_pauseMuteVideos(); goodTube_youtube_pauseMuteVideos();
setInterval(goodTube_youtube_pauseMuteVideos, 1);
// Add CSS classes to hide elements (without Youtube knowing) // Add CSS classes to hide elements (without Youtube knowing)
goodTube_helper_showHide_init(); goodTube_helper_showHide_init();
// Hide the youtube players // Hide the youtube players
goodTube_youtube_hidePlayers(); goodTube_youtube_hidePlayers();
setInterval(goodTube_youtube_hidePlayers, 100);
// Add CSS to hide ads, shorts, etc // Add CSS to hide ads, shorts, etc
goodTube_youtube_hideAdsShortsEtc(); goodTube_youtube_hideAdsShortsEtc();
// Hide shorts that popup as you use the site (like video results) // Hide shorts (real time)
setInterval(goodTube_youtube_hideShorts, 100); goodTube_youtube_hideShortsRealtime();
/* Load GoodTube /* Load GoodTube