Skip to content

Commit

Permalink
Fix logging code causing extension to crash in old YT
Browse files Browse the repository at this point in the history
  • Loading branch information
austencm committed Oct 23, 2019
1 parent 997d27c commit d7d2147
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ const IS_MATERIAL = !document.body.id;
debug.log('YouTube variant:', IS_MATERIAL ? 'material' : 'classic');

debug.log('navigated:', window.location.href);
['yt-navigate', 'yt-navigate-finish', 'yt-page-data-updated'].forEach(eventType => {
document.querySelector('ytd-app').addEventListener(eventType, e => {
debug.log('event:', e.type);
if (eventType === 'yt-navigate-finish') {
debug.log('navigated:', window.location.href);
}
if (env.DEBUG) {
['yt-navigate', 'yt-navigate-finish', 'yt-page-data-updated'].forEach(eventType => {
const appRoot = document.querySelector('ytd-app');
appRoot && appRoot.addEventListener(eventType, e => {
debug.log('event:', e.type);
if (eventType === 'yt-navigate-finish') {
debug.log('navigated:', window.location.href);
}
});
});
});
}

const init = () => {
// Create an OptionManager
Expand Down

0 comments on commit d7d2147

Please sign in to comment.