2020-10-20 23:25:34 +02:00
/ * *
* @ name PersonalPins
2021-03-05 13:26:41 +01:00
* @ author DevilBro
2020-10-20 23:25:34 +02:00
* @ authorId 278543574059057154
2021-03-11 21:27:03 +01:00
* @ version 2.0 . 2
2021-03-05 13:26:41 +01:00
* @ description Allows you to locally pin Messages
2020-10-20 23:25:34 +02:00
* @ invite Jx3TjNS
* @ 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/PersonalPins/
2021-03-10 09:17:37 +01:00
* @ updateUrl https : //mwittrien.github.io/BetterDiscordAddons/Plugins/PersonalPins/PersonalPins.plugin.js
2020-10-20 23:25:34 +02:00
* /
2018-12-28 14:28:50 +01: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" : "PersonalPins" ,
"author" : "DevilBro" ,
2021-03-11 21:27:03 +01:00
"version" : "2.0.2" ,
2021-03-04 12:26:17 +01:00
"description" : "Allows you to locally pin Messages"
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
} ;
2020-11-13 19:47:44 +01:00
2020-10-09 21:09:35 +02:00
return ! 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-07-11 23:28:30 +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-03-11 21:27:03 +01:00
let _this ;
2021-01-21 16:15:24 +01:00
const pinIconGeneral = ` <svg name="Note" width="24" height="24" viewBox="0 0 24 24"><mask/><path fill="currentColor" mask="url(#pinIconMask)" d="M 6.7285156 2 C 6.4051262 2 6.1425781 2.2615247 6.1425781 2.5859375 L 6.1425781 3.7578125 C 6.1425781 4.081202 6.4041028 4.34375 6.7285156 4.34375 C 7.0529284 4.34375 7.3144531 4.0822254 7.3144531 3.7578125 L 7.3144531 2.5859375 C 7.3144531 2.2615247 7.0529284 2 6.7285156 2 z M 10.244141 2 C 9.9207511 2 9.6582031 2.2615247 9.6582031 2.5859375 L 9.6582031 3.7578125 C 9.6582031 4.081202 9.9197277 4.34375 10.244141 4.34375 C 10.568554 4.34375 10.830078 4.0822254 10.830078 3.7578125 L 10.830078 2.5859375 C 10.830078 2.2615247 10.568554 2 10.244141 2 z M 13.759766 2 C 13.436377 2 13.173828 2.2615247 13.173828 2.5859375 L 13.173828 3.7578125 C 13.173828 4.081202 13.435354 4.34375 13.759766 4.34375 C 14.083156 4.34375 14.347656 4.0822254 14.347656 3.7578125 L 14.347656 2.5859375 C 14.346656 2.2615247 14.083156 2 13.759766 2 z M 17.275391 2 C 16.952002 2 16.689453 2.2615247 16.689453 2.5859375 L 16.689453 3.7578125 C 16.689453 4.081202 16.950979 4.34375 17.275391 4.34375 C 17.598781 4.34375 17.863281 4.0822254 17.863281 3.7578125 L 17.863281 2.5859375 C 17.862281 2.2615247 17.598781 2 17.275391 2 z M 4.9667969 3.2792969 C 4.2903399 3.5228623 3.8007813 4.1662428 3.8007812 4.9296875 L 3.8007812 20.242188 C 3.8007812 21.211333 4.5884253 22 5.5585938 22 L 18.447266 22 C 19.41641 22 20.205078 21.212356 20.205078 20.242188 L 20.205078 4.9296875 C 20.204054 4.1662428 19.713754 3.5228623 19.033203 3.2792969 L 19.033203 3.7578125 C 19.033203 4.7269575 18.245559 5.515625 17.275391 5.515625 C 16.306246 5.515625 15.517578 4.7279808 15.517578 3.7578125 C 15.517578 4.7269575 14.72798 5.515625 13.757812 5.515625 C 12.788668 5.515625 12 4.7279808 12 3.7578125 C 12 4.7269575 11.212357 5.515625 10.242188 5.515625 C 9.2730428 5.515625 8.484375 4.7279808 8.484375 3.7578125 C 8.484375 4.7269575 7.6967309 5.515625 6.7265625 5.515625 C 5.7574176 5.515625 4.9667969 4.7279808 4.9667969 3.7578125 L 4.9667969 3.2792969 z M 6.7285156 7.2734375 L 17.275391 7.2734375 C 17.598781 7.2734375 17.861328 7.5349622 17.861328 7.859375 C 17.861328 8.1837878 17.598781 8.4453125 17.275391 8.4453125 L 6.7285156 8.4453125 C 6.4051262 8.4453125 6.1425781 8.1837878 6.1425781 7.859375 C 6.1425781 7.5349622 6.4041028 7.2734375 6.7285156 7.2734375 z M 6.7285156 10.787109 L 17.275391 10.787109 C 17.598781 10.787109 17.861328 11.050587 17.861328 11.375 C 17.861328 11.699413 17.598781 11.960938 17.275391 11.960938 L 6.7285156 11.960938 C 6.4051262 11.960938 6.1425781 11.699413 6.1425781 11.375 C 6.1425781 11.050587 6.4041028 10.787109 6.7285156 10.787109 z M 6.7285156 14.380859 L 17.275391 14.380859 C 17.598781 14.380859 17.861328 14.642384 17.861328 14.966797 C 17.861328 15.29121 17.598781 15.552734 17.275391 15.552734 L 6.7285156 15.552734 C 6.4051262 15.552734 6.1425781 15.29121 6.1425781 14.966797 C 6.1425781 14.643408 6.4041028 14.380859 6.7285156 14.380859 z M 6.7285156 17.896484 L 17.275391 17.896484 C 17.598781 17.896484 17.861328 18.158009 17.861328 18.482422 C 17.861328 18.806835 17.598781 19.068359 17.275391 19.068359 L 6.7285156 19.068359 C 6.4051262 19.068359 6.1425781 18.806835 6.1425781 18.482422 C 6.1425781 18.159033 6.4041028 17.896484 6.7285156 17.896484 z"/><extra/></svg> ` ;
const pinIconMask = ` <mask id="pinIconMask" fill="black"><path fill="white" d="M 0 0 H 24 V 24 H 0 Z"/><path fill="black" d="M24 12 H 12 V 24 H 24 Z"/></mask> ` ;
2020-09-19 20:49:33 +02:00
const pinIcon = pinIconGeneral . replace ( ` <extra/> ` , ` ` ) . replace ( ` <mask/> ` , ` ` ) . replace ( ` mask="url(#pinIconMask)" ` , ` ` ) ;
2021-01-21 16:21:08 +01:00
const pinIconDelete = pinIconGeneral . replace ( ` <extra/> ` , ` <path fill="none" stroke="#f04747" stroke-width="2" d="m 14.702359,14.702442 8.596228,8.596148 m 0,-8.597139 -8.59722,8.596147 z"/> ` ) . replace ( ` <mask/> ` , pinIconMask ) ;
const pinIconUpdate = pinIconGeneral . replace ( ` <extra/> ` , ` <path fill="#43b581" d="M 24,18.375879 V 14 l -1.470407,1.468882 C 21.626418,14.562588 20.378506,14 18.996922,14 16.232873,14 14,16.238045 14,19 c 0,2.761955 2.231994,5 4.996043,5 2.32873,0 4.280186,-1.594585 4.833347,-3.750879 h -1.301556 c -0.516226,1.455696 -1.89781,2.5 -3.53355,2.5 -2.073696,0 -3.752528,-1.678973 -3.752528,-3.750879 0,-2.071906 1.678832,-3.750879 3.751649,-3.750879 1.034209,0 1.962887,0.430731 2.641808,1.109353 L 19.6178,18.372363 H 24 Z"/> ` ) . replace ( ` <mask/> ` , pinIconMask ) ;
2020-09-19 20:49:33 +02:00
const filterKeys = [ "channel" , "server" , "all" ] ;
const sortKeys = [ "notetime" , "messagetime" ] ;
const orderKeys = [ "ascending" , "descending" ] ;
2020-09-23 09:29:56 +02:00
2021-03-11 21:27:03 +01:00
const popoutProps = { } ;
const NotesPopoutComponent = class NotesPopout extends BdApi . React . Component {
containsSearchkey ( data , key , searchKey ) {
let value = BDFDB . ObjectUtils . get ( data , key ) ;
return value && value . toUpperCase ( ) . indexOf ( searchKey ) > - 1 ;
2020-09-19 20:49:33 +02:00
}
2021-03-11 21:27:03 +01:00
filterMessages ( ) {
let messages = [ ] , notes = BDFDB . DataUtils . load ( _this , "notes" ) , updateData = false ;
2020-09-19 20:49:33 +02:00
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 ) ;
if ( message . customRenderedContent && message . customRenderedContent . content . length ) message . customRenderedContent . content = BDFDB . ReactUtils . objectToReact ( message . customRenderedContent . content ) ;
for ( let embed of message . embeds ) {
embed . color = typeof embed . color != "string" ? null : embed . color ;
embed . timestamp = embed . timestamp && new BDFDB . DiscordObjects . Timestamp ( embed . timestamp ) ;
}
message . embeds = message . embeds . filter ( n => ! ( n && n . type == "gifv" ) ) ;
message . reactions = [ ] ;
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 ) ;
}
}
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
} ) ;
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
if ( updateData ) BDFDB . DataUtils . save ( notes , _this , "notes" ) ;
2020-09-19 20:49:33 +02:00
let currentChannel = BDFDB . LibraryModules . ChannelStore . getChannel ( BDFDB . LibraryModules . LastChannelStore . getChannelId ( ) ) || { } ;
2021-03-11 21:27:03 +01:00
switch ( popoutProps . selectedFilter . value ) {
2020-09-19 20:49:33 +02:00
case "channel" :
messages = messages . filter ( messageData => messageData . channel _id == currentChannel . id ) ;
break ;
case "server" :
messages = messages . filter ( messageData => messageData . guild _id == ( currentChannel . guild _id || BDFDB . DiscordConstants . ME ) ) ;
break ;
case "allservers" :
messages = messages ;
break ;
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
let searchKey = popoutProps . searchKey . toUpperCase ( ) ;
if ( searchKey ) {
2020-09-19 20:49:33 +02:00
let searchValues = [ "content" , "author.username" , "rawDescription" , "author.name" ] ;
2021-03-11 21:27:03 +01:00
messages = messages . filter ( messageData => searchValues . some ( key => this . containsSearchkey ( messageData . message , key , searchKey ) || messageData . message . embeds . some ( embed => this . containsSearchkey ( embed , key , searchKey ) ) ) ) ;
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
BDFDB . ArrayUtils . keySort ( messages , popoutProps . selectedSort . value ) ;
if ( popoutProps . selectedOrder . value != "descending" ) messages . reverse ( ) ;
2020-09-19 20:49:33 +02:00
return Object . keys ( messages ) . length ?
2021-03-11 21:27:03 +01:00
messages . map ( messageData => this . renderMessage ( messageData . note , messageData . message , messageData . channel ) ) . flat ( 10 ) . filter ( n => n ) :
2020-09-19 20:49:33 +02:00
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MessagesPopoutComponents . EmptyStateCenter , {
msg : BDFDB . LanguageUtils . LanguageStrings . AUTOCOMPLETE _NO _RESULTS _HEADER ,
2021-03-11 21:27:03 +01:00
image : BDFDB . DiscordUtils . getTheme ( ) == BDFDB . disCN . themelight ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg"
2020-09-19 20:49:33 +02:00
} ) ;
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
renderMessage ( note , message , channel ) {
2020-09-19 20:49:33 +02:00
if ( ! message || ! channel ) return null ;
2020-10-06 12:40:59 +02:00
let channelName = channel . name ;
2020-09-19 20:49:33 +02:00
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 ;
2021-03-11 21:27:03 +01:00
if ( popoutProps . selectedFilter . value != "channel" && ! channelName && channel . recipients . length > 0 ) {
2020-09-19 20:49:33 +02:00
for ( let dmuser _id of channel . recipients ) {
2020-10-06 12:40:59 +02:00
channelName = channelName ? channelName + ", @" : channelName ;
channelName = channelName + ( ( BDFDB . LibraryModules . UserStore . getUser ( dmuser _id ) || { } ) . username || BDFDB . LanguageUtils . LanguageStrings . UNKNOWN _USER ) ;
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
return [ popoutProps . selectedFilter . value == "channel" ? null : BDFDB . ReactUtils . createElement ( "div" , {
2020-09-19 20:49:33 +02:00
className : BDFDB . disCN . messagespopoutchannelseparator ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
tag : "span" ,
className : BDFDB . disCN . messagespopoutchannelname ,
2021-03-05 18:02:12 +01:00
onClick : _ => BDFDB . LibraryModules . HistoryUtils . transitionTo ( BDFDB . DiscordConstants . Routes . CHANNEL ( channel . guild _id , channel . id ) ) ,
2020-10-06 12:40:59 +02:00
children : channelName ? ( ( channel . guild _id ? "#" : "@" ) + channelName ) : "???"
2020-09-19 20:49:33 +02:00
} ) ,
2021-03-11 21:27:03 +01:00
popoutProps . selectedFilter . value == "all" ? BDFDB . ReactUtils . createElement ( "span" , {
2020-09-19 20:49:33 +02:00
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
]
} ) , BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopoutgroupwrapper ,
key : message . id ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MessageGroup , {
className : BDFDB . disCN . messagespopoutgroupcozy ,
message : message ,
2020-10-06 12:09:36 +02:00
channel : channel ,
2021-03-11 21:27:03 +01:00
onContextMenu : e => BDFDB . MessageUtils . openMenu ( message , e , true )
2020-09-19 20:49:33 +02:00
} ) ,
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . messagespopoutactionbuttons ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagespopoutjumpbutton ,
2021-03-05 18:02:12 +01:00
onClick : _ => BDFDB . LibraryModules . HistoryUtils . transitionTo ( BDFDB . DiscordConstants . Routes . CHANNEL ( channel . guild _id , channel . id , message . id ) ) ,
2020-09-19 20:49:33 +02:00
children : BDFDB . ReactUtils . createElement ( "div" , {
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 ) ;
}
2020-02-04 09:26:05 +01:00
}
2020-09-19 20:49:33 +02:00
} ) ;
}
} ,
children : BDFDB . ReactUtils . createElement ( "div" , {
children : BDFDB . LanguageUtils . LanguageStrings . COPY
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Button , {
look : BDFDB . LibraryComponents . Button . Looks . BLANK ,
size : BDFDB . LibraryComponents . Button . Sizes . NONE ,
2021-03-11 21:27:03 +01:00
onClick : _ => {
_this . removeNoteData ( note ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
2020-09-19 20:49:33 +02:00
} ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCN . messagespopoutclosebutton ,
name : BDFDB . LibraryComponents . SvgIcon . Names . CLOSE
} )
2020-02-04 09:26:05 +01:00
} )
2020-09-19 20:49:33 +02:00
]
} )
]
} ) ] ;
}
2021-03-11 21:27:03 +01:00
render ( ) {
let searchTimeout ;
return BDFDB . ReactUtils . createElement ( BDFDB . ReactUtils . Fragment , {
children : [
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . messagespopouttabbarheader + BDFDB . disCN . messagespopoutheader ,
style : { paddingBottom : 4 } ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
direction : BDFDB . LibraryComponents . Flex . Direction . VERTICAL ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
className : BDFDB . disCN . marginbottom4 ,
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
className : BDFDB . disCN . messagespopouttitle ,
children : _this . labels . popout _note
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SearchBar , {
query : popoutProps . searchKey ,
onChange : value => {
BDFDB . TimeUtils . clear ( searchTimeout ) ;
searchTimeout = BDFDB . TimeUtils . timeout ( _ => {
popoutProps . searchKey = value ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} , 1000 ) ;
} ,
onClear : _ => {
popoutProps . searchKey = "" ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TabBar , {
className : BDFDB . disCN . messagespopouttabbar ,
itemClassName : BDFDB . disCN . messagespopouttabbartab ,
itemSelectedClassName : BDFDB . disCN . messagespopouttabbartabactive ,
type : BDFDB . LibraryComponents . TabBar . Types . TOP _PILL ,
selectedItem : popoutProps . selectedFilter . value ,
items : filterKeys . map ( option => _this . getPopoutValue ( option , "filter" ) ) ,
onItemSelect : option => {
popoutProps . selectedFilter = _this . getPopoutValue ( option , "filter" ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . QuickSelect , {
label : BDFDB . LanguageUtils . LibraryStrings . sort _by + ":" ,
value : popoutProps . selectedSort ,
options : sortKeys . map ( option => _this . getPopoutValue ( option , "sort" ) ) ,
onChange : option => {
popoutProps . selectedSort = _this . getPopoutValue ( option , "sort" ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . QuickSelect , {
label : BDFDB . LanguageUtils . LibraryStrings . order + ":" ,
value : popoutProps . selectedOrder ,
options : orderKeys . map ( option => _this . getPopoutValue ( option , "order" ) ) ,
onChange : option => {
popoutProps . selectedOrder = _this . getPopoutValue ( option , "order" ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} )
]
} )
]
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Scrollers . Thin , {
className : BDFDB . disCN . messagespopout ,
children : this . filterMessages ( )
} )
]
} ) ;
}
} ;
return class PersonalPins extends Plugin {
onLoad ( ) {
_this = this ;
this . defaults = {
choices : {
defaultFilter : { value : filterKeys [ 0 ] , options : filterKeys , type : "filter" , description : "Default choice tab" } ,
defaultSort : { value : sortKeys [ 0 ] , options : sortKeys , type : "sort" , description : "Default sort choice" } ,
defaultOrder : { value : orderKeys [ 0 ] , options : orderKeys , type : "order" , description : "Default order choice" } ,
}
} ;
this . patchedModules = {
after : {
HeaderBarContainer : "render"
}
} ;
}
onStart ( ) {
BDFDB . PatchUtils . forceAllUpdates ( this ) ;
}
onStop ( ) {
BDFDB . PatchUtils . forceAllUpdates ( this ) ;
}
getSettingsPanel ( collapseStates = { } ) {
let settingsPanel ;
return settingsPanel = BDFDB . PluginUtils . createSettingsPanel ( this , {
collapseStates : collapseStates ,
children : _ => {
let settingsItems = [ ] ;
for ( let key in this . settings . choices ) settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
type : "Select" ,
plugin : this ,
keys : [ "choices" , key ] ,
label : this . defaults . choices [ key ] . description ,
basis : "50%" ,
value : this . settings . choices [ key ] ,
options : ( this . defaults . choices [ key ] . options || [ ] ) . map ( option => this . getPopoutValue ( option , this . defaults . choices [ key ] . type ) ) ,
searchable : true
} ) ) ;
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Button" ,
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 settingsItems ;
}
} ) ;
}
onSettingsClosed ( ) {
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
BDFDB . PatchUtils . forceAllUpdates ( this ) ;
}
}
onMessageContextMenu ( e ) {
if ( e . instance . props . message && e . instance . props . channel ) {
let note = this . getNoteData ( e . instance . props . message , e . instance . props . channel ) ;
let hint = BDFDB . BDUtils . isPluginEnabled ( "MessageUtilities" ) ? BDFDB . BDUtils . getPlugin ( "MessageUtilities" ) . getActiveShortcutString ( "__Note_Message" ) : null ;
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "pin" , "unpin" ] } ) ;
if ( index == - 1 ) [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "edit" , "add-reaction" , "quote" ] } ) ;
children . splice ( index > - 1 ? index + 1 : 0 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
label : note ? this . labels . context _unpinoption : this . labels . context _pinoption ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , note ? "unpin-note" : "pin-note" ) ,
hint : hint && ( _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuHint , {
hint : hint
} ) ) ,
action : _ => this . addMessageToNotes ( e . instance . props . message , e . instance . props . channel )
} ) ) ;
if ( this . isNoteOutdated ( note , e . instance . props . message ) ) children . splice ( index > - 1 ? index + 1 : 0 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
label : this . labels . context _updateoption ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "update-note" ) ,
action : _ => this . updateNoteData ( note , e . instance . props . message )
} ) ) ;
}
}
onMessageOptionContextMenu ( e ) {
if ( e . instance . props . message && e . instance . props . channel ) {
let note = this . getNoteData ( e . instance . props . message , e . instance . props . channel ) ;
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "pin" , "unpin" ] } ) ;
children . splice ( index + 1 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
label : note ? this . labels . context _unpinoption : this . labels . context _pinoption ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , note ? "unpin-note" : "pin-note" ) ,
icon : _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuIcon , {
icon : note ? pinIconDelete : pinIcon
} ) ,
action : _ => this . addMessageToNotes ( e . instance . props . message , e . instance . props . channel )
} ) ) ;
if ( this . isNoteOutdated ( note , e . instance . props . message ) ) children . splice ( index + 1 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
label : this . labels . context _updateoption ,
id : "update-note" ,
icon : _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuIcon , {
icon : pinIconUpdate
} ) ,
action : _ => this . updateNoteData ( note , e . instance . props . message )
} ) ) ;
}
}
onMessageOptionToolbar ( e ) {
if ( e . instance . props . expanded && e . instance . props . message && e . instance . props . channel ) {
let note = this . getNoteData ( e . instance . props . message , e . instance . props . channel ) ;
e . returnvalue . props . children . unshift ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
key : note ? "unpin-note" : "pin-note" ,
text : note ? this . labels . context _unpinoption : this . labels . context _pinoption ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagetoolbarbutton ,
onClick : _ => this . addMessageToNotes ( e . instance . props . message , e . instance . props . channel ) ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCN . messagetoolbaricon ,
iconSVG : note ? pinIconDelete : pinIcon
} )
} )
} ) ) ;
if ( this . isNoteOutdated ( note , e . instance . props . message ) ) e . returnvalue . props . children . unshift ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
key : "update-note" ,
text : this . labels . context _updateoption ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagetoolbarbutton ,
onClick : _ => this . updateNoteData ( note , e . instance . props . message ) ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCN . messagetoolbaricon ,
iconSVG : pinIconUpdate
} )
} )
} ) ) ;
}
}
processHeaderBarContainer ( e ) {
let [ children , index ] = BDFDB . ReactUtils . findParent ( BDFDB . ObjectUtils . get ( 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 ,
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 : pinIcon
} )
} )
} ) ,
popoutClassName : BDFDB . disCN . messagespopoutwrap ,
animation : BDFDB . LibraryComponents . PopoutContainer . Animation . SCALE ,
position : BDFDB . LibraryComponents . PopoutContainer . Positions . BOTTOM ,
align : BDFDB . LibraryComponents . PopoutContainer . Align . RIGHT ,
width : 650 ,
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 ) ;
popoutProps . selectedFilter = popoutProps . selectedFilter || this . getPopoutValue ( this . settings . choices . defaultFilter || filterKeys [ 0 ] , "filter" ) ;
popoutProps . selectedSort = popoutProps . selectedSort || this . getPopoutValue ( this . settings . choices . defaultSort || sortKeys [ 0 ] , "sort" ) ;
popoutProps . selectedOrder = popoutProps . selectedOrder || this . getPopoutValue ( this . settings . choices . defaultOrder || orderKeys [ 0 ] , "order" ) ;
popoutProps . searchKey = popoutProps . searchKey || "" ;
return BDFDB . ReactUtils . createElement ( NotesPopoutComponent , { } ) ;
}
} ) ) ;
}
getPopoutValue ( key , type ) {
return {
label : type == "order" ? BDFDB . LanguageUtils . LibraryStrings [ key ] : this . labels [ ` popout_ ${ type } _ ${ key } ` ] ,
value : key
} ;
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
addMessageToNotes ( message , channel ) {
if ( ! message ) return ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
channel = channel || BDFDB . LibraryModules . ChannelStore . getChannel ( message . channel _id ) ;
let guild _id = channel . guild _id || BDFDB . DiscordConstants . 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 ] ) {
notes [ guild _id ] [ channel . id ] [ message . id ] = {
addedat : new Date ( ) . getTime ( ) ,
channel : JSON . stringify ( channel ) ,
id : message . id ,
message : JSON . stringify ( message ) ,
timestamp : message . timestamp . _i . getTime ( )
} ;
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
2020-12-21 19:56:36 +01:00
BDFDB . NotificationUtils . toast ( this . labels . toast _noteadd , { type : "success" } ) ;
2020-09-19 20:49:33 +02:00
}
else this . removeNoteData ( notes [ guild _id ] [ channel . id ] [ message . id ] ) ;
}
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 ) ) ;
2020-02-04 08:20:40 +01:00
}
2019-11-09 12:53:04 +01:00
2020-09-19 20:49:33 +02:00
getNoteData ( message , channel ) {
if ( ! message ) return ;
channel = channel || BDFDB . LibraryModules . ChannelStore . getChannel ( message . channel _id ) ;
let guild _id = channel . guild _id || BDFDB . DiscordConstants . ME ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
return notes [ guild _id ] && notes [ guild _id ] [ channel . id ] && notes [ guild _id ] [ channel . id ] [ message . id ] ;
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
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 || BDFDB . DiscordConstants . ME ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
notes [ guild _id ] [ channel . id ] [ note . id ] . message = JSON . stringify ( newmessage ) ;
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
2020-12-21 19:56:36 +01:00
BDFDB . NotificationUtils . toast ( this . labels . toast _noteupdate , { type : "info" } ) ;
2020-09-19 20:49:33 +02:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02: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 || BDFDB . DiscordConstants . ME ;
let notes = BDFDB . DataUtils . load ( this , "notes" ) ;
delete notes [ guild _id ] [ channel . id ] [ note . id ] ;
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 ] ;
}
BDFDB . DataUtils . save ( notes , this , "notes" ) ;
2020-12-21 19:56:36 +01:00
BDFDB . NotificationUtils . toast ( this . labels . toast _noteremove , { type : "danger" } ) ;
2020-02-04 08:20:40 +01:00
}
2020-07-11 23:28:30 +02:00
2020-02-04 08:20:40 +01: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-21 19:56:36 +01:00
context _pinoption : "Запишете съобщението" ,
context _unpinoption : "Премахване на бележката" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "Бележката за актуализация" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Всички сървъри" ,
popout _filter _channel : "Канал" ,
popout _filter _server : "Сървър" ,
popout _note : "Бележки" ,
popout _pinoption : "Забележка" ,
popout _sort _messagetime : "Дата на съобщението" ,
popout _sort _notetime : "Дата на бележка" ,
toast _noteadd : "Съобщението е добавено към бележника" ,
toast _noteremove : "Съобщението е премахнато от бележника" ,
toast _noteupdate : "Актуализира съобщението в бележника"
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-21 19:56:36 +01:00
context _pinoption : "Skriv beskeden ned" ,
context _unpinoption : "Fjern noten" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "Opdater noten" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Alle servere" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Server" ,
popout _note : "Noter" ,
popout _pinoption : "Bemærk" ,
popout _sort _messagetime : "Meddelelsesdato" ,
popout _sort _notetime : "Bemærkdato" ,
toast _noteadd : "Besked føjet til notesbog" ,
toast _noteremove : "Besked fjernet fra notesbog" ,
toast _noteupdate : "Opdateret meddelelsen i notesbogen"
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-21 19:56:36 +01:00
context _pinoption : "Nachricht notieren" ,
context _unpinoption : "Notiz entfernen" ,
context _updateoption : "Notiz aktualisieren" ,
popout _filter _all : "Alle Server" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Server" ,
popout _note : "Notizen" ,
popout _pinoption : "Notieren" ,
popout _sort _messagetime : "Nachrichtendatum" ,
popout _sort _notetime : "Notizdatum" ,
toast _noteadd : "Nachricht zum Notizbuch hinzugefügt" ,
toast _noteremove : "Nachricht aus dem Notizbuch entfernt" ,
toast _noteupdate : "Nachricht im Notizbuch aktualisiert"
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-21 19:56:36 +01:00
context _pinoption : "Γράψτε το μήνυμα" ,
context _unpinoption : "Αφαιρέστε τη σημείωση" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "Ενημέρωση τη σημείωση" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Όλοι ο ι διακομιστές" ,
popout _filter _channel : "Κανάλι" ,
popout _filter _server : "Υπηρέτης" ,
popout _note : "Σημειώσεις" ,
popout _pinoption : "Σημείωση" ,
popout _sort _messagetime : "Ημερομηνία μηνύματος" ,
popout _sort _notetime : "Σημείωση ημερομηνίας" ,
toast _noteadd : "Τ ο μήνυμα προστέθηκε στο σημειωματάριο" ,
toast _noteremove : "Τ ο μήνυμα καταργήθηκε από το σημειωματάριο" ,
toast _noteupdate : "Ενημερώθηκε το μήνυμα στο σημειωματάριο"
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-21 19:56:36 +01:00
context _pinoption : "Escribe el mensaje" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Eliminar la nota" ,
context _updateoption : "Actualiza la nota" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Todos los servidores" ,
popout _filter _channel : "Canal" ,
popout _filter _server : "Servidor" ,
popout _note : "Notas" ,
popout _pinoption : "Nota" ,
popout _sort _messagetime : "Fecha del mensaje" ,
popout _sort _notetime : "Fecha della nota" ,
toast _noteadd : "Mensaje agregado al cuaderno" ,
toast _noteremove : "Mensaje eliminado de la libreta" ,
toast _noteupdate : "Se actualizó el mensaje en el cuaderno."
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-21 19:56:36 +01:00
context _pinoption : "Kirjoita viesti muistiin" ,
context _unpinoption : "Poista muistiinpano" ,
context _updateoption : "Päivitä muistiinpano" ,
popout _filter _all : "Kaikki palvelimet" ,
popout _filter _channel : "Kanava" ,
popout _filter _server : "Palvelin" ,
popout _note : "Muistiinpanoja" ,
popout _pinoption : "Merkintä" ,
popout _sort _messagetime : "Viestin päivämäärä" ,
popout _sort _notetime : "Muistiinpanon päivämäärä" ,
toast _noteadd : "Viesti lisättiin muistikirjaan" ,
toast _noteremove : "Viesti poistettu muistikirjasta" ,
toast _noteupdate : "Päivitetty muistikirjan viesti"
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 {
2021-03-26 12:46:07 +01:00
context _pinoption : "Noter le message" ,
2020-12-21 19:56:36 +01:00
context _unpinoption : "Supprimer la note" ,
context _updateoption : "Mettre à jour la note" ,
popout _filter _all : "Tous les serveurs" ,
popout _filter _channel : "Salon" ,
popout _filter _server : "Serveur" ,
2021-03-26 12:46:07 +01:00
popout _note : "Notes" ,
popout _pinoption : "Note" ,
2020-12-21 19:56:36 +01:00
popout _sort _messagetime : "Date du message" ,
popout _sort _notetime : "Date de la note" ,
2021-03-26 12:46:07 +01:00
toast _noteadd : "Message ajouté au carnet" ,
toast _noteremove : "Message supprimé du carnet" ,
toast _noteupdate : "Mise à jour du message dans le carnet"
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-21 19:56:36 +01:00
context _pinoption : "Zapišite poruku" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Izbriši bilješku" ,
context _updateoption : "Ažurirajte bilješku" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Svi poslužitelji" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Poslužitelju" ,
popout _note : "Bilješke" ,
popout _pinoption : "Bilješka" ,
popout _sort _messagetime : "Datum poruke" ,
popout _sort _notetime : "Datum bilješke" ,
toast _noteadd : "Poruka dodana u bilježnicu" ,
toast _noteremove : "Poruka uklonjena iz bilježnice" ,
toast _noteupdate : "Ažurirana je poruka u bilježnici"
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-21 19:56:36 +01:00
context _pinoption : "Írja le az üzenetet" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Törölje a jegyzetet" ,
2020-12-21 19:56:36 +01:00
context _updateoption : "Frissítse a jegyzetet" ,
popout _filter _all : "Minden szerver" ,
popout _filter _channel : "Csatorna" ,
popout _filter _server : "Szerver" ,
popout _note : "Jegyzetek" ,
popout _pinoption : "Jegyzet" ,
popout _sort _messagetime : "Üzenet dátuma" ,
popout _sort _notetime : "Jegyzet dátuma" ,
toast _noteadd : "Üzenet hozzáadva a jegyzetfüzethez" ,
toast _noteremove : "Üzenet eltávolítva a jegyzetfüzetből" ,
toast _noteupdate : "Frissítette az üzenetet a jegyzetfüzetben"
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-21 19:56:36 +01:00
context _pinoption : "Annota il messaggio" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Elimina la nota" ,
context _updateoption : "Aggiorna la nota" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Tutti i server" ,
popout _filter _channel : "Canale" ,
popout _filter _server : "Server" ,
popout _note : "Appunti" ,
popout _pinoption : "Nota" ,
popout _sort _messagetime : "Messaggio data" ,
popout _sort _notetime : "Nota data" ,
toast _noteadd : "Messaggio aggiunto al taccuino" ,
toast _noteremove : "Messaggio rimosso dal taccuino" ,
toast _noteupdate : "Aggiornato il messaggio nel taccuino"
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-21 19:56:36 +01:00
context _pinoption : "メッセージを書き留めます" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "メモを削除します" ,
context _updateoption : "メモを更新する" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "すべてのサーバー" ,
popout _filter _channel : "チャネル" ,
popout _filter _server : "サーバ" ,
popout _note : "ノート" ,
popout _pinoption : "注意" ,
popout _sort _messagetime : "メッセージの日付" ,
popout _sort _notetime : "メモ日" ,
toast _noteadd : "ノートブックにメッセージを追加" ,
toast _noteremove : "ノートブックからメッセージが削除されました" ,
toast _noteupdate : "ノートブックのメッセージを更新しました"
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-21 19:56:36 +01:00
context _pinoption : "메시지를 적어" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "메모 삭제" ,
2020-12-21 19:56:36 +01:00
context _updateoption : "메모 업데이트" ,
popout _filter _all : "모든 서버" ,
popout _filter _channel : "채널" ,
popout _filter _server : "섬기는 사람" ,
popout _note : "메모" ,
popout _pinoption : "노트" ,
popout _sort _messagetime : "메시지 날짜" ,
popout _sort _notetime : "메모 날짜" ,
toast _noteadd : "노트북에 추가 된 메시지" ,
toast _noteremove : "노트북에서 메시지가 제거되었습니다." ,
toast _noteupdate : "노트북의 메시지를 업데이트했습니다."
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-21 19:56:36 +01:00
context _pinoption : "Užrašykite žinutę" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Ištrinkite užrašą" ,
context _updateoption : "Atnaujinkite užrašą" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Visi serveriai" ,
popout _filter _channel : "Kanalą" ,
popout _filter _server : "Serverio" ,
popout _note : "Pastabos" ,
popout _pinoption : "Pastaba" ,
popout _sort _messagetime : "Pranešimo data" ,
popout _sort _notetime : "Užrašo data" ,
toast _noteadd : "Pranešimas pridėtas prie užrašų knygelės" ,
toast _noteremove : "Pranešimas pašalintas iš užrašų knygelės" ,
toast _noteupdate : "Atnaujino pranešimą užrašų knygutėje"
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-21 19:56:36 +01:00
context _pinoption : "Schrijf het bericht op" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Verwijder de notitie" ,
context _updateoption : "Werk de notitie bij" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Alle servers" ,
popout _filter _channel : "Kanaal" ,
popout _filter _server : "Server" ,
popout _note : "Notities" ,
popout _pinoption : "Notitie" ,
popout _sort _messagetime : "Datum bericht" ,
popout _sort _notetime : "Datum notitie" ,
toast _noteadd : "Bericht toegevoegd aan notitieblok" ,
toast _noteremove : "Bericht verwijderd uit notitieblok" ,
toast _noteupdate : "Het bericht in het notitieblok bijgewerkt"
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-21 19:56:36 +01:00
context _pinoption : "Skriv ned meldingen" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Slett notatet" ,
context _updateoption : "Oppdater notatet" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Alle servere" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Server" ,
popout _note : "Notater" ,
popout _pinoption : "Merk" ,
popout _sort _messagetime : "Meldingsdato" ,
popout _sort _notetime : "Merkdato" ,
toast _noteadd : "Melding lagt til notatbok" ,
toast _noteremove : "Melding fjernet fra notatblokken" ,
toast _noteupdate : "Oppdaterte meldingen i notatboken"
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-21 19:56:36 +01:00
context _pinoption : "Zapisz wiadomość" ,
context _unpinoption : "Usuń notatkę" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "Zaktualizuj notatkę" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Wszystkie serwery" ,
popout _filter _channel : "Kanał" ,
popout _filter _server : "Serwer" ,
popout _note : "Notatki" ,
popout _pinoption : "Uwaga" ,
popout _sort _messagetime : "Data wiadomości" ,
popout _sort _notetime : "Data notatki" ,
toast _noteadd : "Wiadomość dodana do notatnika" ,
toast _noteremove : "Wiadomość została usunięta z notatnika" ,
toast _noteupdate : "Zaktualizowano wiadomość w notatniku"
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 {
2021-03-25 16:38:03 +01:00
context _pinoption : "Anotar mensagem" ,
context _unpinoption : "Desanotar mensagem" ,
context _updateoption : "Atualizar nota" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Todos os servidores" ,
popout _filter _channel : "Canal" ,
popout _filter _server : "Servidor" ,
popout _note : "Notas" ,
popout _pinoption : "Nota" ,
popout _sort _messagetime : "Data da mensagem" ,
popout _sort _notetime : "Data da nota" ,
toast _noteadd : "Mensagem adicionada ao caderno" ,
2021-03-25 16:38:52 +01:00
toast _noteremove : "Mensagem removida do caderno" ,
2021-03-25 16:38:03 +01:00
toast _noteupdate : "Atualizou a mensagem no caderno"
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-21 19:56:36 +01:00
context _pinoption : "Notează mesajul" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Ștergeți nota" ,
context _updateoption : "Actualizați nota" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Toate serverele" ,
popout _filter _channel : "Canal" ,
popout _filter _server : "Server" ,
popout _note : "Note" ,
popout _pinoption : "Notă" ,
popout _sort _messagetime : "Mesajului data" ,
popout _sort _notetime : "Notați data" ,
toast _noteadd : "Mesaj adăugat în caiet" ,
toast _noteremove : "Mesaj eliminat din caiet" ,
toast _noteupdate : "Am actualizat mesajul din caiet"
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-21 19:56:36 +01:00
context _pinoption : "Запишите сообщение" ,
context _unpinoption : "Удалить заметку" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "Обновить заметку" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "В с е серверы" ,
popout _filter _channel : "Канал" ,
popout _filter _server : "Сервер" ,
2021-01-24 12:23:01 +01:00
popout _note : "Замечания" ,
2020-12-21 19:56:36 +01:00
popout _pinoption : "Запись" ,
popout _sort _messagetime : "Дата сообщения" ,
popout _sort _notetime : "Дата записи" ,
toast _noteadd : "Сообщение добавлено в блокнот" ,
toast _noteremove : "Сообщение удалено из записной книжки" ,
toast _noteupdate : "Обновил сообщение в блокноте"
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-21 19:56:36 +01:00
context _pinoption : "Skriv ner meddelandet" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Radera anteckningen" ,
context _updateoption : "Uppdatera anteckningen" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Alla servrar" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Server" ,
popout _note : "Anteckningar" ,
popout _pinoption : "Notera" ,
popout _sort _messagetime : "Meddelandedatum" ,
popout _sort _notetime : "Noteradatum" ,
toast _noteadd : "Meddelande tillagt anteckningsbok" ,
toast _noteremove : "Meddelandet har tagits bort från anteckningsboken" ,
toast _noteupdate : "Uppdaterat meddelandet i anteckningsboken"
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-21 19:56:36 +01:00
context _pinoption : "จดข้อความ" ,
context _unpinoption : "ลบบันทึก" ,
context _updateoption : "อัปเดตบันทึก" ,
popout _filter _all : "เซิร์ฟเวอร์ทั้งหมด" ,
popout _filter _channel : "ช่อง" ,
popout _filter _server : "เซิร์ฟเวอร์" ,
popout _note : "หมายเหตุ" ,
popout _pinoption : "บันทึก" ,
popout _sort _messagetime : "วันที่ส่งข้อความ" ,
popout _sort _notetime : "วันที่หมายเหตุ" ,
toast _noteadd : "เพิ่มข้อความในสมุดบันทึกแล้ว" ,
toast _noteremove : "ข้อความถูกลบออกจากสมุดบันทึก" ,
toast _noteupdate : "อัปเดตข้อความในสมุดบันทึก"
} ;
case "tr" : // Turkish
return {
context _pinoption : "Mesajı yazı n" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Notu silin" ,
context _updateoption : "Notu güncelleyin" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "Tüm sunucular" ,
popout _filter _channel : "Kanal" ,
popout _filter _server : "Sunucu" ,
popout _note : "Notlar" ,
popout _pinoption : "Not" ,
popout _sort _messagetime : "Mesaj tarihi" ,
popout _sort _notetime : "Not tarihi" ,
toast _noteadd : "Not defterine mesaj eklendi" ,
toast _noteremove : "Mesaj not defterinden kaldı rı ldı " ,
toast _noteupdate : "Defterdeki mesaj güncellendi"
} ;
case "uk" : // Ukrainian
return {
context _pinoption : "Запишіть повідомлення" ,
2021-01-24 12:23:01 +01:00
context _unpinoption : "Видаліть нотатку" ,
context _updateoption : "Оновіть нотатку" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "У с і сервери" ,
popout _filter _channel : "Каналу" ,
popout _filter _server : "Сервер" ,
popout _note : "Нотатки" ,
popout _pinoption : "Примітка" ,
popout _sort _messagetime : "Дата повідомлення" ,
popout _sort _notetime : "Дата примітки" ,
toast _noteadd : "Повідомлення додано до блокнота" ,
toast _noteremove : "Повідомлення видалено з блокнота" ,
toast _noteupdate : "Оновлено повідомлення в блокноті"
} ;
case "vi" : // Vietnamese
return {
context _pinoption : "Viết lại tin nhắn" ,
context _unpinoption : "Xóa ghi chú" ,
context _updateoption : "Cập nhật ghi chú" ,
popout _filter _all : "Tất cả các máy chủ" ,
popout _filter _channel : "Kênh" ,
popout _filter _server : "Người phục vụ" ,
popout _note : "Ghi chú" ,
popout _pinoption : "Ghi chú" ,
popout _sort _messagetime : "Ngày nhắn tin" ,
popout _sort _notetime : "Ghi chú ngày" ,
toast _noteadd : "Đã thêm tin nhắn vào sổ tay" ,
toast _noteremove : "Đã xóa tin nhắn khỏi sổ ghi chép" ,
toast _noteupdate : "Đã cập nhật tin nhắn trong sổ tay"
} ;
2021-01-15 17:54:22 +01:00
case "zh-CN" : // Chinese (China)
2020-12-21 19:56:36 +01:00
return {
context _pinoption : "写下消息" ,
context _unpinoption : "删除笔记" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "更新笔记" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "所有服务器" ,
popout _filter _channel : "渠道" ,
popout _filter _server : "服务器" ,
popout _note : "笔记" ,
popout _pinoption : "注意" ,
popout _sort _messagetime : "留言日期" ,
popout _sort _notetime : "备注日期" ,
toast _noteadd : "邮件已添加到笔记本" ,
toast _noteremove : "邮件已从笔记本中删除" ,
toast _noteupdate : "更新了笔记本中的消息"
} ;
2021-01-15 17:54:22 +01:00
case "zh-TW" : // Chinese (Taiwan)
2020-12-21 19:56:36 +01:00
return {
context _pinoption : "寫下消息" ,
context _unpinoption : "刪除筆記" ,
2021-01-24 12:23:01 +01:00
context _updateoption : "更新筆記" ,
2020-12-21 19:56:36 +01:00
popout _filter _all : "所有服務器" ,
popout _filter _channel : "渠道" ,
popout _filter _server : "服務器" ,
popout _note : "筆記" ,
popout _pinoption : "注意" ,
popout _sort _messagetime : "留言日期" ,
popout _sort _notetime : "備註日期" ,
toast _noteadd : "郵件已添加到筆記本" ,
toast _noteremove : "郵件已從筆記本中刪除" ,
toast _noteupdate : "更新了筆記本中的消息"
} ;
default : // English
return {
context _pinoption : "Note Message" ,
context _unpinoption : "Remove Note" ,
context _updateoption : "Update Note" ,
popout _filter _all : "All Servers" ,
popout _filter _channel : "Channel" ,
popout _filter _server : "Server" ,
popout _note : "Notes" ,
popout _pinoption : "Note" ,
popout _sort _messagetime : "Message Date" ,
popout _sort _notetime : "Note Date" ,
toast _noteadd : "Message added to Notebook" ,
toast _noteremove : "Message removed from Notebook" ,
2021-01-24 12:23:01 +01:00
toast _noteupdate : "Updated the Message in the Notebook"
2020-09-19 20:49:33 +02:00
} ;
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
} ;
2020-10-09 21:09:35 +02:00
} ) ( window . BDFDB _Global . PluginUtils . buildPlugin ( config ) ) ;
2020-09-19 20:49:33 +02:00
} ) ( ) ;