2018-07-03 12:33:31 +02:00
/// <reference path="../../client.ts" />
/// <reference path="../modal/ModalSettings.ts" />
2018-10-20 19:58:06 +02:00
/// <reference path="../modal/ModalBanList.ts" />
2018-02-27 17:20:49 +01:00
/ *
client_output_hardware Value : '1'
client_output_muted Value : '0'
client_outputonly_muted Value : '0'
client_input_hardware Value : '1'
client_input_muted Value : '0'
client_away Value : '0'
client_away_message Value : ''
* /
2018-10-20 19:58:06 +02:00
2018-02-27 17:20:49 +01:00
class ControlBar {
private _muteInput : boolean ;
private _muteOutput : boolean ;
private _away : boolean ;
2018-12-18 20:00:29 +01:00
private _query_visible : boolean ;
2018-02-27 17:20:49 +01:00
private _awayMessage : string ;
2019-03-17 12:15:39 +01:00
private _channel_subscribe_all : boolean ;
2018-02-27 17:20:49 +01:00
2018-09-22 15:14:39 +02:00
private codec_supported : boolean = false ;
private support_playback : boolean = false ;
private support_record : boolean = false ;
2018-04-30 23:57:21 +02:00
2018-02-27 17:20:49 +01:00
readonly handle : TSClient ;
htmlTag : JQuery ;
constructor ( handle : TSClient , htmlTag : JQuery ) {
this . handle = handle ;
this . htmlTag = htmlTag ;
}
initialise() {
2018-05-05 14:58:30 +02:00
this . htmlTag . find ( ".btn_connect" ) . on ( 'click' , this . onConnect . bind ( this ) ) ;
2018-09-25 12:57:47 +02:00
this . htmlTag . find ( ".btn_disconnect" ) . on ( 'click' , this . onDisconnect . bind ( this ) ) ;
2018-05-05 14:58:30 +02:00
this . htmlTag . find ( ".btn_mute_input" ) . on ( 'click' , this . onInputMute . bind ( this ) ) ;
this . htmlTag . find ( ".btn_mute_output" ) . on ( 'click' , this . onOutputMute . bind ( this ) ) ;
this . htmlTag . find ( ".btn_open_settings" ) . on ( 'click' , this . onOpenSettings . bind ( this ) ) ;
2018-09-30 21:50:59 +02:00
this . htmlTag . find ( ".btn_permissions" ) . on ( 'click' , this . onPermission . bind ( this ) ) ;
2018-10-20 19:58:06 +02:00
this . htmlTag . find ( ".btn_banlist" ) . on ( 'click' , this . onBanlist . bind ( this ) ) ;
2019-03-17 12:15:39 +01:00
this . htmlTag . find ( ".button-subscribe-mode" ) . on ( 'click' , this . on_toggle_channel_subscribe_all . bind ( this ) ) ;
2019-01-20 18:43:14 +01:00
this . htmlTag . find ( ".button-playlist-manage" ) . on ( 'click' , this . on_playlist_manage . bind ( this ) ) ;
2019-03-17 12:15:39 +01:00
let dropdownify = ( tag : JQuery ) = > {
tag . find ( ".button-dropdown" ) . on ( 'click' , ( ) = > {
tag . addClass ( "displayed" ) ;
} ) . hover ( ( ) = > {
console . log ( "Add" ) ;
tag . addClass ( "displayed" ) ;
} , ( ) = > {
if ( tag . find ( ".dropdown:hover" ) . length > 0 )
return ;
console . log ( "Removed" ) ;
tag . removeClass ( "displayed" ) ;
2018-09-25 12:57:47 +02:00
} ) ;
2019-03-17 12:15:39 +01:00
tag . on ( 'mouseleave' , ( ) = > {
tag . removeClass ( "displayed" ) ;
2018-09-25 12:57:47 +02:00
} ) ;
2019-03-17 12:15:39 +01:00
} ;
{
let tokens = this . htmlTag . find ( ".btn_token" ) ;
dropdownify ( tokens ) ;
2018-09-25 12:57:47 +02:00
tokens . find ( ".btn_token_use" ) . on ( 'click' , this . on_token_use . bind ( this ) ) ;
tokens . find ( ".btn_token_list" ) . on ( 'click' , this . on_token_list . bind ( this ) ) ;
}
{
let away = this . htmlTag . find ( ".btn_away" ) ;
2019-03-17 12:15:39 +01:00
dropdownify ( away ) ;
2018-09-25 12:57:47 +02:00
away . find ( ".btn_away_toggle" ) . on ( 'click' , this . on_away_toggle . bind ( this ) ) ;
away . find ( ".btn_away_message" ) . on ( 'click' , this . on_away_set_message . bind ( this ) ) ;
}
2018-12-18 20:00:29 +01:00
{
let bookmark = this . htmlTag . find ( ".btn_bookmark" ) ;
2019-03-17 12:15:39 +01:00
dropdownify ( bookmark ) ;
2018-12-28 15:39:23 +01:00
bookmark . find ( ".btn_bookmark_list" ) . on ( 'click' , this . on_bookmark_manage . bind ( this ) ) ;
bookmark . find ( ".btn_bookmark_add" ) . on ( 'click' , this . on_bookmark_server_add . bind ( this ) ) ;
2018-12-18 20:00:29 +01:00
2018-12-28 15:39:23 +01:00
this . update_bookmarks ( ) ;
this . update_bookmark_status ( ) ;
2018-12-18 20:00:29 +01:00
}
{
let query = this . htmlTag . find ( ".btn_query" ) ;
2019-03-17 12:15:39 +01:00
dropdownify ( query ) ;
2018-12-18 20:00:29 +01:00
query . find ( ".btn_query_toggle" ) . on ( 'click' , this . on_query_visibility_toggle . bind ( this ) ) ;
2018-12-23 17:41:14 +01:00
query . find ( ".btn_query_create" ) . on ( 'click' , this . on_query_create . bind ( this ) ) ;
query . find ( ".btn_query_manage" ) . on ( 'click' , this . on_query_manage . bind ( this ) ) ;
2018-12-18 20:00:29 +01:00
}
2018-02-27 17:20:49 +01:00
2019-03-17 12:15:39 +01:00
/* Mobile dropdowns */
{
const dropdown = this . htmlTag . find ( ".dropdown-audio" ) ;
dropdownify ( dropdown ) ;
dropdown . find ( ".button-display" ) . on ( 'click' , ( ) = > dropdown . addClass ( "displayed" ) ) ;
}
{
const dropdown = this . htmlTag . find ( ".dropdown-servertools" ) ;
dropdownify ( dropdown ) ;
dropdown . find ( ".button-display" ) . on ( 'click' , ( ) = > dropdown . addClass ( "displayed" ) ) ;
}
2018-02-27 17:20:49 +01:00
//Need an initialise
2019-03-17 12:15:39 +01:00
this . muteInput = settings . static_global ( Settings . KEY_CONTROL_MUTE_INPUT , false ) ;
this . muteOutput = settings . static_global ( Settings . KEY_CONTROL_MUTE_OUTPUT , false ) ;
this . query_visible = settings . static_global ( Settings . KEY_CONTROL_SHOW_QUERIES , false ) ;
this . channel_subscribe_all = settings . static_global ( Settings . KEY_CONTROL_CHANNEL_SUBSCRIBE_ALL , true ) ;
2018-02-27 17:20:49 +01:00
}
2018-09-25 12:57:47 +02:00
on_away_toggle() {
this . _awayMessage = "" ;
2018-02-27 17:20:49 +01:00
this . away = ! this . _away ;
}
2018-09-25 12:57:47 +02:00
on_away_set_message() {
2018-12-05 20:46:33 +01:00
createInputModal ( tr ( "Set away message" ) , tr ( "Please enter the away message" ) , message = > true , message = > {
2018-09-25 12:57:47 +02:00
if ( message )
this . away = message ;
} ) . open ( ) ;
}
2018-02-27 17:20:49 +01:00
onInputMute() {
this . muteInput = ! this . _muteInput ;
}
onOutputMute() {
this . muteOutput = ! this . _muteOutput ;
}
set muteInput ( flag : boolean ) {
if ( this . _muteInput == flag ) return ;
this . _muteInput = flag ;
let tag = this . htmlTag . find ( ".btn_mute_input" ) ;
2019-03-17 12:15:39 +01:00
const tag_icon = tag . find ( ".icon_x32, .icon" ) ;
2018-02-27 17:20:49 +01:00
2019-03-17 12:15:39 +01:00
tag . toggleClass ( 'activated' , flag )
2018-02-27 17:20:49 +01:00
2019-03-17 12:15:39 +01:00
tag_icon
. toggleClass ( 'client-input_muted' , flag )
. toggleClass ( 'client-capture' , ! flag ) ;
if ( this . handle . serverConnection . connected ( ) )
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "clientupdate" , {
2018-04-16 20:38:35 +02:00
client_input_muted : this._muteInput
2018-02-27 17:20:49 +01:00
} ) ;
2019-03-17 12:15:39 +01:00
settings . changeGlobal ( Settings . KEY_CONTROL_MUTE_INPUT , this . _muteInput ) ;
2018-02-27 17:20:49 +01:00
this . updateMicrophoneRecordState ( ) ;
}
2018-04-11 17:56:09 +02:00
get muteOutput ( ) : boolean { return this . _muteOutput ; }
2018-02-27 17:20:49 +01:00
set muteOutput ( flag : boolean ) {
if ( this . _muteOutput == flag ) return ;
this . _muteOutput = flag ;
2019-03-17 12:15:39 +01:00
2018-02-27 17:20:49 +01:00
let tag = this . htmlTag . find ( ".btn_mute_output" ) ;
2019-03-17 12:15:39 +01:00
const tag_icon = tag . find ( ".icon_x32, .icon" ) ;
2018-02-27 17:20:49 +01:00
2019-03-17 12:15:39 +01:00
tag . toggleClass ( 'activated' , flag )
tag_icon
. toggleClass ( 'client-output_muted' , flag )
. toggleClass ( 'client-volume' , ! flag ) ;
if ( this . handle . serverConnection . connected ( ) )
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "clientupdate" , {
2018-04-16 20:38:35 +02:00
client_output_muted : this._muteOutput
2018-02-27 17:20:49 +01:00
} ) ;
2019-03-17 12:15:39 +01:00
settings . changeGlobal ( Settings . KEY_CONTROL_MUTE_OUTPUT , this . _muteOutput ) ;
2018-02-27 17:20:49 +01:00
this . updateMicrophoneRecordState ( ) ;
}
set away ( value : boolean | string ) {
if ( typeof ( value ) == "boolean" ) {
if ( this . _away == value ) return ;
this . _away = value ;
this . _awayMessage = "" ;
} else {
this . _awayMessage = value ;
this . _away = true ;
}
2018-09-25 12:57:47 +02:00
let tag = this . htmlTag . find ( ".btn_away_toggle" ) ;
2018-02-27 17:20:49 +01:00
if ( this . _away ) {
2018-09-25 12:57:47 +02:00
tag . addClass ( "activated" ) ;
2018-02-27 17:20:49 +01:00
} else {
2018-09-25 12:57:47 +02:00
tag . removeClass ( "activated" ) ;
2018-02-27 17:20:49 +01:00
}
if ( this . handle . serverConnection . connected )
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "clientupdate" , {
2018-04-16 20:38:35 +02:00
client_away : this._away ,
2018-02-27 17:20:49 +01:00
client_away_message : this._awayMessage
} ) ;
this . updateMicrophoneRecordState ( ) ;
}
private updateMicrophoneRecordState() {
let enabled = ! this . _muteInput && ! this . _muteOutput && ! this . _away ;
2019-03-07 15:30:53 +01:00
if ( this . handle . voiceConnection )
this . handle . voiceConnection . voiceRecorder . update ( enabled ) ;
2018-02-27 17:20:49 +01:00
}
2018-03-07 19:06:52 +01:00
updateProperties() {
if ( this . handle . serverConnection . connected )
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "clientupdate" , {
2018-04-16 20:38:35 +02:00
client_input_muted : this._muteInput ,
client_output_muted : this._muteOutput ,
client_away : this._away ,
2018-03-07 19:06:52 +01:00
client_away_message : this._awayMessage ,
2018-09-22 15:14:39 +02:00
client_input_hardware : this.codec_supported && this . support_record ,
client_output_hardware : this.codec_supported && this . support_playback
2018-03-07 19:06:52 +01:00
} ) ;
}
2018-04-30 23:57:21 +02:00
updateVoice ( targetChannel? : ChannelEntry ) {
2019-03-07 15:30:53 +01:00
if ( ! targetChannel )
targetChannel = this . handle . getClient ( ) . currentChannel ( ) ;
2018-09-22 15:14:39 +02:00
let client = this . handle . getClient ( ) ;
2018-04-30 23:57:21 +02:00
2019-03-07 15:30:53 +01:00
this . codec_supported = targetChannel ? this . handle . voiceConnection && this . handle . voiceConnection . codecSupported ( targetChannel . properties . channel_codec ) : true ;
this . support_record = this . handle . voiceConnection && this . handle . voiceConnection . voice_send_support ( ) ;
this . support_playback = this . handle . voiceConnection && this . handle . voiceConnection . voice_playback_support ( ) ;
2018-09-22 15:14:39 +02:00
this . htmlTag . find ( ".btn_mute_input" ) . prop ( "disabled" , ! this . codec_supported || ! this . support_playback || ! this . support_record ) ;
this . htmlTag . find ( ".btn_mute_output" ) . prop ( "disabled" , ! this . codec_supported || ! this . support_playback ) ;
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "clientupdate" , {
2018-09-22 15:14:39 +02:00
client_input_hardware : this.codec_supported && this . support_record ,
client_output_hardware : this.codec_supported && this . support_playback
2018-04-30 23:57:21 +02:00
} ) ;
2018-09-22 15:14:39 +02:00
if ( ! this . codec_supported )
2018-12-05 20:46:33 +01:00
createErrorModal ( tr ( "Channel codec unsupported" ) , tr ( "This channel has an unsupported codec.<br>You cant speak or listen to anybody within this channel!" ) ) . open ( ) ;
2018-09-22 15:14:39 +02:00
/* Update these properties anyways (for case the server fails to handle the command) */
client . updateVariables (
{ key : "client_input_hardware" , value : ( this . codec_supported && this . support_record ) + "" } ,
{ key : "client_output_hardware" , value : ( this . codec_supported && this . support_playback ) + "" }
) ;
2018-04-30 23:57:21 +02:00
}
2018-03-07 19:06:52 +01:00
private onOpenSettings() {
Modals . spawnSettingsModal ( ) ;
}
private onConnect() {
2019-02-17 16:08:10 +01:00
this . handle . cancel_reconnect ( ) ;
2018-12-03 18:56:36 +01:00
Modals . spawnConnectModal ( {
url : "ts.TeaSpeak.de" ,
enforce : false
} ) ;
2018-03-07 19:06:52 +01:00
}
2018-09-25 12:57:47 +02:00
update_connection_state() {
switch ( this . handle . serverConnection ? this . handle.serverConnection._connectionState : ConnectionState.UNCONNECTED ) {
case ConnectionState . CONNECTED :
case ConnectionState . CONNECTING :
case ConnectionState . INITIALISING :
this . htmlTag . find ( ".btn_disconnect" ) . show ( ) ;
this . htmlTag . find ( ".btn_connect" ) . hide ( ) ;
break ;
default :
this . htmlTag . find ( ".btn_disconnect" ) . hide ( ) ;
this . htmlTag . find ( ".btn_connect" ) . show ( ) ;
}
}
private onDisconnect() {
2019-02-17 16:08:10 +01:00
this . handle . cancel_reconnect ( ) ;
2018-09-25 12:57:47 +02:00
this . handle . handleDisconnect ( DisconnectReason . REQUESTED ) ; //TODO message?
this . update_connection_state ( ) ;
2018-11-04 00:39:29 +01:00
sound . play ( Sound . CONNECTION_DISCONNECTED ) ;
2018-09-25 12:57:47 +02:00
}
private on_token_use() {
2018-12-05 20:46:33 +01:00
createInputModal ( tr ( "Use token" ) , tr ( "Please enter your token/priviledge key" ) , message = > message . length > 0 , result = > {
2018-09-25 12:57:47 +02:00
if ( ! result ) return ;
if ( this . handle . serverConnection . connected )
2019-02-23 14:15:22 +01:00
this . handle . serverConnection . send_command ( "tokenuse" , {
2018-09-25 12:57:47 +02:00
token : result
} ) . then ( ( ) = > {
2018-12-05 20:46:33 +01:00
createInfoModal ( tr ( "Use token" ) , tr ( "Toke successfully used!" ) ) . open ( ) ;
2018-09-25 12:57:47 +02:00
} ) . catch ( error = > {
2018-12-05 20:46:33 +01:00
//TODO tr
createErrorModal ( tr ( "Use token" ) , "Failed to use token: " + ( error instanceof CommandResult ? error.message : error ) ) . open ( ) ;
2018-09-25 12:57:47 +02:00
} ) ;
} ) . open ( ) ;
}
private on_token_list() {
2018-12-05 20:46:33 +01:00
createErrorModal ( tr ( "Not implemented" ) , tr ( "Token list is not implemented yet!" ) ) . open ( ) ;
2018-09-25 12:57:47 +02:00
}
2018-09-30 21:50:59 +02:00
private onPermission() {
let button = this . htmlTag . find ( ".btn_permissions" ) ;
button . addClass ( "activated" ) ;
setTimeout ( ( ) = > {
Modals . spawnPermissionEdit ( ) . open ( ) ;
button . removeClass ( "activated" ) ;
} , 0 ) ;
}
2018-10-20 19:58:06 +02:00
private onBanlist() {
if ( ! this . handle . serverConnection ) return ;
2018-12-23 17:41:14 +01:00
if ( this . handle . permissions . neededPermission ( PermissionType . B_CLIENT_BAN_LIST ) . granted ( 1 ) ) {
2019-02-21 20:13:02 +01:00
Modals . openBanList ( this . handle ) ;
2018-12-23 17:41:14 +01:00
} else {
createErrorModal ( tr ( "You dont have the permission" ) , tr ( "You dont have the permission to view the ban list" ) ) . open ( ) ;
sound . play ( Sound . ERROR_INSUFFICIENT_PERMISSIONS ) ;
}
2018-10-20 19:58:06 +02:00
}
2018-12-18 20:00:29 +01:00
2018-12-28 15:39:23 +01:00
private on_bookmark_server_add() {
if ( globalClient && globalClient . connected ) {
createInputModal ( tr ( "Enter bookmarks name" ) , tr ( "Please enter the bookmarks name:<br>" ) , text = > true , result = > {
if ( result ) {
const bookmark = bookmarks . create_bookmark ( result as string , bookmarks . bookmarks ( ) , {
server_port : globalClient.serverConnection._remote_address.port ,
server_address : globalClient.serverConnection._remote_address.host ,
server_password : "" ,
server_password_hash : ""
} , globalClient . getClient ( ) . clientNickName ( ) ) ;
bookmarks . save_bookmark ( bookmark ) ;
this . update_bookmarks ( )
}
} ) . open ( ) ;
} else {
createErrorModal ( tr ( "You have to be connected" ) , tr ( "You have to be connected!" ) ) . open ( ) ;
}
}
update_bookmark_status() {
this . htmlTag . find ( ".btn_bookmark_add" ) . removeClass ( "hidden" ) . addClass ( "disabled" ) ;
this . htmlTag . find ( ".btn_bookmark_remove" ) . addClass ( "hidden" ) ;
}
2018-12-18 20:00:29 +01:00
update_bookmarks() {
//<div class="btn_bookmark_connect" target="localhost"><a>Localhost</a></div>
let tag_bookmark = this . htmlTag . find ( ".btn_bookmark .dropdown" ) ;
2018-12-28 15:39:23 +01:00
tag_bookmark . find ( ".bookmark, .directory" ) . detach ( ) ;
2018-12-18 20:00:29 +01:00
2018-12-28 15:39:23 +01:00
const build_entry = ( bookmark : bookmarks.DirectoryBookmark | bookmarks . Bookmark ) = > {
2018-12-18 20:00:29 +01:00
if ( bookmark . type == bookmarks . BookmarkType . ENTRY ) {
2018-12-28 15:39:23 +01:00
const mark = < bookmarks.Bookmark > bookmark ;
return $ . spawn ( "div" )
2018-12-18 20:00:29 +01:00
. addClass ( "bookmark" )
2018-12-28 15:39:23 +01:00
. append (
$ . spawn ( "div" ) . addClass ( "icon client-server" )
)
. append (
$ . spawn ( "div" )
. addClass ( "name" )
. text ( bookmark . display_name )
. on ( 'click' , event = > {
this . htmlTag . find ( ".btn_bookmark" ) . find ( ".dropdown" ) . removeClass ( "displayed" ) ;
2018-12-30 01:51:34 +01:00
const profile = profiles . find_profile ( mark . connect_profile ) || profiles . default_profile ( ) ;
if ( profile . valid ( ) ) {
this . handle . startConnection (
mark . server_properties . server_address + ":" + mark . server_properties . server_port ,
profile ,
mark . nickname ,
{
password : mark.server_properties.server_password_hash ,
hashed : true
}
) ;
} else {
Modals . spawnConnectModal ( {
url : mark.server_properties.server_address + ":" + mark . server_properties . server_port ,
enforce : true
} , {
profile : profile ,
enforce : true
} )
}
2018-12-28 15:39:23 +01:00
} )
)
} else {
const mark = < bookmarks.DirectoryBookmark > bookmark ;
const container = $ . spawn ( "div" ) . addClass ( "sub-menu dropdown" ) ;
for ( const member of mark . content )
container . append ( build_entry ( member ) ) ;
return $ . spawn ( "div" )
. addClass ( "directory" )
. append (
$ . spawn ( "div" ) . addClass ( "icon client-folder" )
)
. append (
$ . spawn ( "div" )
. addClass ( "name" )
. text ( bookmark . display_name )
)
. append (
$ . spawn ( "div" ) . addClass ( "arrow right" )
)
. append (
$ . spawn ( "div" ) . addClass ( "sub-container" )
. append ( container )
)
2018-12-18 20:00:29 +01:00
}
2018-12-28 15:39:23 +01:00
} ;
for ( const bookmark of bookmarks . bookmarks ( ) . content ) {
const entry = build_entry ( bookmark ) ;
tag_bookmark . append ( entry ) ;
2018-12-18 20:00:29 +01:00
}
}
2018-12-28 15:39:23 +01:00
private on_bookmark_manage() {
Modals . spawnBookmarkModal ( ) ;
}
2019-02-17 16:08:10 +01:00
get query_visible() {
2018-12-18 20:00:29 +01:00
return this . _query_visible ;
}
2019-02-17 16:08:10 +01:00
set query_visible ( flag : boolean ) {
console . error ( flag ) ;
2018-12-18 20:00:29 +01:00
if ( this . _query_visible == flag ) return ;
this . _query_visible = flag ;
2019-03-17 12:15:39 +01:00
settings . changeGlobal ( Settings . KEY_CONTROL_SHOW_QUERIES , flag ) ;
2018-12-18 20:00:29 +01:00
this . update_query_visibility_button ( ) ;
this . handle . channelTree . toggle_server_queries ( flag ) ;
}
private on_query_visibility_toggle() {
2019-02-17 16:08:10 +01:00
this . query_visible = ! this . _query_visible ;
2018-12-18 20:00:29 +01:00
this . update_query_visibility_button ( ) ;
}
private update_query_visibility_button() {
2019-03-17 12:15:39 +01:00
this . htmlTag . find ( ".btn_query_toggle" ) . toggleClass ( 'activated' , this . _query_visible ) ;
2018-12-18 20:00:29 +01:00
}
private on_query_create() {
if ( this . handle . permissions . neededPermission ( PermissionType . B_CLIENT_CREATE_MODIFY_SERVERQUERY_LOGIN ) . granted ( 1 ) ) {
Modals . spawnQueryCreate ( ) ;
} else {
createErrorModal ( tr ( "You dont have the permission" ) , tr ( "You dont have the permission to create a server query login" ) ) . open ( ) ;
sound . play ( Sound . ERROR_INSUFFICIENT_PERMISSIONS ) ;
}
}
2018-12-23 17:41:14 +01:00
private on_query_manage() {
if ( globalClient && globalClient . connected ) {
Modals . spawnQueryManage ( globalClient ) ;
} else {
createErrorModal ( tr ( "You have to be connected" ) , tr ( "You have to be connected!" ) ) . open ( ) ;
}
}
2019-01-20 18:43:14 +01:00
private on_playlist_manage() {
if ( this . handle && this . handle . connected ) {
Modals . spawnPlaylistManage ( this . handle ) ;
} else {
createErrorModal ( tr ( "You have to be connected" ) , tr ( "You have to be connected to use this function!" ) ) . open ( ) ;
}
}
2019-03-17 12:15:39 +01:00
get channel_subscribe_all ( ) : boolean {
return this . _channel_subscribe_all ;
}
set channel_subscribe_all ( flag : boolean ) {
if ( this . _channel_subscribe_all == flag )
return ;
this . _channel_subscribe_all = flag ;
this . htmlTag
. find ( ".button-subscribe-mode" )
. toggleClass ( 'activated' , this . _channel_subscribe_all )
. find ( '.icon_x32' )
. toggleClass ( 'client-unsubscribe_from_all_channels' , ! this . _channel_subscribe_all )
. toggleClass ( 'client-subscribe_to_all_channels' , this . _channel_subscribe_all ) ;
settings . changeGlobal ( Settings . KEY_CONTROL_CHANNEL_SUBSCRIBE_ALL , flag ) ;
if ( flag )
this . handle . channelTree . subscribe_all_channels ( ) ;
else
this . handle . channelTree . unsubscribe_all_channels ( ) ;
}
private on_toggle_channel_subscribe_all() {
this . channel_subscribe_all = ! this . channel_subscribe_all ;
}
2018-02-27 17:20:49 +01:00
}