Skip to content

Commit

Permalink
making sure #2272 & #2282
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed May 21, 2024
1 parent 386e4b0 commit 768e37f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
11 changes: 2 additions & 9 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,6 @@ ImprovedTube.videoPageUpdate = function () {
ImprovedTube.playerOnPlay = function () {
HTMLMediaElement.prototype.play = (function (original) {
return function () {
const returnValue = original.apply(this, arguments);
try { ImprovedTube.autoplayDisable(this)}
catch (error){console.error("Couldn't disable autoplay immediately:", error);
const self=this; setTimeout(function() {
try { ImprovedTube.autoplayDisable(self); }
catch (error) { console.error('failed to disable autoplay:', error);
} }, 0); }

this.removeEventListener('loadedmetadata', ImprovedTube.playerOnLoadedMetadata);
this.addEventListener('loadedmetadata', ImprovedTube.playerOnLoadedMetadata);

Expand All @@ -345,10 +337,11 @@ ImprovedTube.playerOnPlay = function () {
this.removeEventListener('ended', ImprovedTube.playerOnEnded, true);
this.addEventListener('ended', ImprovedTube.playerOnEnded, true);

ImprovedTube.autoplayDisable(this);
ImprovedTube.playerLoudnessNormalization();
ImprovedTube.playerCinemaModeEnable();

return returnValue;
return original.apply(this, arguments);
}
})(HTMLMediaElement.prototype.play);
};
Expand Down
6 changes: 3 additions & 3 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ ImprovedTube.autoplayDisable = function (videoElement) {
// channel homepage & !channel_trailer_autoplay
|| (this.storage.channel_trailer_autoplay === false && this.regex.channel.test(location.href)))) {

videoElement.pause();
player.pauseVideo();
console.log("autoplayDisable: Pausing");
setTimeout(function() { try { player.pauseVideo(); }
catch (error) { console.log("autoplayDisable: Pausing"); videoElement.pause(); }
});
}
}
};
Expand Down
10 changes: 4 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"short_name" : "ImprovedTube",
"name": "'Improve YouTube!' 🎧 (for YouTube & Videos)",
"description": "__MSG_description_ext__",
"version": "4.937",
"version": "4.930",
"default_locale": "en",
"icons": {
"128": "stuff/icons/128.png",
Expand All @@ -19,7 +19,7 @@
"default_area": "navbar"
},
"side_panel": {
"default_path": "menu/sidepanel.html"
"default_path": "menu/index.html"
},
"options_page": "menu/index.html",
"options_ui": {
Expand All @@ -36,8 +36,7 @@
"js&css/extension/www.youtube.com/appearance/player/player.css",
"js&css/extension/www.youtube.com/appearance/details/details.css",
"js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css",
"js&css/extension/www.youtube.com/appearance/comments/comments.css",
"js&css/extension/www.youtube.com/appearance/footer/footer.css"
"js&css/extension/www.youtube.com/appearance/comments/comments.css"
],
"exclude_matches": [
"https://www.youtube.com/audiolibrary/*",
Expand Down Expand Up @@ -65,8 +64,7 @@
"permissions": [
"contextMenus",
"storage",
"sidePanel",
"battery"
"sidePanel"
],
"web_accessible_resources": [
{
Expand Down
3 changes: 1 addition & 2 deletions manifest2.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"js&css/extension/www.youtube.com/appearance/player/player.css",
"js&css/extension/www.youtube.com/appearance/details/details.css",
"js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css",
"js&css/extension/www.youtube.com/appearance/comments/comments.css",
"js&css/extension/www.youtube.com/appearance/footer/footer.css"
"js&css/extension/www.youtube.com/appearance/comments/comments.css"
],
"exclude_matches": [
"https://www.youtube.com/audiolibrary/*",
Expand Down

0 comments on commit 768e37f

Please sign in to comment.