Skip to content

Commit

Permalink
remove debug point
Browse files Browse the repository at this point in the history
  • Loading branch information
pantyetta committed Dec 9, 2023
1 parent 7a7648b commit 87310c2
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ const skipAds = (tabId) => {

const playerObserver = new MutationObserver(() => {
const $skip_container = document.getElementsByClassName("video-ads ytp-ad-module")[0] || null;
console.log("skip container");
if($skip_container == null || !$skip_container.children.length) return;

const observer = new MutationObserver(() => {
const $skip_button = document.getElementsByClassName('ytp-ad-skip-button-modern ytp-button')[0] || null;
if($skip_button == null) return;
$skip_button.click();
console.log('skip ads click');

observer.disconnect();
});
Expand All @@ -29,7 +27,6 @@ const skipAds = (tabId) => {
const video = document.querySelector('video');
try {
video.currentTime = video.duration;
console.log('skip ads');
} catch (error) {}

});
Expand All @@ -46,7 +43,6 @@ const isEmpty = (obj) => {
chrome.webNavigation.onCommitted.addListener((details) => {
if (details.transitionType === 'reload') {
chrome.storage.session.remove([details.tabId.toString()]);
console.log("remove script");
}
}, {url: [{urlMatches : 'https://www.youtube.com/*'}]});

Expand All @@ -56,7 +52,6 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {

chrome.storage.session.get([tabId.toString()]).then((result) => {
if(isEmpty(result)){
console.log("insert script");
skipAds(tabId);
}
});
Expand Down

0 comments on commit 87310c2

Please sign in to comment.