diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index 34f77b252..c50ef9376 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -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]; @@ -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++) { diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index d2ab8944d..f1bf72e5a 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -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') {