2023-08-14 20:12:54 +00:00
import { $ , $all , $add , $event , $ready } from '../public/efy/efy.js' ;
2022-11-08 16:38:20 +00:00
2023-08-14 20:12:54 +00:00
$ready ( '#efy_sidebar' , ( ) => {
$add ( 'div' , { id : 'piped_efy_module' } , [ ] , $ ( '#efy_sidebar' ) , 'afterbegin' ) ;
2022-11-08 16:38:20 +00:00
2023-08-14 20:12:54 +00:00
/*Custom Menu*/ $add ( 'div' , { id : 'custom_sidebar_menu' } , [ ] , $ ( '#efy_modules' ) ) ;
for ( let a = [ 'preferences' , 'history' , 'playlists' , 'feed' ] , b = [ 'Preferences' , 'History' , 'Playlists' , 'Feed' ] , c = $ ( '#custom_sidebar_menu' ) , i = 0 ; i < a . length ; i ++ ) { $add ( 'a' , { href : ` ./ ${ a [ i ] } ` } , [ b [ i ] ] , c ) }
2022-11-08 16:38:20 +00:00
2023-08-14 20:12:54 +00:00
/*Custom Settings*/ $add ( 'details' , { id : 'piped_style' } , [
$add ( 'summary' , { } , [ $add ( 'i' , { efy _icon : 'dots' } ) , 'Piped Style' ] ) ,
$add ( 'div' , { efy _tabs : 'piped_style' } )
] , $ ( '#efy_modules' ) ) ;
$add ( 'mark' , { efy _lang : 'alpha' } , [ ] , $ ( '#piped_style > summary' ) , 'beforeend' ) ;
2022-11-08 16:38:20 +00:00
/*Tabs*/ for ( let a = [ 'option1' , 'option2' , 'option3' ] , b = [ 'Tab 1' , 'Tab 2' , 'Tab 3' ] , c = $ ( '[efy_tabs=piped_style]' ) , i = 0 ; i < a . length ; i ++ ) {
2023-08-14 20:12:54 +00:00
$add ( 'button' , { efy _tab : a [ i ] } , [ b [ i ] ] , c ) ;
2022-11-08 16:38:20 +00:00
}
for ( let a = [ 'option1' , 'option2' , 'option3' ] , c = $ ( '[efy_tabs=piped_style]' ) , i = 0 ; i < a . length ; i ++ ) {
2023-08-14 20:12:54 +00:00
$add ( 'div' , { efy _content : a [ i ] , efy _select : '' , id : ` efy_ ${ a [ i ] } ` } , [ ] , c )
}
/*Active*/ for ( let a = [ '[efy_tab=option1]' , '[efy_content=option1]' ] , b = '[efy_tabs=piped_style] > ' , i = 0 ; i < a . length ; i ++ ) {
$ ( b + a [ i ] ) . setAttribute ( 'efy_active' , '' )
2022-11-08 16:38:20 +00:00
}
/*Tab1*/ for ( let a = 'comments_full captions-trans captions-solid' . split ( ' ' ) , b = [ 'Comments - Full Width' , 'Captions - No Background' , 'Captions - Black Background' ] , c = $ ( '[efy_tabs=piped_style] [efy_content=option1]' ) , i = 0 ; i < a . length ; i ++ ) {
2023-08-14 20:12:54 +00:00
$add ( 'input' , { type : 'checkbox' , name : 'piped_style_option1' , id : ` piped_style_ ${ a [ i ] } ` } , [ ] , c ) ;
$add ( 'label' , { for : ` piped_style_ ${ a [ i ] } ` } , [ b [ i ] ] , c ) ;
2022-11-08 16:38:20 +00:00
}
/*Comments & Captions*/ for ( let a = [ 'comments_full' , 'captions-trans' , 'captions-solid' ] , b = [ '.pp-comments' , '.shaka-text-container' , '.shaka-text-container' ] , c = [ 'pp-full-width' , 'pp-trans' , 'pp-solid' ] , i = 0 ; i < a . length ; i ++ ) {
2023-08-14 20:12:54 +00:00
$event ( $ ( ` #piped_style_ ${ a [ i ] } ` ) , 'click' , ( ) => {
2022-11-08 16:38:20 +00:00
$all ( b [ i ] ) . forEach ( ( e ) => { e . classList . toggle ( c [ i ] ) } )
} )
}
2023-08-14 20:12:54 +00:00
} , 1 ) ;