Skip to content

Commit

Permalink
🐎 Only inject on video pages
Browse files Browse the repository at this point in the history
Add guard clause to abort injection when not needed.
  • Loading branch information
dideler committed Sep 2, 2017
1 parent 3cf433d commit 7e3463d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ function toggleComments() {
}

function inject(e) {
if (window.location.pathname != '/watch') {
return; // only inject on video pages
}
if (e.type == 'spfdone') {
injected = false; // old UI requires re-injection on navigation
}
Expand Down

0 comments on commit 7e3463d

Please sign in to comment.