Skip to content

Commit

Permalink
Merge pull request #2007 from ugackMiner53/master
Browse files Browse the repository at this point in the history
Disable Video Preview On Hover Option
  • Loading branch information
ImprovedTube authored Feb 13, 2024
2 parents 4fa591f + 5c7543b commit 20b3169
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"device":{"message":"Device"},
"dim":{"message":"Dim"},
"disabled":{"message":"Disabled"},
"disableThumbnailPlayback":{"message":"Disable video playback on hover"},
"dislike":{"message":"Dislike"},
"displayDayOfTheWeak":{"message":"Display day of the week"},
"doNotChange":{"message":"Don't change"},
Expand Down
1 change: 1 addition & 0 deletions js&css/extension/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extension.events.on('init', function () {
extension.features.confirmationBeforeClosing();
extension.features.defaultContentCountry();
extension.features.popupWindowButtons();
extension.features.disableThumbnailPlayback();
extension.features.markWatchedVideos();
extension.features.relatedVideos();
extension.features.comments();
Expand Down
17 changes: 17 additions & 0 deletions js&css/extension/www.youtube.com/general/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,23 @@ extension.features.thumbnailsQuality = function (anything) {
}
};

/*--------------------------------------------------------------
# DISABLE VIDEO PLAYBACK ON HOVER
--------------------------------------------------------------*/
extension.features.disableThumbnailPlayback = function (event) {
if (event instanceof Event) {
if (event.composedPath().some(elem => (elem.matches != null ? elem.matches("#content ytd-rich-item-renderer") : false)
)) {
event.stopImmediatePropagation();
}
} else {
if (extension.storage.get('disable_thumbnail_playback') === true) {
window.addEventListener('mouseenter', this.disableThumbnailPlayback, true);
} else {
window.removeEventListener('mouseenter', this.disableThumbnailPlayback, true);
}
}
};

/*--------------------------------------------------------------
# OPEN VIDEOS IN A NEW TAB
Expand Down
4 changes: 4 additions & 0 deletions menu/skeleton-parts/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ extension.skeleton.main.layers.section.general = {
text: 'hideAnimatedThumbnails',
tags: 'preview'
},
disable_thumbnail_playback: {
component: 'switch',
text: 'disableThumbnailPlayback',
},
popup_window_buttons: {
component: 'switch',
text: 'popupWindowButtons',
Expand Down

0 comments on commit 20b3169

Please sign in to comment.