@@ -36,7 +36,7 @@ let YTNonstop = function YTNonstop(options) {
3636 * 5 – video cued
3737 */
3838 const get_YT = {
39- player : ( ) => document . getElementById ( "movie_player" ) ,
39+ player : ( ) => document . getElementById ( "movie_player" ) || document . getElementById ( "player" ) ,
4040 loop : {
4141 button : ( ) => playlistActionMenu ( ) [ 1 ] ,
4242 status : function ( ) {
@@ -89,7 +89,7 @@ let YTNonstop = function YTNonstop(options) {
8989 } ,
9090 callback : ( MutationList , Observer ) => {
9191 // check if mutationList has the 'attributes' type
92- if ( MutationList . some ( t => t . type === "attributes" ) ) {
92+ if ( MutationList . some ( el => el . type === "attributes" ) ) {
9393 // get "you there?" popup
9494 const p = window . document . getElementById ( "confirm-button" ) || window . document . getElementsByClassName ( 'ytmusic-you-there-renderer' ) [ 2 ] || undefined ;
9595 if ( p ) {
@@ -109,13 +109,29 @@ let YTNonstop = function YTNonstop(options) {
109109 //set play button observer
110110 const pb_Observer = new MutationObserver ( Play_Pause . callback ) ;
111111 pb_Observer . observe ( Play_Pause . getButton , Play_Pause . config ) ;
112-
112+
113+ //set autonav button
114+ Settings . setAutonav ( ) ;
115+
113116 //set loop button
114117 Settings . setLoop ( ) ;
115118
116119 clearInterval ( Settings . setInterval )
117120 } , 1000 ) ,
118121
122+ setAutonav : function ( ) {
123+ const on = document . querySelector ( '.ytp-autonav-toggle-button-container > .ytp-autonav-toggle-button[aria-checked="true"]' )
124+ || document . querySelector ( '#automix[role="button"][aria-pressed="true"]' )
125+ const off = document . querySelector ( '.ytp-autonav-toggle-button-container > .ytp-autonav-toggle-button[aria-checked="false"]' )
126+ || document . querySelector ( '#automix[role="button"][aria-pressed="false"]' )
127+
128+ if ( Nonstop . getIsAutoSkip ( ) == true ) {
129+ off . click ( ) ;
130+ } else {
131+ on . click ( ) ;
132+ }
133+ } ,
134+
119135 setLoop : function ( ) {
120136 if ( get_YT . loop . button ( ) && Nonstop . getIsAutoLoop ( ) && ! get_YT . loop . status ( ) ) {
121137 get_YT . loop . button ( ) . click ( )
@@ -125,7 +141,8 @@ let YTNonstop = function YTNonstop(options) {
125141
126142 setInterval ( ( ) => {
127143 yt . util && yt . util . activity && yt . util . activity . setTimestamp ( ) ;
128- Settings . setLoop ( )
144+ Settings . setLoop ( ) ;
145+ Settings . setAutonav ( )
129146 } , 5000 ) ;
130147
131148 return Nonstop
0 commit comments