2020-02-27 08:44:03 +01:00
//META{"name":"ServerFolders","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ServerFolders","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ServerFolders/ServerFolders.plugin.js"}*//
2018-10-11 10:21:26 +02:00
2020-02-08 19:07:33 +01:00
var ServerFolders = ( _ => {
2020-04-15 09:14:05 +02:00
var _this ;
2020-02-08 19:07:33 +01:00
var folderStates , folderReads , guildStates ;
2020-07-15 16:50:10 +02:00
var folderConfigs = { } , customIcons = { } , settings = { } ;
2019-01-13 22:53:07 +01:00
2020-02-08 19:07:33 +01:00
const folderIcons = [
{ openicon : ` <path d="M 200,390 H 955 L 795,770 H 200 Z" fill="REPLACE_FILL2"/><path d="M 176.6,811 C 163.9,811 155.1,802.6 155,784.7 V 212.9 C 157.9,190.5 169,179.8 195.9,176 h 246 c 20.3,3.2 34.5,18.7 41,28.6 C 494.9,228.3 492.9,240.4 494,266 l 313.6,1.3 c 17.6,0.4 23.3,3.7 23.3,3.7 8.6,4.2 14.8,10.7 19,19.5 C 856.3,319.5 854,360 854,360 h 108.9 c 4.4,2.4 13.7,1.2 11.8,23.5 L 815.8,789.4 c -2.1,5.2 -12.5,13.6 -18.7,16.1 -6.8,2.7 -18.5,5.5 -23.9,5.5 z M 767,759 897,430 H 360 L 230,759 Z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 175,320 V 790 H 820 V 320 Z" fill="REPLACE_FILL2"/><path d="M 183,811 c -12.2,-0.6 -17.9,-4.8 -21.5,-8.2 C 159.5,801 154.8,792.6 155,779.7 V 215.6 c 3.3,-14.1 9.3,-21.4 15.1,-26.4 7.4,-6.3 16,-11.6 36.7,-13.2 h 237.3 c 23.3,6 32.2,18.7 38.7,28.6 7.6,11.7 9.4,18.6 10.3,41.4 L 494,266 h 313.4 c 16.9,0.1 23.5,5.1 23.5,5.1 8.6,4.2 14.5,10.9 19,19.5 0,0 3.7,7.5 3.1,19.8 V 777.2 c -1.1,9 -4.1,13.7 -4.1,13.7 -4.2,8.6 -10.7,14.8 -19.5,19 L 823.3,811 Z m 602.8,-55 c 2.8,-1.7 6.9,-4.5 8.9,-7.4 2.4,-3.6 5,-10.8 5.4,-24.7 V 362 c -0.2,-10.9 -4.2,-16.3 -4.2,-16.3 -2,-3 -5.9,-6.8 -8.7,-8.6 0,0 -5.8,-3 -12.7,-3.2 h -548.1 c -7.8,0 -13.9,3.6 -13.9,3.6 -3,2 -7.3,6.7 -8.4,17.3 v 386.4 c 2.8,10.4 7.5,16 13.6,17.7 h 544.9 c 11,-0.2 18.4,-1.9 23.3,-3 z" fill="REPLACE_FILL1"/> ` } ,
{ openicon : ` <path d="M 167,200 h 200 l 50,50 H 829.8 L 830,330 H 970 L 825,779 H 167 Z" fill="REPLACE_FILL2"/><path d="M 184,799 c -10.5,0 -22.3,-5.3 -27,-10 -4.7,-4.7 -9,-15.1 -9,-34 V 212 c 0,-13.3 5,-22 11,-28 4.4,-4.4 15.4,-10 30,-10 h 170.3 l 53.3,53 H 820 c 13.1,0 18.2,4.2 25,10 6.4,5.5 7,14.4 7,31 v 52 h 122.3 c 11.6,0 17.1,3.3 17.1,3.3 2.9,2.9 3.3,4.4 3.3,14.2 0,8.4 -0.9,13.5 -3.8,22.4 L 849,799 Z M 933,360 H 335 l -130,398.1 603.2,1.3 z M 289.7,334.6 c 3,-8.2 8,-14.8 17,-14.8 0,0 506.6,0.2 506.3,0.2 0,-39.8 -12.2,-53 -53,-53 L 403.3,266.7 350,213 H 240 c -37.6,0 -53,10.1 -53,53 v 382.7 z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 173,190 V 771 H 825 V 250 H 420 l -70,-60 z" fill="REPLACE_FILL2"/><path d="M 184.2,799 C 170.3,799 164.3,795.8 157.4,788.9 151.7,783.3 148,774.6 148,754.9 V 211.2 c 0.7,-18.6 6,-21.7 11.9,-27.6 6.8,-6.8 15.5,-9.4 29.3,-9.6 h 170.1 l 53.3,53 h 407.7 c 14.1,0 18.6,2.8 25.3,9.4 6.4,6.4 7.1,13.4 7.1,30.8 v 246.1 247.4 c 0.2,11.8 -1.9,22.1 -7.4,27.6 C 839.7,793.9 831,799 819.4,799 Z M 813,707 V 415 c 0,-36.9 -13.9,-53 -53,-53 H 240 c -38.1,0 -53,11.7 -53,53 v 292 c 0,38.8 11.5,53 53,53 h 520 c 37.8,0 53,-12.1 53,-53 z M 760,267 c 0,0 -228.6,-0.3 -356.7,-0.3 L 350,213 H 240 c -41.6,2.7 -52.2,14.3 -53,53 v 54 h 626 c -0.6,-37.5 -12,-53 -53,-53 z" fill="REPLACE_FILL1"/> ` } ,
{ openicon : ` <path d="M 307,330 H 970 L 825,779 H 167 Z" fill="REPLACE_FILL2"/><path d="M 189 174 C 174.4 174 163.4 179.6 159 184 C 153 190 148 198.7 148 212 L 148 755 C 148 773.9 152.3 784.3 157 789 C 161.7 793.7 173.5 799 184 799 L 849 799 L 990.8 359.8 C 993.8 350.9 994.7 345.9 994.7 337.4 C 994.7 327.6 994.3 326.2 991.4 323.3 C 991.4 323.3 985.9 320 974.3 320 L 852 320 L 852 268 C 852 251.4 851.4 242.5 845 237 C 838.2 231.2 833.1 227 820 227 L 412.6 227 L 359.3 174 L 189 174 z M 335 360 L 933 360 L 808.2 759.3 L 205 758.1 L 335 360 z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 173,345 V 771 H 825 V 345 Z" fill="REPLACE_FILL2"/><path d="M 189.2 174 C 175.4 174.2 166.7 176.8 159.9 183.6 C 154 189.5 148.7 192.7 148 211.2 L 148 754.9 C 148 774.6 151.7 783.3 157.4 788.9 C 164.3 795.8 170.3 799 184.2 799 L 819.4 799 C 831 799 839.7 793.9 845.2 788.4 C 850.8 782.8 852.9 772.5 852.7 760.8 L 852.7 513.3 L 852.7 267.2 C 852.7 249.8 852 242.8 845.6 236.4 C 838.9 229.7 834.4 227 820.3 227 L 412.6 227 L 359.3 174 L 189.2 174 z M 240 362 L 760 362 C 799.1 362 813 378.1 813 415 L 813 707 C 813 747.9 797.8 760 760 760 L 240 760 C 198.5 760 187 745.8 187 707 L 187 415 C 187 373.7 201.9 362 240 362 z" fill="REPLACE_FILL1"/> ` } ,
{ openicon : ` <path d="M 167,200 h 200 l 50,50 H 829.8 L 830,330 H 314 L 167,779 Z" fill="REPLACE_FILL2"/><path d="M 189 174 C 174.4 174 163.4 179.6 159 184 C 153 190 148 198.7 148 212 L 148 755 C 148 773.9 152.3 784.3 157 789 C 161.7 793.7 173.5 799 184 799 L 849 799 L 990.8 359.8 C 993.8 350.9 994.7 345.9 994.7 337.4 C 994.7 327.6 994.3 326.2 991.4 323.3 C 991.4 323.3 985.9 320 974.3 320 L 852 320 L 852 268 C 852 251.4 851.4 242.5 845 237 C 838.2 231.2 833.1 227 820 227 L 412.6 227 L 359.3 174 L 189 174 z M 240 213 L 350 213 L 403.3 266.7 L 760 267 C 800.8 267 813 280.2 813 320 C 813.3 320 306.7 319.8 306.7 319.8 C 297.7 319.8 292.7 326.4 289.7 334.6 L 187 648.7 L 187 266 C 187 223.1 202.4 213 240 213 z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 173,190 V 350 H 825 V 250 H 420 l -70,-60 z" fill="REPLACE_FILL2"/><path d="M 189.2 174 C 175.4 174.2 166.7 176.8 159.9 183.6 C 154 189.5 148.7 192.7 148 211.2 L 148 754.9 C 148 774.6 151.7 783.3 157.4 788.9 C 164.3 795.8 170.3 799 184.2 799 L 819.4 799 C 831 799 839.7 793.9 845.2 788.4 C 850.8 782.8 852.9 772.5 852.7 760.8 L 852.7 513.3 L 852.7 267.2 C 852.7 249.8 852 242.8 845.6 236.4 C 838.9 229.7 834.4 227 820.3 227 L 412.6 227 L 359.3 174 L 189.2 174 z M 240 213 L 350 213 L 403.3 266.7 C 531.4 266.7 760 267 760 267 C 801 267 812.4 282.5 813 320 L 187 320 L 187 266 C 187.8 227.3 198.4 215.7 240 213 z" fill="REPLACE_FILL1"/> ` } ,
{ openicon : ` <path d="M 132,305 H 880 V 750 H 132 Z" fill="REPLACE_FILL2"/><path d="M 135,188 c -5.6,0 -13.9,2.9 -19.8,8.9 C 109.4,203 107,206.8 107,216 c 0,189.7 0,379.3 0,569 0,11.1 1.7,14.8 7,20.2 C 120.5,811.6 125.4,813 135,813 h 717 c 16.7,0 16.7,-1.6 18.6,-6.6 L 981.3,423.4 c 0,-5.8 -1,-6.2 -2.8,-8.1 -1.9,-1.9 -4.3,-2 -11.9,-2 l -691.9,2.1 c -16.4,0 -21.3,11.5 -23.4,17.2 l -80.9,263 -0.2,0 C 159.1,714.4 147,704.3 147,677.2 V 334 h 733 v -26 c 0,-7.7 -1.6,-14.7 -7.6,-19.8 C 866.3,283.1 860.4,280 852,280 H 440 l -20,-82 c -1.2,-2.5 -3.1,-6.8 -5.8,-7.7 0,0 -3,-2.3 -10.2,-2.3 z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 132,305 H 880 V 750 H 132 Z" fill="REPLACE_FILL2"/><path d="M 135,813 c -10.3,0 -14.5,-1.4 -21,-7.8 C 108.7,799.8 107,796.1 107,785 c 0,-189.7 0,-379.3 0,-569 0,-9.2 2.4,-13 8.2,-19.1 C 121.1,190.9 129.4,188 135,188 h 269 c 7.2,0 10.2,2.3 10.2,2.3 2.7,0.9 4.6,5.2 5.8,7.7 l 20,82 h 412 c 8.4,0 14.3,3.1 20.4,8.2 C 878.4,293.3 880,300.3 880,308 v 26 H 147 v 343.2 c 0,27.1 18.1,25.2 21.7,5.4 l 32.7,-277.7 c 0.7,-2.8 2.7,-7.5 5.8,-10.6 C 210.4,391.1 214.5,388 222.7,388 H 852 c 7.9,0 15.9,2.9 20.5,7.5 C 878.3,401.3 880,408.6 880,416 v 369 c 0,6.9 -1.8,14.7 -7.4,19.3 C 866.2,809.6 858.9,813 852,813 Z" fill="REPLACE_FILL1"/> ` } ,
{ openicon : ` <path d="M 186.3,187 c -20,0 -35.7,7.4 -47.4,19.3 -11.7,11.9 -17.6,25 -17.6,45.7 v 80 l -0.3,416 c 0,10.9 4.6,32.6 16.7,45.1 C 149.8,805.6 168,813 186.3,813 365.7,749.3 880.3,734.5 880.3,734.5 c 0,0 0,-255.4 0,-402.5 0,-16.9 -4.7,-35 -17.2,-47.4 -12.5,-12.4 -30.1,-17.6 -47.8,-17.6 h -310 l -79,-80 z" fill="REPLACE_FILL1"/><path d="m 175.1,810.3 79.1,-393 c 8.3,-23.6 21.8,-42.9 53.1,-43 H 920.6 c 17.7,0 35.9,19.5 33.7,29.3 l -73.7,365.7 c -9,24.8 -11.1,41.3 -51.8,44 H 185.6 c -3.6,0 -6.4,-0.1 -11.1,-0.9 z" fill="REPLACE_FILL2"/> ` ,
closedicon : ` <path d="M 121,252 c 0,-20.7 5.9,-33.8 17.6,-45.7 C 150.3,194.4 166,187 186,187 h 240 l 79,80 -384,113 z" fill="REPLACE_FILL1"/><path d="M 186,813 c -18.4,0 -36.5,-7.4 -48.6,-19.9 C 125.3,780.6 120.7,758.9 120.7,748 L 121,332 c 0,-16.9 7.2,-31.7 18.6,-43.5 C 151,276.7 170.1,267 186,267 h 629 c 17.6,0 35.2,5.3 47.8,17.6 C 875.3,297 880,315.1 880,332 v 416 c 0,14.8 -3.4,36.6 -17,47.9 C 849.5,807.2 830.9,813 815,813 Z" fill="REPLACE_FILL2"/> ` } ,
{ openicon : ` <path d="M 160,253 h 614 c 14.8,0 29.7,8.6 36.9,15.8 C 819.4,277.3 826,289.4 826,305 v 95 H 160 Z" fill="REPLACE_FILL2"/><path d="M 199,200 c -26.2,0 -33.9,6.5 -41.5,15.6 C 149.8,224.8 147,231.8 147,252 V 386.7 387 c -20.9,0.5 -56.5,-3.5 -70.3,6.9 -2.5,1.9 -5.4,3.2 -8.3,9.8 -6.8,25.6 -0.3,54.8 1.1,70.3 9.1,59.2 69.1,294.7 74.9,310 3.7,9.8 4.6,13.6 10,15 h 689.6 c 6.3,-1.4 11.6,-15 11.6,-15 L 931.8,474 c 2.7,-20 8.3,-54 -0.2,-70.3 -2,-3.5 -6.5,-8.1 -9.3,-9.8 C 902.5,385.1 881.9,387 853,387 852.6,369.4 855,346.8 846.6,333 842.4,326.2 830.5,321.3 826,321.3 V 387 L 173.2,386.7 173,387 v -82 c 0,-14.6 2.8,-25.9 12.4,-35.5 C 195.9,259 207.7,253 225,253 h 201 l -54,-53 z" fill="REPLACE_FILL1"/> ` ,
closedicon : ` <path d="M 160,400 V 253 h 440 v 147 z" fill="REPLACE_FILL2"/><path d="M 186,799 c -24.2,0 -34,-8 -39.7,-13.6 C 140.8,779.9 134,769.1 134,747 V 372 c 0,-21.5 13,-32 13,-32 V 252 c 0,-20.2 2.8,-27.2 10.5,-36.4 C 165.1,206.5 172.8,200 199,200 h 173 l 54,53 H 225 c -17.3,0 -29.1,6 -39.6,16.5 C 175.8,279.1 173,290.4 173,305 l -0.4,19 c 0,0 9.6,-4 20.9,-4 H 494 L 614,200 h 186 c 17.7,0 26.6,7.1 36,14.2 C 846.5,222 852,233.6 852,252 v 495 c 0,16.1 -7.5,30.2 -14.1,36.7 C 831.4,790.2 815.9,799 800,799 Z" fill="REPLACE_FILL1"/> ` }
] ;
var folderGuildContent = null ;
const folderGuildContentComponent = class FolderGuildsContent extends BdApi . React . Component {
componentDidMount ( ) {
folderGuildContent = this ;
}
render ( ) {
let closing = this . props . closing ;
delete this . props . closing ;
2020-07-20 21:41:30 +02:00
let folders = Array . from ( BDFDB . LibraryModules . FolderUtils . getExpandedFolders ( ) ) . map ( folderId => BDFDB . LibraryModules . FolderStore . getGuildFolderById ( folderId ) ) . filter ( folder => folder && folder . guildIds ) ;
2020-02-08 19:07:33 +01:00
this . props . folders = folders . length || closing ? folders : ( this . props . folders || [ ] ) ;
BDFDB . TimeUtils . clear ( this . _rerenderTimeout ) ;
if ( ! folders . length && this . props . folders . length && ! closing ) this . _rerenderTimeout = BDFDB . TimeUtils . timeout ( _ => {
this . props . closing = true ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} , 300 ) ;
2020-04-19 11:51:11 +02:00
return BDFDB . ReactUtils . createElement ( "nav" , {
2020-02-08 19:07:33 +01:00
className : BDFDB . DOMUtils . formatClassName ( BDFDB . disCN . guildswrapper , BDFDB . disCN . guilds , this . props . themeOverride && BDFDB . disCN . themedark , BDFDB . disCN . _serverfoldersfoldercontent , ( ! folders . length || closing ) && BDFDB . disCN . _serverfoldersfoldercontentclosed ) ,
2020-06-27 09:33:54 +02:00
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ScrollerNone , {
2020-02-08 19:07:33 +01:00
className : BDFDB . disCN . guildsscroller ,
2020-07-20 21:41:30 +02:00
children : this . props . folders . map ( folder => {
let data = _this . getFolderConfig ( folder . folderId ) ;
return folder . guildIds . map ( guildId => {
2020-02-08 19:07:33 +01:00
return [
this . draggedGuild == guildId ? null : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . GuildComponents . Guild , {
guild : BDFDB . LibraryModules . GuildStore . getGuild ( guildId ) ,
state : true ,
list : true ,
2020-03-30 22:48:55 +02:00
tooltipConfig : Object . assign ( {
offset : 12
} , data . copyTooltipColor && {
2020-02-08 19:07:33 +01:00
backgroundColor : data . color3 ,
2020-03-30 22:48:55 +02:00
fontColor : data . color4 ,
} ) ,
2020-02-08 19:07:33 +01:00
onClick : event => {
if ( BDFDB . InternalData . pressedKeys . includes ( 46 ) ) {
BDFDB . ListenerUtils . stopEvent ( event ) ;
2020-07-21 09:58:39 +02:00
_this . removeGuildFromFolder ( folder . folderId , guildId ) ;
2020-02-08 19:07:33 +01:00
}
else {
if ( settings . closeAllFolders ) {
2020-07-21 09:58:39 +02:00
for ( let openFolderId of BDFDB . LibraryModules . FolderUtils . getExpandedFolders ( ) ) if ( openFolderId != folder . folderId || ! settings . forceOpenFolder ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( openFolderId ) ;
2020-02-08 19:07:33 +01:00
}
2020-07-21 09:58:39 +02:00
else if ( settings . closeTheFolder && ! settings . forceOpenFolder && BDFDB . LibraryModules . FolderUtils . isFolderExpanded ( folder . folderId ) ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( folder . folderId ) ;
2020-02-08 19:07:33 +01:00
else BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} ,
onMouseDown : ( event , instance ) => {
2020-03-28 08:00:23 +01:00
event = event . nativeEvent || event ;
2020-02-08 19:07:33 +01:00
let mousemove = event2 => {
if ( Math . sqrt ( ( event . pageX - event2 . pageX ) * * 2 ) > 20 || Math . sqrt ( ( event . pageY - event2 . pageY ) * * 2 ) > 20 ) {
BDFDB . ListenerUtils . stopEvent ( event ) ;
this . draggedGuild = guildId ;
2020-04-15 09:14:05 +02:00
let dragpreview = _this . createDragPreview ( BDFDB . ReactUtils . findDOMNode ( instance ) . cloneNode ( true ) , event2 ) ;
2020-02-08 19:07:33 +01:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
2019-11-28 10:18:29 +01:00
document . removeEventListener ( "mousemove" , mousemove ) ;
document . removeEventListener ( "mouseup" , mouseup ) ;
2020-02-08 19:07:33 +01:00
let dragging = event3 => {
2020-04-15 09:14:05 +02:00
_this . updateDragPreview ( dragpreview , event3 ) ;
2020-02-08 19:07:33 +01:00
let placeholder = BDFDB . DOMUtils . getParent ( BDFDB . dotCN . _serverfoldersguildplaceholder , event3 . target ) ;
let hoveredGuild = ( BDFDB . ReactUtils . findValue ( BDFDB . DOMUtils . getParent ( BDFDB . dotCNS . _serverfoldersfoldercontent + BDFDB . dotCN . guildouter , placeholder ? placeholder . previousSibling : event3 . target ) , "guild" , { up : true } ) || { } ) . id ;
if ( hoveredGuild ) {
let hoveredGuildFolder = BDFDB . GuildUtils . getFolder ( hoveredGuild ) ;
if ( ! hoveredGuildFolder || hoveredGuildFolder . folderId != folder . folderId ) hoveredGuild = null ;
}
let update = hoveredGuild != this . hoveredGuild ;
if ( hoveredGuild ) this . hoveredGuild = hoveredGuild ;
else delete this . hoveredGuild ;
if ( update ) BDFDB . ReactUtils . forceUpdate ( this ) ;
} ;
let releasing = event3 => {
BDFDB . ListenerUtils . stopEvent ( event3 ) ;
BDFDB . DOMUtils . remove ( dragpreview ) ;
if ( this . hoveredGuild ) {
let guildIds = [ ] . concat ( folder . guildIds ) ;
BDFDB . ArrayUtils . remove ( guildIds , this . draggedGuild , true ) ;
guildIds . splice ( guildIds . indexOf ( this . hoveredGuild ) + 1 , 0 , this . draggedGuild ) ;
2020-04-15 09:14:05 +02:00
_this . updateFolder ( Object . assign ( { } , folder , { guildIds } ) ) ;
2020-02-08 19:07:33 +01:00
}
delete this . draggedGuild ;
delete this . hoveredGuild ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
document . removeEventListener ( "mousemove" , dragging ) ;
document . removeEventListener ( "mouseup" , releasing ) ;
} ;
document . addEventListener ( "mousemove" , dragging ) ;
document . addEventListener ( "mouseup" , releasing ) ;
}
} ;
let mouseup = _ => {
document . removeEventListener ( "mousemove" , mousemove ) ;
document . removeEventListener ( "mouseup" , mouseup ) ;
} ;
document . addEventListener ( "mousemove" , mousemove ) ;
document . addEventListener ( "mouseup" , mouseup ) ;
}
2019-11-28 10:18:29 +01:00
} ) ,
2020-02-08 19:07:33 +01:00
this . hoveredGuild != guildId ? null : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . guildouter + BDFDB . disCN . _serverfoldersguildplaceholder ,
2019-11-28 10:18:29 +01:00
children : BDFDB . ReactUtils . createElement ( "div" , {
2020-02-11 17:05:06 +01:00
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . GuildComponents . Items . DragPlaceholder , { } )
2019-11-28 10:18:29 +01:00
} )
} )
]
2020-07-20 21:41:30 +02:00
} ) ;
2020-06-08 21:05:22 +02:00
} ) . filter ( n => n ) . reduce ( ( r , a ) => r . concat ( a , settings . addSeparators ? BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . GuildComponents . Items . Separator , { } ) : null ) , [ 0 ] ) . slice ( 1 , - 1 ) . flat ( 10 ) . filter ( n => n )
2020-02-08 19:07:33 +01:00
} )
} ) ;
}
} ;
const folderIconPickerComponent = class FolderIconPicker extends BdApi . React . Component {
render ( ) {
2020-04-15 09:14:05 +02:00
let folderIcons = _this . loadAllIcons ( ) ;
2020-02-08 19:07:33 +01:00
for ( let id in folderIcons ) if ( ! folderIcons [ id ] . customID ) {
2020-04-15 09:14:05 +02:00
folderIcons [ id ] . openicon = _this . createBase64SVG ( folderIcons [ id ] . openicon ) ;
folderIcons [ id ] . closedicon = _this . createBase64SVG ( folderIcons [ id ] . closedicon ) ;
2020-02-08 19:07:33 +01:00
}
folderIcons [ "-1" ] = { } ;
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
wrap : BDFDB . LibraryComponents . Flex . Wrap . WRAP ,
children : Object . keys ( folderIcons ) . sort ( ) . map ( id => {
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Card , {
className : BDFDB . DOMUtils . formatClassName ( BDFDB . disCN . _serverfoldersiconswatch , this . props . selectedIcon == id && BDFDB . disCN . _serverfoldersiconswatchselected ) ,
backdrop : false ,
iconID : id ,
grow : 0 ,
shrink : 0 ,
noRemove : ! folderIcons [ id ] . customID || this . props . selectedIcon == id ,
onMouseEnter : _ => {
this . props . hoveredIcon = id ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ,
onMouseLeave : _ => {
delete this . props . hoveredIcon ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ,
onClick : _ => {
this . props . selectedIcon = id ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ,
onRemove : _ => {
2020-07-15 16:50:10 +02:00
delete customIcons [ id ] ;
BDFDB . DataUtils . save ( customIcons , _this , "customicons" ) ;
2020-02-08 19:07:33 +01:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ,
children : folderIcons [ id ] . closedicon ? BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . _serverfoldersiconswatchinner ,
style : { background : ` url( ${ this . props . hoveredIcon == id ? folderIcons [ id ] . openicon : folderIcons [ id ] . closedicon } ) center/cover no-repeat ` }
} ) : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCN . _serverfoldersiconswatchinner ,
name : BDFDB . LibraryComponents . SvgIcon . Names . FOLDER ,
style : { color : "rbg(0, 0, 0)" }
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
} ) ;
} )
} )
}
} ;
var redCross = ` 'data:image/svg+xml; base64, PHN2ZyB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI0MDAiIGhlaWdodD0iNDAwIj48cGF0aCBkPSJNNDAuNDAwIDE3LjE3OCBDIDM5Ljg1MCAxNy4zNjYsMzguNzkzIDE3LjUzOCwzOC4wNTAgMTcuNTYwIEMgMzMuMzUxIDE3LjY5OSwyMy4zOTcgMjQuNzg4LDIxLjM4MSAyOS40MzIgQyAyMS4wODcgMzAuMTA5LDIwLjU2NiAzMC44OTYsMjAuMjIzIDMxLjE4MSBDIDE5Ljg4MCAzMS40NjUsMTkuNjAwIDMxLjg2NiwxOS42MDAgMzIuMDcxIEMgMTkuNjAwIDMyLjI3NiwxOS4yMzYgMzMuMjQyLDE4Ljc5MiAzNC4yMTggQyAxNi4zNDUgMzkuNTg5LDE2LjM0NSA0OS42MTEsMTguNzkyIDU0Ljk4MiBDIDE5LjIzNiA1NS45NTgsMTkuNjAwIDU2LjkxOCwxOS42MDAgNTcuMTE2IEMgMTkuNjAwIDU3LjMxNCwxOS45NjAgNTcuODAyLDIwLjQwMCA1OC4yMDAgQyAyMC44NDAgNTguNTk4LDIxLjIwMCA1OS4xMzEsMjEuMjAwIDU5LjM4NSBDIDIxLjIwMCA2MC4zOTEsMjUuNjgwIDY0Ljk0Miw5MS41MDUgMTMwLjgwMCBDIDEyOC45OTUgMTY4LjMxMCwxNTkuODQ5IDE5OS4zMjYsMTYwLjA2OCAxOTkuNzI0IEMgMTYwLjQwOSAyMDAuMzQ0LDE1MC45NTAgMjA5Ljk2NCw5My45ODkgMjY2LjkyNCBDIDE4Ljc5OCAzNDIuMTEzLDE5LjYwMCAzNDEuMjkyLDE5LjYwMCAzNDMuMTI2IEMgMTkuNjAwIDM0My4yODMsMTkuMjUwIDM0NC4wNjUsMTguODIyIDM0NC44NjQgQyAxNS40MjkgMzUxLjE5NSwxNS45NTggMzYyLjkxOCwxOS45MzIgMzY5LjQ0MCBDIDIyLjA5NCAzNzIuOTkwLDI3LjQ3NCAzNzguODAwLDI4LjU5OCAzNzguODAwIEMgMjguODYxIDM3OC44MDAsMjkuNDAyIDM3OS4xNjAsMjkuODAwIDM3OS42MDAgQyAzMC4xOTggMzgwLjA0MCwzMC43MDMgMzgwLjQwMCwzMC45MjIgMzgwLjQwMCBDIDMxLjE0MSAzODAuNDAwLDMyLjIzOCAzODAuODMxLDMzLjM2MCAzODEuMzU4IEMgMzQuNDgyIDM4MS44ODYsMzYuNDgwIDM4Mi41MzMsMzcuODAwIDM4Mi43OTcgQyA0My43ODYgMzgzLjk5NCw0NC4zMjMgMzg0LjAyNyw0Ny4yOTkgMzgzLjM4NiBDIDQ4Ljg5NSAzODMuMDQyLDUxLjAxMCAzODIuNjE5LDUyLjAwMCAzODIuNDQ2IEMgNTIuOTkwIDM4Mi4yNzQsNTQuNTE3IDM4MS43NDMsNTUuMzk0IDM4MS4yNjYgQyA1Ni4yNzEgMzgwLjc5MCw1Ny4xODggMzgwLjQwMCw1Ny40MzIgMzgwLjQwMCBDIDU3LjY3NiAzODAuNDAwLDU4LjIwMiAzODAuMDQwLDU4LjYwMCAzNzkuNjAwIEMgNTguOTk4IDM3OS4xNjAsNTkuNTk4IDM3OC44MDAsNTkuOTMyIDM3OC44MDAgQyA2MC4yNjcgMzc4LjgwMCw5MS43MjUgMzQ3LjYxNSwxMjkuODM5IDMwOS41MDAgQyAxNjkuMDU3IDI3MC4yODEsMTk5LjQ5NiAyNDAuMTQ1LDE5OS45NjQgMjQwLjA3MyBDIDIwMC42MDIgMjM5Ljk3NSwyMTYuMDAxIDI1NS4xOTMsMjY3LjQ5NSAzMDYuODE0IEMgMzI3LjA0NiAzNjYuNTExLDMzOS41MzEgMzc4LjgwMCwzNDAuNjI3IDM3OC44MDAgQyAzNDAuNzk4IDM3OC44MDAsMzQxLjI2NSAzNzkuMDk3LDM0MS42NjcgMzc5LjQ2MSBDIDM0NS43MjggMzgzLjEzNiwzNjEuMDEzIDM4NC40MDksMzY1LjY4NSAzODEuNDYxIEMgMzY2LjE4OCAzODEuMTQzLDM2Ny4wMjQgMzgwLjc1NywzNjcuNTQxIDM4MC42MDIgQyAzNzAuNTgzIDM3OS42OTEsMzc2LjYyMyAzNzQuMjAwLDM3OS4zODIgMzY5LjgzNiBDIDM4NS4xMDUgMzYwLjc4NSwzODQuMDM5IDM0Ni40MDksMzc3LjAzOSAzMzguMjI4IEMgMzc2LjA4NCAzMzcuMTEzLDM0NC44NDYgMzA1Ljc0MywzMDcuNjIxIDI2OC41MTcgQyAyNTUuMzI5IDIxNi4yMjQsMjM5Ljk2OSAyMDAuNjQ3LDI0MC4wNzAgMjAwLjAwOSBDIDI0MC4xNDMgMTk5LjU0NSwyNzAuMDYyIDE2OS4yODgsMzA4LjIxNiAxMzEuMDkxIEMgMzQ1LjYyNSA5My42NDEsMzc2LjcyMyA2Mi4zNzAsMzc3LjMyNCA2MS42MDAgQyAzODQuMjg2IDUyLjY3OCwzODUuMDM2IDQwLjYyMSwzNzkuMjc3IDMwLjE3MSBDIDM3Ni4xMzYgMjQuNDY5LDM2Ny45MDYgMTguNTM3LDM2MS42NjggMTcuNDc3IEMgMzU0LjY1NiAxNi4yODYsMzQ1LjA5NSAxNy42NjUsMzQxLjg4MyAyMC4zMzEgQyAzNDEuNTY3IDIwLjU5NCwzNDAuNTQ5IDIxLjMxOCwzMzkuNjIyIDIxLjk0MSBDIDMzOC42OTUgMjIuNTYzLDMwNy4wMzEgNTMuOTcyLDI2OS4yNTkgOTEuNzM3IEMgMjMxLjQ4NiAxMjkuNTAxLDIwMC4zMzAgMTYwLjQwMCwyMDAuMDIyIDE2MC40MDAgQyAxOTkuNzE0IDE2MC40MDAsMTY4LjkzOCAxMjkuODY5LDEzMS42MzEgOTIuNTU0IEMgNTYuMjI1IDE3LjEzMSw2MC4yODggMjEuMDQ3LDU1LjIwMCAxOC44ODcgQyA1MS41OTEgMTcuMzU0LDQyLjgzNiAxNi4zNDMsNDAuNDAwIDE3LjE3OHoiIGZpbGw9InJnYigyNDAsIDcxLCA3MSkiPjwvcGF0aD48L3N2Zz4=' ` ;
const folderIconCustomPreviewComponent = class FolderIconCustomPreview extends BdApi . React . Component {
componentDidMount ( ) {
this . _previewInterval = BDFDB . TimeUtils . interval ( _ => {
this . props . tick = ! this . props . tick ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} , 2000 ) ;
}
componentWillUnmount ( ) {
BDFDB . TimeUtils . clear ( this . _previewInterval ) ;
}
2020-06-17 17:16:11 +02:00
checkImage ( base64OrUrl , callback ) {
if ( base64OrUrl . indexOf ( "https://" ) == 0 || base64OrUrl . indexOf ( "http://" ) == 0 ) BDFDB . LibraryRequires . request ( base64OrUrl . trim ( ) , ( error , response , body ) => {
if ( response && response . headers [ "content-type" ] && response . headers [ "content-type" ] . indexOf ( "image" ) != - 1 && response . headers [ "content-type" ] != "image/gif" ) {
this . resizeImage ( "data:" + response . headers [ "content-type" ] + ";base64," + ( new Buffer ( body ) . toString ( "base64" ) ) , callback ) ;
}
else callback ( base64OrUrl ) ;
} ) ;
else this . resizeImage ( base64OrUrl , callback ) ;
}
resizeImage ( base64 , callback ) {
let type = base64 . split ( "data:" ) . slice ( 1 ) . join ( " " ) . split ( ";" ) [ 0 ] ;
if ( type == "image/gif" ) callback ( base64 ) ;
else {
let img = new Image ( ) ;
img . onload = function ( ) {
let width = 0 , height = 0 ;
if ( this . width >= this . height ) {
width = ( 128 / this . height ) * this . width ;
height = 128 ;
}
else {
width = 128 ;
height = ( 128 / this . width ) * this . height ;
}
let canvas = document . createElement ( "canvas" ) ;
let ctx = canvas . getContext ( "2d" ) ;
ctx . canvas . width = width ;
ctx . canvas . height = height ;
document . body . appendChild ( canvas ) ;
ctx . drawImage ( img , 0 , 0 , width , height ) ;
callback ( canvas . toDataURL ( type ) ) ;
} ;
img . onerror = function ( ) {
callback ( base64 ) ;
} ;
img . src = base64 ;
}
}
2020-02-08 19:07:33 +01:00
render ( ) {
return [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2020-04-15 09:14:05 +02:00
title : _this . labels . modal _customopen _text ,
2020-02-08 19:07:33 +01:00
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
type : "file" ,
filter : "image" ,
value : this . props . open ,
onChange : value => {
this . props . open = value ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2020-04-15 09:14:05 +02:00
title : _this . labels . modal _customclosed _text ,
2020-02-08 19:07:33 +01:00
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
type : "file" ,
filter : "image" ,
value : this . props . closed ,
onChange : value => {
this . props . closed = value ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2020-04-15 09:14:05 +02:00
title : _this . labels . modal _custompreview _text ,
2020-02-08 19:07:33 +01:00
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
justify : BDFDB . LibraryComponents . Flex . Justify . BETWEEN ,
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . _serverfoldersiconswatch + BDFDB . disCN . _serverfoldersiconswatchpreview ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . _serverfoldersiconswatchinner ,
style : { background : ` url( ${ this . props . open || redCross } ) center/cover no-repeat ` }
} )
} ) ,
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . _serverfoldersiconswatch + BDFDB . disCN . _serverfoldersiconswatchpreview ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . _serverfoldersiconswatchinner ,
style : { background : ` url( ${ this . props . closed || redCross } ) center/cover no-repeat ` }
} )
} ) ,
BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCNS . _serverfoldersiconswatch + BDFDB . disCN . _serverfoldersiconswatchpreview ,
children : BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . _serverfoldersiconswatchinner ,
style : { background : ` url( ${ ( this . props . tick ? this . props . open : this . props . closed ) || redCross } ) center/cover no-repeat ` }
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Button , {
children : BDFDB . LanguageUtils . LanguageStrings . ADD ,
onClick : ( e , instance ) => {
let inputIns = BDFDB . ReactUtils . findOwner ( this , { name : "BDFDB_TextInput" , all : true , unlimited : true } ) ;
if ( inputIns . length == 2 && inputIns [ 0 ] . props . value && inputIns [ 1 ] . props . value ) {
2020-06-17 17:16:11 +02:00
this . checkImage ( inputIns [ 0 ] . props . value , openIcon => {
this . checkImage ( inputIns [ 1 ] . props . value , closedIcon => {
2020-07-15 16:50:10 +02:00
customIcons [ _this . generateId ( "customicon" ) ] = { openicon : openIcon , closedicon : closedIcon } ;
BDFDB . DataUtils . save ( customIcons , _this , "customicons" ) ;
2020-06-17 17:16:11 +02:00
this . props . open = null ;
this . props . closed = null ;
BDFDB . ModuleUtils . forceAllUpdates ( _this , "GuildFolderSettingsModal" ) ;
BDFDB . NotificationUtils . toast ( "Custom Icon was added to selection" , { type : "success" } ) ;
} ) ;
} )
2020-02-08 19:07:33 +01:00
}
else BDFDB . NotificationUtils . toast ( "Add an image for the open and the closed icon" , { type : "danger" } ) ;
}
} )
]
} )
} )
]
}
} ;
return class ServerFolders {
getName ( ) { return "ServerFolders" ; }
2019-01-26 22:45:19 +01:00
2020-07-21 09:58:39 +02:00
getVersion ( ) { return "6.8.4" ; }
2018-10-11 10:21:26 +02:00
2020-02-08 19:07:33 +01:00
getAuthor ( ) { return "DevilBro" ; }
2018-10-11 10:21:26 +02:00
2020-02-08 19:07:33 +01:00
getDescription ( ) { return "Patches Discords native Folders in a way to open Servers within a Folder in a new bar to the right. Also adds a bunch of new features to more easily organize, customize and manage your Folders." ; }
2018-10-11 10:21:26 +02:00
2020-07-20 21:41:30 +02:00
constructor ( ) {
this . changelog = {
2020-07-21 09:58:39 +02:00
"fixed" : [ [ "Empty invisible folders" , "Fixed an issue where an open empty invisible folder would force the extra column to stay open forever, why the fuck discord are there empty invisible folders" ] , [ "Switching" , "Clicking a server in a folder opens the server again" ] ]
2020-07-20 21:41:30 +02:00
} ;
2020-02-08 19:07:33 +01:00
this . patchedModules = {
after : {
AppView : "render" ,
2020-03-30 22:48:55 +02:00
GuildFolder : "type" ,
2020-07-15 16:50:10 +02:00
Guilds : "render" ,
2020-02-08 19:07:33 +01:00
Guild : [ "componentDidMount" , "render" ] ,
GuildFolderSettingsModal : [ "componentDidMount" , "render" ]
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
} ;
2018-10-11 10:21:26 +02:00
}
2020-02-08 19:07:33 +01:00
initConstructor ( ) {
2020-04-15 09:14:05 +02:00
_this = this ;
folderStates = { } ;
folderReads = { } ;
guildStates = { } ;
2020-03-31 20:46:41 +02:00
2020-02-08 19:07:33 +01:00
this . css = `
. $ { this . name } - modal $ { BDFDB . dotCN . _serverfoldersiconswatch } {
position : relative ;
margin : 3 px 3 px ;
padding : 3 px 3 px ;
width : 55 px ;
height : 55 px ;
border - radius : 12 px ;
cursor : pointer ;
}
. $ { this . name } - modal $ { BDFDB . dotCN . _serverfoldersiconswatch + BDFDB . dotCN . _serverfoldersiconswatchpreview } {
width : 95 px ;
height : 95 px ;
cursor : default ;
}
. $ { this . name } - modal $ { BDFDB . dotCN . _serverfoldersiconswatch } : hover {
background - color : var ( -- background - modifier - hover ) ;
}
. $ { this . name } - modal $ { BDFDB . dotCN . _serverfoldersiconswatch + BDFDB . dotCN . _serverfoldersiconswatchselected } {
background - color : var ( -- background - modifier - selected ) ;
}
. $ { this . name } - modal $ { BDFDB . dotCNS . _serverfoldersiconswatch + BDFDB . dotCN . _serverfoldersiconswatchinner } {
width : 100 % ;
height : 100 % ;
border - radius : 12 px ;
background - position : center ;
background - size : cover ;
background - repeat : no - repeat ;
}
. $ { this . name } - modal $ { BDFDB . dotCN . _serverfoldersiconswatch } svg$ { BDFDB . dotCN . _serverfoldersiconswatchinner } {
transform : translateY ( - 2 px ) scale ( 0.8 ) ;
}
. $ { this . name } - modal $ { BDFDB . dotCNS . _serverfoldersiconswatch + BDFDB . dotCN . hovercardbutton } {
position : absolute ;
top : - 10 px ;
right : - 10 px ;
}
$ { BDFDB . dotCN . _serverfoldersdragpreview } {
pointer - events : none ! important ;
position : absolute ! important ;
opacity : 0.5 ! important ;
z - index : 10000 ! important ;
}
$ { BDFDB . dotCN . guildswrapper + BDFDB . dotCN . _serverfoldersfoldercontent } {
transition : width 0.3 s linear ! important ;
}
$ { BDFDB . dotCN . guildswrapper + BDFDB . dotCN . _serverfoldersfoldercontent + BDFDB . dotCN . _serverfoldersfoldercontentclosed } {
width : 0 px ! important ;
}
$ { BDFDB . dotCN . appcontainer } {
display : flex ! important ;
}
$ { BDFDB . dotCN . guildswrapper } {
position : static ! important ;
contain : unset ! important ;
}
$ { BDFDB . dotCN . chatbase } {
position : static ! important ;
contain : unset ! important ;
width : 100 % ! important ;
} ` ;
2019-10-08 19:12:48 +02:00
2020-02-08 19:07:33 +01:00
this . defaults = {
settings : {
closeOtherFolders : { value : false , description : "Close other Folders when opening a Folder." } ,
closeTheFolder : { value : false , description : "Close the Folder when selecting a Server." } ,
closeAllFolders : { value : false , description : "Close All Folders when selecting a Server." } ,
forceOpenFolder : { value : false , description : "Force a Folder to open when switching to a Server of that Folder." } ,
showCountBadge : { value : true , description : "Display Badge for Amount of Servers in a Folder." } ,
2020-05-11 14:18:20 +02:00
extraColumn : { value : true , description : "Moves the Servers from opened Folders in an extra column." } ,
addSeparators : { value : true , description : "Adds separators between Servers of different Folders in extra column." }
2020-02-08 19:07:33 +01:00
}
} ;
}
2020-09-04 10:51:39 +02:00
getSettingsPanel ( collapseStates = { } ) {
2020-02-08 19:07:33 +01:00
if ( ! window . BDFDB || typeof BDFDB != "object" || ! BDFDB . loaded || ! this . started ) return ;
2020-09-04 11:25:48 +02:00
settings = BDFDB . DataUtils . get ( this , "settings" ) ;
2020-03-28 07:55:39 +01:00
let settingsPanel , settingsItems = [ ] ;
2019-10-08 19:12:48 +02:00
2020-03-28 07:55:39 +01:00
for ( let key in settings ) settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
2020-02-08 19:07:33 +01:00
className : BDFDB . disCN . marginbottom8 ,
type : "Switch" ,
plugin : this ,
keys : [ "settings" , key ] ,
label : this . defaults . settings [ key ] . description ,
value : settings [ key ]
} ) ) ;
2020-03-28 07:55:39 +01:00
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
2020-02-08 19:07:33 +01:00
type : "Button" ,
className : BDFDB . disCN . marginbottom8 ,
color : BDFDB . LibraryComponents . Button . Colors . RED ,
label : "Reset all Folders" ,
onClick : _ => {
BDFDB . ModalUtils . confirm ( this , "Are you sure you want to reset all folders?" , _ => {
BDFDB . DataUtils . remove ( this , "folders" ) ;
} ) ;
} ,
children : BDFDB . LanguageUtils . LanguageStrings . RESET
} ) ) ;
2020-03-28 07:55:39 +01:00
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
2020-02-08 19:07:33 +01:00
type : "Button" ,
className : BDFDB . disCN . marginbottom8 ,
color : BDFDB . LibraryComponents . Button . Colors . RED ,
label : "Remove all custom Icons" ,
onClick : _ => {
BDFDB . ModalUtils . confirm ( this , "Are you sure you want to remove all custom icons?" , _ => {
BDFDB . DataUtils . remove ( this , "customicons" ) ;
} ) ;
} ,
children : BDFDB . LanguageUtils . LanguageStrings . REMOVE
} ) ) ;
2019-12-18 10:55:02 +01:00
2020-03-28 07:55:39 +01:00
return settingsPanel = BDFDB . PluginUtils . createSettingsPanel ( this , settingsItems ) ;
2018-10-11 10:21:26 +02:00
}
2020-04-11 19:32:58 +02:00
// Legacy
2020-08-21 16:17:47 +02:00
load ( ) {
if ( window . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) BDFDB . PluginUtils . load ( this ) ;
}
2020-02-08 19:07:33 +01:00
start ( ) {
if ( ! window . BDFDB ) window . BDFDB = { myPlugins : { } } ;
if ( window . BDFDB && window . BDFDB . myPlugins && typeof window . BDFDB . myPlugins == "object" ) window . BDFDB . myPlugins [ this . getName ( ) ] = this ;
let libraryScript = document . querySelector ( "head script#BDFDBLibraryScript" ) ;
if ( ! libraryScript || ( performance . now ( ) - libraryScript . getAttribute ( "date" ) ) > 600000 ) {
if ( libraryScript ) libraryScript . remove ( ) ;
libraryScript = document . createElement ( "script" ) ;
libraryScript . setAttribute ( "id" , "BDFDBLibraryScript" ) ;
libraryScript . setAttribute ( "type" , "text/javascript" ) ;
libraryScript . setAttribute ( "src" , "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js" ) ;
libraryScript . setAttribute ( "date" , performance . now ( ) ) ;
libraryScript . addEventListener ( "load" , _ => { this . initialize ( ) ; } ) ;
document . head . appendChild ( libraryScript ) ;
}
else if ( window . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) this . initialize ( ) ;
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-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
initialize ( ) {
if ( window . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
if ( this . started ) return ;
BDFDB . PluginUtils . init ( this ) ;
let forceClosing = false ;
BDFDB . ModuleUtils . patch ( this , BDFDB . LibraryModules . GuildUtils , "toggleGuildFolderExpand" , { after : e => {
2020-06-08 21:05:22 +02:00
if ( settings . closeOtherFolders && ! forceClosing ) {
2020-02-08 19:07:33 +01:00
forceClosing = true ;
for ( let openFolderId of BDFDB . LibraryModules . FolderUtils . getExpandedFolders ( ) ) if ( openFolderId != e . methodArguments [ 0 ] ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( openFolderId ) ;
forceClosing = false ;
}
} } ) ;
2020-03-30 22:48:55 +02:00
this . forceUpdateAll ( ) ;
2020-02-08 19:07:33 +01:00
}
else console . error ( ` %c[ ${ this . getName ( ) } ]%c ` , "color: #3a71c1; font-weight: 700;" , "" , "Fatal Error: Could not load BD functions!" ) ;
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
stop ( ) {
if ( window . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
this . stopping = true ;
2020-03-30 22:48:55 +02:00
this . forceUpdateAll ( ) ;
2020-02-08 19:07:33 +01:00
BDFDB . DOMUtils . removeClassFromDOM ( BDFDB . disCN . _serverfoldersfoldercontentisopen ) ;
BDFDB . PluginUtils . clear ( this ) ;
}
}
2018-10-11 10:21:26 +02:00
2020-02-08 19:07:33 +01:00
onSwitch ( ) {
2020-06-08 21:05:22 +02:00
if ( typeof BDFDB === "object" && settings . forceOpenFolder ) {
2020-02-08 19:07:33 +01:00
let folder = BDFDB . GuildUtils . getFolder ( BDFDB . LibraryModules . LastGuildStore . getGuildId ( ) ) ;
if ( folder && ! BDFDB . LibraryModules . FolderUtils . isFolderExpanded ( folder . folderId ) ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( folder . folderId ) ;
}
2019-11-28 10:18:29 +01:00
}
2020-02-08 19:07:33 +01:00
2020-04-11 19:32:58 +02:00
// Begin of own functions
2020-02-08 19:07:33 +01:00
onSettingsClosed ( ) {
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
2020-08-03 21:08:18 +02:00
folderStates = { } ;
2020-03-30 22:48:55 +02:00
this . forceUpdateAll ( ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
}
onGuildContextMenu ( e ) {
if ( document . querySelector ( BDFDB . dotCN . modalwrapper ) ) return ;
2020-05-19 18:55:16 +02:00
if ( e . instance . props . guild ) {
let folders = BDFDB . LibraryModules . FolderStore . guildFolders . filter ( n => n . folderId ) ;
let folder = BDFDB . GuildUtils . getFolder ( e . instance . props . guild . id ) ;
let unfolderedGuilds = BDFDB . LibraryModules . FolderStore . getSortedGuilds ( ) . filter ( n => ! n . folderId ) . map ( n => n . guilds [ 0 ] ) . filter ( n => n ) ;
2020-05-20 14:40:43 +02:00
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : "devmode-copy-id" , group : true } ) ;
2020-05-20 11:55:46 +02:00
children . splice ( index > - 1 ? index : children . length , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-05-19 18:55:16 +02:00
label : this . labels . servercontext _serverfolders _text ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "submenu-add" ) ,
children : folder ? [
2020-05-20 11:55:46 +02:00
BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-05-19 18:55:16 +02:00
label : this . labels . serversubmenu _removefromfolder _text ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "remove-from-folder" ) ,
color : BDFDB . LibraryComponents . MenuItems . Colors . DANGER ,
action : _ => {
this . removeGuildFromFolder ( folder . folderId , e . instance . props . guild . id ) ;
}
} )
] : [
2020-05-20 11:55:46 +02:00
BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-05-19 18:55:16 +02:00
label : this . labels . serversubmenu _createfolder _text ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "create-folder" ) ,
disabled : ! unfolderedGuilds . length ,
action : _ => {
this . openFolderCreationMenu ( unfolderedGuilds , e . instance . props . guild . id ) ;
}
} ) ,
2020-05-20 11:55:46 +02:00
BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-05-19 18:55:16 +02:00
label : this . labels . serversubmenu _addtofolder _text ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "submenu-add-to-folder" ) ,
disabled : ! folders . length ,
2020-05-20 11:55:46 +02:00
children : folders . map ( ( folder , i ) => BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-05-19 18:55:16 +02:00
label : folder . folderName || ` ${ BDFDB . LanguageUtils . LanguageStrings . SERVER _FOLDER _PLACEHOLDER } # ${ i + 1 } ` ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "add-to-folder" , i + 1 ) ,
action : _ => {
this . addGuildToFolder ( folder . folderId , e . instance . props . guild . id ) ;
}
} ) )
} )
]
} )
} ) ) ;
}
}
onGuildFolderContextMenu ( e ) {
if ( document . querySelector ( BDFDB . dotCN . modalwrapper ) ) return ;
if ( e . instance . props . target && e . instance . props . folderId ) {
2020-02-08 19:07:33 +01:00
let folder = BDFDB . LibraryModules . FolderStore . getGuildFolderById ( e . instance . props . folderId ) ;
let data = this . getFolderConfig ( e . instance . props . folderId ) ;
let muted = data . muteFolder && folder . guildIds . every ( guildid => BDFDB . LibraryModules . MutedUtils . isGuildOrCategoryOrChannelMuted ( guildid ) ) ;
if ( data . muteFolder != muted ) {
data . muteFolder = muted ;
2019-11-28 10:18:29 +01:00
BDFDB . DataUtils . save ( data , this , "folders" , e . instance . props . folderId ) ;
2019-10-08 19:12:48 +02:00
}
2020-05-20 14:40:43 +02:00
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : "mark-folder-read" } ) ;
children . splice ( index > - 1 ? index + 1 : children . length , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuCheckboxItem , {
label : this . labels . foldercontext _autoreadfolder _text ,
2020-05-19 18:55:16 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "auto-read-folder" ) ,
2020-05-20 14:40:43 +02:00
checked : data . autoRead ,
action : state => {
data . autoRead = state ;
BDFDB . DataUtils . save ( data , this , "folders" , e . instance . props . folderId ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
} ) ) ;
2020-05-20 11:55:46 +02:00
e . returnvalue . props . children . splice ( e . returnvalue . props . children . length - 1 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
2020-05-20 14:40:43 +02:00
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuCheckboxItem , {
label : this . labels . foldercontext _mutefolder _text ,
2020-05-19 18:55:16 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "mute-folder" ) ,
2020-05-20 14:40:43 +02:00
checked : muted ,
action : state => {
data . muteFolder = state ;
BDFDB . DataUtils . save ( data , this , "folders" , e . instance . props . folderId ) ;
2020-07-17 10:33:54 +02:00
for ( let guildId of folder . guildIds ) if ( BDFDB . LibraryModules . MutedUtils . isGuildOrCategoryOrChannelMuted ( guildId ) != state ) BDFDB . LibraryModules . GuildNotificationsUtils . updateGuildNotificationSettings ( guildId , { muted : state , suppress _everyone : state , suppress _roles : state } ) ;
2020-02-08 19:07:33 +01:00
}
} )
} ) ) ;
2020-05-20 11:55:46 +02:00
e . returnvalue . props . children . push ( BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-02-08 19:07:33 +01:00
label : this . labels . foldercontext _removefolder _text ,
2020-05-19 18:55:16 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "remove-folder" ) ,
color : BDFDB . LibraryComponents . MenuItems . Colors . DANGER ,
2020-02-08 19:07:33 +01:00
action : event => {
BDFDB . ModalUtils . confirm ( this , ` Are you sure you want to remove the folder ${ folder . folderName ? ` ' ${ folder . folderName } ' ` : "" } ? ` , _ => {
this . removeFolder ( e . instance . props . folderId ) ;
} ) ;
}
} )
} ) ) ;
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
processAppView ( e ) {
2020-06-08 21:05:22 +02:00
if ( settings . extraColumn ) {
2020-06-16 17:07:08 +02:00
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : [ "FluxContainer(Guilds)" , "FluxContainer(NavigableGuilds)" ] } ) ;
2020-05-11 14:18:20 +02:00
if ( index > - 1 ) children . splice ( index + 1 , 0 , BDFDB . ReactUtils . createElement ( folderGuildContentComponent , {
themeOverride : children [ index ] . props . themeOverride
2020-08-03 21:08:18 +02:00
} , true ) ) ;
2020-05-11 14:18:20 +02:00
}
2019-11-28 10:18:29 +01:00
}
2020-07-15 16:50:10 +02:00
processGuilds ( e ) {
if ( settings . extraColumn ) {
let topBar = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . guildswrapperunreadmentionsbartop ] ] } ) ;
if ( topBar ) {
let topIsVisible = topBar . props . isVisible ;
topBar . props . isVisible = ( ... args ) => {
let ids = BDFDB . LibraryModules . FolderStore . guildFolders . filter ( n => n . folderId ) . map ( n => n . guildIds ) . flat ( 10 ) ;
args [ 2 ] = args [ 2 ] . filter ( n => ! ids . includes ( n ) ) ;
return topIsVisible ( ... args ) ;
} ;
}
let bottomBar = BDFDB . ReactUtils . findChild ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . guildswrapperunreadmentionsbarbottom ] ] } ) ;
if ( bottomBar ) {
let bottomIsVisible = bottomBar . props . isVisible ;
bottomBar . props . isVisible = ( ... args ) => {
let ids = BDFDB . LibraryModules . FolderStore . guildFolders . filter ( n => n . folderId ) . map ( n => n . guildIds ) . flat ( 10 ) ;
args [ 2 ] = args [ 2 ] . filter ( n => ! ids . includes ( n ) ) ;
return bottomIsVisible ( ... args ) ;
} ;
}
}
}
2020-02-08 19:07:33 +01:00
processGuildFolder ( e ) {
let expandedFolders = BDFDB . LibraryModules . FolderUtils . getExpandedFolders ( ) ;
if ( expandedFolders . size ) BDFDB . DOMUtils . addClass ( document . body , BDFDB . disCN . _serverfoldersfoldercontentisopen ) ;
else BDFDB . DOMUtils . removeClassFromDOM ( BDFDB . disCN . _serverfoldersfoldercontentisopen ) ;
2020-03-31 20:46:41 +02:00
2020-02-08 19:07:33 +01:00
let data = this . getFolderConfig ( e . instance . props . folderId ) ;
2020-07-17 10:33:54 +02:00
if ( data . muteFolder ) for ( let guildId of e . instance . props . guildIds ) if ( ! BDFDB . LibraryModules . MutedUtils . isGuildOrCategoryOrChannelMuted ( guildId ) ) BDFDB . LibraryModules . GuildNotificationsUtils . updateGuildNotificationSettings ( guildId , { muted : true , suppress _everyone : true } ) ;
2020-03-31 20:46:41 +02:00
let state = this . getState ( e . instance ) ;
2020-02-08 19:07:33 +01:00
if ( folderStates [ e . instance . props . folderId ] && ! BDFDB . equals ( state , folderStates [ e . instance . props . folderId ] ) ) {
if ( data . autoRead && ( state . unread || state . badge > 0 ) ) {
BDFDB . TimeUtils . clear ( folderReads [ e . instance . props . folderId ] ) ;
folderReads [ e . instance . props . folderId ] = BDFDB . TimeUtils . timeout ( _ => {
BDFDB . GuildUtils . markAsRead ( e . instance . props . guildIds ) ;
} , 10000 ) ;
}
BDFDB . ReactUtils . forceUpdate ( folderGuildContent ) ;
2019-01-13 22:53:07 +01:00
}
2020-02-08 19:07:33 +01:00
folderStates [ e . instance . props . folderId ] = state ;
2020-03-31 20:46:41 +02:00
2020-06-16 17:07:08 +02:00
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : "ListItemTooltip" } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) children [ index ] = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : e . instance . props . folderName || BDFDB . FolderUtils . getDefaultName ( e . instance . props . folderId ) ,
tooltipConfig : {
type : "right" ,
list : true ,
2020-03-30 22:48:55 +02:00
offset : 12 ,
2020-02-08 19:07:33 +01:00
backgroundColor : data . color3 ,
fontColor : data . color4
} ,
children : children [ index ] . props . children
} ) ;
if ( e . instance . props . expanded || data . useCloseIcon ) {
let folderIcons = this . loadAllIcons ( ) , icontype = e . instance . props . expanded ? "openicon" : "closedicon" ;
let icon = folderIcons [ data . iconID ] ? ( ! folderIcons [ data . iconID ] . customID ? this . createBase64SVG ( folderIcons [ data . iconID ] [ icontype ] , data . color1 , data . color2 ) : folderIcons [ data . iconID ] [ icontype ] ) : null ;
if ( icon ) {
2020-06-16 17:07:08 +02:00
[ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : "FolderIcon" } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) children [ index ] = BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . guildfoldericonwrapper ,
style : { background : ` url( ${ icon } ) center/cover no-repeat ` }
} ) ;
}
2019-01-13 22:53:07 +01:00
}
2020-05-11 14:18:20 +02:00
if ( settings . showCountBadge ) {
2020-06-16 17:07:08 +02:00
[ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : "BlobMask" } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) {
2020-02-11 17:11:59 +01:00
children [ index ] . props . upperLeftBadgeWidth = BDFDB . LibraryComponents . Badges . getBadgeWidthForValue ( e . instance . props . guildIds . length ) ;
children [ index ] . props . upperLeftBadge = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Badges . NumberBadge , {
2020-02-08 19:07:33 +01:00
count : e . instance . props . guildIds . length ,
style : { backgroundColor : BDFDB . DiscordConstants . Colors . BRAND }
} ) ;
}
2019-11-28 10:18:29 +01:00
}
2020-05-11 14:18:20 +02:00
if ( settings . extraColumn ) {
e . returnvalue . props . children [ 0 ] = null ;
e . returnvalue . props . children [ 2 ] = BDFDB . ReactUtils . createElement ( "div" , {
children : e . returnvalue . props . children [ 2 ] ,
style : { display : "none" }
} ) ;
}
2019-01-13 22:53:07 +01:00
}
2020-02-08 19:07:33 +01:00
processGuild ( e ) {
2019-11-28 10:18:29 +01:00
let folder = BDFDB . GuildUtils . getFolder ( e . instance . props . guild . id ) ;
2020-02-08 19:07:33 +01:00
if ( folder ) {
let state = this . getState ( e . instance ) ;
if ( guildStates [ e . instance . props . guild . id ] && ! BDFDB . equals ( state , guildStates [ e . instance . props . guild . id ] ) ) {
BDFDB . ReactUtils . forceUpdate ( folderGuildContent ) ;
}
guildStates [ e . instance . props . guild . id ] = state ;
2020-05-11 14:18:20 +02:00
if ( e . returnvalue ) {
let data = this . getFolderConfig ( folder . folderId ) ;
2020-06-16 17:07:08 +02:00
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : [ "GuildTooltip" , "BDFDB_TooltipContainer" ] } ) ;
2020-05-11 14:18:20 +02:00
if ( index > - 1 ) children [ index ] = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
tooltipConfig : Object . assign ( {
type : "right" ,
list : true ,
guild : e . instance . props . guild ,
offset : 12
} , data . copyTooltipColor && {
backgroundColor : data . color3 ,
fontColor : data . color4 ,
} ) ,
children : children [ index ] . props . children
} ) ;
}
2020-02-08 19:07:33 +01:00
}
if ( e . node ) BDFDB . ListenerUtils . add ( this , e . node , "click" , _ => { BDFDB . TimeUtils . timeout ( _ => {
let folder = BDFDB . GuildUtils . getFolder ( e . instance . props . guild . id ) ;
if ( settings . closeAllFolders ) for ( let openFolderId of BDFDB . LibraryModules . FolderUtils . getExpandedFolders ( ) ) if ( ! folder || openFolderId != folder . folderId || ! settings . forceOpenFolder ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( openFolderId ) ;
else if ( folder && settings . closeTheFolder && ! settings . forceOpenFolder && BDFDB . LibraryModules . FolderUtils . isFolderExpanded ( folder . folderId ) ) BDFDB . LibraryModules . GuildUtils . toggleGuildFolderExpand ( folder . folderId ) ;
} ) } ) ;
2019-11-28 10:18:29 +01:00
}
2020-02-08 19:07:33 +01:00
processGuildFolderSettingsModal ( e ) {
if ( e . node ) {
let root = e . node . parentElement . querySelector ( BDFDB . dotCN . layermodal ) ;
BDFDB . DOMUtils . addClass ( root , BDFDB . disCN . layermodalmedium , BDFDB . disCN . modalwrapper , ` ${ this . name } -modal ` ) ;
BDFDB . DOMUtils . removeClass ( root , BDFDB . disCN . layermodalsmall ) ;
2019-11-28 10:18:29 +01:00
}
2020-02-08 19:07:33 +01:00
if ( e . returnvalue ) {
let folder = BDFDB . LibraryModules . FolderStore . getGuildFolderById ( e . instance . props . folderId ) ;
let data = this . getFolderConfig ( e . instance . props . folderId ) ;
2020-06-16 17:07:08 +02:00
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : [ "ModalHeader" , "Header" ] } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) {
children [ index ] . props . className = BDFDB . DOMUtils . formatClassName ( children [ index ] . props . className , BDFDB . disCN . modalheaderhassibling ) ,
children . splice ( index + 1 , 0 , BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
grow : 0 ,
shrink : 0 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
className : BDFDB . disCN . tabbarcontainer ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TabBar , {
className : BDFDB . disCN . tabbar ,
itemClassName : BDFDB . disCN . tabbaritem ,
type : BDFDB . LibraryComponents . TabBar . Types . TOP ,
items : [
{ value : this . labels . modal _tabheader1 _text } ,
{ value : this . labels . modal _tabheader2 _text } ,
{ value : this . labels . modal _tabheader3 _text } ,
{ value : this . labels . modal _tabheader4 _text }
] ,
onItemSelect : ( value , instance ) => {
let tabContentInstances = BDFDB . ReactUtils . findOwner ( e . instance , { name : "BDFDB_ModalTabContent" , all : true , unlimited : true } ) ;
for ( let ins of tabContentInstances ) {
if ( ins . props . tab == value ) ins . props . open = true ;
else delete ins . props . open ;
}
BDFDB . ReactUtils . forceUpdate ( tabContentInstances ) ;
}
2019-11-28 10:18:29 +01:00
} )
} )
2020-02-08 19:07:33 +01:00
} ) ) ;
}
2020-06-17 17:16:11 +02:00
[ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : [ "ModalContent" , "Content" ] } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) children [ index ] . props . children = [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ModalComponents . ModalTabContent , {
tab : this . labels . modal _tabheader1 _text ,
open : true ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : BDFDB . LanguageUtils . LanguageStrings . GUILD _FOLDER _NAME ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
inputClassName : "input-foldername" ,
value : folder . folderName ,
placeholder : folder . folderName || BDFDB . LanguageUtils . LanguageStrings . SERVER _FOLDER _PLACEHOLDER ,
autoFocus : true
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : this . labels . modal _iconpicker _text ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( folderIconPickerComponent , {
selectedIcon : data . iconID
2020-08-03 21:08:18 +02:00
} , true )
2020-02-08 19:07:33 +01:00
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
className : BDFDB . disCN . marginbottom20 + " input-usecloseicon" ,
label : this . labels . modal _usecloseicon _text ,
2020-02-17 11:33:49 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
2020-02-08 19:07:33 +01:00
value : data . useCloseIcon
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ModalComponents . ModalTabContent , {
tab : this . labels . modal _tabheader2 _text ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : this . labels . modal _colorpicker1 _text ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ColorSwatches , {
color : data . color1 ,
defaultFallback : ! data . color1 && ! data . swapColors ,
number : 1
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : this . labels . modal _colorpicker2 _text ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ColorSwatches , {
color : data . color2 ,
defaultFallback : ! data . color2 && data . swapColors ,
number : 2
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
className : BDFDB . disCN . marginbottom20 + " input-swapcolors" ,
label : this . labels . modal _swapcolor _text ,
2020-02-17 11:33:49 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
2020-02-08 19:07:33 +01:00
value : data . swapColors
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ModalComponents . ModalTabContent , {
tab : this . labels . modal _tabheader3 _text ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : this . labels . modal _colorpicker3 _text ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ColorSwatches , {
color : data . color3 ,
number : 3
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
title : this . labels . modal _colorpicker4 _text ,
className : BDFDB . disCN . marginbottom20 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ColorSwatches , {
color : data . color4 ,
number : 4
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
className : BDFDB . disCN . marginbottom20 + " input-copytooltipcolor" ,
label : this . labels . modal _copytooltipcolor _text ,
2020-02-17 11:33:49 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTitle . Tags . H5 ,
2020-02-08 19:07:33 +01:00
value : data . copyTooltipColor
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ModalComponents . ModalTabContent , {
tab : this . labels . modal _tabheader4 _text ,
2020-08-03 21:08:18 +02:00
children : BDFDB . ReactUtils . createElement ( folderIconCustomPreviewComponent , { } , true )
2020-02-08 19:07:33 +01:00
} )
] ;
2020-06-16 17:07:08 +02:00
[ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { name : [ "ModalFooter" , "Footer" ] } ) ;
2020-02-08 19:07:33 +01:00
if ( index > - 1 ) children [ index ] . props . children = [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Button , {
children : BDFDB . LanguageUtils . LanguageStrings . SAVE ,
onClick : event => {
2020-07-15 16:50:10 +02:00
let oldData = Object . assign ( { } , data ) ;
2020-02-08 19:07:33 +01:00
let root = BDFDB . ReactUtils . findDOMNode ( e . instance ) . parentElement . querySelector ( BDFDB . dotCN . layermodal ) ;
data . iconID = root . querySelector ( BDFDB . dotCN . _serverfoldersiconswatch + BDFDB . dotCN . _serverfoldersiconswatchselected ) . getAttribute ( "iconID" ) ;
2019-11-28 10:18:29 +01:00
2020-02-08 19:07:33 +01:00
data . useCloseIcon = root . querySelector ( ".input-usecloseicon " + BDFDB . dotCN . switchinner ) . checked ;
data . swapColors = root . querySelector ( ".input-swapcolors " + BDFDB . dotCN . switchinner ) . checked ;
data . copyTooltipColor = root . querySelector ( ".input-copytooltipcolor " + BDFDB . dotCN . switchinner ) . checked ;
data . color1 = BDFDB . ColorUtils . getSwatchColor ( root , 1 ) ;
data . color2 = BDFDB . ColorUtils . getSwatchColor ( root , 2 ) ;
data . color3 = BDFDB . ColorUtils . getSwatchColor ( root , 3 ) ;
data . color4 = BDFDB . ColorUtils . getSwatchColor ( root , 4 ) ;
2020-07-15 16:50:10 +02:00
let nativeColor = data . swapColors ? "color2" : "color1" ;
2020-02-08 19:07:33 +01:00
this . updateFolder ( {
folderId : e . instance . props . folderId ,
folderName : root . querySelector ( ".input-foldername" ) . value ,
2020-07-15 16:50:10 +02:00
folderColor : data [ nativeColor ] ? BDFDB . ColorUtils . convert ( data [ nativeColor ] && BDFDB . ObjectUtils . is ( data [ nativeColor ] ) ? data [ nativeColor ] [ Object . keys ( data [ nativeColor ] ) [ 0 ] ] : data [ nativeColor ] , "INT" ) : null
2020-02-08 19:07:33 +01:00
} ) ;
2020-07-15 16:50:10 +02:00
if ( ! BDFDB . equals ( oldData , data ) ) {
2020-02-08 19:07:33 +01:00
BDFDB . DataUtils . save ( data , this , "folders" , e . instance . props . folderId ) ;
2020-07-15 16:50:10 +02:00
this . forceUpdateAll ( ) ;
2020-02-08 19:07:33 +01:00
}
e . instance . close ( ) ;
2019-11-28 10:18:29 +01:00
}
2020-02-08 19:07:33 +01:00
} )
]
}
2019-11-28 10:18:29 +01:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
loadAllIcons ( ) {
let icons = { } ;
2020-07-15 16:50:10 +02:00
folderIcons . forEach ( ( array , i ) => {
icons [ i ] = {
openicon : array . openicon ,
closedicon : array . closedicon ,
customID : null
} ;
} ) ;
for ( let id in customIcons ) icons [ id ] = Object . assign ( { customID : id } , customIcons [ id ] ) ;
2020-02-08 19:07:33 +01:00
return icons ;
2019-10-08 21:09:14 +02:00
}
2020-02-08 19:07:33 +01:00
2020-07-15 16:50:10 +02:00
generateId ( prefix ) {
2020-02-08 19:07:33 +01:00
if ( prefix == "folder" ) {
let id = Math . floor ( Math . random ( ) * 4294967296 ) ;
2020-07-15 16:50:10 +02:00
return BDFDB . LibraryModules . FolderStore . guildFolders . every ( n => ! n . folderId || n . folderId != id ) ? id : this . generateId ( prefix ) ;
2020-02-08 19:07:33 +01:00
}
else {
let data = BDFDB . DataUtils . load ( this , prefix + "s" ) ;
let id = prefix + "_" + Math . round ( Math . random ( ) * 10000000000000000 ) ;
2020-07-15 16:50:10 +02:00
return data [ id ] ? this . generateId ( prefix ) : id ;
2020-02-08 19:07:33 +01:00
}
2019-10-08 21:09:14 +02:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
getState ( instance ) {
let state = { } ;
for ( let key in instance . props ) {
if ( typeof instance . props [ key ] != "object" && typeof instance . props [ key ] != "function" ) state [ key ] = instance . props [ key ] ;
else if ( Array . isArray ( instance . props [ key ] ) ) state [ key ] = instance . props [ key ] . length ;
}
return state ;
2019-04-25 21:58:21 +02:00
}
2020-02-08 19:07:33 +01:00
getFolderConfig ( folderId ) {
let folder = BDFDB . LibraryModules . FolderStore . getGuildFolderById ( folderId ) || { } ;
2020-07-15 16:50:10 +02:00
let data = folderConfigs [ folderId ] || {
2020-02-08 19:07:33 +01:00
iconID : "-1" ,
muteFolder : false ,
autoRead : false ,
useCloseIcon : true ,
swapColors : false ,
copyTooltipColor : false ,
color1 : null ,
color2 : [ "255" , "255" , "255" ] ,
color3 : null ,
color4 : null
} ;
2020-07-15 16:50:10 +02:00
let nativeColor = data . swapColors ? "color2" : "color1" ;
if ( ! data [ nativeColor ] ) data [ nativeColor ] = BDFDB . ColorUtils . convert ( folder . folderColor , "RGBCOMP" ) ;
else if ( folder . folderColor && ! BDFDB . ColorUtils . compare ( folder . folderColor , BDFDB . ColorUtils . convert ( BDFDB . ObjectUtils . is ( data [ nativeColor ] ) ? data [ nativeColor ] [ Object . keys ( data [ nativeColor ] ) [ 0 ] ] : data [ nativeColor ] , "INT" ) ) ) {
data [ nativeColor ] = BDFDB . ColorUtils . convert ( folder . folderColor , "RGBCOMP" ) ;
2020-02-08 19:07:33 +01:00
BDFDB . DataUtils . save ( data , this , "folders" , folderId ) ;
}
2020-07-15 16:50:10 +02:00
folderConfigs [ folderId ] = data ;
2020-02-08 19:07:33 +01:00
return data ;
2019-10-29 23:12:52 +01:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
createBase64SVG ( paths , color1 = "#000000" , color2 = "#FFFFFF" ) {
if ( paths . indexOf ( "<path " ) != 0 ) return paths ;
2020-04-30 18:35:03 +02:00
let isGradient1 = color1 && BDFDB . ObjectUtils . is ( color1 ) ;
let isGradient2 = color2 && BDFDB . ObjectUtils . is ( color2 ) ;
2020-02-08 19:07:33 +01:00
let svg = ` <svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="-60 -50 1100 1100"> ` ;
2020-04-30 18:35:03 +02:00
if ( isGradient1 ) {
color1 = BDFDB . ColorUtils . convert ( color1 , "RGBA" ) ;
2020-02-08 19:07:33 +01:00
svg += ` <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"> ` ;
for ( let pos of Object . keys ( color1 ) . sort ( ) ) svg += ` <stop offset=" ${ pos * 100 } %" style="stop-color: ${ color1 [ pos ] } ;"></stop> ` ;
svg += ` </linearGradient> ` ;
}
2020-04-30 18:35:03 +02:00
if ( isGradient2 ) {
color2 = BDFDB . ColorUtils . convert ( color2 , "RGBA" ) ;
2020-02-08 19:07:33 +01:00
svg += ` <linearGradient id="grad2" x1="0%" y1="0%" x2="100%" y2="0%"> ` ;
for ( let pos of Object . keys ( color2 ) . sort ( ) ) svg += ` <stop offset=" ${ pos * 100 } %" style="stop-color: ${ color2 [ pos ] } ;"></stop> ` ;
svg += ` </linearGradient> ` ;
}
2020-04-30 18:35:03 +02:00
svg += ` ${ paths . replace ( "REPLACE_FILL1" , isGradient1 ? "url(#grad1)" : BDFDB . ColorUtils . convert ( color1 , "RGBA" ) ) . replace ( "REPLACE_FILL2" , isGradient2 ? "url(#grad2)" : BDFDB . ColorUtils . convert ( color2 , "RGBA" ) ) } </svg> ` ;
2020-02-08 19:07:33 +01:00
return ` data:image/svg+xml;base64, ${ btoa ( svg ) } ` ;
2019-10-08 19:12:48 +02:00
}
2019-01-26 22:45:19 +01:00
2020-06-17 17:16:11 +02:00
openFolderCreationMenu ( guilds , initGuildId ) {
let targetedGuildIds = [ ] . concat ( initGuildId || [ ] ) ;
2020-02-08 19:07:33 +01:00
BDFDB . ModalUtils . open ( this , {
size : "MEDIUM" ,
header : this . labels . serversubmenu _createfolder _text ,
subheader : "" ,
contentClassName : BDFDB . disCN . listscroller ,
children : guilds . map ( ( guild , i ) => {
return [
i == 0 ? null : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCNS . margintop4 + BDFDB . disCN . marginbottom4
2019-11-28 10:18:29 +01:00
} ) ,
2020-02-08 19:07:33 +01:00
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ListRow , {
prefix : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . GuildComponents . Guild , {
className : BDFDB . disCN . listavatar ,
guild : guild ,
menu : false ,
tooltip : false
} ) ,
label : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextScroller , {
children : guild . name
} ) ,
suffix : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Switch , {
value : targetedGuildIds . includes ( guild . id ) ,
onChange : value => {
if ( value ) targetedGuildIds . push ( guild . id ) ;
else BDFDB . ArrayUtils . remove ( targetedGuildIds , guild . id , true ) ;
}
} )
2019-11-28 10:18:29 +01:00
} )
2020-02-08 19:07:33 +01:00
] ;
} ) . flat ( 10 ) . filter ( n => n ) ,
buttons : [ {
contents : BDFDB . LanguageUtils . LanguageStrings . DONE ,
color : "BRAND" ,
close : true ,
click : ( modal , instance ) => {
this . createFolder ( BDFDB . ArrayUtils . removeCopies ( targetedGuildIds ) ) ;
}
} ]
} ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
updateFolder ( folder ) {
let oldGuildFolders = [ ] . concat ( BDFDB . LibraryModules . FolderStore . guildFolders ) , guildFolders = [ ] , guildPositions = [ ] ;
for ( let oldFolder of oldGuildFolders ) {
if ( oldFolder . folderId == folder . folderId ) guildFolders . push ( Object . assign ( { } , oldFolder , folder ) ) ;
else guildFolders . push ( oldFolder ) ;
}
for ( let folder of guildFolders ) for ( let fGuildId of folder . guildIds ) guildPositions . push ( fGuildId ) ;
BDFDB . LibraryModules . SettingsUtils . updateRemoteSettings ( { guildPositions , guildFolders } ) ;
}
createFolder ( guildIds ) {
if ( ! guildIds ) return ;
guildIds = [ guildIds ] . flat ( 10 ) ;
if ( ! guildIds . length ) return ;
let oldGuildFolders = [ ] . concat ( BDFDB . LibraryModules . FolderStore . guildFolders ) , guildFolders = [ ] , guildPositions = [ ] , added = false ;
for ( let oldFolder of oldGuildFolders ) {
if ( ! oldFolder . folderId && guildIds . includes ( oldFolder . guildIds [ 0 ] ) ) {
if ( ! added ) {
added = true ;
guildFolders . push ( {
guildIds : guildIds ,
2020-07-15 16:50:10 +02:00
folderId : this . generateId ( "folder" )
2020-02-08 19:07:33 +01:00
} ) ;
}
2019-10-09 09:40:15 +02:00
}
2020-02-08 19:07:33 +01:00
else guildFolders . push ( oldFolder ) ;
2019-10-09 09:40:15 +02:00
}
2020-02-08 19:07:33 +01:00
for ( let folder of guildFolders ) for ( let fGuildId of folder . guildIds ) guildPositions . push ( fGuildId ) ;
BDFDB . LibraryModules . SettingsUtils . updateRemoteSettings ( { guildPositions , guildFolders } ) ;
2019-10-08 21:09:14 +02:00
}
2020-02-08 19:07:33 +01:00
removeFolder ( folderId ) {
let oldGuildFolders = [ ] . concat ( BDFDB . LibraryModules . FolderStore . guildFolders ) , guildFolders = [ ] , guildPositions = [ ] ;
for ( let oldFolder of oldGuildFolders ) {
if ( oldFolder . folderId == folderId ) {
for ( let guildId of oldFolder . guildIds ) guildFolders . push ( { guildIds : [ guildId ] } ) ;
}
else guildFolders . push ( oldFolder ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
for ( let folder of guildFolders ) for ( let fGuildId of folder . guildIds ) guildPositions . push ( fGuildId ) ;
BDFDB . LibraryModules . SettingsUtils . updateRemoteSettings ( { guildPositions , guildFolders } ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
addGuildToFolder ( folderId , guildId ) {
let oldGuildFolders = [ ] . concat ( BDFDB . LibraryModules . FolderStore . guildFolders ) , guildFolders = [ ] , guildPositions = [ ] ;
for ( let oldFolder of oldGuildFolders ) {
if ( oldFolder . folderId ) {
let newFolder = Object . assign ( { } , oldFolder ) ;
if ( oldFolder . folderId == folderId ) newFolder . guildIds . push ( guildId ) ;
else BDFDB . ArrayUtils . remove ( newFolder . guildIds , guildId ) ;
guildFolders . push ( newFolder ) ;
}
else if ( oldFolder . guildIds [ 0 ] != guildId ) guildFolders . push ( oldFolder ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
for ( let folder of guildFolders ) for ( let fGuildId of folder . guildIds ) guildPositions . push ( fGuildId ) ;
BDFDB . LibraryModules . SettingsUtils . updateRemoteSettings ( { guildPositions , guildFolders } ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
removeGuildFromFolder ( folderId , guildId ) {
let oldGuildFolders = [ ] . concat ( BDFDB . LibraryModules . FolderStore . guildFolders ) , guildFolders = [ ] , guildPositions = [ ] ;
for ( let oldFolder of oldGuildFolders ) {
if ( oldFolder . folderId == folderId ) {
let newFolder = Object . assign ( { } , oldFolder ) ;
BDFDB . ArrayUtils . remove ( newFolder . guildIds , guildId ) ;
guildFolders . push ( newFolder ) ;
guildFolders . push ( { guildIds : [ guildId ] } ) ;
}
else guildFolders . push ( oldFolder ) ;
2019-10-08 19:12:48 +02:00
}
2020-02-08 19:07:33 +01:00
for ( let folder of guildFolders ) for ( let fGuildId of folder . guildIds ) guildPositions . push ( fGuildId ) ;
BDFDB . LibraryModules . SettingsUtils . updateRemoteSettings ( { guildPositions , guildFolders } ) ;
2019-10-08 19:12:48 +02:00
}
2019-09-04 12:34:02 +02:00
2020-02-08 19:07:33 +01:00
createDragPreview ( div , event ) {
if ( ! Node . prototype . isPrototypeOf ( div ) ) return ;
let dragpreview = div . cloneNode ( true ) ;
BDFDB . DOMUtils . addClass ( dragpreview , BDFDB . disCN . _serverfoldersdragpreview ) ;
BDFDB . DOMUtils . remove ( dragpreview . querySelector ( BDFDB . dotCNC . guildlowerbadge + BDFDB . dotCNC . guildupperbadge + BDFDB . dotCN . guildpillwrapper ) ) ;
BDFDB . DOMUtils . hide ( dragpreview ) ;
dragpreview . style . setProperty ( "pointer-events" , "none" , "important" ) ;
dragpreview . style . setProperty ( "left" , event . clientX - 25 + "px" , "important" ) ;
dragpreview . style . setProperty ( "top" , event . clientY - 25 + "px" , "important" ) ;
document . querySelector ( BDFDB . dotCN . appmount ) . appendChild ( dragpreview ) ;
return dragpreview ;
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
updateDragPreview ( dragpreview , event ) {
if ( ! Node . prototype . isPrototypeOf ( dragpreview ) ) return ;
BDFDB . DOMUtils . show ( dragpreview ) ;
dragpreview . style . setProperty ( "left" , event . clientX - 25 + "px" , "important" ) ;
dragpreview . style . setProperty ( "top" , event . clientY - 25 + "px" , "important" ) ;
2020-03-30 22:48:55 +02:00
}
forceUpdateAll ( ) {
2020-06-08 21:05:22 +02:00
settings = BDFDB . DataUtils . get ( this , "settings" ) ;
2020-07-15 16:50:10 +02:00
folderConfigs = BDFDB . DataUtils . load ( this , "folders" ) ;
customIcons = BDFDB . DataUtils . load ( this , "customicons" ) ;
2020-06-08 21:05:22 +02:00
2020-07-15 16:50:10 +02:00
BDFDB . ReactUtils . forceUpdate ( folderGuildContent ) ;
2020-03-30 22:48:55 +02:00
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
BDFDB . GuildUtils . rerenderAll ( ) ;
2020-02-08 19:07:33 +01:00
}
2019-01-26 22:45:19 +01:00
2020-02-08 19:07:33 +01:00
setLabelsByLanguage ( ) {
switch ( BDFDB . LanguageUtils . getLanguage ( ) . id ) {
case "hr" : //croatian
return {
servercontext _serverfolders _text : "Poslužitelj mapu" ,
serversubmenu _createfolder _text : "Izradi mapu" ,
serversubmenu _addtofolder _text : "Dodaj poslužitelj u mapu" ,
serversubmenu _removefromfolder _text : "Ukloni poslužitelj iz mapu" ,
foldercontext _autoreadfolder _text : "Auto: Označite kao pročitano" ,
foldercontext _mutefolder _text : "Isključite mapu" ,
foldercontext _removefolder _text : "Izbriši mapu" ,
modal _tabheader1 _text : "Mape" ,
modal _tabheader2 _text : "Boja mape" ,
modal _tabheader3 _text : "Boja tooltip" ,
modal _tabheader4 _text : "Prilagođeni ikona" ,
modal _iconpicker _text : "Odabir mape" ,
modal _usecloseicon _text : "Koristite zatvorenu ikonu umjesto minisevera" ,
modal _swapcolor _text : "Koristite drugu boju za izvorne mape" ,
modal _copytooltipcolor _text : "Koristite iste boje za poslužitelj u mapi" ,
modal _colorpicker1 _text : "Boja primarne mape" ,
modal _colorpicker2 _text : "Boja sekundarne mape" ,
modal _colorpicker3 _text : "Boja tooltip" ,
modal _colorpicker4 _text : "Boja fonta" ,
modal _customopen _text : "Otvori ikona" ,
modal _customclosed _text : "Zatvorena ikona" ,
modal _custompreview _text : "Pregled ikona"
} ;
case "da" : //danish
return {
servercontext _serverfolders _text : "Servermapper" ,
serversubmenu _createfolder _text : "Opret mappe" ,
serversubmenu _addtofolder _text : "Tilføj server til mappe" ,
serversubmenu _removefromfolder _text : "Fjern server fra mappe" ,
foldercontext _autoreadfolder _text : "Auto: Markér som læst" ,
foldercontext _mutefolder _text : "Dæmp mappe" ,
foldercontext _removefolder _text : "Slet mappe" ,
modal _tabheader1 _text : "Mappe" ,
modal _tabheader2 _text : "Mappefarve" ,
modal _tabheader3 _text : "Tooltipfarve" ,
modal _tabheader4 _text : "Brugerdefinerede ikoner" ,
modal _iconpicker _text : "Mappevalg" ,
modal _usecloseicon _text : "Brug et lukket ikon i stedet for miniserverne" ,
modal _swapcolor _text : "BBrug den anden farve til de originale mapper" ,
modal _copytooltipcolor _text : "Brug de samme farver til server på mappen" ,
modal _colorpicker1 _text : "Primær mappefarve" ,
modal _colorpicker2 _text : "Sekundær mappefarve" ,
modal _colorpicker3 _text : "Tooltipfarve" ,
modal _colorpicker4 _text : "Skriftfarve" ,
modal _customopen _text : "Åbn ikon" ,
modal _customclosed _text : "Lukket ikon" ,
modal _custompreview _text : "Ikon forhåndsvisning"
} ;
case "de" : //german
return {
servercontext _serverfolders _text : "Serverordner" ,
serversubmenu _createfolder _text : "Ordner erzeugen" ,
serversubmenu _addtofolder _text : "Server zum Ordner hinzufügen" ,
serversubmenu _removefromfolder _text : "Server aus Ordner entfernen" ,
foldercontext _autoreadfolder _text : "Auto: Als gelesen markieren" ,
foldercontext _mutefolder _text : "Ordner stummschalten" ,
foldercontext _removefolder _text : "Ordner löschen" ,
modal _tabheader1 _text : "Ordner" ,
modal _tabheader2 _text : "Ordnerfarbe" ,
modal _tabheader3 _text : "Tooltipfarbe" ,
modal _tabheader4 _text : "Eigene Icons" ,
modal _iconpicker _text : "Ordnerauswahl" ,
modal _usecloseicon _text : "Verwende anstelle der Miniserver ein geschlossenes Symbol" ,
modal _swapcolor _text : "Verwende die zweite Farbe für den ursprünglichen Ordner" ,
modal _copytooltipcolor _text : "Verwende dieselbe Farbe für alle Server eines Ordners" ,
modal _colorpicker1 _text : "Primäre Ordnerfarbe" ,
modal _colorpicker2 _text : "Sekundäre Ordnerfarbe" ,
modal _colorpicker3 _text : "Tooltipfarbe" ,
modal _colorpicker4 _text : "Schriftfarbe" ,
modal _customopen _text : "Geöffnetes Icon" ,
modal _customclosed _text : "Geschlossenes Icon" ,
modal _custompreview _text : "Iconvorschau"
} ;
case "es" : //spanish
return {
servercontext _serverfolders _text : "Carpetas de servidor" ,
serversubmenu _createfolder _text : "Crear carpeta" ,
serversubmenu _addtofolder _text : "Añadir servidor a la carpeta" ,
serversubmenu _removefromfolder _text : "Eliminar servidor de la carpeta" ,
foldercontext _autoreadfolder _text : "Auto: Marcar como leído" ,
foldercontext _mutefolder _text : "Silenciar carpeta" ,
foldercontext _removefolder _text : "Eliminar carpeta" ,
modal _tabheader1 _text : "Carpeta" ,
modal _tabheader2 _text : "Color de carpeta" ,
modal _tabheader3 _text : "Color de tooltip" ,
modal _tabheader4 _text : "Iconos personalizados" ,
modal _iconpicker _text : "Selección de carpeta" ,
modal _usecloseicon _text : "Use un icono cerrado en lugar de los miniservidores" ,
modal _swapcolor _text : "Use el segundo color para las carpetas originales" ,
modal _copytooltipcolor _text : "Usa los mismos colores para el servidor de la carpeta" ,
modal _colorpicker1 _text : "Color primaria de carpeta" ,
modal _colorpicker2 _text : "Color secundario de la carpeta" ,
modal _colorpicker3 _text : "Color de tooltip" ,
modal _colorpicker4 _text : "Color de fuente" ,
modal _customopen _text : "Ícono abierto" ,
modal _customclosed _text : "Icono cerrado" ,
modal _custompreview _text : "Vista previa del icono"
} ;
case "fr" : //french
return {
servercontext _serverfolders _text : "Dossiers du serveur" ,
serversubmenu _createfolder _text : "Créer le dossier" ,
serversubmenu _addtofolder _text : "Ajouter le serveur à un dossier" ,
serversubmenu _removefromfolder _text : "Supprimer le serveur du dossier" ,
foldercontext _autoreadfolder _text : "Auto: Marquer comme lu" ,
foldercontext _mutefolder _text : "Rendre muet le dossier" ,
foldercontext _removefolder _text : "Supprimer le dossier" ,
modal _tabheader1 _text : "Dossier" ,
modal _tabheader2 _text : "Couleur du dossier" ,
modal _tabheader3 _text : "Couleur de tooltip" ,
modal _tabheader4 _text : "Icônes personnalisées" ,
modal _iconpicker _text : "Choix du dossier" ,
modal _usecloseicon _text : "Utilisez une icône fermée à la place des mini-serveurs" ,
modal _swapcolor _text : "Utilisez la deuxième couleur pour les dossiers d'origine" ,
modal _copytooltipcolor _text : "Utilisez les mêmes couleurs pour le serveur du dossier" ,
modal _colorpicker1 _text : "Couleur primaire du dossier" ,
modal _colorpicker2 _text : "Couleur secondaire du dossier" ,
modal _colorpicker3 _text : "Couleur de tooltip" ,
modal _colorpicker4 _text : "Couleur de la police" ,
modal _customopen _text : "Icône ouverte" ,
modal _customclosed _text : "Icône fermée" ,
modal _custompreview _text : "Aperçu de l'icône"
} ;
case "it" : //italian
return {
servercontext _serverfolders _text : "Cartelle del server" ,
serversubmenu _addtofolder _text : "Aggiungi il server alla cartella" ,
serversubmenu _createfolder _text : "Creare una cartella" ,
serversubmenu _removefromfolder _text : "Rimuovi il server dalla cartella" ,
foldercontext _autoreadfolder _text : "Auto: Contrassegna come letto" ,
foldercontext _mutefolder _text : "Disattiva cartella" ,
foldercontext _removefolder _text : "Elimina cartella" ,
modal _tabheader1 _text : "Cartella" ,
modal _tabheader2 _text : "Colore della cartella" ,
modal _tabheader3 _text : "Colore della tooltip" ,
modal _tabheader4 _text : "Icone personalizzate" ,
modal _iconpicker _text : "Selezione della cartella" ,
modal _usecloseicon _text : "Utilizzare un'icona chiusa anziché i mini server" ,
modal _swapcolor _text : "Usa il secondo colore per le cartelle originali" ,
modal _copytooltipcolor _text : "Usa gli stessi colori per il server della cartella" ,
modal _colorpicker1 _text : "Colore primaria della cartella" ,
modal _colorpicker2 _text : "Colore secondaria della cartella" ,
modal _colorpicker3 _text : "Colore della tooltip" ,
modal _colorpicker4 _text : "Colore del carattere" ,
modal _customopen _text : "Icona aperta" ,
modal _customclosed _text : "Icona chiusa" ,
modal _custompreview _text : "Icona anteprima"
} ;
case "nl" : //dutch
return {
servercontext _serverfolders _text : "Servermappen" ,
serversubmenu _addtofolder _text : "Voeg server toe aan de map" ,
serversubmenu _createfolder _text : "Map aanmaken" ,
serversubmenu _removefromfolder _text : "Verwijder de server uit de map" ,
foldercontext _autoreadfolder _text : "Auto: Markeren als gelezen" ,
foldercontext _mutefolder _text : "Demp map" ,
foldercontext _removefolder _text : "Verwijder map" ,
modal _tabheader1 _text : "Map" ,
modal _tabheader2 _text : "Mapkleur" ,
modal _tabheader3 _text : "Tooltipkleur" ,
modal _tabheader4 _text : "Aangepaste keuze" ,
modal _iconpicker _text : "Map keuze" ,
modal _usecloseicon _text : "Gebruik een gesloten keuze in plaats van de miniservers" ,
modal _swapcolor _text : "Gebruik de tweede kleur voor de originele mappen" ,
modal _copytooltipcolor _text : "Gebruik dezelfde kleuren voor de server van de map" ,
modal _colorpicker1 _text : "Primaire mapkleur" ,
modal _colorpicker2 _text : "Tweede mapkleur" ,
modal _colorpicker3 _text : "Tooltipkleur" ,
modal _colorpicker4 _text : "Doopvontkleur" ,
modal _customopen _text : "Geopende keuze" ,
modal _customclosed _text : "Gesloten keuze" ,
modal _custompreview _text : "Voorbeeld van keuze"
} ;
case "no" : //norwegian
return {
servercontext _serverfolders _text : "Servermapper" ,
serversubmenu _addtofolder _text : "Legg til server i mappe" ,
serversubmenu _createfolder _text : "Lag mappe" ,
serversubmenu _removefromfolder _text : "Fjern server fra mappe" ,
foldercontext _autoreadfolder _text : "Auto: Merk som les" ,
foldercontext _mutefolder _text : "Demp mappe" ,
foldercontext _removefolder _text : "Slett mappe" ,
modal _tabheader1 _text : "Mappe" ,
modal _tabheader2 _text : "Mappefarge" ,
modal _tabheader3 _text : "Tooltipfarge" ,
modal _tabheader4 _text : "Tilpassede ikoner" ,
modal _iconpicker _text : "Mappevalg" ,
modal _usecloseicon _text : "Bruk et lukket ikon i stedet for minitjenerne" ,
modal _swapcolor _text : "Bruk den andre fargen for de originale mappene" ,
modal _copytooltipcolor _text : "Bruk de samme fargene til serveren til mappen" ,
modal _colorpicker1 _text : "Primær mappefarge" ,
modal _colorpicker2 _text : "Sekundær mappefarge" ,
modal _colorpicker3 _text : "Tooltipfarge" ,
modal _colorpicker4 _text : "Skriftfarge" ,
modal _customopen _text : "Åpnet ikon" ,
modal _customclosed _text : "Lukket ikon" ,
modal _custompreview _text : "Ikon forhåndsvisning"
} ;
case "pl" : //polish
return {
servercontext _serverfolders _text : "Foldery serwera" ,
serversubmenu _addtofolder _text : "Dodaj serwer do folderu" ,
serversubmenu _createfolder _text : "Utwórz folder" ,
serversubmenu _removefromfolder _text : "Usuń serwer z folderu" ,
foldercontext _autoreadfolder _text : "Auto: Oznacz jako przeczytane" ,
foldercontext _mutefolder _text : "Wycisz folder" ,
foldercontext _removefolder _text : "Usuń folder" ,
modal _tabheader1 _text : "Folder" ,
modal _tabheader2 _text : "Kolor folderu" ,
modal _tabheader3 _text : "Kolor podpowiedzi" ,
modal _tabheader4 _text : "Niestandardowe ikony" ,
modal _iconpicker _text : "Wybór folderu" ,
modal _usecloseicon _text : "Użyj zamkniętej ikony zamiast mini serwerów" ,
modal _swapcolor _text : "Użyj drugiego koloru dla oryginalnych folderów" ,
modal _copytooltipcolor _text : "Użyj tych samych kolorów dla serwera folderu" ,
modal _colorpicker1 _text : "Podstawowy kolor folderu" ,
modal _colorpicker2 _text : "Drugorzędny kolor folderu" ,
modal _colorpicker3 _text : "Kolor podpowiedzi" ,
modal _colorpicker4 _text : "Kolor czcionki" ,
modal _customopen _text : "Otwarta ikona" ,
modal _customclosed _text : "Zamknięta ikona" ,
modal _custompreview _text : "Podgląd ikony"
} ;
case "pt-BR" : //portuguese (brazil)
return {
servercontext _serverfolders _text : "Pastas de servidores" ,
serversubmenu _addtofolder _text : "Adicionar servidor à pasta" ,
serversubmenu _createfolder _text : "Criar pasta" ,
serversubmenu _removefromfolder _text : "Remover servidor da pasta" ,
foldercontext _autoreadfolder _text : "Auto: Marcar como lido" ,
foldercontext _mutefolder _text : "Silenciar pasta" ,
foldercontext _removefolder _text : "Excluir pasta" ,
modal _tabheader1 _text : "Pasta" ,
modal _tabheader2 _text : "Cor da pasta" ,
modal _tabheader3 _text : "Cor da tooltip" ,
modal _tabheader4 _text : "Ícones personalizados" ,
modal _iconpicker _text : "Escolha da pasta" ,
modal _usecloseicon _text : "Use um ícone fechado em vez dos mini servidores" ,
modal _swapcolor _text : "Use a segunda cor para as pastas originais" ,
modal _copytooltipcolor _text : "Use as mesmas cores para o servidor da pasta" ,
modal _colorpicker1 _text : "Cor primária da pasta" ,
modal _colorpicker2 _text : "Cor secundária da pasta" ,
modal _colorpicker3 _text : "Cor da tooltip" ,
modal _colorpicker4 _text : "Cor da fonte" ,
modal _customopen _text : "Ícone aberto" ,
modal _customclosed _text : "Ícone fechado" ,
modal _custompreview _text : "Pré-visualização de ícones"
} ;
case "fi" : //finnish
return {
servercontext _serverfolders _text : "Palvelinkansiot" ,
serversubmenu _addtofolder _text : "Lisää palvelin kansioon" ,
serversubmenu _createfolder _text : "Luo kansio" ,
serversubmenu _removefromfolder _text : "Poista palvelin kansioon" ,
foldercontext _autoreadfolder _text : "Auto: merkitse luettavaksi" ,
foldercontext _mutefolder _text : "Mykistä kansio" ,
foldercontext _removefolder _text : "Poista kansio" ,
modal _tabheader1 _text : "Kansio" ,
modal _tabheader2 _text : "Kansionväri" ,
modal _tabheader3 _text : "Tooltipväri" ,
modal _tabheader4 _text : "Mukautetut kuvakkeet" ,
modal _iconpicker _text : "Kansion valinta" ,
modal _usecloseicon _text : "Käytä suljettua kuvaketta minipalvelimien sijasta" ,
modal _swapcolor _text : "Käytä toista väriä alkuperäisissä kansioissa" ,
modal _copytooltipcolor _text : "Käytä samoja värejä kansion palvelimelle" ,
modal _colorpicker1 _text : "Ensisijainen kansionväri" ,
modal _colorpicker2 _text : "Toissijainen kansionväri" ,
modal _colorpicker3 _text : "Tooltipväri" ,
modal _colorpicker4 _text : "Fontinväri" ,
modal _customopen _text : "Avattu kuvake" ,
modal _customclosed _text : "Suljettu kuvake" ,
modal _custompreview _text : "Kuvakkeen esikatselu"
} ;
case "sv" : //swedish
return {
servercontext _serverfolders _text : "Servermappar" ,
serversubmenu _addtofolder _text : "Lägg till server i mapp" ,
serversubmenu _createfolder _text : "Skapa mapp" ,
serversubmenu _removefromfolder _text : "Ta bort servern från mappen" ,
foldercontext _autoreadfolder _text : "Auto: Markera som Läs" ,
foldercontext _mutefolder _text : "Stäng mapp" ,
foldercontext _removefolder _text : "Ta bort mapp" ,
modal _tabheader1 _text : "Mapp" ,
modal _tabheader2 _text : "Mappfärg" ,
modal _tabheader3 _text : "Tooltipfärg" ,
modal _tabheader4 _text : "Anpassade ikoner" ,
modal _iconpicker _text : "Mappval" ,
modal _usecloseicon _text : "Använd en stängd ikon istället för miniservrarna" ,
modal _swapcolor _text : "Använd den andra färgen för originalmapparna" ,
modal _copytooltipcolor _text : "Använd samma färger för mappen på mappen" ,
modal _colorpicker1 _text : "Primär mappfärg" ,
modal _colorpicker2 _text : "Sekundär mappfärg" ,
modal _colorpicker3 _text : "Tooltipfärg" ,
modal _colorpicker4 _text : "Fontfärg" ,
modal _customopen _text : "Öppnad ikon" ,
modal _customclosed _text : "Closed Icon" ,
modal _custompreview _text : "Ikon förhandsvisning"
} ;
case "tr" : //turkish
return {
servercontext _serverfolders _text : "Sunucu klasörleri" ,
serversubmenu _addtofolder _text : "Klasöre sunucu ekle" ,
serversubmenu _createfolder _text : "Klasör oluşturun" ,
serversubmenu _removefromfolder _text : "Sunucuyu klasörden kaldı r" ,
foldercontext _autoreadfolder _text : "Oto: Okundu Olarak İşaretle" ,
foldercontext _mutefolder _text : "Klasörü kapat" ,
foldercontext _removefolder _text : "Klasörü sil" ,
modal _tabheader1 _text : "Klasör" ,
modal _tabheader2 _text : "Klasör rengi" ,
modal _tabheader3 _text : "Tooltip rengi" ,
modal _tabheader4 _text : "Özel simgeler" ,
modal _iconpicker _text : "Klasör seçimi" ,
modal _usecloseicon _text : "Mini sunucular yerine kapalı bir simge kullanı n" ,
modal _swapcolor _text : "Orijinal klasörler için ikinci rengi kullanı n" ,
modal _copytooltipcolor _text : "Klasörün sunucusu için aynı renkleri kullanı n" ,
modal _colorpicker1 _text : "Birincil klasör rengi" ,
modal _colorpicker2 _text : "İkincil klasör rengi" ,
modal _colorpicker3 _text : "Tooltip rengi" ,
modal _colorpicker4 _text : "Yazı rengi" ,
modal _customopen _text : "Açı lmı ş simge" ,
modal _customclosed _text : "Kapalı simge" ,
modal _custompreview _text : "Simge önizleme"
} ;
case "cs" : //czech
return {
servercontext _serverfolders _text : "Složky serveru" ,
serversubmenu _addtofolder _text : "Přidat server do složky" ,
serversubmenu _createfolder _text : "Vytvořit složky" ,
serversubmenu _removefromfolder _text : "Odebrat server ze složky" ,
foldercontext _autoreadfolder _text : "Auto: Označit jako přečtené" ,
foldercontext _mutefolder _text : "Ztlumte složky" ,
foldercontext _removefolder _text : "Smazat složky" ,
modal _tabheader1 _text : "Složky" ,
modal _tabheader2 _text : "Barva složky" ,
modal _tabheader3 _text : "Barva tooltip" ,
modal _tabheader4 _text : "Vlastní ikony" ,
modal _iconpicker _text : "Volba složky" ,
modal _usecloseicon _text : "Místo mini serverů použijte uzavřenou ikonu" ,
modal _swapcolor _text : "Použijte druhou barvu pro původní složky" ,
modal _copytooltipcolor _text : "Použijte stejné barvy pro server složky" ,
modal _colorpicker1 _text : "Primární barva složky" ,
modal _colorpicker2 _text : "Sekundární barva složky" ,
modal _colorpicker3 _text : "Barva tooltip" ,
modal _colorpicker4 _text : "Barva fontu" ,
modal _customopen _text : "Otevřená ikona" ,
modal _customclosed _text : "Uzavřená ikona" ,
modal _custompreview _text : "Náhled ikony"
} ;
case "bg" : //bulgarian
return {
servercontext _serverfolders _text : "Сървърни папки" ,
serversubmenu _addtofolder _text : "Добавяне на сървър в папка" ,
serversubmenu _createfolder _text : "Създай папка" ,
serversubmenu _removefromfolder _text : "Премахване на сървър от папка" ,
foldercontext _autoreadfolder _text : "Авто: Маркиране като четене" ,
foldercontext _mutefolder _text : "Заглушаване на папката" ,
foldercontext _removefolder _text : "Изтриване на папка" ,
modal _tabheader1 _text : "Папка" ,
modal _tabheader2 _text : "Цвят на папка" ,
modal _tabheader3 _text : "Цвят на подсказка" ,
modal _tabheader4 _text : "Персонализирани икони" ,
modal _iconpicker _text : "Избор на папки" ,
modal _usecloseicon _text : "Използвайте затворена икона вместо мини сървърите" ,
modal _swapcolor _text : "Използвайте втория цвят за оригиналните папки" ,
modal _copytooltipcolor _text : "Използвайте същите цветове за сървъра на папката" ,
modal _colorpicker3 _text : "Цвят на подсказка" ,
modal _colorpicker4 _text : "Цвят на шрифта" ,
modal _colorpicker1 _text : "Цвят основнен на папка" ,
modal _colorpicker2 _text : "цвят вторичен на папка" ,
modal _customopen _text : "Отворена икона" ,
modal _customclosed _text : "Затворена икона" ,
modal _custompreview _text : "Икона Преглед"
} ;
case "ru" : //russian
return {
servercontext _serverfolders _text : "Папки сервера" ,
serversubmenu _addtofolder _text : "Добавить сервер в папку" ,
serversubmenu _createfolder _text : "Создать папки" ,
serversubmenu _removefromfolder _text : "Удалить сервер из папки" ,
foldercontext _autoreadfolder _text : "Авто: Отметить как прочитанное" ,
foldercontext _mutefolder _text : "Отключить папки" ,
foldercontext _removefolder _text : "Удалить папки" ,
modal _tabheader1 _text : "Папка" ,
modal _tabheader2 _text : "Цвет папки" ,
modal _tabheader3 _text : "Цвет подсказка" ,
modal _tabheader4 _text : "Пользовательские значки" ,
modal _iconpicker _text : "Выбор папки" ,
modal _usecloseicon _text : "Используйте закрытую иконку вместо мини-серверов" ,
modal _swapcolor _text : "Используйте второй цвет для оригинальных папок" ,
modal _copytooltipcolor _text : "Используйте те же цвета для сервера папки" ,
modal _colorpicker1 _text : "Цвет основной папки" ,
modal _colorpicker2 _text : "Цвет вторичной папки" ,
modal _colorpicker3 _text : "Цвет подсказка" ,
modal _colorpicker4 _text : "Цвет шрифта" ,
modal _customopen _text : "Открытая иконка" ,
modal _customclosed _text : "Закрытая иконка" ,
modal _custompreview _text : "Иконка Просмотр"
} ;
case "uk" : //ukrainian
return {
servercontext _serverfolders _text : "Папки сервера" ,
serversubmenu _addtofolder _text : "Додати сервер до папки" ,
serversubmenu _createfolder _text : "Створити папки" ,
serversubmenu _removefromfolder _text : "Видалити папку з папки" ,
foldercontext _autoreadfolder _text : "Авто: Позначити як прочитане" ,
foldercontext _mutefolder _text : "Відключення папки" ,
foldercontext _removefolder _text : "Видалити папки" ,
modal _tabheader1 _text : "Папки" ,
modal _tabheader2 _text : "Колір папки" ,
modal _tabheader3 _text : "Колір підказка" ,
modal _tabheader4 _text : "Користувальницькі іконки" ,
modal _iconpicker _text : "Вибір папки" ,
modal _usecloseicon _text : "Використовуйте закритий значок замість міні-серверів" ,
modal _swapcolor _text : "Використовуйте другий колір для оригінальних папок" ,
modal _copytooltipcolor _text : "Використовуйте ті ж кольори для сервера папки" ,
modal _colorpicker1 _text : "Колір основної папки" ,
modal _colorpicker2 _text : "Колір вторинного папки" ,
modal _colorpicker3 _text : "Колір підказка" ,
modal _colorpicker4 _text : "Колір шрифту" ,
modal _customopen _text : "Відкрита ікона" ,
modal _customclosed _text : "Закрита ікона" ,
modal _custompreview _text : "Піктограма попереднього перегляду"
} ;
case "ja" : //japanese
return {
servercontext _serverfolders _text : "サーバーフォルダ" ,
serversubmenu _addtofolder _text : "サーバーをフォルダに追加する" ,
serversubmenu _createfolder _text : "フォルダーを作る" ,
serversubmenu _removefromfolder _text : "サーバーをフォルダから削除する" ,
foldercontext _autoreadfolder _text : "自動: 読み取りとしてマークする" ,
foldercontext _mutefolder _text : "ミュートフォルダー" ,
foldercontext _removefolder _text : "フォルダを削除する" ,
modal _tabheader1 _text : "フォルダ" ,
modal _tabheader2 _text : "フォルダの色" ,
modal _tabheader3 _text : "ツールチップの色" ,
modal _tabheader4 _text : "カスタムアイコン" ,
modal _iconpicker _text : "フォルダの選択" ,
modal _usecloseicon _text : "ミニサーバーの代わりに閉じたアイコンを使用する" ,
modal _swapcolor _text : "Використовуйте другий колір для оригінальних папок" ,
modal _copytooltipcolor _text : "フォルダのサーバーに同じ色を使う" ,
modal _colorpicker1 _text : "プライマリフォルダの色" ,
modal _colorpicker2 _text : "セカンダリフォルダの色" ,
modal _colorpicker3 _text : "ツールチップの色" ,
modal _colorpicker4 _text : "フォントの色" ,
modal _customopen _text : "開いたアイコン" ,
modal _customclosed _text : "クローズドアイコン" ,
modal _custompreview _text : "アイコンのプレビュー"
} ;
case "zh-TW" : //chinese (traditional)
return {
servercontext _serverfolders _text : "服務器文件夾" ,
serversubmenu _addtofolder _text : "添加服務器到文件夾" ,
serversubmenu _createfolder _text : "創建文件夾" ,
serversubmenu _removefromfolder _text : "從文件夾中刪除服務器" ,
foldercontext _autoreadfolder _text : "自動: 標記為已讀" ,
foldercontext _mutefolder _text : "靜音文件夾" ,
foldercontext _removefolder _text : "刪除文件夾" ,
modal _tabheader1 _text : "夾" ,
modal _tabheader2 _text : "文件夾顏色" ,
modal _tabheader3 _text : "工具提示顏色" ,
modal _tabheader4 _text : "自定義圖標" ,
modal _iconpicker _text : "文件夾選擇" ,
modal _usecloseicon _text : "使用關閉的圖標代替迷你服務器" ,
modal _swapcolor _text : "將第二種顏色用於原始文件夾" ,
modal _copytooltipcolor _text : "對文件夾的服務器使用相同的顏色" ,
modal _colorpicker1 _text : "主文件夾顏色" ,
modal _colorpicker2 _text : "輔助文件夾顏色" ,
modal _colorpicker3 _text : "工具提示顏色" ,
modal _colorpicker4 _text : "字體顏色" ,
modal _customopen _text : "打開的圖標" ,
modal _customclosed _text : "封閉的圖標" ,
modal _custompreview _text : "圖標預覽"
} ;
case "ko" : //korean
return {
servercontext _serverfolders _text : "서버 폴더" ,
serversubmenu _addtofolder _text : "폴더에 서버 추가" ,
serversubmenu _createfolder _text : "폴더 만들기" ,
serversubmenu _removefromfolder _text : "폴더에서 서버 제거" ,
foldercontext _autoreadfolder _text : "자동: 읽은 상태로 표시" ,
foldercontext _mutefolder _text : "폴더 음소거" ,
foldercontext _removefolder _text : "폴더 삭제" ,
modal _tabheader1 _text : "폴더" ,
modal _tabheader2 _text : "폴더 색" ,
modal _tabheader3 _text : "툴팁 색깔" ,
modal _tabheader4 _text : "사용자 정의 아이콘" ,
modal _iconpicker _text : "폴더 선택" ,
modal _usecloseicon _text : "미니 서버 대신 닫힌 아이콘을 사용하십시오" ,
modal _swapcolor _text : "원본 폴더에 두 번째 색상 사용" ,
modal _copytooltipcolor _text : "폴더의 서버에 대해 동일한 색상을 사용하십시오." ,
modal _colorpicker1 _text : "기본 폴더 색" ,
modal _colorpicker2 _text : "보조 폴더 색" ,
modal _colorpicker3 _text : "툴팁 색깔" ,
modal _colorpicker4 _text : "글꼴 색깔" ,
modal _customopen _text : "열린 아이콘" ,
modal _customclosed _text : "닫힌 아이콘" ,
modal _custompreview _text : "아이콘 미리보기"
} ;
default : //default: english
return {
servercontext _serverfolders _text : "Serverfolders" ,
serversubmenu _addtofolder _text : "Add Server to Folder" ,
serversubmenu _createfolder _text : "Create Folder" ,
serversubmenu _removefromfolder _text : "Remove Server from Folder" ,
foldercontext _autoreadfolder _text : "Auto: Mark As Read" ,
foldercontext _mutefolder _text : "Mute Folder" ,
foldercontext _removefolder _text : "Delete Folder" ,
modal _tabheader1 _text : "Folder" ,
modal _tabheader2 _text : "Foldercolor" ,
modal _tabheader3 _text : "Tooltipcolor" ,
modal _tabheader4 _text : "Custom Icons" ,
modal _iconpicker _text : "Folderchoice" ,
modal _usecloseicon _text : "Use a closed Icon instead of the Mini-Servers" ,
modal _swapcolor _text : "Use second Color for the native Folder" ,
modal _copytooltipcolor _text : "Use same Colors for Servers of the Folder" ,
modal _colorpicker1 _text : "Primary Foldercolor" ,
modal _colorpicker2 _text : "Secondary Foldercolor" ,
modal _colorpicker3 _text : "Tooltipcolor" ,
modal _colorpicker4 _text : "Fontcolor" ,
modal _customopen _text : "Open Icon" ,
modal _customclosed _text : "Closed Icon" ,
modal _custompreview _text : "Iconpreview"
} ;
}
2018-10-11 10:21:26 +02:00
}
}
2020-07-21 09:58:39 +02:00
} ) ( ) ;
2020-07-26 17:02:25 +02:00
module . exports = ServerFolders ;