Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Sep 29, 2023
1 parent d3481a2 commit c587180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ ImprovedTube.ytElementsHandler = function (node) {
ImprovedTube.elements.player_thumbnail = node.querySelector('.ytp-cued-thumbnail-overlay-image');
ImprovedTube.elements.player_subtitles_button = node.querySelector('.ytp-subtitles-button');
ImprovedTube.playerSize();
// if ( typeof this.storage.ads !== 'undefined' && this.storage.ads !== "all_videos" ) {
if ( typeof this.storage.ads !== 'undefined' && this.storage.ads !== "all_videos" ) {
new MutationObserver(function (mutationList) {
for (var i = 0, l = mutationList.length; i < l; i++) {
var mutation = mutationList[i];
Expand All @@ -179,15 +179,16 @@ ImprovedTube.ytElementsHandler = function (node) {
){ImprovedTube.playerAds(node);}
}
}
// if (mutation.type === 'attributes' && mutation.attributeName === 'id' && mutation.target.querySelector('*[id^="ad-text"]') )
// {ImprovedTube.playerAds(node);}
if (mutation.type === 'attributes' && mutation.attributeName === 'id' && mutation.target.querySelector('*[id^="ad-text"]') )
{ImprovedTube.playerAds(node);}
}
}).observe(node, {
attributes: false,
// attributes: true,
childList: true,
subtree: true
}); // }
});
}

new MutationObserver(function (mutationList) {
for (var i = 0, l = mutationList.length; i < l; i++) {
Expand Down
4 changes: 2 additions & 2 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ ADS
ImprovedTube.playerAds = function (parent) {
let button = parent.querySelector('.ytp-ad-skip-button.ytp-button') || parent;
// TODO: Replace this with centralized video element pointer
let video = document.querySelector('.video-stream.html5-main-video') || false;
// let video = document.querySelector('.video-stream.html5-main-video') || false;
function skipAd() {
if (video) video.currentTime = video.duration;
// if (video) video.currentTime = video.duration;
if (button) button.click();
}
if (this.storage.ads === 'block_all') {
Expand Down

0 comments on commit c587180

Please sign in to comment.