Skip to content

Commit

Permalink
Optimized "Player" -> "Up next autoplay"
Browse files Browse the repository at this point in the history
  • Loading branch information
adokseo committed Mar 5, 2021
1 parent 67de39e commit 7728c88
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions youtube-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,13 +1106,11 @@ ImprovedTube.upNextAutoplay = function() {
var option = this.storage.up_next_autoplay;

if (this.isset(option)) {
var toggle = document.querySelector('.ytp-right-controls .ytp-autonav-toggle-button'),
attribute = toggle.getAttribute('aria-checked');
var toggle = document.querySelector('.ytp-autonav-toggle-button'),
attribute = toggle.getAttribute('aria-checked') === 'true';

if (toggle) {
var option = ImprovedTube.storage.up_next_autoplay;

if (option === true && attribute === 'false' || option === false && attribute === 'true') {
if (option !== attribute) {
toggle.click();
}
}
Expand Down

0 comments on commit 7728c88

Please sign in to comment.