Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear playlistItems when navigating on YT #2587

Open
wants to merge 14 commits into
base: feature/Playlists
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Added Audio API

  • Loading branch information
Brandon-T committed Mar 25, 2020
commit f2e5beee062f59e4be752fe201f0f1aa138d48cf
@@ -36,6 +36,12 @@ function observeDocument(node) {
if (node.constructor.name == "HTMLVideoElement") {
observeNode(node);
}
else if (node.constructor.name == "HTMLAudioElement") {
observeNode(node);
}
else if (node.constructor.name == "HTMLMediaElement") {
console.log("DETECTED MEDIA ELEMENT: " + node.constructor.name);
}
});
});
});
@@ -47,6 +53,10 @@ function getAllVideoElements() {
return document.querySelectorAll('video');
}

function getAllAudioElements() {
return document.querySelectorAll('audio');
}

function onReady(fn) {
if (document.readyState === "complete" || document.readyState === "interactive") {
setTimeout(fn, 1);
@@ -74,6 +84,11 @@ function observePage() {
observeNode(node);
notifyNode(node);
});

getAllAudioElements().forEach(function(node) {
observeNode(node);
notifyNode(node);
});
}, 1000);

var timeout = setTimeout(function() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.