2019-09-20 22:32:52 +02:00
//META{"name":"PersonalPins","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/PersonalPins","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/PersonalPins/PersonalPins.plugin.js"}*//
2018-12-28 14:28:50 +01:00
class PersonalPins {
2019-01-17 23:48:29 +01:00
getName ( ) { return "PersonalPins" ; }
getDescription ( ) { return "Similar to normal pins. Lets you save messages as notes for yourself." ; }
2019-11-09 12:53:04 +01:00
getVersion ( ) { return "1.8.4" ; }
2019-01-17 23:48:29 +01:00
getAuthor ( ) { return "DevilBro" ; }
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
constructor ( ) {
2019-02-03 19:02:15 +01:00
this . changelog = {
2019-11-09 12:53:04 +01:00
"improved" : [ [ "New Library Structure & React" , "Restructured my Library and switched to React rendering instead of DOM manipulation" ] ]
2019-02-03 19:02:15 +01:00
} ;
2019-09-04 12:34:02 +02:00
2018-12-28 14:28:50 +01:00
this . patchModules = {
2019-11-09 12:53:04 +01:00
HeaderBarContainer : "render"
2018-12-28 14:28:50 +01:00
} ;
2019-09-04 12:34:02 +02:00
}
2019-01-26 22:45:19 +01:00
2018-12-28 14:28:50 +01:00
getSettingsPanel ( ) {
2019-01-22 11:28:32 +01:00
if ( ! global . BDFDB || typeof BDFDB != "object" || ! BDFDB . loaded || ! this . started ) return ;
2019-11-09 12:53:04 +01:00
let settingsitems = [ ] ;
settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Button" ,
className : BDFDB . disCN . marginbottom8 ,
color : BDFDB . LibraryComponents . Button . Colors . RED ,
label : "Delete all Notes" ,
onClick : _ => {
BDFDB . ModalUtils . confirm ( this , "Are you sure you want to delete all pinned notes?" , ( ) => {
BDFDB . DataUtils . remove ( this , "notes" ) ;
} ) ;
} ,
children : BDFDB . LanguageUtils . LanguageStrings . DELETE
} ) ) ;
return BDFDB . PluginUtils . createSettingsPanel ( this , settingsitems ) ;
2018-12-28 14:28:50 +01:00
}
//legacy
load ( ) { }
start ( ) {
2019-02-04 09:13:15 +01:00
if ( ! global . BDFDB ) global . BDFDB = { myPlugins : { } } ;
if ( global . BDFDB && global . BDFDB . myPlugins && typeof global . BDFDB . myPlugins == "object" ) global . BDFDB . myPlugins [ this . getName ( ) ] = this ;
2019-05-26 13:55:26 +02:00
var libraryScript = document . querySelector ( 'head script#BDFDBLibraryScript' ) ;
if ( ! libraryScript || ( performance . now ( ) - libraryScript . getAttribute ( "date" ) ) > 600000 ) {
2018-12-28 14:28:50 +01:00
if ( libraryScript ) libraryScript . remove ( ) ;
libraryScript = document . createElement ( "script" ) ;
2019-05-26 13:55:26 +02:00
libraryScript . setAttribute ( "id" , "BDFDBLibraryScript" ) ;
2018-12-28 14:28:50 +01:00
libraryScript . setAttribute ( "type" , "text/javascript" ) ;
2019-10-18 10:56:41 +02:00
libraryScript . setAttribute ( "src" , "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js" ) ;
2019-01-17 23:48:29 +01:00
libraryScript . setAttribute ( "date" , performance . now ( ) ) ;
2019-05-26 13:55:26 +02:00
libraryScript . addEventListener ( "load" , ( ) => { this . initialize ( ) ; } ) ;
2018-12-28 14:28:50 +01:00
document . head . appendChild ( libraryScript ) ;
}
2019-01-17 23:48:29 +01:00
else if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) this . initialize ( ) ;
2019-11-01 10:27:07 +01:00
this . startTimeout = setTimeout ( ( ) => {
try { return this . initialize ( ) ; }
catch ( err ) { console . error ( ` %c[ ${ this . getName ( ) } ]%c ` , "color: #3a71c1; font-weight: 700;" , "" , "Fatal Error: Could not initiate plugin! " + err ) ; }
} , 30000 ) ;
2018-12-28 14:28:50 +01:00
}
initialize ( ) {
2019-01-17 23:48:29 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
2019-01-22 11:05:54 +01:00
if ( this . started ) return ;
2019-10-22 18:55:25 +02:00
BDFDB . PluginUtils . init ( this ) ;
2019-11-09 12:53:04 +01:00
2019-11-09 12:53:27 +01:00
// REMOVE
2019-11-09 12:53:04 +01:00
let pins = BDFDB . DataUtils . load ( this , "pins" ) , notes = { } , olddata = 0 , resolveddata = 0 , loading = true , i = 0 ;
for ( let guild _id in pins ) {
notes [ guild _id ] = { } ;
for ( let channel _id in pins [ guild _id ] ) {
notes [ guild _id ] [ channel _id ] = { } ;
for ( let message _idPOS in pins [ guild _id ] [ channel _id ] ) olddata ++ ;
}
}
if ( olddata > 0 ) BDFDB . ModalUtils . confirm ( this , ` ${ this . name } found ${ olddata } instances of old saved notes. Press the "Okay" button to refetch the messages and update your old config. This will take around ${ ( olddata + 1 ) * 5 } seconds. ` , _ => {
BDFDB . TimeUtils . timeout ( _ => {
BDFDB . DataUtils . remove ( this , "pins" ) ;
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
loading = false ;
BDFDB . ModalUtils . confirm ( this , ` ${ resolveddata } of ${ olddata } pins could be transfered to the new format. ${ olddata - resolveddata > 0 ? " " + ( olddata - resolveddata ) + " could not be transfered because the message could no longer be found in discords data." : "" } ` , _ => { } ) ;
} , ( olddata + 1 ) * 5000 ) ;
for ( let guild _id in pins ) for ( let channel _id in pins [ guild _id ] ) for ( let message _idPOS in pins [ guild _id ] [ channel _id ] ) {
BDFDB . TimeUtils . timeout ( _ => { if ( loading ) BDFDB . LibraryModules . APIUtils . get ( BDFDB . DiscordConstants . Endpoints . MESSAGES ( pins [ guild _id ] [ channel _id ] [ message _idPOS ] . channel _id ) + "?limit=1&around=" + pins [ guild _id ] [ channel _id ] [ message _idPOS ] . id ) . then ( result => { if ( result && result . body && result . body [ 0 ] && result . body [ 0 ] . id == pins [ guild _id ] [ channel _id ] [ message _idPOS ] . id ) {
let note = { } ;
note . addedat = pins [ guild _id ] [ channel _id ] [ message _idPOS ] . addedat ;
note . channel = JSON . stringify ( BDFDB . LibraryModules . ChannelStore . getChannel ( channel _id ) ) ;
note . id = pins [ guild _id ] [ channel _id ] [ message _idPOS ] . id ;
note . message = JSON . stringify ( result . body [ 0 ] ) ;
note . pos = pins [ guild _id ] [ channel _id ] [ message _idPOS ] . pos ;
note . timestamp = pins [ guild _id ] [ channel _id ] [ message _idPOS ] . timestamp ;
notes [ guild _id ] [ channel _id ] [ message _idPOS ] = note ;
resolveddata ++ ;
} } ) } , i * 5000 ) ;
i ++ ;
}
} ) ;
2019-01-26 22:45:19 +01:00
2019-10-22 18:55:25 +02:00
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
2018-12-28 14:28:50 +01:00
}
2019-11-01 10:14:50 +01:00
else console . error ( ` %c[ ${ this . getName ( ) } ]%c ` , "color: #3a71c1; font-weight: 700;" , "" , "Fatal Error: Could not load BD functions!" ) ;
2018-12-28 14:28:50 +01:00
}
stop ( ) {
2019-01-17 23:48:29 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
2019-10-22 11:37:23 +02:00
this . stopping = true ;
2019-11-09 12:53:04 +01:00
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
2019-10-22 18:55:25 +02:00
BDFDB . PluginUtils . clear ( this ) ;
2018-12-28 14:28:50 +01:00
}
}
2019-01-26 22:45:19 +01:00
2018-12-28 14:28:50 +01:00
// begin of own functions
2019-01-26 22:45:19 +01:00
2019-11-09 12:53:04 +01:00
onMessageContextMenu ( e ) {
if ( e . instance . props && e . instance . props . message && e . instance . props . channel && e . instance . props . target ) {
let { messagediv , pos } = this . getMessageAndPos ( e . instance . props . target ) ;
2019-09-03 12:37:14 +02:00
if ( ! messagediv || pos == - 1 ) return ;
2019-11-09 12:53:04 +01:00
let note = this . getNoteData ( e . instance . props . message , e . instance . props . target , e . instance . props . channel ) ;
let [ children , index ] = BDFDB . ReactUtils . findChildren ( e . returnvalue , { name : "MessagePinItem" } ) ;
2019-10-22 18:55:25 +02:00
const pinUnpinItem = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ContextMenuItem , {
2019-09-11 12:14:43 +02:00
label : this . labels [ note ? "context_unpinoption_text" : "context_pinoption_text" ] ,
2019-10-23 11:10:01 +02:00
hint : BDFDB . BDUtils . isPluginEnabled ( "MessageUtilities" ) ? BDFDB . BDUtils . getPlugin ( "MessageUtilities" ) . getActiveShortcutString ( "__Note_Message" ) : null ,
2019-11-09 12:53:04 +01:00
action : _ => {
BDFDB . ContextMenuUtils . close ( e . instance ) ;
this . addMessageToNotes ( e . instance . props . message , e . instance . props . target , e . instance . props . channel ) ;
2019-09-11 12:14:43 +02:00
}
2019-01-12 15:07:06 +01:00
} ) ;
2019-09-11 12:14:43 +02:00
if ( index > - 1 ) children . splice ( index , 0 , pinUnpinItem ) ;
else children . push ( pinUnpinItem ) ;
2019-11-09 12:53:04 +01:00
if ( this . isNoteOutdated ( note , e . instance . props . message ) ) {
const updateItem = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ContextMenuItem , {
label : this . labels . context _updateoption _text ,
action : _ => {
BDFDB . ContextMenuUtils . close ( e . instance ) ;
this . updateNoteData ( note , e . instance . props . message ) ;
}
} ) ;
if ( index > - 1 ) children . splice ( index , 0 , updateItem ) ;
else children . push ( updateItem ) ;
2019-09-03 12:37:14 +02:00
}
2019-09-11 12:14:43 +02:00
}
}
2019-11-09 12:53:04 +01:00
onMessageOptionPopout ( e ) {
if ( e . instance . props . message && e . instance . props . channel && e . instance . props . target ) {
let { messagediv , pos } = this . getMessageAndPos ( e . instance . props . target ) ;
2019-09-11 12:14:43 +02:00
if ( ! messagediv || pos == - 1 ) return ;
2019-11-09 12:53:04 +01:00
let note = this . getNoteData ( e . instance . props . message , e . instance . props . target , e . instance . props . channel ) ;
let [ children , index ] = BDFDB . ReactUtils . findChildren ( e . returnvalue , { props : [ [ "label" , [ BDFDB . LanguageUtils . LanguageStrings . PIN , BDFDB . LanguageUtils . LanguageStrings . UNPIN ] ] ] } ) ;
2019-11-07 22:33:27 +01:00
children . splice ( index + 1 , 0 , BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ContextMenuItem , {
2019-09-11 12:14:43 +02:00
label : this . labels [ note ? "context_unpinoption_text" : "popout_pinoption_text" ] ,
2019-11-07 22:33:27 +01:00
className : BDFDB . disCN . optionpopoutitem ,
2019-11-09 12:53:04 +01:00
action : _ => {
this . addMessageToNotes ( e . instance . props . message , e . instance . props . target , e . instance . props . channel ) ;
e . instance . props . onClose ( ) ;
}
} ) ) ;
if ( this . isNoteOutdated ( note , e . instance . props . message ) ) children . splice ( index + 1 , 0 , BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ContextMenuItem , {
label : this . labels . context _updateoption _text ,
className : BDFDB . disCN . optionpopoutitem ,
action : _ => {
this . updateNoteData ( note , e . instance . props . message ) ;
e . instance . props . onClose ( ) ;
2019-09-11 12:14:43 +02:00
}
2019-11-07 22:33:27 +01:00
} ) ) ;
2018-12-28 14:28:50 +01:00
}
}
2019-09-04 12:34:02 +02:00
2019-11-09 12:53:04 +01:00
processHeaderBarContainer ( e ) {
let [ children , index ] = BDFDB . ReactUtils . findChildren ( BDFDB . ReactUtils . getValue ( e . returnvalue , "props.toolbar" ) , { name : "FluxContainer(Search)" } ) ;
if ( index > - 1 ) children . splice ( index , 0 , BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . PopoutContainer , {
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : this . labels . popout _note _text ,
tooltipConfig : { type : "bottom" } ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCNS . channelheadericonwrapper + BDFDB . disCN . channelheadericonclickable ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCNS . channelheadericon ,
iconSVG : ` <svg name="Note" width="24" height="24" viewBox="-1 -1 23 23"><path fill="currentColor" d="M 4.618, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 s 0.573 -0.256, 0.573 -0.573 V 0.573 C 5.191, 0.256, 4.935, 0, 4.618, 0 z"/><path fill="currentColor" d="M 8.053, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 s 0.573 -0.256, 0.573 -0.573 V 0.573 C 8.626, 0.256, 8.37, 0, 8.053, 0 z"/><path fill="currentColor" d="M 11.489, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 c 0.316, 0, 0.573 -0.256, 0.573 -0.573 V 0.573 C 12.061, 0.256, 11.805, 0, 11.489, 0 z "/><path fill="currentColor" d="M 14.924, 0 c -0.316, 0 -0.573, 0.256 -0.573, 0.573 v 1.145 c 0, 0.316, 0.256, 0.573, 0.573, 0.573 c 0.316, 0, 0.573 -0.256, 0.573 -0.573 V 0.573 C 15.496, 0.256, 15.24, 0, 14.924, 0 z"/><path fill="currentColor" d="M 16.641, 1.25 V 1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 c 0, 0.947 -0.77, 1.718 -1.718, 1.718 c -0.947, 0 -1.718 -0.77 -1.718 -1.718 V 1.25 C 2.236, 1.488, 1.756, 2.117, 1.756, 2.863 v 14.962 c 0, 0.947, 0.77, 1.718, 1.718, 1.718 h 12.595 c 0.947, 0, 1.718 -0.77, 1.718 -1.718 V 2.863 C 17.786, 2.117, 17.306, 1.488, 16.641, 1.25 z M 14.924, 16.679 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 c 0 -0.316, 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 C 15.496, 16.423, 15.24, 16.679, 14.924, 16.679 z M 14.924, 13.244 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 c 0 -0.316, 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 C 15.496, 12.988, 15.24, 13.244, 14.924, 13.244 z M 14.924, 9.733 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 s 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 S 15.24, 9.733, 14.924, 9.733 z M 14.924, 6.298 H 4.618 c -0.316, 0 -0.573 -0.256 -0.573 -0.573 s 0.256 -0.573, 0.573 -0.573 h 10.305 c 0.316, 0, 0.573, 0.256, 0.573, 0.573 S 15.24, 6.298, 14.924, 6.298 z"/></svg> `
} )
} )
} ) ,
popoutClassName : BDFDB . disCN . messagespopoutwrap ,
animation : BDFDB . LibraryComponents . PopoutContainer . Animation . SCALE ,
position : BDFDB . LibraryComponents . PopoutContainer . Positions . BOTTOM ,
align : BDFDB . LibraryComponents . PopoutContainer . Align . RIGHT ,
width : 500 ,
maxHeight : "calc(100vh - 100px)" ,
onClose : instance => {
BDFDB . DOMUtils . removeClass ( instance . domElementRef . current , BDFDB . disCN . channelheadericonselected ) ;
} ,
renderPopout : instance => {
BDFDB . DOMUtils . addClass ( instance . domElementRef . current , BDFDB . disCN . channelheadericonselected ) ;
return this . createNotesPopout ( instance ) ;
}
} ) ) ;
2019-04-23 14:03:21 +02:00
}
2019-11-09 12:53:04 +01:00
createNotesPopout ( buttoninstance ) {
let tabkeys = [ "channel" , "server" , "all" ] , sortkeys = [ "notetime" , "messagetime" ] ;
buttoninstance . props . selectedFilter = buttoninstance . props . selectedFilter || this . getValue ( tabkeys [ 0 ] , "filter" ) ;
buttoninstance . props . selectedSort = buttoninstance . props . selectedSort || this . getValue ( sortkeys [ 0 ] , "sort" ) ;
buttoninstance . props . searchKey = buttoninstance . props . searchKey || "" ;
return [
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . popoutheader + BDFDB . disCN . messagespopoutheader ,
style : {
paddingBottom : 0
} ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
className : BDFDB . disCNS . popouttitle + BDFDB . disCN . messagespopouttitle ,
children : this . labels . popout _note _text
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SearchBar , {
query : buttoninstance . props . searchKey ,
onChange : value => {
BDFDB . TimeUtils . clear ( this . searchTimeout ) ;
this . searchTimeout = BDFDB . TimeUtils . timeout ( _ => {
buttoninstance . props . searchKey = value ;
BDFDB . ReactUtils . forceUpdate ( buttoninstance . popout . _owner . stateNode ) ;
} , 1000 ) ;
} ,
onClear : _ => {
buttoninstance . props . searchKey = "" ;
BDFDB . ReactUtils . forceUpdate ( buttoninstance . popout . _owner . stateNode ) ;
}
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . tabbarheadercontainer ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TabBar , {
className : BDFDB . disCN . tabbarheader ,
itemClassName : BDFDB . disCN . tabbarheaderitem ,
type : BDFDB . LibraryComponents . TabBar . Types . TOP ,
selectedItem : buttoninstance . props . selectedFilter . value ,
items : tabkeys . map ( key => this . getValue ( key , "filter" ) ) ,
onItemSelect : key => {
buttoninstance . props . selectedFilter = this . getValue ( key , "filter" ) ;
BDFDB . ReactUtils . forceUpdate ( buttoninstance . popout . _owner . stateNode ) ;
}
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . QuickSelect , {
spacing : - 25 ,
label : this . labels . popout _sort _text + ":" ,
value : buttoninstance . props . selectedSort ,
options : sortkeys . map ( key => this . getValue ( key , "sort" ) ) ,
onChange : key => {
buttoninstance . props . selectedSort = this . getValue ( key , "sort" ) ;
BDFDB . ReactUtils . forceUpdate ( buttoninstance . popout . _owner . stateNode ) ;
}
} )
]
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ScrollerVertical , {
className : BDFDB . disCN . messagespopout ,
children : this . filterMessages ( buttoninstance , buttoninstance . props . selectedFilter . value , buttoninstance . props . selectedSort . value , buttoninstance . props . searchKey . toUpperCase ( ) )
} )
] ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
getValue ( key , type ) {
return {
label : this . labels [ ` popout_ ${ type } _ ${ key } _text ` ] ,
value : key
}
}
filterMessages ( buttoninstance , filter , sort , searchkey ) {
let lighttheme = BDFDB . DiscordUtils . getTheme ( ) == BDFDB . disCN . themelight ;
let messages = [ ] , notes = BDFDB . DataUtils . load ( this , "notes" ) , updatedata = false ;
for ( let guild _id in notes ) for ( let channel _id in notes [ guild _id ] ) for ( let message _idPOS in notes [ guild _id ] [ channel _id ] ) {
let message = JSON . parse ( notes [ guild _id ] [ channel _id ] [ message _idPOS ] . message ) ;
message . author = new BDFDB . DiscordObjects . User ( message . author ) ;
message . timestamp = new BDFDB . DiscordObjects . Timestamp ( message . timestamp ) ;
message . editedTimestamp = message . editedTimestamp && new BDFDB . DiscordObjects . Timestamp ( message . editedTimestamp ) ;
for ( let embed of message . embeds ) embed . timestamp = embed . timestamp && new BDFDB . DiscordObjects . Timestamp ( embed . timestamp ) ;
message = new BDFDB . DiscordObjects . Message ( message ) ;
let channel = notes [ guild _id ] [ channel _id ] [ message _idPOS ] . channel && new BDFDB . DiscordObjects . Channel ( JSON . parse ( notes [ guild _id ] [ channel _id ] [ message _idPOS ] . channel ) ) ;
if ( ! channel ) {
channel = BDFDB . LibraryModules . ChannelStore . getChannel ( message . channel _id ) ;
if ( channel ) {
updatedata = true ;
notes [ guild _id ] [ channel _id ] [ message _idPOS ] . channel = JSON . stringify ( channel ) ;
}
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
messages . push ( {
note : notes [ guild _id ] [ channel _id ] [ message _idPOS ] ,
channel _id ,
guild _id ,
message ,
channel ,
messagetime : notes [ guild _id ] [ channel _id ] [ message _idPOS ] . timestamp ,
notetime : notes [ guild _id ] [ channel _id ] [ message _idPOS ] . addedat
} ) ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
if ( updatedata ) BDFDB . DataUtils . save ( notes , this , "notes" ) ;
let currentchannel = BDFDB . LibraryModules . ChannelStore . getChannel ( BDFDB . LibraryModules . LastChannelStore . getChannelId ( ) ) || { } ;
switch ( filter ) {
case "channel" :
messages = messages . filter ( messagedata => messagedata . channel _id == currentchannel . id ) ;
break ;
case "server" :
messages = messages . filter ( messagedata => messagedata . guild _id == ( currentchannel . guild _id || "@me" ) ) ;
break ;
case "allservers" :
messages = messages ;
break ;
}
if ( searchkey ) {
let searchvalues = [ "content" , "author.username" , "rawDescription" , "author.name" ] ;
messages = messages . filter ( messagedata => searchvalues . some ( key => this . containsSearchkey ( messagedata . message , key , searchkey ) || messagedata . message . embeds . some ( embed => this . containsSearchkey ( embed , key , searchkey ) ) ) ) ;
}
BDFDB . ArrayUtils . keySort ( messages , sort ) ;
messages . reverse ( ) ;
return Object . keys ( messages ) . length ?
messages . map ( messagedata => this . renderMessage ( buttoninstance , messagedata . note , messagedata . message , messagedata . channel , filter ) ) . flat ( ) . filter ( n => n ) :
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MessagesPopoutComponents . EmptyStateCenter , {
msg : BDFDB . LanguageUtils . LanguageStrings . AUTOCOMPLETE _NO _RESULTS _HEADER ,
image : lighttheme ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg"
} ) ;
}
containsSearchkey ( data , key , searchkey ) {
let value = BDFDB . ReactUtils . getValue ( data , key ) ;
return value && value . toUpperCase ( ) . indexOf ( searchkey ) > - 1
}
renderMessage ( buttoninstance , note , message , channel , filter ) {
if ( ! message || ! channel ) return null ;
let channelname = channel . name ;
let guild = channel . guild _id && BDFDB . LibraryModules . GuildStore . getGuild ( channel . guild _id ) ;
let role = guild && BDFDB . LibraryModules . PermissionRoleUtils . getHighestRole ( guild , message . author . id ) ;
if ( role ) message . colorString = role . colorString ;
if ( filter != "channel" && ! channelname && channel . recipients . length > 0 ) {
for ( let dmuser _id of channel . recipients ) {
channelname = channelname ? channelname + ", @" : channelname ;
channelname = channelname + BDFDB . LibraryModules . UserStore . getUser ( dmuser _id ) . username ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
}
let separator = filter == "channel" ? null : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopoutchannelseparator ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
tag : "span" ,
className : BDFDB . disCN . messagespopoutchannelname ,
onClick : _ => {
BDFDB . LibraryModules . SelectChannelUtils . selectChannel ( channel . guild _id , channel . id ) ;
} ,
children : channelname ? ( ( channel . guild _id ? "#" : "@" ) + channelname ) : "???"
} ) ,
filter == "all" ? BDFDB . ReactUtils . createElement ( "span" , {
className : BDFDB . disCN . messagespopoutguildname ,
children : channel . guild _id ? ( BDFDB . LibraryModules . GuildStore . getGuild ( channel . guild _id ) || { } ) . name || BDFDB . LanguageUtils . LanguageStrings . GUILD _UNAVAILABLE _HEADER : BDFDB . LanguageUtils . LanguageStrings . DIRECT _MESSAGES
} ) : null
]
} ) ;
2019-01-26 22:45:19 +01:00
2019-11-09 12:53:04 +01:00
return [ separator , BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagegroupwrapper ,
key : message . id ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagegroupwrapperoffsetcorrection ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MessageGroup , {
cozyClassName : BDFDB . disCN . messagespopoutmessagegroupcozy ,
messages : [ message ] ,
channel : channel ,
inlineAttachmentMedia : true ,
inlineEmbedMedia : true ,
renderEmbeds : true ,
renderEmbedsSmall : true ,
compact : false ,
developerMode : false ,
hasDivider : false ,
popoutPosition : BDFDB . LibraryComponents . PopoutContainer . Positions . LEFT ,
groupOption : _ => {
return BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopoutactionbuttons ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagespopoutjumpbutton ,
onClick : _ => {
BDFDB . LibraryModules . SelectChannelUtils . selectChannel ( channel . guild _id , channel . id , message . id ) ;
} ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopouttext ,
children : BDFDB . LanguageUtils . LanguageStrings . JUMP
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagespopoutjumpbutton ,
onClick : _ => {
if ( message . content || message . attachments . length > 1 ) {
let text = message . content || "" ;
for ( let attachment of message . attachments ) if ( attachment . url ) text += ( ( text ? "\n" : "" ) + attachment . url ) ;
BDFDB . LibraryRequires . electron . clipboard . write ( { text } ) ;
}
else if ( message . attachments . length == 1 && message . attachments [ 0 ] . url ) {
BDFDB . LibraryRequires . request ( { url : message . attachments [ 0 ] . url , encoding : null } , ( error , response , buffer ) => {
if ( buffer ) {
if ( BDFDB . LibraryRequires . process . platform === "win32" || BDFDB . LibraryRequires . process . platform === "darwin" ) {
BDFDB . LibraryRequires . electron . clipboard . write ( { image : BDFDB . LibraryRequires . electron . nativeImage . createFromBuffer ( buffer ) } ) ;
}
else {
let file = BDFDB . LibraryRequires . path . join ( BDFDB . LibraryRequires . process . env [ "HOME" ] , "personalpinstemp.png" ) ;
BDFDB . LibraryRequires . fs . writeFileSync ( file , buffer , { encoding : null } ) ;
BDFDB . LibraryRequires . electron . clipboard . write ( { image : file } ) ;
BDFDB . LibraryRequires . fs . unlinkSync ( file ) ;
}
}
} ) ;
}
} ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopouttext ,
children : BDFDB . LanguageUtils . LanguageStrings . COPY
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Button , {
look : BDFDB . LibraryComponents . Button . Looks . BLANK ,
size : BDFDB . LibraryComponents . Button . Sizes . NONE ,
onClick : ( e , instance ) => {
this . removeNoteData ( note ) ;
BDFDB . ReactUtils . forceUpdate ( buttoninstance . popout . _owner . stateNode ) ;
} ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopoutclosebutton
} )
} )
]
} ) ;
} ,
messageOption : false ,
canEdit : false ,
accessoriesClassName : BDFDB . disCN . messagespopoutaccessories
} )
} )
} ) ] ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
2018-12-28 14:28:50 +01:00
addNotes ( notespopout ) {
2019-10-23 11:10:01 +02:00
BDFDB . DOMUtils . remove ( notespopout . querySelectorAll ( BDFDB . dotCNC . messagegroupwrapper + BDFDB . dotCN . messagespopoutchannelseparator ) ) ;
2019-10-22 18:55:25 +02:00
let channel = BDFDB . ChannelUtils . getSelected ( ) ;
2019-01-12 15:07:06 +01:00
if ( channel ) {
let guild _id = channel . guild _id ? channel . guild _id : "@me" ;
2019-10-22 19:49:57 +02:00
let pins = BDFDB . DataUtils . load ( this , "pins" ) ;
2019-10-22 18:55:25 +02:00
if ( ! BDFDB . ObjectUtils . isEmpty ( pins ) ) {
2018-12-28 14:28:50 +01:00
let container = notespopout . querySelector ( BDFDB . dotCN . messagespopout ) ;
let placeholder = notespopout . querySelector ( BDFDB . dotCN . messagespopoutemptyplaceholder ) ;
2019-01-12 15:07:06 +01:00
if ( ! container || ! placeholder ) return ;
2019-10-22 18:55:25 +02:00
placeholder . querySelector ( BDFDB . dotCN . messagespopoutimage ) . style . setProperty ( "background-image" , ` url( ${ BDFDB . DiscordUtils . getTheme ( ) == BDFDB . disCN . themelight ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg" } ) ` ) ;
2019-01-12 15:07:06 +01:00
let notes = { } ;
switch ( notespopout . querySelector ( BDFDB . dotCN . tabbarheaderitem + BDFDB . dotCN . settingsitemselected ) . getAttribute ( "tab" ) ) {
2018-12-28 14:28:50 +01:00
case "channel" :
2019-01-12 15:07:06 +01:00
notes = pins [ guild _id ] && pins [ guild _id ] [ channel . id ] ? pins [ guild _id ] [ channel . id ] : { } ;
2018-12-28 14:28:50 +01:00
break ;
case "server" :
2019-09-04 12:34:02 +02:00
if ( pins [ guild _id ] ) for ( let channel in pins [ guild _id ] ) notes = Object . assign ( notes , pins [ guild _id ] [ channel ] ) ;
2018-12-28 14:28:50 +01:00
break ;
case "allservers" :
2019-09-04 12:34:02 +02:00
for ( let server in pins ) if ( pins [ server ] ) for ( let channel in pins [ server ] ) notes = Object . assign ( notes , pins [ server ] [ channel ] ) ;
2018-12-28 14:28:50 +01:00
break ;
}
2019-01-12 15:07:06 +01:00
let noteArray = [ ] ;
for ( let id in notes ) { noteArray . push ( notes [ id ] ) ; }
2019-10-22 18:55:25 +02:00
BDFDB . ArrayUtils . keySort ( noteArray , notespopout . querySelector ( BDFDB . dotCN . recentmentionsmentionfiltervalue ) . getAttribute ( "option" ) ) ;
2019-05-26 13:55:26 +02:00
for ( let noteData of noteArray ) this . appendNote ( notespopout , container , noteData , placeholder ) ;
2019-01-12 15:07:06 +01:00
let searchstring = notespopout . querySelector ( BDFDB . dotCN . searchbarinput ) . value . replace ( /[<|>]/g , "" ) ;
if ( searchstring ) for ( let note of notespopout . querySelectorAll ( BDFDB . dotCN . messagegroupwrapper ) ) {
note . innerHTML = BDFDB . highlightText ( note . innerHTML , searchstring ) ;
if ( ! note . querySelector ( BDFDB . dotCN . highlight ) ) {
note . previousSibling . remove ( ) ;
note . remove ( ) ;
2018-12-28 14:28:50 +01:00
}
2019-01-12 15:07:06 +01:00
}
2019-10-23 11:10:01 +02:00
BDFDB . DOMUtils . toggle ( placeholder , container . firstElementChild == placeholder ) ;
2019-01-12 15:07:06 +01:00
}
}
}
2019-01-26 22:45:19 +01:00
2019-01-12 15:07:06 +01:00
addMessageToNotes ( message , target , channel ) {
if ( ! message || ! target ) return ;
let { messagediv , pos } = this . getMessageAndPos ( target ) ;
if ( ! messagediv || pos == - 1 ) return ;
2019-11-09 12:53:04 +01:00
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
channel = channel || BDFDB . LibraryModules . ChannelStore . getChannel ( message . channel _id ) ;
let guild _id = channel . guild _id || "@me" ;
notes [ guild _id ] = notes [ guild _id ] || { } ;
notes [ guild _id ] [ channel . id ] = notes [ guild _id ] [ channel . id ] || { }
if ( ! notes [ guild _id ] [ channel . id ] [ message . id + "_" + pos ] ) {
notes [ guild _id ] [ channel . id ] [ message . id + "_" + pos ] = {
addedat : new Date ( ) . getTime ( ) ,
channel : JSON . stringify ( channel ) ,
id : message . id ,
message : JSON . stringify ( message ) ,
pos : pos ,
timestamp : message . timestamp . _i . getTime ( )
} ;
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
BDFDB . NotificationUtils . toast ( this . labels . toast _noteadd _text , { type : "success" } ) ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
else this . removeNoteData ( notes [ guild _id ] [ channel . id ] [ message . id + "_" + pos ] ) ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
isNoteOutdated ( note , message ) {
let notemessage = note && JSON . parse ( note . message ) , keys = [ "content" , "embeds" , "attachment" ] ;
return notemessage && ! BDFDB . equals ( BDFDB . ObjectUtils . extract ( notemessage , keys ) , BDFDB . ObjectUtils . extract ( message , keys ) ) ;
2019-09-03 12:37:14 +02:00
}
2019-01-26 22:45:19 +01:00
2019-01-12 15:07:06 +01:00
getNoteData ( message , target , channel ) {
if ( ! message || ! target ) return ;
let { messagediv , pos } = this . getMessageAndPos ( target ) ;
if ( ! messagediv || pos == - 1 ) return ;
2019-11-09 12:53:04 +01:00
channel = channel || BDFDB . LibraryModules . ChannelStore . getChannel ( message . channel _id ) ;
let guild _id = channel . guild _id || "@me" ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
return notes [ guild _id ] && notes [ guild _id ] [ channel . id ] && notes [ guild _id ] [ channel . id ] [ message . id + "_" + pos ] ;
}
updateNoteData ( note , newmessage ) {
let message = JSON . parse ( note . message ) ;
let channel = JSON . parse ( note . channel ) ;
if ( ! message || ! channel ) return ;
let guild _id = channel . guild _id || "@me" ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
notes [ guild _id ] [ channel . id ] [ note . id + "_" + note . pos ] . message = JSON . stringify ( newmessage ) ;
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
BDFDB . NotificationUtils . toast ( this . labels . toast _noteupdate _text , { type : "info" } ) ;
2019-01-02 10:09:39 +01:00
}
2019-01-26 22:45:19 +01:00
2019-11-09 12:53:04 +01:00
removeNoteData ( note ) {
let message = JSON . parse ( note . message ) ;
let channel = JSON . parse ( note . channel ) ;
if ( ! message || ! channel ) return ;
let guild _id = channel . guild _id || "@me" ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
delete notes [ guild _id ] [ channel . id ] [ note . id + "_" + note . pos ] ;
if ( BDFDB . ObjectUtils . isEmpty ( notes [ guild _id ] [ channel . id ] ) ) {
delete notes [ guild _id ] [ channel . id ] ;
if ( BDFDB . ObjectUtils . isEmpty ( notes [ guild _id ] ) ) delete notes [ guild _id ] ;
2018-12-28 14:28:50 +01:00
}
2019-11-09 12:53:04 +01:00
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
BDFDB . NotificationUtils . toast ( this . labels . toast _noteremove _text , { type : "danger" } ) ;
2018-12-28 14:28:50 +01:00
}
2019-09-11 12:14:43 +02:00
2019-01-12 15:07:06 +01:00
getMessageAndPos ( target ) {
2019-11-08 14:36:57 +01:00
let messagediv = BDFDB . DOMUtils . getParent ( BDFDB . dotCN . messagegroup + "> [aria-disabled]," + BDFDB . dotCN . messagegroup + "> * > [aria-disabled]" , target ) ;
2019-09-11 12:14:43 +02:00
let pos = messagediv ? Array . from ( messagediv . parentElement . childNodes ) . filter ( n => n . nodeType != Node . TEXT _NODE ) . indexOf ( messagediv ) : - 1 ;
2019-01-12 15:07:06 +01:00
return { messagediv , pos } ;
}
2019-01-26 22:45:19 +01:00
2018-12-28 14:28:50 +01:00
setLabelsByLanguage ( ) {
2019-10-24 11:47:57 +02:00
switch ( BDFDB . LanguageUtils . getLanguage ( ) . id ) {
2018-12-28 14:28:50 +01:00
case "hr" : //croatian
return {
popout _note _text : "Bilješke" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Poslužavnik" ,
popout _filter _all _text : "Svi poslužitelji" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Poredaj po" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Vijesti-Datum" ,
popout _sort _notetime _text : "Bilješka-Datum" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Napominjemo poruku" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Ažuriraj bilješku" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Uklonite bilješku" ,
popout _pinoption _text : "Bilješka" ,
toast _noteadd _text : "Poruka dodana u bilježnicu." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Poruka je ažurirana u bilježnici." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Poruka uklonjena iz bilježnice."
} ;
case "da" : //danish
return {
popout _note _text : "Noter" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Alle servere" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sorter efter" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Meddelelse-Dato" ,
popout _sort _notetime _text : "Note-Dato" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Noter besked" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Opdater note" ,
context _unpinoption _text : "Fjern note" ,
2018-12-28 14:28:50 +01:00
popout _pinoption _text : "Noter" ,
toast _noteadd _text : "Meddelelse tilføjet til notesbog." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Meddelelse opdateret i den notesbog." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Meddelelse fjernet fra notesbog."
} ;
case "de" : //german
return {
popout _note _text : "Notizen" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Alle Server" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sortieren nach" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Nachrichten-Datum" ,
popout _sort _notetime _text : "Notiz-Datum" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Nachricht notieren" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Notiz aktualisieren" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Notiz entfernen" ,
popout _pinoption _text : "Notieren" ,
toast _noteadd _text : "Nachricht zum Notizbuch hinzugefügt." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Nachricht im Notizbuch aktualisiert." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Nachricht aus dem Notizbuch entfernt."
} ;
case "es" : //spanish
return {
popout _note _text : "Notas" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Canal" ,
popout _filter _server _text : "Servidor" ,
popout _filter _all _text : "Todos los servidores" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Ordenar por" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Mensaje-Fecha" ,
popout _sort _notetime _text : "Nota-Fecha" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Anotar mensaje" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Actualiza la nota" ,
context _unpinoption _text : "Eliminar la nota" ,
2018-12-28 14:28:50 +01:00
popout _pinoption _text : "Anotar" ,
toast _noteadd _text : "Mensaje agregado al cuaderno." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Mensaje actualizado en el cuaderno." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Mensaje eliminado del cuaderno."
} ;
case "fr" : //french
return {
popout _note _text : "Notes" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Canal" ,
popout _filter _server _text : "Serveur" ,
popout _filter _all _text : "Tous les serveurs" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Trier par" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Message-Date" ,
popout _sort _notetime _text : "Note-Date" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Noter le message" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Mettre à jour la note" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Enlevez la note" ,
popout _pinoption _text : "Noter" ,
2019-09-03 12:37:14 +02:00
toast _noteadd _text : "Message ajouté au cahier." ,
toast _noteupdate _text : "Message mis à jour dans le cahier." ,
toast _noteremove _text : "Message supprimé du cahier."
2018-12-28 14:28:50 +01:00
} ;
case "it" : //italian
return {
popout _note _text : "Note" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Canale" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Tutti i server" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Ordina per" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Messaggio-Data" ,
popout _sort _notetime _text : "Nota-Data" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Annotare il messaggio" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Aggiorna la nota" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Rimuovi la nota" ,
popout _pinoption _text : "Annotare" ,
toast _noteadd _text : "Messaggio aggiunto al blocco note." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Messaggio aggiornato nel blocco note." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Messaggio rimosso dal blocco note."
} ;
case "nl" : //dutch
return {
popout _note _text : "Notities" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanaal" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Alle servers" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sorteer op" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Bericht-Datum" ,
popout _sort _notetime _text : "Notitie-Datum" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Noteer bericht" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Update de notitie" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Verwijder de notitie" ,
popout _pinoption _text : "Noteer" ,
toast _noteadd _text : "Bericht toegevoegd aan notitieblok." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Bericht bijgewerkt in het notitieblok." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Bericht verwijderd van notitieblok."
} ;
case "no" : //norwegian
return {
popout _note _text : "Notatene" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Alle servere" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sorter etter" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Melding-Dato" ,
popout _sort _notetime _text : "Merknad-Dato" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Notat ned meldingen" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Oppdater notatet" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Fjern notatet" ,
popout _pinoption _text : "Notere" ,
toast _noteadd _text : "Melding lagt til i notisboken." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Melding oppdatert i notisbok." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Melding fjernet fra notatboken."
} ;
case "pl" : //polish
return {
popout _note _text : "Notatki" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanał" ,
popout _filter _server _text : "Serwer" ,
popout _filter _all _text : "Wszystkie serwery" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sortuj według" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Wiadomość-Data" ,
popout _sort _notetime _text : "Notatka-Data" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Notuj wiadomość" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Zaktualizuj notatkę" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Usuń notatkę" ,
popout _pinoption _text : "Notuj" ,
toast _noteadd _text : "Wiadomość została dodana do notatnika." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Wiadomość zaktualizowana w notatniku." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Wiadomość została usunięta z notatnika."
} ;
case "pt-BR" : //portuguese (brazil)
return {
popout _note _text : "Notas" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Canal" ,
popout _filter _server _text : "Servidor" ,
popout _filter _all _text : "Todos os servidores" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Ordenar por" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Mensagem-Data" ,
popout _sort _notetime _text : "Nota-Data" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Anote a mensagem" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Atualize a nota" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Remova a nota" ,
popout _pinoption _text : "Anotar" ,
toast _noteadd _text : "Mensagem adicionada ao caderno." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Mensagem atualizada no caderno." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Mensagem removida do caderno."
} ;
case "fi" : //finnish
return {
popout _note _text : "Muistiinpanot" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanava" ,
popout _filter _server _text : "Palvelin" ,
popout _filter _all _text : "Kaikki palvelimet" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Järjestä" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Viesti-Päivämäärä" ,
popout _sort _notetime _text : "Huomaa-Päivämäärä" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Huomaa viesti" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Päivitä muistiinpano" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Poista muistiinpano" ,
popout _pinoption _text : "Huomaa" ,
toast _noteadd _text : "Viesti lisätty muistikirjaan." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Viesti päivitetty muistikirjaan." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Viesti poistettiin muistikirjaan."
} ;
case "sv" : //swedish
return {
popout _note _text : "Anteckningarna" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Alla servrar" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sortera efter" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Meddelande-Datum" ,
popout _sort _notetime _text : "Anteckningen-Datum" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Anteckna meddelande" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Uppdatera noten" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Ta bort noten" ,
popout _pinoption _text : "Anteckna" ,
toast _noteadd _text : "Meddelandet läggs till i anteckningsboken." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Meddelandet uppdateras i anteckningsboken." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Meddelande borttaget från anteckningsboken."
} ;
case "tr" : //turkish
return {
popout _note _text : "Notlar" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanal" ,
popout _filter _server _text : "Sunucu" ,
popout _filter _all _text : "Tüm Sunucular" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Göre sı rala" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Mesaj-Tarih" ,
popout _sort _notetime _text : "Not-Tarih" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Mesajı not alı n" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Notu güncelle" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Notu kaldı rmak" ,
popout _pinoption _text : "Not almak" ,
toast _noteadd _text : "Mesaj not defteri'ya eklendi." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Mesaj defterde güncellendi." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Mesaj not defteri'dan kaldı rı ldı ."
} ;
case "cs" : //czech
return {
popout _note _text : "Poznámky" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Kanál" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "Všechny servery" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Seřazeno podle" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Zpráva-datum" ,
popout _sort _notetime _text : "Poznámka-datum" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Poznámka dolů zprávu" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Aktualizujte poznámku" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Odstraňte poznámku" ,
popout _pinoption _text : "Poznámka dolů" ,
toast _noteadd _text : "Zpráva byla přidána do notebooku." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Zpráva byla v notebooku aktualizována." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Zpráva byla odebrána z notebooku."
} ;
case "bg" : //bulgarian
return {
popout _note _text : "бележките" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Канал" ,
popout _filter _server _text : "Сървър" ,
popout _filter _all _text : "Всички сървъри" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Сортиране по" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Съобщение-Дата" ,
popout _sort _notetime _text : "Забележка-Дата" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Oтб е ле же те съобщението" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Актуализирайте бележката" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Премахнете бележката" ,
popout _pinoption _text : "Oтб е ле же те " ,
toast _noteadd _text : "Съобщението б е добавено към бележника." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Съобщението е актуализирано в бележника." ,
toast _noteremove _text : "Съобщението е премахнато от преносимия бележника."
2018-12-28 14:28:50 +01:00
} ;
case "ru" : //russian
return {
popout _note _text : "Заметки" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Канал" ,
popout _filter _server _text : "Cе р ве р " ,
popout _filter _all _text : "В с е серверы" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Сортировать по" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Сообщение-дата" ,
popout _sort _notetime _text : "Заметки-Дата" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Записывать вниз" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Обновить заметку" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Удалить заметку" ,
popout _pinoption _text : "Записывать" ,
toast _noteadd _text : "Сообщение добавлено в блокнот." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Сообщение обновлено в записной блокнот." ,
toast _noteremove _text : "Сообщение удалено из записной блокнот."
2018-12-28 14:28:50 +01:00
} ;
case "uk" : //ukrainian
return {
popout _note _text : "Замітки" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Канал" ,
popout _filter _server _text : "Сервер" ,
popout _filter _all _text : "В с і сервери" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Сортувати за" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Повідомлення-дата" ,
popout _sort _notetime _text : "Примітка-дата" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Зверніть увагу на повідомлення" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Оновіть нотатку" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Видаліть нотатку" ,
popout _pinoption _text : "Занотуйте" ,
toast _noteadd _text : "Повідомлення додається до ноутбука." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Повідомлення оновлено в ноутбука." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Повідомлення видалено з ноутбука."
} ;
case "ja" : //japanese
return {
popout _note _text : "ノート" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "チャネル" ,
popout _filter _server _text : "サーバ" ,
popout _filter _all _text : "すべてのサーバー" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "並び替え" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "メッセージ-日付" ,
popout _sort _notetime _text : "注-日付" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "ノートダウンメッセージ" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "メモを更新する" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "メモを削除" ,
popout _pinoption _text : "書き留める" ,
toast _noteadd _text : "ノートブックにメッセージが追加されました." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "ノートブックで更新されたメッセージ." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "ノートブックからメッセージが削除されました."
} ;
case "zh-TW" : //chinese (traditional)
return {
popout _note _text : "筆記" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "渠道" ,
popout _filter _server _text : "服務器" ,
popout _filter _all _text : "所有服務器" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "排序方式" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "消息-日期" ,
popout _sort _notetime _text : "注-日期" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "記下下來的消息" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "更新說明" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "刪除備註" ,
popout _pinoption _text : "記下" ,
toast _noteadd _text : "消息添加到筆記本." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "消息在筆記本中更新." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "消息從筆記本中刪除."
} ;
case "ko" : //korean
return {
popout _note _text : "노트" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "채널" ,
popout _filter _server _text : "섬기는 사람" ,
popout _filter _all _text : "모든 서버" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "정렬 기준" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "메시지-날짜" ,
popout _sort _notetime _text : "주-날짜" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "메모 다운 메시지" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "메모 업데이트" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "메모 삭제" ,
popout _pinoption _text : "메모하다" ,
toast _noteadd _text : "노트북에 메시지 추가됨." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "노트북에서 메시지가 업데이트되었습니다." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "노트에서 메시지 삭제됨."
} ;
default : //default: english
return {
popout _note _text : "Notes" ,
2019-11-09 12:53:04 +01:00
popout _filter _channel _text : "Channel" ,
popout _filter _server _text : "Server" ,
popout _filter _all _text : "All Servers" ,
2018-12-28 14:28:50 +01:00
popout _sort _text : "Sort by" ,
2019-11-09 12:53:04 +01:00
popout _sort _messagetime _text : "Message-Date" ,
popout _sort _notetime _text : "Note-Date" ,
2018-12-28 14:28:50 +01:00
context _pinoption _text : "Note Message" ,
2019-09-03 12:37:14 +02:00
context _updateoption _text : "Update Note" ,
2018-12-28 14:28:50 +01:00
context _unpinoption _text : "Remove Note" ,
popout _pinoption _text : "Note" ,
toast _noteadd _text : "Message added to notebook." ,
2019-09-03 12:37:14 +02:00
toast _noteupdate _text : "Message updated in the notebook." ,
2018-12-28 14:28:50 +01:00
toast _noteremove _text : "Message removed from notebook."
} ;
}
}
}