2020-10-20 23:25:34 +02:00
/ * *
* @ name EditChannels
2021-03-05 13:26:41 +01:00
* @ author DevilBro
2020-10-20 23:25:34 +02:00
* @ authorId 278543574059057154
2021-07-28 23:04:01 +02:00
* @ version 4.3 . 3
2021-03-05 13:26:41 +01:00
* @ description Allows you to locally edit Channels
2020-10-20 23:25:34 +02:00
* @ invite Jx3TjNS
2020-11-19 16:45:36 +01:00
* @ donate https : //www.paypal.me/MircoWittrien
* @ patreon https : //www.patreon.com/MircoWittrien
2021-03-09 15:10:55 +01:00
* @ website https : //mwittrien.github.io/
* @ source https : //github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditChannels/
2021-03-10 09:17:37 +01:00
* @ updateUrl https : //mwittrien.github.io/BetterDiscordAddons/Plugins/EditChannels/EditChannels.plugin.js
2020-10-20 23:25:34 +02:00
* /
2018-10-11 10:21:26 +02:00
2020-09-19 20:49:33 +02:00
module . exports = ( _ => {
2020-10-09 21:09:35 +02:00
const config = {
2020-09-19 20:49:33 +02:00
"info" : {
"name" : "EditChannels" ,
"author" : "DevilBro" ,
2021-07-28 23:04:01 +02:00
"version" : "4.3.3" ,
2021-03-04 12:15:46 +01:00
"description" : "Allows you to locally edit Channels"
2020-12-22 20:38:51 +01:00
} ,
"changeLog" : {
2021-07-28 23:04:01 +02:00
"improved" : {
"Threads" : "Works flawlessly with Threads now"
2020-12-22 20:38:51 +01:00
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
} ;
2020-11-13 19:47:44 +01:00
2021-08-11 17:33:29 +02:00
return ( window . Lightcord && ! Node . prototype . isPrototypeOf ( window . Lightcord ) || window . LightCord && ! Node . prototype . isPrototypeOf ( window . LightCord ) ) ? class {
2021-06-15 13:42:02 +02:00
getName ( ) { return config . info . name ; }
getAuthor ( ) { return config . info . author ; }
getVersion ( ) { return config . info . version ; }
getDescription ( ) { return "Do not use LightCord!" ; }
load ( ) { BdApi . alert ( "Attention!" , "By using LightCord you are risking your Discord Account, due to using a 3rd Party Client. Switch to an official Discord Client (https://discord.com/) with the proper BD Injection (https://betterdiscord.app/)" ) ; }
start ( ) { }
stop ( ) { }
} : ! window . BDFDB _Global || ( ! window . BDFDB _Global . loaded && ! window . BDFDB _Global . started ) ? class {
2021-01-06 12:38:36 +01:00
getName ( ) { return config . info . name ; }
getAuthor ( ) { return config . info . author ; }
getVersion ( ) { return config . info . version ; }
2021-02-01 17:13:13 +01:00
getDescription ( ) { return ` The Library Plugin needed for ${ config . info . name } is missing. Open the Plugin Settings to download it. \n \n ${ config . info . description } ` ; }
downloadLibrary ( ) {
require ( "request" ) . get ( "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js" , ( e , r , b ) => {
2021-03-05 13:14:18 +01:00
if ( ! e && b && r . statusCode == 200 ) require ( "fs" ) . writeFile ( require ( "path" ) . join ( BdApi . Plugins . folder , "0BDFDB.plugin.js" ) , b , _ => BdApi . showToast ( "Finished downloading BDFDB Library" , { type : "success" } ) ) ;
2021-03-06 14:59:48 +01:00
else BdApi . alert ( "Error" , "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library" ) ;
2021-02-01 17:13:13 +01:00
} ) ;
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
load ( ) {
2020-11-19 16:51:14 +01:00
if ( ! window . BDFDB _Global || ! Array . isArray ( window . BDFDB _Global . pluginQueue ) ) window . BDFDB _Global = Object . assign ( { } , window . BDFDB _Global , { pluginQueue : [ ] } ) ;
2020-09-19 20:49:33 +02:00
if ( ! window . BDFDB _Global . downloadModal ) {
window . BDFDB _Global . downloadModal = true ;
2021-01-14 16:14:44 +01:00
BdApi . showConfirmationModal ( "Library Missing" , ` The Library Plugin needed for ${ config . info . name } is missing. Please click "Download Now" to install it. ` , {
2020-09-19 20:49:33 +02:00
confirmText : "Download Now" ,
cancelText : "Cancel" ,
onCancel : _ => { delete window . BDFDB _Global . downloadModal ; } ,
2020-09-20 08:15:13 +02:00
onConfirm : _ => {
delete window . BDFDB _Global . downloadModal ;
2021-02-01 17:13:13 +01:00
this . downloadLibrary ( ) ;
2020-09-20 08:15:13 +02:00
}
2020-09-19 20:49:33 +02:00
} ) ;
}
if ( ! window . BDFDB _Global . pluginQueue . includes ( config . info . name ) ) window . BDFDB _Global . pluginQueue . push ( config . info . name ) ;
2020-10-09 21:09:35 +02:00
}
2021-01-06 12:38:36 +01:00
start ( ) { this . load ( ) ; }
stop ( ) { }
getSettingsPanel ( ) {
2020-11-28 23:12:09 +01:00
let template = document . createElement ( "template" ) ;
2021-01-14 16:14:44 +01:00
template . innerHTML = ` <div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${ config . info . name } is missing. \n Please click <a style="font-weight: 500;">Download Now</a> to install it.</div> ` ;
2021-02-01 17:13:13 +01:00
template . content . firstElementChild . querySelector ( "a" ) . addEventListener ( "click" , this . downloadLibrary ) ;
2020-11-28 23:12:09 +01:00
return template . content . firstElementChild ;
}
2020-10-09 21:09:35 +02:00
} : ( ( [ Plugin , BDFDB ] ) => {
2021-05-20 16:44:45 +02:00
var changedChannels = { } ;
2020-09-19 20:49:33 +02:00
2020-10-09 21:09:35 +02:00
return class EditChannels extends Plugin {
2021-01-06 12:38:36 +01:00
onLoad ( ) {
2020-09-19 20:49:33 +02:00
this . defaults = {
2021-05-20 16:44:45 +02:00
general : {
changeChannelIcon : { value : true , description : "Change Color of Channel Icon" }
} ,
places : {
chatTextarea : { value : true , description : "Chat Textarea" } ,
2021-07-28 23:04:01 +02:00
chatWindow : { value : true , description : "Messages" } ,
2021-05-20 16:44:45 +02:00
mentions : { value : true , description : "Mentions" } ,
channelList : { value : true , description : "Channel/Group List" } ,
channelHeader : { value : true , description : "Channel/Group Header" } ,
recentDms : { value : true , description : "Group Notifications" } ,
recentMentions : { value : true , description : "Recent Mentions Popout" } ,
2021-07-28 23:04:01 +02:00
threads : { value : true , description : "Thread Overview" } ,
2021-05-20 16:44:45 +02:00
autocompletes : { value : true , description : "Autocomplete Menu" } ,
auditLog : { value : true , description : "Audit Log" } ,
inviteLog : { value : true , description : "Invite Log" } ,
quickSwitcher : { value : true , description : "Quick Switcher" } ,
searchResults : { value : true , description : "Search Results" } ,
searchPopout : { value : true , description : "Search Popout" } ,
appTitle : { value : true , description : "Discord App Title (Channels)" }
2020-09-19 20:49:33 +02:00
}
} ;
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
this . patchedModules = {
before : {
ChannelEditorContainer : "render" ,
2021-07-28 23:04:01 +02:00
TextChannelEmptyMessage : "default" ,
ThreadEmptyMessage : "default" ,
2021-07-28 23:39:25 +02:00
SystemMessageWrapper : "type" ,
2020-09-19 20:49:33 +02:00
AutocompleteChannelResult : "render" ,
AuditLog : "render" ,
SettingsInvites : "render" ,
HeaderBarContainer : "render" ,
2020-11-12 19:04:22 +01:00
ChannelCategoryItem : "type" ,
2020-10-30 15:54:55 +01:00
ChannelItem : "default" ,
2021-07-28 23:04:01 +02:00
GuildSidebarThreadListEntry : "type" ,
2020-09-19 20:49:33 +02:00
QuickSwitchChannelResult : "render" ,
2021-02-04 22:51:39 +01:00
SearchPopoutComponent : "render" ,
2020-09-19 20:49:33 +02:00
MessageContent : "type"
} ,
after : {
2021-07-28 23:39:25 +02:00
ThreadMessageAccessories : "default" ,
ThreadCreated : "default" ,
2020-09-19 20:49:33 +02:00
AutocompleteChannelResult : "render" ,
AuditLog : "render" ,
HeaderBarContainer : "render" ,
2021-07-28 23:04:01 +02:00
ThreadSidebar : "default" ,
ThreadCard : "type" ,
2020-11-12 19:04:22 +01:00
FocusRing : "default" ,
2020-10-30 15:54:55 +01:00
ChannelItem : "default" ,
2021-07-28 23:04:01 +02:00
GuildSidebarThreadListEntry : "type" ,
2021-01-09 22:06:27 +01:00
DirectMessage : "render" ,
PrivateChannel : "render" ,
2020-09-19 20:49:33 +02:00
QuickSwitchChannelResult : "render" ,
2021-02-04 22:51:39 +01:00
SearchResultsInner : "default" ,
2020-12-04 22:38:52 +01:00
RecentsChannelHeader : "default" ,
2021-02-24 17:32:17 +01:00
RichChannelMention : "ChannelMention"
2020-09-19 20:49:33 +02:00
}
} ;
2021-06-09 17:52:32 +02:00
this . patchPriority = 9 ;
2020-09-19 20:49:33 +02:00
this . css = `
$ { BDFDB . dotCN . messagespopoutchannelname } : hover > span [ style *= "color" ] ,
2021-02-04 22:51:39 +01:00
$ { BDFDB . dotCN . recentmentionschannelname } : hover > span [ style *= "color" ] ,
$ { BDFDB . dotCN . searchresultschannelname } : hover > span [ style *= "color" ] {
2020-09-19 20:49:33 +02:00
text - decoration : underline ;
}
` ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-06-09 17:52:32 +02:00
onStart ( ) {
2020-02-04 08:20:40 +01:00
let observer = new MutationObserver ( _ => { this . changeAppTitle ( ) ; } ) ;
2021-01-09 22:06:27 +01:00
BDFDB . ObserverUtils . connect ( this , document . head . querySelector ( "title" ) , { name : "appTitleObserver" , instance : observer } , { childList : true } ) ;
2020-02-04 08:20:40 +01:00
2020-09-26 18:37:56 +02:00
if ( BDFDB . LibraryModules . AutocompleteOptions && BDFDB . LibraryModules . AutocompleteOptions . AUTOCOMPLETE _OPTIONS ) BDFDB . PatchUtils . patch ( this , BDFDB . LibraryModules . AutocompleteOptions . AUTOCOMPLETE _OPTIONS . CHANNELS , "queryResults" , { after : e => {
let channelArray = [ ] ;
for ( let id in changedChannels ) if ( changedChannels [ id ] && changedChannels [ id ] . name ) {
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( id ) ;
let category = channel && channel . parent _id && BDFDB . LibraryModules . ChannelStore . getChannel ( channel . parent _id ) ;
let catData = category && changedChannels [ category . id ] || { } ;
if ( BDFDB . ChannelUtils . isTextChannel ( channel ) && channel . guild _id == e . methodArguments [ 0 ] . guild _id ) channelArray . push ( Object . assign ( {
lowerCaseName : changedChannels [ id ] . name . toLowerCase ( ) ,
lowerCaseCatName : catData && catData . name && catData . name . toLowerCase ( ) ,
channel ,
category ,
catData
} , changedChannels [ id ] ) ) ;
}
2021-06-25 20:59:12 +02:00
channelArray = BDFDB . ArrayUtils . keySort ( channelArray . filter ( n => e . returnValue . results . channels . every ( channel => channel . id != n . channel . id ) && ( n . lowerCaseName . indexOf ( e . methodArguments [ 2 ] . toLowerCase ( ) ) != - 1 || ( n . lowerCaseCatName && n . lowerCaseCatName . indexOf ( e . methodArguments [ 2 ] . toLowerCase ( ) ) != - 1 ) ) ) , "lowerCaseName" ) ;
e . returnValue . results . channels = [ ] . concat ( e . returnValue . results . channels , channelArray . map ( n => n . channel ) ) . slice ( 0 , BDFDB . DiscordConstants . MAX _AUTOCOMPLETE _RESULTS ) ;
2020-09-26 18:37:56 +02:00
} } ) ;
2020-02-04 08:20:40 +01:00
this . forceUpdateAll ( ) ;
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
onStop ( ) {
2020-06-08 20:50:04 +02:00
this . forceUpdateAll ( ) ;
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
getSettingsPanel ( collapseStates = { } ) {
2021-05-20 16:44:45 +02:00
let settingsPanel ;
return settingsPanel = BDFDB . PluginUtils . createSettingsPanel ( this , {
collapseStates : collapseStates ,
children : _ => {
let settingsItems = [ ] ;
settingsItems . push ( Object . keys ( this . defaults . general ) . map ( key => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
type : "Switch" ,
plugin : this ,
keys : [ "general" , key ] ,
label : this . defaults . general [ key ] . description ,
value : this . settings . general [ key ]
} ) ) ) ;
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsPanelList , {
title : "Change Channels in:" ,
children : Object . keys ( this . defaults . places ) . map ( key => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
type : "Switch" ,
plugin : this ,
keys : [ "places" , key ] ,
label : this . defaults . places [ key ] . description ,
value : this . settings . places [ key ]
} ) )
} ) ) ;
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Button" ,
color : BDFDB . LibraryComponents . Button . Colors . RED ,
label : "Reset all Channels" ,
onClick : _ => BDFDB . ModalUtils . confirm ( this , this . labels . confirm _resetall , _ => {
BDFDB . DataUtils . remove ( this , "channels" ) ;
this . forceUpdateAll ( ) ; ;
} ) ,
children : BDFDB . LanguageUtils . LanguageStrings . RESET
} ) ) ;
return settingsItems ;
}
} ) ;
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
2021-01-06 12:38:36 +01:00
onSettingsClosed ( ) {
2020-09-19 20:49:33 +02:00
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
this . forceUpdateAll ( ) ;
}
2020-02-04 08:20:40 +01:00
}
2020-10-30 15:54:55 +01:00
forceUpdateAll ( instant = false ) {
2020-09-19 20:49:33 +02:00
changedChannels = BDFDB . DataUtils . load ( this , "channels" ) ;
this . changeAppTitle ( ) ;
BDFDB . PatchUtils . forceAllUpdates ( this ) ;
2020-10-30 15:54:55 +01:00
BDFDB . ChannelUtils . rerenderAll ( instant ) ;
2020-11-19 16:51:14 +01:00
BDFDB . ReactUtils . forceUpdate ( BDFDB . ReactUtils . findOwner ( document . querySelector ( BDFDB . dotCN . app ) , { name : "Channel" , unlimited : true } ) ) ;
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
2020-09-19 20:49:33 +02:00
onChannelContextMenu ( e ) {
2021-01-09 22:06:27 +01:00
this . injectItem ( e ) ;
}
onGroupDMContextMenu ( e ) {
this . injectItem ( e ) ;
}
injectItem ( e ) {
2020-09-19 20:49:33 +02:00
if ( e . instance . props . channel ) {
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : "devmode-copy-id" , group : true } ) ;
children . splice ( index > - 1 ? index : children . length , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-12-21 19:56:36 +01:00
label : this . labels . context _localchannelsettings ,
2020-09-19 20:49:33 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "settings-submenu" ) ,
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
children : [
BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-12-21 19:56:36 +01:00
label : this . labels . submenu _channelsettings ,
2020-09-19 20:49:33 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "settings-change" ) ,
action : _ => {
this . openChannelSettingsModal ( e . instance . props . channel ) ;
}
} ) ,
BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-12-21 19:56:36 +01:00
label : this . labels . submenu _resetsettings ,
2020-09-19 20:49:33 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "settings-reset" ) ,
2020-12-22 20:38:51 +01:00
color : BDFDB . LibraryComponents . MenuItems . Colors . DANGER ,
2020-09-19 20:49:33 +02:00
disabled : ! changedChannels [ e . instance . props . channel . id ] ,
2020-12-22 20:38:51 +01:00
action : event => {
let remove = _ => {
BDFDB . DataUtils . remove ( this , "channels" , e . instance . props . channel . id ) ;
this . forceUpdateAll ( true ) ;
} ;
if ( event . shiftKey ) remove ( ) ;
else BDFDB . ModalUtils . confirm ( this , this . labels . confirm _reset , remove ) ;
2020-09-19 20:49:33 +02:00
}
} )
]
} )
} )
} ) ) ;
}
}
processChannelEditorContainer ( e ) {
2021-07-29 20:47:38 +02:00
if ( ! e . instance . props . disabled && e . instance . props . channel && ( BDFDB . ChannelUtils . isTextChannel ( e . instance . props . channel ) || BDFDB . ChannelUtils . isThread ( e . instance . props . channel ) || e . instance . props . channel . isGroupDM ( ) ) && ( e . instance . props . type == BDFDB . DiscordConstants . TextareaTypes . NORMAL || e . instance . props . type == BDFDB . DiscordConstants . TextareaTypes . SIDEBAR ) && this . settings . places . chatTextarea ) {
2021-06-09 17:52:32 +02:00
if ( changedChannels [ e . instance . props . channel . id ] && changedChannels [ e . instance . props . channel . id ] . name ) e . instance . props . placeholder = BDFDB . LanguageUtils . LanguageStringsFormat ( "TEXTAREA_PLACEHOLDER" , ` # ${ changedChannels [ e . instance . props . channel . id ] . name } ` ) ;
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
processTextChannelEmptyMessage ( e ) {
if ( e . instance . props . channel && changedChannels [ e . instance . props . channel . id ] && this . settings . places . chatWindow ) e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id ) ;
}
processThreadEmptyMessage ( e ) {
if ( e . instance . props . channel && changedChannels [ e . instance . props . channel . id ] && this . settings . places . chatWindow ) e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id ) ;
}
2021-07-28 23:39:25 +02:00
processSystemMessageWrapper ( e ) {
if ( e . instance . props . channel && changedChannels [ e . instance . props . channel . id ] && this . settings . places . chatWindow ) e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id ) ;
}
processThreadCreated ( e ) {
if ( e . instance . props . message && e . instance . props . message . messageReference && e . instance . props . message . messageReference . channel _id && changedChannels [ e . instance . props . message . messageReference . channel _id ] && this . settings . places . chatWindow ) {
let channelName = BDFDB . ObjectUtils . get ( e , "returnvalue.props.children.2.props.children.0" ) ;
if ( changedChannels [ e . instance . props . message . messageReference . channel _id ] . name ) channelName . props . children = [ changedChannels [ e . instance . props . message . messageReference . channel _id ] . name ] ;
this . changeChannelColor ( channelName , e . instance . props . message . messageReference . channel _id ) ;
}
}
processThreadMessageAccessories ( e ) {
if ( e . returnvalue . props . channel && changedChannels [ e . returnvalue . props . channel . id ] && this . settings . places . chatWindow ) {
e . returnvalue . props . channel = this . getChannelData ( e . returnvalue . props . channel . id ) ;
let type = e . returnvalue . type ;
e . returnvalue . type = BDFDB . TimeUtils . suppress ( ( ... args ) => {
let returnValue = type ( ... args ) ;
let channelName = BDFDB . ReactUtils . findChild ( returnValue , { props : [ [ "className" , BDFDB . disCN . messagesystemname ] ] } ) ;
this . changeChannelColor ( channelName , e . instance . props . message . messageReference . channel _id ) ;
return returnValue ;
} , "" , this ) ;
}
}
2020-01-03 21:05:35 +01:00
2020-09-19 20:49:33 +02:00
processAutocompleteChannelResult ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . channel && this . settings . places . autocompletes ) {
2020-09-19 20:49:33 +02:00
if ( ! e . returnvalue ) {
e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id ) ;
if ( e . instance . props . category ) e . instance . props . category = this . getChannelData ( e . instance . props . category . id ) ;
}
else {
2021-06-25 20:59:12 +02:00
if ( typeof e . returnvalue . props . children == "function" ) {
let childrenRender = e . returnvalue . props . children ;
2021-07-05 16:33:10 +02:00
e . returnvalue . props . children = BDFDB . TimeUtils . suppress ( ( ... args ) => {
2021-06-25 20:59:12 +02:00
let children = childrenRender ( ... args ) ;
let channelName = BDFDB . ReactUtils . findChild ( children , { name : "AutocompleteRowHeading" } ) ;
if ( channelName ) this . changeChannelColor ( channelName , e . instance . props . channel . id ) ;
let channelIcon = BDFDB . ReactUtils . findChild ( children , { props : [ [ "className" , BDFDB . disCN . autocompleteicon ] ] } ) ;
if ( channelIcon ) this . changeChannelIconColor ( channelIcon , e . instance . props . channel . id ) ;
if ( e . instance . props . category ) {
let categoryName = BDFDB . ReactUtils . findChild ( children , { name : "AutocompleteRowContentSecondary" } ) ;
if ( categoryName ) this . changeChannelColor ( categoryName , e . instance . props . category . id ) ;
}
return children ;
2021-07-05 16:33:10 +02:00
} , "" , this ) ;
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
}
}
2020-01-03 21:05:35 +01:00
}
2020-09-19 20:49:33 +02:00
processAuditLog ( e ) {
let channel = BDFDB . ObjectUtils . get ( e . instance , "props.log.options.channel" ) ;
2021-05-20 16:44:45 +02:00
if ( channel && this . settings . places . auditLog ) {
2020-09-19 20:49:33 +02:00
if ( ! e . returnvalue ) e . instance . props . log . options . channel = this . getChannelData ( channel . id ) ;
else {
2020-11-19 16:51:14 +01:00
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "children" , [ [ "#" + channel . name ] ] ] ] } ) ;
2020-09-19 20:49:33 +02:00
if ( channelName ) this . changeChannelColor ( channelName , channel . id ) ;
}
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2020-09-19 20:49:33 +02:00
processSettingsInvites ( e ) {
2021-05-20 16:44:45 +02:00
if ( BDFDB . ObjectUtils . is ( e . instance . props . invites ) && this . settings . places . inviteLog ) {
2020-09-19 20:49:33 +02:00
e . instance . props . invites = Object . assign ( { } , e . instance . props . invites ) ;
for ( let id in e . instance . props . invites ) e . instance . props . invites [ id ] = new BDFDB . DiscordObjects . Invite ( Object . assign ( { } , e . instance . props . invites [ id ] , { channel : this . getChannelData ( e . instance . props . invites [ id ] . channel . id ) } ) ) ;
}
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
2020-09-19 20:49:33 +02:00
processHeaderBarContainer ( e ) {
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( e . instance . props . channelId ) ;
2021-07-29 20:47:38 +02:00
if ( channel && ( BDFDB . ChannelUtils . isTextChannel ( channel ) || channel . isGroupDM ( ) || BDFDB . ChannelUtils . isThread ( channel ) ) && this . settings . places . channelHeader ) {
2021-07-28 23:04:01 +02:00
let thread ;
2021-07-29 20:47:38 +02:00
if ( BDFDB . ChannelUtils . isThread ( channel ) ) {
2021-07-28 23:04:01 +02:00
thread = channel ;
channel = BDFDB . LibraryModules . ChannelStore . getChannel ( thread . parent _id ) ;
}
2020-09-19 20:49:33 +02:00
if ( ! e . returnvalue ) {
2021-07-28 23:04:01 +02:00
let channelNames = BDFDB . ReactUtils . findChild ( e . instance , { all : true , name : [ "Title" , "ChannelName" ] } ) ;
if ( channelNames . length ) {
if ( channelNames [ 0 ] . props . children ) {
if ( changedChannels [ channel . id ] && changedChannels [ channel . id ] . name ) channelNames [ 0 ] . props . children = channel . isGroupDM ( ) ? this . getGroupName ( channel . id ) : this . getChannelData ( channel . id ) . name ;
this . changeChannelColor ( channelNames [ 0 ] , channel . id ) ;
}
if ( channelNames [ 0 ] . props . channel ) channelNames [ 0 ] . props . channel = this . getChannelData ( channel . id ) ;
if ( thread && channelNames [ 1 ] . props . children ) {
if ( changedChannels [ thread . id ] && changedChannels [ thread . id ] . name ) channelNames [ 1 ] . props . children = this . getChannelData ( thread . id ) . name ;
this . changeChannelColor ( channelNames [ 1 ] , thread . id ) ;
2021-01-09 22:06:27 +01:00
}
2020-09-19 20:49:33 +02:00
}
2020-03-08 14:07:16 +01:00
}
2020-09-19 20:49:33 +02:00
else {
2021-07-28 23:04:01 +02:00
let channelIcons = BDFDB . ReactUtils . findChild ( e . instance , { all : true , name : "Icon" } ) ;
if ( channelIcons . length ) {
if ( channelIcons [ 0 ] . props . icon ) {
let iconRender = channelIcons [ 0 ] . props . icon ;
channelIcons [ 0 ] . props . icon = BDFDB . TimeUtils . suppress ( ( ... args ) => {
let icon = iconRender ( ... args ) ;
this . changeChannelIconColor ( icon , channel . id ) ;
return icon ;
} , "" , this ) ;
}
if ( thread && channelIcons [ 1 ] . props . icon ) {
let iconRender = channelIcons [ 1 ] . props . icon ;
channelIcons [ 1 ] . props . icon = BDFDB . TimeUtils . suppress ( ( ... args ) => {
let icon = iconRender ( ... args ) ;
this . changeChannelIconColor ( icon , thread . id ) ;
return icon ;
} , "" , this ) ;
}
2020-09-19 20:49:33 +02:00
}
2020-03-08 14:07:16 +01:00
}
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
processThreadSidebar ( e ) {
if ( changedChannels [ e . instance . props . channelId ] && this . settings . places . channelHeader ) {
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { name : [ "Title" , "ChannelName" ] } ) ;
if ( channelName && channelName . props . children ) {
if ( changedChannels [ e . instance . props . channelId ] . name ) channelName . props . children = this . getChannelData ( e . instance . props . channelId ) . name ;
this . changeChannelColor ( channelName , e . instance . props . channelId ) ;
}
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : "Icon" } ) ;
if ( index > - 1 ) {
let icon = BDFDB . ReactUtils . createElement ( children [ index ] . props . icon , {
className : BDFDB . disCN . channelheadericon
} ) ;
this . changeChannelIconColor ( icon , e . instance . props . channelId ) ;
children [ index ] = BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . channelheadericonwrapper ,
children : icon
} )
}
}
}
processThreadCard ( e ) {
if ( changedChannels [ e . instance . props . threadId ] && this . settings . places . threads ) {
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . threadcardname ] ] } ) ;
if ( channelName ) {
if ( changedChannels [ e . instance . props . threadId ] . name ) channelName . props . children = changedChannels [ e . instance . props . threadId ] . name ;
this . changeChannelColor ( channelName , e . instance . props . threadId ) ;
}
}
}
2020-01-03 21:05:35 +01:00
2020-11-12 19:04:22 +01:00
processFocusRing ( e ) {
2021-02-04 22:51:39 +01:00
if ( e . returnvalue && e . returnvalue . props . className ) {
let change , channelId , nameClass , categoyClass , iconClass , modify = { } ;
2021-05-20 16:44:45 +02:00
if ( this . settings . places . channelList && e . returnvalue . props . className . indexOf ( BDFDB . disCN . categoryiconvisibility ) > - 1 ) {
2021-02-04 22:51:39 +01:00
change = true ;
2021-06-15 13:06:51 +02:00
channelId = ( BDFDB . ReactUtils . findValue ( e . returnvalue , "data-list-item-id" ) || "" ) . split ( "___" ) . pop ( ) ;
2021-02-04 22:51:39 +01:00
nameClass = BDFDB . disCN . categoryname ;
iconClass = BDFDB . disCN . categoryicon ;
modify = { muted : BDFDB . LibraryModules . MutedUtils . isGuildOrCategoryOrChannelMuted ( BDFDB . LibraryModules . LastGuildStore . getGuildId ( ) , channelId ) } ;
}
2021-05-20 16:44:45 +02:00
else if ( this . settings . places . searchPopout && e . returnvalue . props . className . indexOf ( BDFDB . disCN . searchpopoutoption ) > - 1 ) {
2021-02-04 22:51:39 +01:00
change = true ;
2021-02-09 14:00:29 +01:00
let channel = ( BDFDB . ReactUtils . findValue ( e . returnvalue . _owner , "result" , { up : true } ) || { } ) . channel ;
channelId = channel && channel . id ;
2021-02-04 22:51:39 +01:00
nameClass = BDFDB . disCN . searchpopoutresultchannel ;
categoyClass = BDFDB . disCN . searchpopoutsearchresultchannelcategory ;
iconClass = BDFDB . disCN . searchpopoutsearchresultchannelicon ;
}
2021-02-09 14:00:29 +01:00
if ( change && channelId ) {
2021-02-04 22:51:39 +01:00
if ( changedChannels [ channelId ] ) {
let name = nameClass && BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , nameClass ] ] } ) ;
if ( name ) {
name = name . props && name . props . children || name ;
this . changeChannelColor ( BDFDB . ArrayUtils . is ( name ) ? name . find ( c => c . type == "strong" ) || name [ 0 ] : name , channelId , modify ) ;
}
let icon = iconClass && BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , iconClass ] ] } ) ;
2021-05-26 23:00:39 +02:00
if ( icon ) this . changeChannelIconColor ( icon , channelId , modify ) ;
2021-02-04 22:51:39 +01:00
}
2021-02-07 22:42:56 +01:00
let categoryId = ( BDFDB . LibraryModules . ChannelStore . getChannel ( channelId ) || { } ) . parent _id ;
2021-02-04 22:51:39 +01:00
if ( categoryId && changedChannels [ categoryId ] ) {
let categoryName = categoyClass && BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , categoyClass ] ] } ) ;
if ( categoryName ) {
categoryName . props . children = this . getChannelData ( categoryId ) . name ;
this . changeChannelColor ( categoryName , categoryId , modify ) ;
}
}
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2020-11-12 19:04:22 +01:00
processChannelCategoryItem ( e ) {
2021-06-15 13:06:51 +02:00
if ( e . instance . props . channel && this . settings . places . channelList ) e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id , true , e . instance . props . channel ) ;
2020-11-12 19:04:22 +01:00
}
2021-07-28 23:04:01 +02:00
2020-09-19 20:49:33 +02:00
processChannelItem ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . channel && this . settings . places . channelList ) {
2021-06-15 13:06:51 +02:00
if ( ! e . returnvalue ) e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id , true , e . instance . props . channel ) ;
2020-09-19 20:49:33 +02:00
else {
let modify = BDFDB . ObjectUtils . extract ( Object . assign ( { } , e . instance . props , e . instance . state ) , "muted" , "locked" , "selected" , "unread" , "connected" , "hovered" ) ;
2021-04-08 16:00:33 +02:00
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . channelnameinner ] ] } ) ;
2020-09-19 20:49:33 +02:00
if ( channelName ) this . changeChannelColor ( channelName , e . instance . props . channel . id , modify ) ;
2021-05-20 16:44:45 +02:00
let channelIcon = this . settings . general . changeChannelIcon && BDFDB . ReactUtils . findChild ( e . returnvalue , { name : "ChannelItemIcon" } ) ;
2021-01-10 14:34:13 +01:00
if ( channelIcon && typeof channelIcon . type == "function" ) {
let type = channelIcon . type ;
2021-07-05 16:33:10 +02:00
channelIcon . type = BDFDB . TimeUtils . suppress ( ( ... args ) => {
2021-01-10 14:34:13 +01:00
let returnValue = type ( ... args ) ;
if ( returnValue && typeof returnValue . props . children == "function" ) {
let childrenRender = returnValue . props . children ;
2021-07-05 16:33:10 +02:00
returnValue . props . children = BDFDB . TimeUtils . suppress ( ( ... args2 ) => {
2021-01-10 14:34:13 +01:00
let renderedChildren = childrenRender ( ... args2 ) ;
2021-05-26 23:00:39 +02:00
this . changeChannelIconColor ( renderedChildren . props . children , e . instance . props . channel . id , modify ) ;
2021-01-10 14:34:13 +01:00
return renderedChildren ;
2021-07-05 16:33:10 +02:00
} , "" , this ) ;
2021-01-10 14:34:13 +01:00
}
return returnValue ;
2021-07-05 16:33:10 +02:00
} , "" , this ) ;
2021-01-10 14:34:13 +01:00
}
2020-09-19 20:49:33 +02:00
}
2020-01-03 21:05:35 +01:00
}
}
2021-01-09 22:06:27 +01:00
2021-07-28 23:04:01 +02:00
processGuildSidebarThreadListEntry ( e ) {
if ( e . instance . props . thread && this . settings . places . channelList ) {
if ( ! e . returnvalue ) e . instance . props . thread = this . getChannelData ( e . instance . props . thread . id , true , e . instance . props . thread ) ;
else {
let modify = BDFDB . ObjectUtils . extract ( Object . assign ( { } , e . instance . props , e . instance . state ) , "muted" , "locked" , "selected" , "unread" , "connected" , "hovered" ) ;
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . channelnameinner ] ] } ) ;
if ( channelName ) this . changeChannelColor ( channelName , e . instance . props . thread . id , modify ) ;
}
}
}
2021-01-09 22:06:27 +01:00
processDirectMessage ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . channel && e . instance . props . channel . isGroupDM ( ) && this . settings . places . recentDms ) {
2021-06-09 17:52:32 +02:00
if ( changedChannels [ e . instance . props . channel . id ] && changedChannels [ e . instance . props . channel . id ] . name ) {
let tooltip = BDFDB . ReactUtils . findChild ( e . returnvalue , { name : "ListItemTooltip" } ) ;
if ( tooltip ) tooltip . props . text = this . getGroupName ( e . instance . props . channel . id ) ;
}
2021-01-09 22:06:27 +01:00
let avatar = BDFDB . ReactUtils . findChild ( e . returnvalue , { filter : c => c && c . props && ! isNaN ( parseInt ( c . props . id ) ) } ) ;
if ( avatar && typeof avatar . props . children == "function" ) {
let childrenRender = avatar . props . children ;
2021-07-05 16:33:10 +02:00
avatar . props . children = BDFDB . TimeUtils . suppress ( ( ... args ) => {
2021-01-09 22:06:27 +01:00
let renderedChildren = childrenRender ( ... args ) ;
if ( renderedChildren && renderedChildren . props ) renderedChildren . props . icon = this . getGroupIcon ( e . instance . props . channel . id ) ;
return renderedChildren ;
2021-07-05 16:33:10 +02:00
} , "" , this ) ;
2021-01-09 22:06:27 +01:00
}
}
}
processPrivateChannel ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . channel && e . instance . props . channel . isGroupDM ( ) && this . settings . places . channelList ) {
2021-06-09 17:52:32 +02:00
if ( changedChannels [ e . instance . props . channel . id ] && changedChannels [ e . instance . props . channel . id ] . name ) {
e . returnvalue . props . name = BDFDB . ReactUtils . createElement ( "span" , { children : this . getGroupName ( e . instance . props . channel . id ) } ) ;
}
2021-01-09 22:06:27 +01:00
this . changeChannelColor ( e . returnvalue . props . name , e . instance . props . channel . id , { modify : BDFDB . ObjectUtils . extract ( Object . assign ( { } , e . instance . props , e . instance . state ) , "hovered" , "selected" , "hasUnreadMessages" , "muted" ) } ) ;
e . returnvalue . props . name = [ e . returnvalue . props . name ] ;
e . returnvalue . props . avatar . props . src = this . getGroupIcon ( e . instance . props . channel . id ) ;
}
}
2020-09-19 20:49:33 +02:00
processQuickSwitchChannelResult ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . channel && this . settings . places . quickSwitcher ) {
2020-09-19 20:49:33 +02:00
if ( ! e . returnvalue ) {
e . instance . props . channel = this . getChannelData ( e . instance . props . channel . id ) ;
if ( e . instance . props . category ) e . instance . props . category = this . getChannelData ( e . instance . props . category . id ) ;
}
else {
let modify = BDFDB . ObjectUtils . extract ( e . instance . props , "focused" , "unread" , "mentions" ) ;
2020-11-19 16:51:14 +01:00
let channelName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . quickswitchresultmatch ] ] } ) ;
2020-09-19 20:49:33 +02:00
if ( channelName ) this . changeChannelColor ( channelName , e . instance . props . channel . id , modify ) ;
2020-11-19 16:51:14 +01:00
let channelIcon = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . quickswitchresulticon ] ] } ) ;
2021-05-26 23:00:39 +02:00
if ( channelIcon ) this . changeChannelIconColor ( channelIcon , e . instance . props . channel . id , modify ) ;
2020-09-19 20:49:33 +02:00
if ( e . instance . props . category ) {
2020-11-19 16:51:14 +01:00
let categoryName = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . quickswitchresultnote ] ] } ) ;
2020-09-19 20:49:33 +02:00
if ( categoryName ) this . changeChannelColor ( categoryName , e . instance . props . category . id ) ;
}
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
}
2021-02-04 22:51:39 +01:00
processSearchPopoutComponent ( e ) {
2021-05-20 16:44:45 +02:00
if ( BDFDB . ArrayUtils . is ( BDFDB . ObjectUtils . get ( e , "instance.props.resultsState.autocompletes" ) ) && this . settings . places . searchPopout ) {
2021-02-04 22:51:39 +01:00
for ( let autocomplete of e . instance . props . resultsState . autocompletes ) if ( autocomplete && BDFDB . ArrayUtils . is ( autocomplete . results ) ) for ( let result of autocomplete . results ) if ( result . channel ) result . channel = this . getChannelData ( result . channel . id ) ;
}
}
processSearchResultsInner ( e ) {
2021-05-20 16:44:45 +02:00
if ( this . settings . places . searchResults ) {
2021-02-04 22:51:39 +01:00
let results = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "id" , "search-results" ] ] } ) ;
if ( results && BDFDB . ArrayUtils . is ( results . props . children ) ) for ( let group of results . props . children ) {
2021-02-07 22:42:56 +01:00
let channelId = ( BDFDB . ObjectUtils . get ( group , "props.children.key" ) || "" ) . split ( "-" ) [ 0 ] ;
2021-02-04 22:51:39 +01:00
let channelName = channelId && changedChannels [ channelId ] && BDFDB . ReactUtils . findChild ( group , { props : [ [ "className" , BDFDB . disCN . searchresultschannelname ] ] } ) ;
if ( channelName ) {
if ( changedChannels [ channelId ] . name ) channelName . props . children = "#" + changedChannels [ channelId ] . name ;
this . changeChannelColor ( channelName , channelId ) ;
}
}
}
}
2020-09-19 20:49:33 +02:00
processRecentsChannelHeader ( e ) {
2021-05-20 16:44:45 +02:00
if ( this . settings . places . recentMentions && BDFDB . ArrayUtils . is ( e . returnvalue . props . children ) ) {
2020-09-19 20:49:33 +02:00
for ( let child of e . returnvalue . props . children ) if ( child && child . props && child . props . channel && child . type . displayName == "ChannelName" ) {
child . props . channel = this . getChannelData ( child . props . channel . id ) ;
let oldType = child . type ;
child . type = ( ... args ) => {
let instance = oldType ( ... args ) ;
2020-11-19 16:51:14 +01:00
let channelName = BDFDB . ReactUtils . findChild ( instance , { props : [ [ "className" , BDFDB . disCN . recentmentionschannelname ] ] } ) ;
2020-09-19 20:49:33 +02:00
if ( channelName ) this . changeChannelColor ( channelName , child . props . channel . id ) ;
return instance ;
} ;
child . type . displayName = oldType . displayName ;
}
2020-01-03 21:05:35 +01:00
}
}
2020-09-19 20:49:33 +02:00
processMessageContent ( e ) {
2021-05-20 16:44:45 +02:00
if ( BDFDB . ArrayUtils . is ( e . instance . props . content ) && this . settings . places . mentions ) for ( let ele of e . instance . props . content ) {
2020-09-19 20:49:33 +02:00
if ( BDFDB . ReactUtils . isValidElement ( ele ) && ele . type && ele . type . displayName == "Tooltip" && typeof ele . props . children == "function" ) {
let children = ele . props . children ( { } ) ;
2021-07-28 23:04:01 +02:00
if ( children && children . type . displayName == "Mention" ) {
const checkChild = label => {
if ( label [ 0 ] != "#" ) return ;
let channelName = label . slice ( 1 ) ;
let guildId = BDFDB . LibraryModules . LastGuildStore . getGuildId ( ) ;
let channels = guildId && [ ] . concat ( BDFDB . LibraryModules . GuildChannelStore . getChannels ( guildId ) . SELECTABLE , Object . keys ( BDFDB . LibraryModules . ThreadStore . getThreadsForGuild ( guildId ) ) . map ( id => ( { channel : BDFDB . LibraryModules . ChannelStore . getChannel ( id ) } ) ) ) ;
if ( BDFDB . ArrayUtils . is ( channels ) ) for ( let channelObj of channels ) {
if ( channelName == channelObj . channel . name ) {
let category = BDFDB . LibraryModules . ChannelStore . getChannel ( channelObj . channel . parent _id ) ;
if ( ! category || category && ele . props . text == category . name ) {
if ( category ) {
let categoryData = changedChannels [ category . id ] ;
if ( categoryData && categoryData . name ) ele . props . text = categoryData . name ;
}
let name = ( changedChannels [ channelObj . channel . id ] || { } ) . name ;
let color = this . getChannelDataColor ( channelObj . channel . id ) ;
if ( name || color ) {
let renderChildren = ele . props . children ;
ele . props . children = ( ... args ) => {
let children = renderChildren ( ... args ) ;
this . changeMention ( children , { name , color } ) ;
return children ;
}
2020-02-04 08:20:40 +01:00
}
2021-07-28 23:04:01 +02:00
break ;
2020-01-03 21:05:35 +01:00
}
}
}
2021-07-28 23:04:01 +02:00
} ;
if ( typeof children . props . children == "string" ) checkChild ( children . props . children ) ;
else if ( BDFDB . ArrayUtils . is ( children . props . children ) ) for ( let i in children . props . children ) {
if ( typeof children . props . children [ i ] == "string" ) checkChild ( children . props . children [ i ] ) ;
else if ( BDFDB . ArrayUtils . is ( children . props . children [ i ] ) ) for ( let j in children . props . children [ i ] ) if ( typeof children . props . children [ i ] [ j ] == "string" ) checkChild ( children . props . children [ i ] [ j ] ) ;
2020-01-03 21:05:35 +01:00
}
}
}
}
}
2020-12-04 22:38:52 +01:00
2021-02-24 17:32:17 +01:00
processRichChannelMention ( e ) {
2021-05-20 16:44:45 +02:00
if ( e . instance . props . id && this . settings . places . mentions ) {
2020-12-04 22:38:52 +01:00
let name = ( changedChannels [ e . instance . props . id ] || { } ) . name ;
let color = this . getChannelDataColor ( e . instance . props . id ) ;
if ( name || color ) {
if ( typeof e . returnvalue . props . children == "function" ) {
let renderChildren = e . returnvalue . props . children ;
2021-07-05 16:33:10 +02:00
e . returnvalue . props . children = BDFDB . TimeUtils . suppress ( ( ... args ) => {
2020-12-04 22:38:52 +01:00
let children = renderChildren ( ... args ) ;
this . changeMention ( children , { name , color } ) ;
return children ;
2021-07-05 16:33:10 +02:00
} , "" , this ) ;
2020-12-04 22:38:52 +01:00
}
else this . changeMention ( e . returnvalue , { name , color } ) ;
}
}
}
changeMention ( mention , data ) {
2021-07-29 20:47:38 +02:00
if ( ! mention ) return ;
2020-12-04 22:38:52 +01:00
if ( data . name ) {
2021-07-28 23:04:01 +02:00
const changeMentionName = ( child , name ) => {
if ( ! child ) return ;
if ( BDFDB . ArrayUtils . is ( child ) ) for ( let i in child ) {
if ( typeof child [ i ] == "string" && child [ i ] [ 0 ] == "#" ) {
if ( child [ i ] == "#" ) child [ parseInt ( i ) + 1 ] = data . name ;
else child [ i ] = "#" + data . name ;
}
else changeMentionName ( child [ i ] ) ;
}
else if ( child . props && typeof child . props . children == "string" && child . props . children [ 0 ] == "#" ) child . props . children = "#" + data . name ;
else if ( child . props && BDFDB . ArrayUtils . is ( child . props . children ) ) changeMentionName ( child . props . children ) ;
2020-12-04 22:38:52 +01:00
} ;
2021-07-28 23:04:01 +02:00
changeMentionName ( mention ) ;
2020-12-04 22:38:52 +01:00
}
2021-07-28 23:04:01 +02:00
if ( data . color ) mention . props . color = BDFDB . ColorUtils . convert ( BDFDB . ObjectUtils . is ( data . color ) ? data . color [ 0 ] : data . color , "INT" ) ;
2020-12-04 22:38:52 +01:00
}
2020-01-03 21:05:35 +01:00
2021-01-06 12:38:36 +01:00
changeAppTitle ( ) {
2021-06-09 17:52:32 +02:00
if ( this . settings . places . appTitle ) {
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( BDFDB . LibraryModules . LastChannelStore . getChannelId ( ) ) ;
let title = document . head . querySelector ( "title" ) ;
2021-06-25 20:59:12 +02:00
if ( title && channel && changedChannels [ channel . id ] && changedChannels [ channel . id ] . name ) {
2021-06-09 17:52:32 +02:00
if ( BDFDB . ChannelUtils . isTextChannel ( channel ) ) BDFDB . DOMUtils . setText ( title , "#" + this . getChannelData ( channel . id ) . name ) ;
else if ( channel && channel . isGroupDM ( ) ) BDFDB . DOMUtils . setText ( title , this . getGroupName ( channel . id ) ) ;
}
2021-01-09 22:06:27 +01:00
}
2020-09-19 20:49:33 +02:00
}
changeChannelColor ( child , channelId , modify ) {
if ( BDFDB . ReactUtils . isValidElement ( child ) ) {
let color = this . getChannelDataColor ( channelId ) ;
if ( color ) {
color = modify ? this . chooseColor ( color , modify ) : BDFDB . ColorUtils . convert ( color , "RGBA" ) ;
let childProp = child . props . children ? "children" : "text" ;
let fontGradient = BDFDB . ObjectUtils . is ( color ) ;
if ( fontGradient ) child . props [ childProp ] = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextGradientElement , {
gradient : BDFDB . ColorUtils . createGradient ( color ) ,
children : child . props [ childProp ]
} ) ;
else child . props [ childProp ] = BDFDB . ReactUtils . createElement ( "span" , {
style : { color : color } ,
children : child . props [ childProp ]
} ) ;
}
2020-07-08 16:32:07 +02:00
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
changeChannelIconColor ( child , channelId , modify ) {
2021-01-10 14:34:13 +01:00
let color = child && this . getChannelDataColor ( channelId ) ;
2021-05-20 16:44:45 +02:00
if ( color && this . settings . general . changeChannelIcon ) {
2020-09-19 20:49:33 +02:00
color = modify ? this . chooseColor ( BDFDB . ObjectUtils . is ( color ) ? color [ 0 ] : color , modify ) : BDFDB . ColorUtils . convert ( BDFDB . ObjectUtils . is ( color ) ? color [ 0 ] : color , "RGBA" ) ;
2021-07-28 23:04:01 +02:00
if ( color ) {
child . props . foreground = null ;
child . props . color = color || "currentColor" ;
child . props . children = [ child . props . children ] . flat ( 10 ) . filter ( n => n ) ;
for ( let c of child . props . children ) {
if ( c && c . props && c . props . fill == "currentColor" ) c . props . fill = color || "currentColor" ;
if ( c && c . props && c . props . path == "currentColor" ) c . props . path = color || "currentColor" ;
}
}
2020-09-19 20:49:33 +02:00
}
2020-03-08 14:07:16 +01:00
}
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
chooseColor ( color , config ) {
if ( color ) {
if ( BDFDB . ObjectUtils . is ( config ) ) {
if ( config . mentions || config . focused || config . hovered || config . selected || config . unread || config . connected ) color = BDFDB . ColorUtils . change ( color , 0.5 ) ;
else if ( config . muted || config . locked ) color = BDFDB . ColorUtils . change ( color , - 0.5 ) ;
}
return BDFDB . ColorUtils . convert ( color , "RGBA" ) ;
2020-01-03 21:05:35 +01:00
}
2020-09-19 20:49:33 +02:00
return null ;
2020-01-03 21:05:35 +01:00
}
2020-09-19 20:49:33 +02:00
getChannelDataColor ( channelId ) {
2021-06-15 19:08:38 +02:00
if ( changedChannels [ channelId ] && changedChannels [ channelId ] . color ) return changedChannels [ channelId ] . color ;
2020-09-19 20:49:33 +02:00
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( channelId ) ;
2021-07-29 20:47:38 +02:00
let category = channel && ( BDFDB . ChannelUtils . isThread ( channel ) ? BDFDB . LibraryModules . ChannelStore . getChannel ( ( BDFDB . LibraryModules . ChannelStore . getChannel ( BDFDB . LibraryModules . ChannelStore . getChannel ( channel . id ) . parent _id ) || { } ) . parent _id ) : BDFDB . LibraryModules . ChannelStore . getChannel ( channel . parent _id ) ) ;
2021-06-15 13:06:51 +02:00
if ( category && changedChannels [ category . id ] && changedChannels [ category . id ] . inheritColor && changedChannels [ category . id ] . color ) return changedChannels [ category . id ] . color ;
2020-09-19 20:49:33 +02:00
return null ;
2020-02-04 08:20:40 +01:00
}
2020-06-08 20:50:04 +02:00
2021-06-15 13:06:51 +02:00
getChannelData ( channelId , change = true , fallbackData ) {
2020-09-19 20:49:33 +02:00
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( channelId ) ;
2021-06-15 13:06:51 +02:00
if ( ! channel && BDFDB . ObjectUtils . is ( fallbackData ) || channel && BDFDB . ObjectUtils . is ( fallbackData ) && channel . name != fallbackData . name ) channel = fallbackData ;
2020-09-19 20:49:33 +02:00
if ( ! channel ) return new BDFDB . DiscordObjects . Channel ( { } ) ;
let data = change && changedChannels [ channel . id ] ;
if ( data ) {
let nativeObject = new BDFDB . DiscordObjects . Channel ( channel ) ;
nativeObject . name = data . name || nativeObject . name ;
return nativeObject ;
}
return new BDFDB . DiscordObjects . Channel ( channel ) ;
}
2021-01-09 22:06:27 +01:00
2021-06-09 17:52:32 +02:00
getGroupName ( channelId ) {
let channel = this . getChannelData ( channelId ) ;
2021-01-09 22:06:27 +01:00
if ( channel . name ) return channel . name ;
let recipients = channel . recipients . map ( BDFDB . LibraryModules . UserStore . getUser ) . filter ( n => n ) ;
return recipients . length > 0 ? recipients . map ( u => u . toString ( ) ) . join ( ", " ) : BDFDB . LanguageUtils . LanguageStrings . UNNAMED ;
}
getGroupIcon ( channelId , change = true ) {
let channel = BDFDB . LibraryModules . ChannelStore . getChannel ( channelId ) ;
if ( ! channel ) return "" ;
let data = change && changedChannels [ channel . id ] ;
if ( data ) {
if ( data . removeIcon ) return "" ;
else if ( data . url ) return data . url ;
}
return BDFDB . LibraryModules . IconUtils . getChannelIconURL ( channel ) ;
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
openChannelSettingsModal ( channel ) {
let data = changedChannels [ channel . id ] || { } ;
2021-01-29 17:59:14 +01:00
let newData = Object . assign ( { } , data ) ;
let iconInput ;
2020-09-19 20:49:33 +02:00
BDFDB . ModalUtils . open ( this , {
size : "MEDIUM" ,
2020-12-21 19:56:36 +01:00
header : this . labels . modal _header ,
2021-01-23 18:50:24 +01:00
subHeader : channel . name ,
2020-09-19 20:49:33 +02:00
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2020-12-21 19:56:36 +01:00
title : this . labels . modal _channelname ,
2021-01-29 17:59:14 +01:00
className : BDFDB . disCN . marginbottom20 ,
2020-09-19 20:49:33 +02:00
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
value : data . name ,
placeholder : channel . name ,
2021-01-29 17:59:14 +01:00
autoFocus : true ,
2021-01-29 20:04:13 +01:00
onChange : value => { newData . name = value ; }
2020-09-19 20:49:33 +02:00
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCN . dividerdefault
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2020-12-21 19:56:36 +01:00
title : this . labels . modal _colorpicker1 ,
2020-09-19 20:49:33 +02:00
className : BDFDB . disCN . marginbottom20 ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ColorSwatches , {
color : data . color ,
2021-01-29 20:04:13 +01:00
onColorChange : value => { newData . color = value ; }
2020-09-19 20:49:33 +02:00
} )
]
} ) ,
2021-01-09 22:06:27 +01:00
! channel . isGroupDM ( ) && BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
2020-09-19 20:49:33 +02:00
type : "Switch" ,
2020-10-14 21:08:41 +02:00
margin : 20 ,
2020-12-21 19:56:36 +01:00
label : this . labels . modal _inheritcolor ,
2020-09-19 20:49:33 +02:00
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
2021-01-09 22:06:27 +01:00
value : channel . isCategory ( ) && data . inheritColor ,
2021-01-29 17:59:14 +01:00
disabled : ! channel . isCategory ( ) ,
2021-01-29 20:04:13 +01:00
onChange : value => { newData . inheritColor = value ; }
2021-01-09 22:06:27 +01:00
} ) ,
2021-01-10 14:34:13 +01:00
channel . isGroupDM ( ) && BDFDB . ReactUtils . createElement ( "div" , {
2021-01-09 22:06:27 +01:00
className : BDFDB . disCN . marginbottom20 ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCNS . dividerdefault + BDFDB . disCN . marginbottom20
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
className : BDFDB . disCN . marginbottom8 ,
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
direction : BDFDB . LibraryComponents . Flex . Direction . HORIZONTAL ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormTitle , {
className : BDFDB . disCN . marginreset ,
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
children : this . labels . modal _channelicon
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
margin : 0 ,
grow : 0 ,
label : BDFDB . LanguageUtils . LanguageStrings . REMOVE ,
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
value : data . removeIcon ,
2021-01-29 19:48:09 +01:00
onChange : value => {
2021-01-29 17:59:14 +01:00
newData . removeIcon = value ;
if ( value ) {
delete iconInput . props . success ;
delete iconInput . props . errorMessage ;
iconInput . props . disabled = true ;
BDFDB . ReactUtils . forceUpdate ( iconInput ) ;
}
else {
iconInput . props . disabled = false ;
this . checkUrl ( iconInput . props . value , iconInput ) . then ( returnValue => {
newData . url = returnValue ;
} ) ;
2021-01-09 22:06:27 +01:00
}
}
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
success : ! data . removeIcon && data . url ,
maxLength : 100000000000000000000 ,
value : data . url ,
placeholder : BDFDB . DMUtils . getIcon ( channel . id ) ,
disabled : data . removeIcon ,
2021-01-29 17:59:14 +01:00
ref : instance => { if ( instance ) iconInput = instance ; } ,
2021-01-09 22:06:27 +01:00
onChange : ( value , instance ) => {
2021-01-29 17:59:14 +01:00
this . checkUrl ( value , instance ) . then ( returnValue => {
newData . url = returnValue ;
} ) ;
2021-01-09 22:06:27 +01:00
}
} )
]
2020-09-19 20:49:33 +02:00
} )
] ,
buttons : [ {
contents : BDFDB . LanguageUtils . LanguageStrings . SAVE ,
color : "BRAND" ,
close : true ,
2021-01-29 17:59:14 +01:00
onClick : _ => {
if ( newData . color != null && ! BDFDB . ObjectUtils . is ( newData . color ) ) {
if ( newData . color [ 0 ] < 30 && newData . color [ 1 ] < 30 && newData . color [ 2 ] < 30 ) newData . color = BDFDB . ColorUtils . change ( newData . color , 30 ) ;
else if ( newData . color [ 0 ] > 225 && newData . color [ 1 ] > 225 && newData . color [ 2 ] > 225 ) newData . color = BDFDB . ColorUtils . change ( newData . color , - 30 ) ;
2020-09-19 20:49:33 +02:00
}
2021-01-29 17:59:14 +01:00
newData . url = ! newData . removeIcon ? newData . url : "" ;
2020-09-19 20:49:33 +02:00
let changed = false ;
2021-01-29 17:59:14 +01:00
if ( Object . keys ( newData ) . every ( key => newData [ key ] == null || newData [ key ] == false ) && ( changed = true ) ) {
BDFDB . DataUtils . remove ( this , "channels" , channel . id ) ;
}
else if ( ! BDFDB . equals ( newData , data ) && ( changed = true ) ) {
BDFDB . DataUtils . save ( newData , this , "channels" , channel . id ) ;
}
2020-10-30 15:54:55 +01:00
if ( changed ) this . forceUpdateAll ( true ) ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
} ]
} ) ;
2020-02-04 08:20:40 +01:00
}
2021-01-09 22:06:27 +01:00
checkUrl ( url , instance ) {
2021-01-29 17:59:14 +01:00
return new Promise ( callback => {
BDFDB . TimeUtils . clear ( instance . checkTimeout ) ;
url = url && url . trim ( ) ;
if ( ! url || instance . props . disabled ) {
delete instance . props . success ;
delete instance . props . errorMessage ;
callback ( "" ) ;
BDFDB . ReactUtils . forceUpdate ( instance ) ;
}
else instance . checkTimeout = BDFDB . TimeUtils . timeout ( _ => {
BDFDB . LibraryRequires . request ( url , ( error , response , result ) => {
delete instance . checkTimeout ;
if ( instance . props . disabled ) {
delete instance . props . success ;
delete instance . props . errorMessage ;
callback ( "" ) ;
}
else if ( response && response . headers [ "content-type" ] && response . headers [ "content-type" ] . indexOf ( "image" ) != - 1 ) {
instance . props . success = true ;
delete instance . props . errorMessage ;
callback ( url ) ;
}
else {
delete instance . props . success ;
instance . props . errorMessage = this . labels . modal _invalidurl ;
callback ( "" ) ;
}
BDFDB . ReactUtils . forceUpdate ( instance ) ;
} ) ;
} , 1000 ) ;
} ) ;
2021-01-09 22:06:27 +01:00
}
2020-07-26 17:02:25 +02:00
2021-01-06 12:38:36 +01:00
setLabelsByLanguage ( ) {
2020-09-19 20:49:33 +02:00
switch ( BDFDB . LanguageUtils . getLanguage ( ) . id ) {
2020-12-21 19:56:36 +01:00
case "bg" : // Bulgarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Наистина ли искате да нулирате този канал?" ,
confirm _resetall : "Наистина ли искате да нулирате всички канали?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Настройки на местния канал" ,
modal _channelname : "Име на местния канал" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Икона" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Локален цвят на канала" ,
modal _header : "Настройки на местния канал" ,
2020-12-22 20:38:51 +01:00
modal _inheritcolor : "Наследете цвета на подканали" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Невалиден адрес" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Промяна на настройките" ,
submenu _resetsettings : "Нулиране на канала"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "da" : // Danish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Er du sikker på, at du vil nulstille denne kanal?" ,
confirm _resetall : "Er du sikker på, at du vil nulstille alle kanaler?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Lokale kanalindstillinger" ,
modal _channelname : "Lokalt kanalnavn" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikon" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Lokal kanalfarve" ,
modal _header : "Lokale kanalindstillinger" ,
modal _inheritcolor : "Arv farve til underkanaler" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Ugyldig URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Ændre indstillinger" ,
submenu _resetsettings : "Nulstil kanal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "de" : // German
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Möchtest du diesen Kanal wirklich zurücksetzen?" ,
confirm _resetall : "Möchtest du wirklich alle Kanäle zurücksetzen?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Lokale Kanaleinstellungen" ,
modal _channelname : "Lokaler Kanalname" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Symbol" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Lokale Kanalfarbe" ,
modal _header : "Lokale Kanaleinstellungen" ,
modal _inheritcolor : "Vererbung der Farbe an Unterkanäle" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Ungültige URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Einstellungen ändern" ,
submenu _resetsettings : "Kanal zurücksetzen"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "el" : // Greek
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Είστε βέβαιοι ότι θέλετε ν α επαναφέρετε αυτό το κανάλι;" ,
confirm _resetall : "Είστε βέβαιοι ότι θέλετε ν α επαναφέρετε όλα τα κανάλια;" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Ρυθμίσεις τοπικού καναλιού" ,
modal _channelname : "Τοπικό όνομα καναλιού" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Εικόνισμα" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Τοπικό χρώμα καναλιού" ,
modal _header : "Ρυθμίσεις τοπικού καναλιού" ,
modal _inheritcolor : "Κληρονομήστε το χρώμα στα δευτερεύοντα κανάλια" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Μη έγκυρη διεύθυνση URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Αλλαξε ρυθμίσεις" ,
submenu _resetsettings : "Επαναφορά καναλιού"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "es" : // Spanish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "¿Estás seguro de que deseas restablecer este canal?" ,
confirm _resetall : "¿Está seguro de que desea restablecer todos los canales?" ,
context _localchannelsettings : "Configuración de canal local" ,
modal _channelname : "Nombre del canal local" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Icono" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Color del canal local" ,
modal _header : "Configuración de canal local" ,
2020-12-21 19:56:36 +01:00
modal _inheritcolor : "Heredar color a subcanales" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL invalida" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Cambiar ajustes" ,
submenu _resetsettings : "Restablecer canal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "fi" : // Finnish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Haluatko varmasti nollata tämän kanavan?" ,
confirm _resetall : "Haluatko varmasti nollata kaikki kanavat?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Paikallisen kanavan asetukset" ,
modal _channelname : "Paikallisen kanavan nimi" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Kuvake" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Paikallisen kanavan väri" ,
modal _header : "Paikallisen kanavan asetukset" ,
modal _inheritcolor : "Peri väri alikanaville" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Virheellinen URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Vaihda asetuksia" ,
submenu _resetsettings : "Nollaa kanava"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "fr" : // French
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Voulez-vous vraiment réinitialiser cette salon?" ,
confirm _resetall : "Voulez-vous vraiment réinitialiser toutes les salons?" ,
context _localchannelsettings : "Paramètres de la salon" ,
modal _channelname : "Nom local de la salon" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Icône" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Couleur locale de la salon" ,
modal _header : "Paramètres locaux de la salon" ,
modal _inheritcolor : "Hériter de la couleur aux sous-canaux" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL invalide" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Modifier les paramètres" ,
2020-12-22 20:38:51 +01:00
submenu _resetsettings : "Réinitialiser la salon"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "hr" : // Croatian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Jeste li sigurni da želite resetirati ovaj kanal?" ,
confirm _resetall : "Jeste li sigurni da želite resetirati sve kanale?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Postavke lokalnog kanala" ,
modal _channelname : "Naziv lokalnog kanala" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikona" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Lokalna boja kanala" ,
2020-12-21 19:56:36 +01:00
modal _header : "Postavke lokalnog kanala" ,
modal _inheritcolor : "Naslijedi boju na podkanalima" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Neispravna poveznica" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Promijeniti postavke" ,
submenu _resetsettings : "Resetiraj kanal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "hu" : // Hungarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Biztosan vissza akarja állítani ezt a csatornát?" ,
confirm _resetall : "Biztosan visszaállítja az összes csatornát?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Helyi csatorna beállításai" ,
modal _channelname : "Helyi csatorna neve" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikon" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Helyi csatorna színe" ,
modal _header : "Helyi csatorna beállításai" ,
modal _inheritcolor : "Örökli a színt az alcsatornákra" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Érvénytelen URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Beállítások megváltoztatása" ,
submenu _resetsettings : "Csatorna visszaállítása"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "it" : // Italian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Sei sicuro di voler ripristinare questo canale?" ,
confirm _resetall : "Sei sicuro di voler ripristinare tutti i canali?" ,
context _localchannelsettings : "Impostazioni del canale locale" ,
modal _channelname : "Nome canale locale" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Icona" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Colore canale locale" ,
modal _header : "Impostazioni del canale locale" ,
2020-12-21 19:56:36 +01:00
modal _inheritcolor : "Eredita colore ai canali secondari" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL non valido" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Cambia impostazioni" ,
submenu _resetsettings : "Reimposta canale"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ja" : // Japanese
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "このチャンネルをリセットしてもよろしいですか?" ,
confirm _resetall : "すべてのチャンネルをリセットしてもよろしいですか?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "ローカルチャンネル設定" ,
modal _channelname : "ローカルチャネル名" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "アイコン" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "ローカルチャンネルの色" ,
modal _header : "ローカルチャンネル設定" ,
modal _inheritcolor : "サブチャネルに色を継承する" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "無効なURL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "設定を変更する" ,
submenu _resetsettings : "チャネルをリセット"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ko" : // Korean
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "이 채널을 재설정 하시겠습니까?" ,
confirm _resetall : "모든 채널을 재설정 하시겠습니까?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "로컬 채널 설정" ,
modal _channelname : "로컬 채널 이름" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "상" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "로컬 채널 색상" ,
modal _header : "로컬 채널 설정" ,
modal _inheritcolor : "하위 채널에 색상 상속" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "잘못된 URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "설정 변경" ,
submenu _resetsettings : "채널 재설정"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "lt" : // Lithuanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Ar tikrai norite iš naujo nustatyti šį kanalą?" ,
confirm _resetall : "Ar tikrai norite iš naujo nustatyti visus kanalus?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Vietinio kanalo nustatymai" ,
modal _channelname : "Vietinio kanalo pavadinimas" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Piktograma" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Vietinio kanalo spalva" ,
modal _header : "Vietinio kanalo nustatymai" ,
modal _inheritcolor : "Paveldėkite spalvas subkanalams" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Neteisingas URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Pakeisti nustatymus" ,
submenu _resetsettings : "Iš naujo nustatyti kanalą"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "nl" : // Dutch
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Weet u zeker dat u dit kanaal opnieuw wilt instellen?" ,
confirm _resetall : "Weet u zeker dat u alle kanalen opnieuw wilt instellen?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Lokale kanaalinstellingen" ,
modal _channelname : "Lokale kanaalnaam" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Icoon" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Lokale kanaalkleur" ,
2020-12-21 19:56:36 +01:00
modal _header : "Lokale kanaalinstellingen" ,
2020-12-22 20:38:51 +01:00
modal _inheritcolor : "Overerf kleur naar subkanalen" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Ongeldige URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Instellingen veranderen" ,
submenu _resetsettings : "Kanaal resetten"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "no" : // Norwegian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Er du sikker på at du vil tilbakestille denne kanalen?" ,
confirm _resetall : "Er du sikker på at du vil tilbakestille alle kanaler?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Lokale kanalinnstillinger" ,
modal _channelname : "Lokalt kanalnavn" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikon" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Lokal kanalfarge" ,
modal _header : "Lokale kanalinnstillinger" ,
modal _inheritcolor : "Arv farge til underkanaler" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Ugyldig URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Endre innstillinger" ,
submenu _resetsettings : "Tilbakestill kanal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "pl" : // Polish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Czy na pewno chcesz zresetować ten kanał?" ,
confirm _resetall : "Czy na pewno chcesz zresetować wszystkie kanały?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Ustawienia kanału lokalnego" ,
modal _channelname : "Nazwa kanału lokalnego" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikona" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Kolor kanału lokalnego" ,
modal _header : "Ustawienia kanału lokalnego" ,
modal _inheritcolor : "Dziedzicz kolor do kanałów podrzędnych" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Nieprawidłowy URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Zmień ustawienia" ,
submenu _resetsettings : "Resetuj kanał"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "pt-BR" : // Portuguese (Brazil)
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Tem certeza que deseja redefinir este canal?" ,
confirm _resetall : "Tem certeza de que deseja redefinir todos os canais?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Configurações de canal local" ,
modal _channelname : "Nome do canal local" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ícone" ,
2020-12-22 20:38:51 +01:00
modal _colorpicker1 : "Cor do Canal Local" ,
2020-12-21 19:56:36 +01:00
modal _header : "Configurações de canal local" ,
modal _inheritcolor : "Herdar cor para subcanais" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL inválida" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Mudar configurações" ,
submenu _resetsettings : "Reiniciar canal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ro" : // Romanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Sigur doriți să resetați acest canal?" ,
confirm _resetall : "Sigur doriți să resetați toate canalele?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Setări canale locale" ,
modal _channelname : "Numele canalului local" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Pictogramă" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Culoare canal local" ,
modal _header : "Setări canale locale" ,
modal _inheritcolor : "Moșteniți culoarea la sub-canale" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL invalid" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Schimbă setările" ,
submenu _resetsettings : "Resetați canalul"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ru" : // Russian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Вы уверены, что хотите сбросить этот канал?" ,
confirm _resetall : "Вы уверены, что хотите сбросить все каналы?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Настройки локального канала" ,
modal _channelname : "Имя локального канала" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Икона" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Цвет локального канала" ,
modal _header : "Настройки локального канала" ,
modal _inheritcolor : "Наследовать цвет для субканалов" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Неверная ссылка" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Изменить настройки" ,
submenu _resetsettings : "Сбросить канал"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "sv" : // Swedish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Är du säker på att du vill återställa den här kanalen?" ,
confirm _resetall : "Är du säker på att du vill återställa alla kanaler?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Lokala kanalinställningar" ,
modal _channelname : "Lokalt kanalnamn" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Ikon" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Lokal kanalfärg" ,
modal _header : "Lokala kanalinställningar" ,
modal _inheritcolor : "Ärva färg till underkanaler" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Ogiltig URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Ändra inställningar" ,
submenu _resetsettings : "Återställ kanal"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "th" : // Thai
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "แน่ใจไหมว่าต้องการรีเซ็ตช่องนี้" ,
confirm _resetall : "แน่ใจไหมว่าต้องการรีเซ็ตช่องทั้งหมด" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "การตั้งค่าช่องท้องถิ่น" ,
modal _channelname : "ชื่อช่องท้องถิ่น" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "ไอคอน" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "ช่องท้องถิ่นสี" ,
modal _header : "การตั้งค่าช่องท้องถิ่น" ,
modal _inheritcolor : "สืบทอดสีไปยังช่องย่อย" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL ไม่ถูกต้อง" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "เปลี่ยนการตั้งค่า" ,
submenu _resetsettings : "รีเซ็ตช่อง"
} ;
case "tr" : // Turkish
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Bu kanalı sı fı rlamak istediğinizden emin misiniz?" ,
confirm _resetall : "Tüm kanalları sı fı rlamak istediğinizden emin misiniz?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Yerel Kanal Ayarları " ,
modal _channelname : "Yerel Kanal Adı " ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Simge" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Yerel Kanal Rengi" ,
modal _header : "Yerel Kanal Ayarları " ,
modal _inheritcolor : "Renkleri Alt Kanallara Devral" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Geçersiz URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Ayarları değiştir" ,
submenu _resetsettings : "Kanalı Sı fı rla"
} ;
case "uk" : // Ukrainian
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Справді скинути цей канал?" ,
confirm _resetall : "Ви впевнені, що хочете скинути всі канали?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Налаштування локального каналу" ,
modal _channelname : "Назва місцевого каналу" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Піктограма" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Колір локального каналу" ,
modal _header : "Налаштування локального каналу" ,
modal _inheritcolor : "Успадковувати колір для підканалів" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Недійсна URL-адреса" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Змінити налаштування" ,
submenu _resetsettings : "Скинути канал"
} ;
case "vi" : // Vietnamese
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Bạn có chắc chắn muốn đặt lại kênh này không?" ,
confirm _resetall : "Bạn có chắc chắn muốn đặt lại tất cả các kênh không?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Cài đặt kênh cục bộ" ,
modal _channelname : "Tên kênh địa phương" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Biểu tượng" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Màu kênh địa phương" ,
modal _header : "Cài đặt kênh cục bộ" ,
modal _inheritcolor : "Kế thừa màu cho các kênh phụ" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "URL không hợp lệ" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Thay đổi cài đặt" ,
submenu _resetsettings : "Đặt lại kênh"
} ;
2021-01-15 17:54:22 +01:00
case "zh-CN" : // Chinese (China)
2020-12-21 19:56:36 +01:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "您确定要重置此频道吗?" ,
confirm _resetall : "您确定要重置所有频道吗?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "本地频道设置" ,
modal _channelname : "本地频道名称" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "图标" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "本地频道颜色" ,
modal _header : "本地频道设置" ,
modal _inheritcolor : "继承颜色到子通道" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "无效的网址" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "更改设置" ,
submenu _resetsettings : "重置频道"
} ;
2021-01-15 17:54:22 +01:00
case "zh-TW" : // Chinese (Taiwan)
2020-12-21 19:56:36 +01:00
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "您確定要重置此頻道嗎?" ,
confirm _resetall : "您確定要重置所有頻道嗎?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "本地頻道設置" ,
modal _channelname : "本地頻道名稱" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "圖標" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "本地頻道顏色" ,
modal _header : "本地頻道設置" ,
modal _inheritcolor : "繼承顏色到子通道" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "無效的網址" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "更改設置" ,
submenu _resetsettings : "重置頻道"
} ;
default : // English
return {
2020-12-22 20:38:51 +01:00
confirm _reset : "Are you sure you want to reset this Channel?" ,
confirm _resetall : "Are you sure you want to reset all Channels?" ,
2020-12-21 19:56:36 +01:00
context _localchannelsettings : "Local Channel Settings" ,
modal _channelname : "Local Channel Name" ,
2021-01-09 22:06:27 +01:00
modal _channelicon : "Icon" ,
2020-12-21 19:56:36 +01:00
modal _colorpicker1 : "Local Channel Color" ,
modal _header : "Local Channel Settings" ,
modal _inheritcolor : "Inherit Color to Sub-Channels" ,
2021-01-29 17:59:14 +01:00
modal _invalidurl : "Invalid URL" ,
2020-12-21 19:56:36 +01:00
submenu _channelsettings : "Change Settings" ,
submenu _resetsettings : "Reset Channel"
2020-09-19 20:49:33 +02:00
} ;
}
}
} ;
2020-10-09 21:09:35 +02:00
} ) ( window . BDFDB _Global . PluginUtils . buildPlugin ( config ) ) ;
2020-12-15 17:45:31 +01:00
} ) ( ) ;