2018-10-11 10:21:26 +02:00
module . exports = ( Plugin , Api , Vendor ) => {
2019-02-04 09:40:44 +01:00
if ( ! global . BDFDB || typeof BDFDB != "object" ) global . BDFDB = { myPlugins : { } , BDv2Api : Api } ;
2018-10-11 10:21:26 +02:00
return class extends Plugin {
initConstructor ( ) {
this . labels = { } ;
2019-01-26 22:45:19 +01:00
this . patchModules = {
"Guilds" : "componentDidMount" ,
"Guild" : [ "componentDidMount" , "componentWillUnmount" ]
} ;
2018-10-11 10:21:26 +02:00
this . css = `
2019-01-01 22:30:57 +01:00
. $ { this . name } - modal . ui - icon - picker - icon {
2018-10-11 10:21:26 +02:00
position : relative ;
width : 70 px ;
height : 70 px ;
border : 4 px solid transparent ;
border - radius : 12 px ;
margin : 0 ;
}
2019-01-01 22:30:57 +01:00
. $ { this . name } - modal . ui - icon - picker - icon . ui - picker - inner {
2018-10-11 10:21:26 +02:00
margin : 5 px 5 px ;
width : 60 px ;
height : 60 px ;
background - repeat : no - repeat ;
background - clip : padding - box ;
background - position : 50 % ;
background - size : cover ;
border - radius : 12 px ;
}
2019-01-01 22:30:57 +01:00
. $ { this . name } - modal . ui - icon - picker - icon . selected $ { BDFDB . dotCN . hovercardbutton } {
2018-10-11 10:21:26 +02:00
display : none ! important ;
}
2019-01-01 22:30:57 +01:00
. $ { this . name } - modal . ui - icon - picker - icon $ { BDFDB . dotCN . hovercardbutton } {
2018-10-11 10:21:26 +02:00
position : absolute ;
top : - 10 px ;
right : - 10 px ;
}
2019-01-01 22:30:57 +01:00
. $ { this . name } - modal . ui - icon - picker - icon . preview . nopic . ui - picker - inner {
2019-01-26 22:45:19 +01:00
background - image : url ( 'data:image/svg+xml; utf8, <svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" width="400" height="400"><path d="M40.400 17.178 C 39.850 17.366,38.793 17.538,38.050 17.560 C 33.351 17.699,23.397 24.788,21.381 29.432 C 21.087 30.109,20.566 30.896,20.223 31.181 C 19.880 31.465,19.600 31.866,19.600 32.071 C 19.600 32.276,19.236 33.242,18.792 34.218 C 16.345 39.589,16.345 49.611,18.792 54.982 C 19.236 55.958,19.600 56.918,19.600 57.116 C 19.600 57.314,19.960 57.802,20.400 58.200 C 20.840 58.598,21.200 59.131,21.200 59.385 C 21.200 60.391,25.680 64.942,91.505 130.800 C 128.995 168.310,159.849 199.326,160.068 199.724 C 160.409 200.344,150.950 209.964,93.989 266.924 C 18.798 342.113,19.600 341.292,19.600 343.126 C 19.600 343.283,19.250 344.065,18.822 344.864 C 15.429 351.195,15.958 362.918,19.932 369.440 C 22.094 372.990,27.474 378.800,28.598 378.800 C 28.861 378.800,29.402 379.160,29.800 379.600 C 30.198 380.040,30.703 380.400,30.922 380.400 C 31.141 380.400,32.238 380.831,33.360 381.358 C 34.482 381.886,36.480 382.533,37.800 382.797 C 43.786 383.994,44.323 384.027,47.299 383.386 C 48.895 383.042,51.010 382.619,52.000 382.446 C 52.990 382.274,54.517 381.743,55.394 381.266 C 56.271 380.790,57.188 380.400,57.432 380.400 C 57.676 380.400,58.202 380.040,58.600 379.600 C 58.998 379.160,59.598 378.800,59.932 378.800 C 60.267 378.800,91.725 347.615,129.839 309.500 C 169.057 270.281,199.496 240.145,199.964 240.073 C 200.602 239.975,216.001 255.193,267.495 306.814 C 327.046 366.511,339.531 378.800,340.627 378.800 C 340.798 378.800,341.265 379.097,341.667 379.461 C 345.728 383.136,361.013 384.409,365.685 381.461 C 366.188 381.143,367.024 380.757,367.541 380.602 C 370.583 379.691,376.623 374.200,379.382 369.836 C 385.105 360.785,384.039 346.409,377.039 338.228 C 376.084 337.113,344.846 305.743,307.621 268.517 C 255.329 216.224,239.969 200.647,240.070 200.009 C 240.143 199.545,270.062 169.288,308.216 131.091 C 345.625 93.641,376.723 62.370,377.324 61.600 C 384.286 52.678,385.036 40.621,379.277 30.171 C 376.136 24.469,367.906 18.537,361.668 17.477 C 354.656 16.286,345.095 17.665,341.883 20.331 C 341.567 20.594,340.549 21.318,339.622 21.941 C 338.695 22.563,307.031 53.972,269.259 91.737 C 231.486 129.501,200.330 160.400,200.022 160.400 C 199.714 160.400,168.938 129.869,131.631 92.554 C 56.225 17.131,60.288 21.047,55.200 18.887 C 51.591 17.354,42.836 16.343,40.400 17.178z" fill="rgb(220,43,67)"></path></svg>' ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . folder $ { BDFDB . dotCN . avataricon } {
background - clip : padding - box ! important ;
background - position : center ! important ;
background - size : cover ! important ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . folder $ { BDFDB . dotCN . badge } . folder . count {
background : # 7289 DA ;
top : - 2 px ;
left : - 2 px ;
right : unset ;
bottom : unset ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview {
pointer - events : none ! important ;
position : absolute ! important ;
opacity : 0.5 ! important ;
z - index : 10000 ! important ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview ,
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview $ { BDFDB . dotCN . guildinner } ,
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview $ { BDFDB . dotCN . guildinner } a ,
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview $ { BDFDB . dotCNS . guildinner + BDFDB . dotCN . guildicon } {
border - radius : 50 % ! important ;
width : 50 px ! important ;
height : 50 px ! important ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview : before ,
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview : after ,
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview $ { BDFDB . dotCN . badge } {
2018-10-11 10:21:26 +02:00
display : none ! important ;
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guild } . serverfolders - dragpreview $ { BDFDB . dotCN . avataricon } {
background - color : transparent ! important ;
overflow : hidden ! important ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guildswrapper } . foldercontent {
transition : width . 3 s linear ! important ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guildswrapper } . foldercontent . folderseparator {
margin - top : 10 px ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
$ { BDFDB . dotCN . guildswrapper } . foldercontent . foldercontentclosed {
width : 0 px ! important ;
2018-10-11 10:21:26 +02:00
} ` ;
this . serverContextEntryMarkup =
` <div class=" ${ BDFDB . disCN . contextmenuitemgroup } ">
< div class = "${BDFDB.disCN.contextmenuitem} serverfolders-item ${BDFDB.disCN.contextmenuitemsubmenu}" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _servercontext _serverfolders _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< / d i v > ` ;
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
this . serverContextSubMenuMarkup =
` <div class=" ${ BDFDB . disCN . contextmenu } serverfolders-submenu">
< div class = "${BDFDB.disCN.contextmenuitemgroup}" >
< div class = "${BDFDB.disCN.contextmenuitem} createfolder-item" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _serversubmenu _createfolder _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< div class = "${BDFDB.disCN.contextmenuitem} removefromfolder-item ${BDFDB.disCN.contextmenuitemdisabled}" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _serversubmenu _removefromfolder _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< / d i v >
< / d i v > ` ;
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
this . folderContextMarkup =
2019-01-26 22:45:19 +01:00
` <div class=" ${ BDFDB . disCN . contextmenu } serverfolder-contextmenu">
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuitemgroup}" >
< div class = "${BDFDB.disCN.contextmenuitem} unreadfolder-item ${BDFDB.disCN.contextmenuitemdisabled}" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _foldercontext _unreadfolder _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< div class = "${BDFDB.disCN.contextmenuitem} autounreadfolder-item ${BDFDB.disCN.contextmenuitemtoggle}" >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCN.contextmenulabel} DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _foldercontext _autounreadfolder _text < / d i v > < / d i v >
< div class = "${BDFDB.disCNS.contextmenucheckbox + BDFDB.disCN.contextmenucheckbox2}" >
< div class = "${BDFDB.disCN.contextmenucheckboxinner}" >
< input class = "${BDFDB.disCN.contextmenucheckboxelement}" type = "checkbox" >
2018-10-11 10:21:26 +02:00
< span > < / s p a n >
< / d i v >
< span > < / s p a n >
< / d i v >
< / d i v >
< div class = "${BDFDB.disCN.contextmenuitem} foldersettings-item" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _foldercontext _foldersettings _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< div class = "${BDFDB.disCN.contextmenuitem} createfolder-item" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _foldercontext _createfolder _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCN.contextmenuitem} removefolder-item ${BDFDB.disCN.contextmenuitemdanger}" >
2019-01-02 22:08:55 +01:00
< span class = "DevilBro-textscrollwrapper" speed = 3 > < div class = "DevilBro-textscroll" > REPLACE _foldercontext _removefolder _text < / d i v > < / s p a n >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.contextmenuhint}" > < / d i v >
< / d i v >
< / d i v >
< / d i v > ` ;
2019-01-26 22:45:19 +01:00
this . folderContentMarkup =
` <div class=" ${ BDFDB . disCN . guildswrapper } foldercontent foldercontentclosed">
< div class = "${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.firefoxfixscrollflex + BDFDB.disCNS.guildsscrollerwrap + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}" >
< div class = "${BDFDB.disCNS.guilds + BDFDB.disCN.scroller}" > < / d i v >
< / d i v >
< / d i v > ` ;
2018-10-11 10:21:26 +02:00
this . folderIconMarkup =
` <div class=" ${ BDFDB . disCN . guild } folder">
< div draggable = "true" >
< div class = "${BDFDB.disCN.guildinner}" draggable = "false" style = "border-radius: 25px;" >
2019-01-26 22:45:19 +01:00
< a >
< div class = "${BDFDB.disCNS.avataricon + BDFDB.disCNS.guildicon + BDFDB.disCNS.avatariconsizelarge + BDFDB.disCN.avatariconinactive}" > < / d i v >
< / a >
2018-10-11 10:21:26 +02:00
< / d i v >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.badgewrapper + BDFDB.disCN.badge} folder notifications" > < / d i v >
< div class = "${BDFDB.disCNS.badgewrapper + BDFDB.disCN.badge} folder count" > < / d i v >
2018-10-11 10:21:26 +02:00
< / d i v > ` ;
this . folderSettingsModalMarkup =
2019-01-26 22:45:19 +01:00
` <span class=" ${ this . name } -modal DevilBro-modal">
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.backdrop}" > < / d i v >
< div class = "${BDFDB.disCN.modal}" >
< div class = "${BDFDB.disCN.modalinner}" >
< div class = "${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}" >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style = "flex: 0 0 auto; padding-bottom: 10px;" >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCN.flexchild}" style = "flex: 1 1 auto;" >
< h4 class = "${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}" > REPLACE _modal _header _text < / h 4 >
< div class = "${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}" > < / d i v >
< / d i v >
2019-01-26 22:45:19 +01:00
< button type = "button" class = "${BDFDB.disCNS.modalclose + BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow}" >
< div class = "${BDFDB.disCN.buttoncontents}" >
< svg name = "Close" width = "18" height = "18" viewBox = "0 0 12 12" style = "flex: 0 1 auto;" >
< g fill = "none" fill - rule = "evenodd" >
< path d = "M0 0h12v12H0" > < / p a t h >
< path class = "fill" fill = "currentColor" d = "M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6" > < / p a t h >
< / g >
< / s v g >
< / d i v >
< / b u t t o n >
2018-10-11 10:21:26 +02:00
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.marginbottom8 + BDFDB.disCN.tabbarcontainer}" style = "flex: 0 0 auto; padding-right: 12px;" >
< div class = "${BDFDB.disCNS.tabbar + BDFDB.disCN.tabbartop}" >
< div tab = "folder" class = "${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}" > REPLACE _modal _tabheader1 _text < / d i v >
< div tab = "icon" class = "${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}" > REPLACE _modal _tabheader2 _text < / d i v >
< div tab = "tooltip" class = "${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}" > REPLACE _modal _tabheader3 _text < / d i v >
< div tab = "custom" class = "${BDFDB.disCNS.settingsitemdefault + BDFDB.disCNS.settingsitem + BDFDB.disCNS.settingsnotselected + BDFDB.disCN.tabbaritem}" > REPLACE _modal _tabheader4 _text < / d i v >
< / d i v >
2018-10-11 10:21:26 +02:00
< / d i v >
< div class = "${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}" >
< div class = "${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner}" >
< div tab = "folder" class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _foldername _text < / h 3 >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style = "flex: 1 1 auto;" > < input type = "text" class = "${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" id = "input-foldername" > < / d i v >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _iconpicker _text < / h 3 >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} icons" style = "flex: 1 1 auto;" > < / d i v >
2018-10-11 10:21:26 +02:00
< / d i v >
< div tab = "icon" class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _colorpicker1 _text < / h 3 >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style = "flex: 1 1 auto;" > < / d i v >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _colorpicker2 _text < / h 3 >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style = "flex: 1 1 auto;" > < / d i v >
2018-10-11 10:21:26 +02:00
< / d i v >
< div tab = "tooltip" class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _colorpicker3 _text < / h 3 >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style = "flex: 1 1 auto;" > < / d i v >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _colorpicker4 _text < / h 3 >
< / d i v >
2019-01-26 22:45:19 +01:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} swatches" style = "flex: 1 1 auto;" > < / d i v >
2018-10-11 10:21:26 +02:00
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
2019-01-26 22:45:19 +01:00
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 1 1 auto;" > REPLACE _modal _copytooltipcolor _text < / h 3 >
< div class = "${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style = "flex: 0 0 auto;" >
< input type = "checkbox" class = "${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id = "input-copytooltipcolor" >
< / d i v >
2018-10-11 10:21:26 +02:00
< / d i v >
< / d i v >
< div tab = "custom" class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} tab-content" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _customopen _text < / h 3 >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style = "flex: 1 1 auto;" >
< input type = "text" option = "open" class = "${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" placeholder = "Url or Filepath" >
< / d i v >
< button type = "button" class = "${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} file-navigator" style = "flex: 0 0 auto;" >
< div class = "${BDFDB.disCN.buttoncontents}" > < / d i v >
< input type = "file" option = "open" accept = "image/*" style = "display:none!important;" >
< / b u t t o n >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _customclosed _text < / h 3 >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn + BDFDB.disCN.flexchild}" style = "flex: 1 1 auto;" >
< input type = "text" option = "closed" class = "${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16}" placeholder = "Url or Filepath" >
< / d i v >
< button type = "button" class = "${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} file-navigator" style = "flex: 0 0 auto;" >
< div class = "${BDFDB.disCN.buttoncontents}" > < / d i v >
< input type = "file" option = "closed" accept = "image/*" style = "display:none!important;" >
< / b u t t o n >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.vertical + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style = "flex: 1 1 auto;" >
< h3 class = "${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style = "flex: 0 0 auto;" > REPLACE _modal _custompreview _text < / h 3 >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style = "flex: 1 1 auto;" >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifycenter + BDFDB.disCN.aligncenter + BDFDB.disCNS.nowrap}" style = "flex: 1 1 auto;" >
< div class = "ui-icon-picker-icon preview nopic open" >
< div class = "ui-picker-inner" > < / d i v >
< / d i v >
< div class = "ui-icon-picker-icon preview nopic closed" style = "margin-left: 25px; margin-right: 25px;" >
< div class = "ui-picker-inner" > < / d i v >
< / d i v >
< div class = "ui-icon-picker-icon preview nopic switching" >
< div class = "ui-picker-inner" > < / d i v >
< / d i v >
< / d i v >
< button type = "button" class = "${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-add btn-addcustom" style = "flex: 0 0 auto;" >
< div class = "${BDFDB.disCN.buttoncontents}" > < / d i v >
< / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
< div class = "${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}" >
< button type = "button" class = "btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}" >
< div class = "${BDFDB.disCN.buttoncontents}" > REPLACE _btn _save _text < / d i v >
< / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
2019-01-26 22:45:19 +01:00
< / s p a n > ` ;
2018-10-11 10:21:26 +02:00
}
onStart ( ) {
2019-02-04 09:40:44 +01:00
if ( global . BDFDB && global . BDFDB . myPlugins && typeof global . BDFDB . myPlugins == "object" ) global . BDFDB . myPlugins [ this . name ] = this ;
2019-01-26 22:45:19 +01:00
var libraryScript = document . querySelector ( 'head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]' ) ;
2019-02-10 19:49:16 +01:00
if ( ! global . BDFDB || typeof BDFDB != "object" || performance . now ( ) - BDFDB . creationTime > 600000 ) {
2018-10-11 10:21:26 +02:00
if ( libraryScript ) libraryScript . remove ( ) ;
libraryScript = document . createElement ( "script" ) ;
libraryScript . setAttribute ( "type" , "text/javascript" ) ;
libraryScript . setAttribute ( "src" , "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js" ) ;
2019-01-26 22:45:19 +01:00
libraryScript . setAttribute ( "date" , performance . now ( ) ) ;
2019-01-30 21:23:49 +01:00
libraryScript . addEventListener ( "load" , ( ) => { if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) this . initialize ( ) ; } ) ;
2018-10-11 10:21:26 +02:00
document . head . appendChild ( libraryScript ) ;
}
2019-01-26 22:45:19 +01:00
else if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) this . initialize ( ) ;
2018-10-11 10:21:26 +02:00
this . startTimeout = setTimeout ( ( ) => { this . initialize ( ) ; } , 30000 ) ;
}
initialize ( ) {
2019-01-26 22:45:19 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
if ( this . started ) return true ;
2018-10-11 10:21:26 +02:00
BDFDB . loadMessage ( this ) ;
2019-01-26 22:45:19 +01:00
if ( BDFDB . isPluginEnabled ( "HideUtils" ) && ! BDFDB . loadData ( "hideutils" , this , "warnings" ) ) BDFDB . openConfirmModal ( this , this . name + " is not compartible with the plugin HideUtils by Arashiryuu. You might expierence bugs like Servers that should be hidden due to being part of a Folder still being visible in the Guildlist. To avoid this disable the Plugin HideUtils. Press the " + BDFDB . getLibraryStrings ( ) . btn _ok _text + "-Button to not show this Message again." , "Warning" , ( ) => { BDFDB . saveData ( "hideutils" , true , this , "warnings" ) } ) ;
this . GuildUtils = BDFDB . WebModules . findByProperties ( "getGuilds" , "getGuild" ) ;
this . DiscordConstants = BDFDB . WebModules . findByProperties ( "Permissions" , "ActivityTypes" , "StatusTypes" ) ;
this . Animations = BDFDB . WebModules . findByProperties ( "spring" ) ;
BDFDB . WebModules . forceAllUpdates ( this , "Guilds" ) ;
2018-10-11 10:21:26 +02:00
return true ;
}
else {
2019-01-24 13:37:08 +01:00
console . error ( ` %c[ ${ this . name } ]%c ` , 'color: #3a71c1; font-weight: 700;' , '' , 'Fatal Error: Could not load BD functions!' ) ;
2018-10-11 10:21:26 +02:00
return false ;
}
}
onStop ( ) {
2019-01-26 22:45:19 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
2018-10-11 10:21:26 +02:00
this . resetAllElements ( ) ;
2019-01-26 22:45:19 +01:00
BDFDB . removeEles ( this . foldercontent , BDFDB . dotCN . guildswrapper + ".foldercontent" , ".serverfolder-contextmenu" ) ;
2018-10-11 10:21:26 +02:00
BDFDB . unloadMessage ( this ) ;
return true ;
}
else {
return false ;
}
}
onSwitch ( ) {
2019-01-26 22:45:19 +01:00
if ( typeof BDFDB === "object" && BDFDB . getData ( "forceOpenFolder" , this , "settings" ) ) {
let serverObj = BDFDB . getSelectedServer ( ) ;
if ( ! serverObj ) return ;
let folderdiv = this . getFolderOfServer ( serverObj ) ;
if ( ! folderdiv || BDFDB . containsClass ( folderdiv , "open" ) ) return ;
this . openCloseFolder ( folderdiv ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
// begin of own functions
2018-10-11 10:21:26 +02:00
changeLanguageStrings ( ) {
this . serverContextEntryMarkup = this . serverContextEntryMarkup . replace ( "REPLACE_servercontext_serverfolders_text" , this . labels . servercontext _serverfolders _text ) ;
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
this . serverContextSubMenuMarkup = this . serverContextSubMenuMarkup . replace ( "REPLACE_serversubmenu_createfolder_text" , this . labels . serversubmenu _createfolder _text ) ;
this . serverContextSubMenuMarkup = this . serverContextSubMenuMarkup . replace ( "REPLACE_serversubmenu_removefromfolder_text" , this . labels . serversubmenu _removefromfolder _text ) ;
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
this . folderContextMarkup = this . folderContextMarkup . replace ( "REPLACE_foldercontext_unreadfolder_text" , this . labels . foldercontext _unreadfolder _text ) ;
this . folderContextMarkup = this . folderContextMarkup . replace ( "REPLACE_foldercontext_autounreadfolder_text" , this . labels . foldercontext _autounreadfolder _text ) ;
this . folderContextMarkup = this . folderContextMarkup . replace ( "REPLACE_foldercontext_foldersettings_text" , this . labels . foldercontext _foldersettings _text ) ;
this . folderContextMarkup = this . folderContextMarkup . replace ( "REPLACE_foldercontext_createfolder_text" , this . labels . serversubmenu _createfolder _text ) ;
this . folderContextMarkup = this . folderContextMarkup . replace ( "REPLACE_foldercontext_removefolder_text" , this . labels . foldercontext _removefolder _text ) ;
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_header_text" , this . labels . modal _header _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_foldername_text" , this . labels . modal _foldername _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_tabheader1_text" , this . labels . modal _tabheader1 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_tabheader2_text" , this . labels . modal _tabheader2 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_tabheader3_text" , this . labels . modal _tabheader3 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_tabheader4_text" , this . labels . modal _tabheader4 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_iconpicker_text" , this . labels . modal _iconpicker _text ) ;
2019-01-26 22:45:19 +01:00
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_copytooltipcolor_text" , this . labels . modal _copytooltipcolor _text ) ;
2018-10-11 10:21:26 +02:00
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_colorpicker1_text" , this . labels . modal _colorpicker1 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_colorpicker2_text" , this . labels . modal _colorpicker2 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_colorpicker3_text" , this . labels . modal _colorpicker3 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_colorpicker4_text" , this . labels . modal _colorpicker4 _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_customopen_text" , this . labels . modal _customopen _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_customclosed_text" , this . labels . modal _customclosed _text ) ;
this . folderSettingsModalMarkup = this . folderSettingsModalMarkup . replace ( "REPLACE_modal_custompreview_text" , this . labels . modal _custompreview _text ) ;
}
2019-01-26 22:45:19 +01:00
onGuildContextMenu ( instance , menu ) {
if ( document . querySelector ( ".DevilBro-modal" ) ) return ;
if ( instance . props && instance . props . target && instance . props . guild && instance . props . type == "GUILD_ICON_BAR" && ! menu . querySelector ( ".serverfolders-item" ) ) {
let serverContextEntry = BDFDB . htmlToElement ( this . serverContextEntryMarkup ) ;
menu . appendChild ( serverContextEntry ) ;
let folderitem = serverContextEntry . querySelector ( ".serverfolders-item" ) ;
folderitem . addEventListener ( "mouseenter" , ( ) => {
let serverContextSubMenu = BDFDB . htmlToElement ( this . serverContextSubMenuMarkup ) ;
let createitem = serverContextSubMenu . querySelector ( ".createfolder-item" ) ;
createitem . addEventListener ( "click" , ( ) => {
instance . _reactInternalFiber . return . memoizedProps . closeContextMenu ( ) ;
this . createNewFolder ( instance . props . target ) ;
2018-10-11 10:21:26 +02:00
} ) ;
2019-01-26 22:45:19 +01:00
let folderdiv = this . getFolderOfServer ( instance . props . guild ) ;
if ( folderdiv ) {
let removeitem = serverContextSubMenu . querySelector ( ".removefromfolder-item" ) ;
BDFDB . removeClass ( removeitem , BDFDB . disCN . contextmenuitemdisabled ) ;
removeitem . addEventListener ( "click" , ( ) => {
instance . _reactInternalFiber . return . memoizedProps . closeContextMenu ( ) ;
this . removeServerFromFolder ( instance . props . guild , folderdiv ) ;
} ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
BDFDB . appendSubMenu ( folderitem , serverContextSubMenu ) ;
2018-10-11 10:21:26 +02:00
} ) ;
}
}
2019-01-26 22:45:19 +01:00
processGuilds ( instance , wrapper ) {
setTimeout ( ( ) => {
if ( ! wrapper . parentElement . querySelector ( BDFDB . dotCN . guildswrapper + ".foldercontent" ) ) {
this . foldercontent = BDFDB . htmlToElement ( this . folderContentMarkup ) ;
wrapper . parentElement . insertBefore ( this . foldercontent , wrapper . nextElementSibling ) ;
this . foldercontentguilds = this . foldercontent . querySelector ( BDFDB . dotCN . guilds ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
let folders = BDFDB . loadAllData ( this , "folders" ) , sortedFolders = [ ] ;
for ( let id in folders ) sortedFolders [ folders [ id ] . position ] = folders [ id ] ;
for ( let data of sortedFolders ) if ( data && ! wrapper . querySelector ( BDFDB . dotCN . guild + ".folder#" + data . folderID ) ) {
let folderdiv = this . createFolderDiv ( data ) ;
this . readIncludedServerList ( folderdiv ) . forEach ( guilddiv => { this . hideServer ( guilddiv , folderdiv ) ; } ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
BDFDB . WebModules . forceAllUpdates ( this , "Guild" ) ;
} , 5000 ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
processGuild ( instance , wrapper , methodnames ) {
if ( instance . props && instance . props . guild ) {
if ( methodnames . includes ( "componentDidMount" ) ) {
let folderdiv = this . getFolderOfServer ( instance . props . guild ) ;
if ( folderdiv && ! wrapper . getAttribute ( "folder" ) ) {
this . hideServer ( wrapper , folderdiv ) ;
this . updateCopyInFolderContent ( wrapper , folderdiv ) ;
this . updateFolderNotifications ( folderdiv ) ;
}
BDFDB . addEventListener ( this , wrapper , "click" , ( ) => {
if ( BDFDB . getData ( "closeAllFolders" , this , "settings" ) ) document . querySelectorAll ( ".folder.open" ) . forEach ( openFolder => { this . openCloseFolder ( openFolder ) ; } ) ;
} ) ;
BDFDB . addEventListener ( this , wrapper , "mousedown" , e => {
if ( BDFDB . pressedKeys . includes ( 17 ) ) {
e . originalEvent . stopPropagation ( ) ;
e . originalEvent . preventDefault ( ) ;
let dragpreview = this . createDragPreview ( wrapper , e ) ;
let updatePreview = e2 => {
this . updateDragPreview ( dragpreview , e2 ) ;
} ;
let droppedPreview = e2 => {
let dropfolderdiv = BDFDB . getParentEle ( BDFDB . dotCN . guild + ".folder" , e2 . target ) ;
if ( dropfolderdiv ) this . addServerToFolder ( instance . props . guild , dropfolderdiv ) ;
document . removeEventListener ( "mousemove" , updatePreview ) ;
document . removeEventListener ( "mouseup" , droppedPreview ) ;
BDFDB . removeEles ( dragpreview ) ;
} ;
document . addEventListener ( "mousemove" , updatePreview ) ;
document . addEventListener ( "mouseup" , droppedPreview ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
} ) ;
}
if ( methodnames . includes ( "componentWillUnmount" ) ) {
let folderdiv = this . getFolderOfServer ( instance . props . guild ) ;
if ( folderdiv ) {
BDFDB . removeEles ( this . foldercontent . querySelectorAll ( ` [guild=" ${ instance . props . guild . id } "] ` ) ) ;
this . updateFolderNotifications ( folderdiv ) ;
}
2018-10-11 10:21:26 +02:00
}
}
}
2019-01-26 22:45:19 +01:00
showFolderSettings ( folderdiv ) {
if ( ! folderdiv ) return ;
let { folderID , folderName , position , iconID , icons , copyTooltipColor , color1 , color2 , color3 , color4 , servers } = BDFDB . loadData ( folderdiv . id , this , "folders" ) || { } ;
if ( ! folderID ) return ;
let folderSettingsModal = BDFDB . htmlToElement ( this . folderSettingsModalMarkup ) ;
let foldernameinput = folderSettingsModal . querySelector ( "#input-foldername" ) ;
let copytooltipcolorinput = folderSettingsModal . querySelector ( "#input-copytooltipcolor" ) ;
folderSettingsModal . querySelector ( BDFDB . dotCN . modalguildname ) . innerText = folderName || "" ;
foldernameinput . value = folderName || "" ;
foldernameinput . setAttribute ( "placeholder" , folderName || "" ) ;
copytooltipcolorinput . checked = copyTooltipColor ;
this . setIcons ( folderSettingsModal , iconID ) ;
BDFDB . setColorSwatches ( folderSettingsModal , color1 ) ;
BDFDB . setColorSwatches ( folderSettingsModal , color2 ) ;
BDFDB . setColorSwatches ( folderSettingsModal , color3 ) ;
BDFDB . setColorSwatches ( folderSettingsModal , color4 ) ;
BDFDB . appendModal ( folderSettingsModal ) ;
BDFDB . addChildEventListener ( folderSettingsModal , "change" , "input[type='file'][option]" , e => {
let file = e . currentTarget . files [ 0 ] ;
if ( file ) this . fetchCustomIcon ( folderSettingsModal , e . currentTarget . getAttribute ( "option" ) ) ;
} ) ;
BDFDB . addChildEventListener ( folderSettingsModal , "keyup" , "input[type='text'][option]" , e => {
if ( e . which == 13 ) this . fetchCustomIcon ( folderSettingsModal , e . currentTarget . getAttribute ( "option" ) ) ;
} ) ;
BDFDB . addChildEventListener ( folderSettingsModal , "click" , ".btn-addcustom" , ( ) => {
this . saveCustomIcon ( folderSettingsModal ) ;
} ) ;
BDFDB . addChildEventListener ( folderSettingsModal , "click" , ".btn-save" , e => {
e . preventDefault ( ) ;
folderName = foldernameinput . value . trim ( ) ;
folderName = folderName ? folderName : null ;
var oldIconID = iconID ;
var selectedIcon = folderSettingsModal . querySelector ( ".ui-icon-picker-icon.selected" ) ;
iconID = selectedIcon . getAttribute ( "value" ) ;
copyTooltipColor = copytooltipcolorinput . checked ;
var oldColor1 = color1 ;
var oldColor2 = color2 ;
color1 = BDFDB . getSwatchColor ( folderSettingsModal , 1 ) ;
color2 = BDFDB . getSwatchColor ( folderSettingsModal , 2 ) ;
color3 = BDFDB . getSwatchColor ( folderSettingsModal , 3 ) ;
color4 = BDFDB . getSwatchColor ( folderSettingsModal , 4 ) ;
if ( iconID != oldIconID || ! BDFDB . equals ( color1 , oldColor1 ) || ! BDFDB . equals ( color2 , oldColor2 ) ) {
let folderIcons = this . loadAllIcons ( ) ;
let isOpen = BDFDB . containsClass ( folderdiv , "open" ) ;
if ( ! BDFDB . containsClass ( selectedIcon , "custom" ) ) {
this . changeImgColor ( color1 , color2 , folderIcons [ iconID ] . openicon , ( openicon ) => {
icons . openicon = openicon ;
this . changeImgColor ( color1 , color2 , folderIcons [ iconID ] . closedicon , ( closedicon ) => {
icons . closedicon = closedicon ;
folderdiv . querySelector ( BDFDB . dotCN . avataricon ) . style . setProperty ( "background-image" , ` url( ${ isOpen ? icons . openicon : icons . closedicon } ) ` ) ;
BDFDB . saveData ( folderID , { folderID , folderName , position , iconID , icons , copyTooltipColor , color1 , color2 , color3 , color4 , servers } , this , "folders" ) ;
} ) ;
} ) ;
}
else {
icons . openicon = folderIcons [ iconID ] . openicon ;
icons . closedicon = folderIcons [ iconID ] . closedicon ;
folderdiv . querySelector ( BDFDB . dotCN . avataricon ) . style . setProperty ( "background-image" , ` url( ${ isOpen ? icons . openicon : icons . closedicon } ) ` ) ;
BDFDB . saveData ( folderID , { folderID , folderName , position , iconID , icons , copyTooltipColor , color1 , color2 , color3 , color4 , servers } , this , "folders" ) ;
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
else BDFDB . saveData ( folderID , { folderID , folderName , position , iconID , icons , copyTooltipColor , color1 , color2 , color3 , color4 , servers } , this , "folders" ) ;
} ) ;
foldernameinput . focus ( ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
changeImgColor ( color1 , color2 , icon , callback ) {
color1 = BDFDB . colorCONVERT ( color1 , "RGBCOMP" ) ;
color2 = BDFDB . colorCONVERT ( color2 , "RGBCOMP" ) ;
if ( ! color1 || ! color2 || ! icon ) return ;
let img = new Image ( ) ;
img . src = icon ;
img . onload = ( ) => {
if ( icon . indexOf ( "data:image" ) == 0 && img . width < 200 && img . height < 200 ) {
let can = document . createElement ( "canvas" ) ;
can . width = img . width ;
can . height = img . height ;
let ctx = can . getContext ( "2d" ) ;
ctx . drawImage ( img , 0 , 0 ) ;
let imageData = ctx . getImageData ( 0 , 0 , img . width , img . height ) ;
let data = imageData . data ;
for ( let i = 0 ; i < data . length ; i += 4 ) {
if ( data [ i ] == 0 && data [ i + 1 ] == 0 && data [ i + 2 ] == 0 ) {
data [ i ] = color1 [ 0 ] ;
data [ i + 1 ] = color1 [ 1 ] ;
data [ i + 2 ] = color1 [ 2 ] ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
else if ( data [ i ] == 255 && data [ i + 1 ] == 255 && data [ i + 2 ] == 255 ) {
data [ i ] = color2 [ 0 ] ;
data [ i + 1 ] = color2 [ 1 ] ;
data [ i + 2 ] = color2 [ 2 ] ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
ctx . putImageData ( imageData , 0 , 0 ) ;
}
callback ( can . toDataURL ( "image/png" ) ) ;
}
else {
callback ( img . src ) ;
}
} ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
setIcons ( modal , selection ) {
let wrapper = modal . querySelector ( ".icons" ) ;
if ( ! wrapper ) return ;
BDFDB . removeEles ( wrapper . childNodes ) ;
let folderIcons = this . loadAllIcons ( ) ;
wrapper . appendChild ( BDFDB . htmlToElement ( ` <div class=" ${ BDFDB . disCNS . flex + BDFDB . disCNS . flex2 + BDFDB . disCNS . horizontal + BDFDB . disCNS . horizontal2 + BDFDB . disCNS . directionrow + BDFDB . disCNS . justifystart + BDFDB . disCNS . alignstretch + BDFDB . disCNS . nowrap + BDFDB . disCN . margintop4 } " style="flex: 1 1 auto;"><div class=" ${ BDFDB . disCNS . flex + BDFDB . disCNS . flex2 + BDFDB . disCNS . horizontal + BDFDB . disCNS . horizontal2 + BDFDB . disCNS . directionrow + BDFDB . disCNS . justifystart + BDFDB . disCNS . alignstretch + BDFDB . disCN . wrap } ui-icon-picker-row" style="flex: 1 1 auto; display: flex; flex-wrap: wrap; overflow: visible !important;"> ${ Object . getOwnPropertyNames ( folderIcons ) . map ( id => ` <div class="ui-icon-picker-icon ${ folderIcons [ id ] . customID ? ' custom' : '' } " value=" ${ id } "><div class="ui-picker-inner" style="background-image: url( ${ folderIcons [ id ] . closedicon } );"></div> ${ folderIcons [ id ] . customID ? '<div value="' + id + '" class="' + BDFDB . disCN . hovercardbutton + '"></div>' : '' } </div> ` ) . join ( "" ) } </div></div> ` ) ) ;
setIcon ( wrapper . querySelector ( ` .ui-icon-picker-icon[value=" ${ folderIcons [ selection ] ? selection : 0 } "] ` ) , false , true ) ;
BDFDB . addChildEventListener ( wrapper , "click" , ".ui-icon-picker-icon" , e => {
if ( BDFDB . containsClass ( e . target , BDFDB . disCN . hovercardbutton ) ) return ;
setIcon ( wrapper . querySelector ( ".ui-icon-picker-icon.selected" ) , false , false ) ;
setIcon ( e . currentTarget , true , true ) ;
} ) ;
BDFDB . addChildEventListener ( wrapper , "click" , BDFDB . dotCN . hovercardbutton , e => {
if ( BDFDB . containsClass ( e . currentTarget . parentElement , "selected" ) ) return ;
BDFDB . removeData ( e . currentTarget . getAttribute ( "value" ) , this , "customicons" ) ;
e . currentTarget . parentElement . remove ( ) ;
BDFDB . showToast ( ` Custom Icon was deleted. ` , { type : "success" } ) ;
} ) ;
BDFDB . addChildEventListener ( wrapper , "mouseenter" , ".ui-icon-picker-icon" , e => {
setIcon ( e . currentTarget , true ) ;
} ) ;
BDFDB . addChildEventListener ( wrapper , "mouseleave" , ".ui-icon-picker-icon" , e => {
setIcon ( e . currentTarget , false ) ;
} ) ;
function setIcon ( icon , hover , enable ) {
if ( ! icon ) return ;
if ( enable != undefined ) BDFDB . toggleClass ( icon , "selected" , enable ) ;
if ( hover ) {
icon . querySelector ( ".ui-picker-inner" ) . style . setProperty ( "background-image" , ` url( ${ folderIcons [ icon . getAttribute ( "value" ) ] . openicon } ) ` ) ;
if ( BDFDB . containsClass ( icon , "selected" ) ) icon . style . setProperty ( "background-color" , "rgb(255,255,255,0.2)" ) ;
else icon . style . setProperty ( "background-color" , "rgb(255,255,255,0.1)" ) ;
}
else {
icon . querySelector ( ".ui-picker-inner" ) . style . setProperty ( "background-image" , ` url( ${ folderIcons [ icon . getAttribute ( "value" ) ] . closedicon } ) ` ) ;
if ( BDFDB . containsClass ( icon , "selected" ) ) icon . style . setProperty ( "background-color" , "rgb(255,255,255,0.2)" ) ;
else icon . style . removeProperty ( "background-color" ) ;
}
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
loadAllIcons ( ) {
2019-01-26 22:45:19 +01:00
let icons = { } ;
this . folderIcons . forEach ( ( array , i ) => { icons [ i ] = { "openicon" : array . openicon , "closedicon" : array . closedicon , "customID" : null } ; } ) ;
2018-10-11 10:21:26 +02:00
Object . assign ( icons , BDFDB . loadAllData ( this , "customicons" ) ) ;
return icons ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
fetchCustomIcon ( modal , type ) {
2019-01-26 22:45:19 +01:00
let successFetchIcon ;
let url = modal . querySelector ( "input[type='text'][option='" + type + "']" ) . value ;
2018-10-11 10:21:26 +02:00
if ( url . indexOf ( "http" ) == 0 ) {
let request = require ( "request" ) ;
request ( url , ( error , response , result ) => {
if ( response ) {
2019-01-26 22:45:19 +01:00
let type = response . headers [ "content-type" ] ;
2018-10-11 10:21:26 +02:00
if ( type && type . indexOf ( "image" ) > - 1 ) {
successFetchIcon ( ) ;
return ;
}
}
BDFDB . showToast ( "Use a valid direct link to an image source. They usually end on something like .png, .jpg or .gif." , { type : "danger" } ) ;
} ) ;
}
else {
let fs = require ( "fs" )
if ( fs . existsSync ( url ) ) {
fs . readFile ( url , ( error , response ) => {
if ( ! error ) {
url = ` data:image/png;base64, ${ response . toString ( "base64" ) } ` ;
successFetchIcon ( ) ;
}
} ) ;
}
else {
BDFDB . showToast ( "Could not fetch file. Please make sure the file exists." , { type : "danger" } ) ;
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
successFetchIcon = ( ) => {
2019-01-26 22:45:19 +01:00
let iconpreview = modal . querySelector ( ".ui-icon-picker-icon.preview." + type ) ;
let iconpreviewinner = iconpreview . querySelector ( ".ui-picker-inner" ) ;
BDFDB . removeClass ( iconpreview , "nopic" ) ;
2018-10-11 10:21:26 +02:00
iconpreview . url = url ;
2019-01-26 22:45:19 +01:00
iconpreviewinner . style . setProperty ( "background-image" , ` url( ${ url } ) ` ) ;
let iconpreviewopen = modal . querySelector ( ".ui-icon-picker-icon.preview.open" ) ;
let iconpreviewclosed = modal . querySelector ( ".ui-icon-picker-icon.preview.closed" ) ;
if ( ! BDFDB . containsClass ( iconpreviewopen , "nopic" ) && ! BDFDB . containsClass ( iconpreviewclosed , "nopic" ) ) {
let iconpreviewswitching = modal . querySelector ( ".ui-icon-picker-icon.preview.switching" ) ;
let iconpreviewopenimage = iconpreviewopen . querySelector ( ".ui-picker-inner" ) . style . getPropertyValue ( "background-image" ) ;
let iconpreviewclosedimage = iconpreviewclosed . querySelector ( ".ui-picker-inner" ) . style . getPropertyValue ( "background-image" ) ;
let iconpreviewswitchinginner = iconpreviewswitching . querySelector ( ".ui-picker-inner" ) ;
BDFDB . removeClass ( iconpreviewswitching , "nopic" ) ;
iconpreviewswitchinginner . style . setProperty ( "background-image" , iconpreviewopenimage ) ;
let switching = true ;
2018-10-11 10:21:26 +02:00
iconpreviewswitching . switchInterval = setInterval ( ( ) => {
switching = ! switching ;
2019-01-26 22:45:19 +01:00
iconpreviewswitchinginner . style . setProperty ( "background-image" , switching ? iconpreviewopenimage : iconpreviewclosedimage ) ;
2018-10-11 10:21:26 +02:00
} , 1000 ) ;
}
} ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
saveCustomIcon ( modal ) {
2019-01-26 22:45:19 +01:00
let iconpreviewopen = modal . querySelector ( ".ui-icon-picker-icon.preview.open" ) ;
let iconpreviewclosed = modal . querySelector ( ".ui-icon-picker-icon.preview.closed" ) ;
let iconpreviewswitching = modal . querySelector ( ".ui-icon-picker-icon.preview.switching" ) ;
if ( ! BDFDB . containsClass ( iconpreviewopen , "nopic" ) && ! BDFDB . containsClass ( iconpreviewclosed , "nopic" ) && ! BDFDB . containsClass ( iconpreviewswitching , "nopic" ) ) {
let customID = this . generateID ( "customicon" ) ;
2018-10-11 10:21:26 +02:00
BDFDB . saveData ( customID , { "openicon" : iconpreviewopen . url , "closedicon" : iconpreviewclosed . url , customID } , this , "customicons" ) ;
2019-01-26 22:45:19 +01:00
modal . querySelectorAll ( "input[type='text'][option]" ) . forEach ( ( input ) => { input . value = "" ; } ) ;
let iconpreviewopeninner = iconpreviewopen . querySelector ( ".ui-picker-inner" ) ;
let iconpreviewclosedinner = iconpreviewclosed . querySelector ( ".ui-picker-inner" ) ;
let iconpreviewswitchinginner = iconpreviewswitching . querySelector ( ".ui-picker-inner" ) ;
BDFDB . addClass ( iconpreviewopen , "nopic" ) ;
iconpreviewopeninner . style . removeProperty ( "background-image" ) ;
BDFDB . addClass ( iconpreviewclosed , "nopic" ) ;
iconpreviewclosedinner . style . removeProperty ( "background-image" ) ;
BDFDB . addClass ( iconpreviewswitching , "nopic" ) ;
iconpreviewswitchinginner . style . removeProperty ( "background-image" ) ;
2018-10-11 10:21:26 +02:00
clearInterval ( iconpreviewswitching . switchInterval ) ;
BDFDB . showToast ( ` Custom Icon was added to selection. ` , { type : "success" } ) ;
2019-01-26 22:45:19 +01:00
this . setIcons ( modal , modal . querySelector ( ".ui-icon-picker-icon.selected" ) . getAttribute ( "value" ) ) ;
2018-10-11 10:21:26 +02:00
}
else {
BDFDB . showToast ( ` Add an image for the open and the closed icon. ` , { type : "danger" } ) ;
}
2019-01-26 22:45:19 +01:00
}
resetAllElements ( ) {
this . toggleFolderContent ( false ) ;
BDFDB . removeEles ( BDFDB . dotCN . guild + ".folder" , ".serverfolders-dragpreview" ) ;
BDFDB . readServerList ( ) . forEach ( info => { this . unhideServer ( info . div ) ; } ) ;
}
createNewFolder ( ankerdiv ) {
if ( ! Node . prototype . isPrototypeOf ( ankerdiv ) ) return ;
let guilddiv = BDFDB . getParentEle ( BDFDB . dotCN . guild , ankerdiv ) ;
if ( ! guilddiv ) return ;
let folderID = this . generateID ( "folder" ) ;
let folderName = "" ;
let position = Array . from ( document . querySelectorAll ( ` div ${ BDFDB . dotCN . guildseparator } :not(.folderseparator) ~ div ${ BDFDB . dotCN . guild } ` ) ) . indexOf ( guilddiv ) ;
let iconID = 0 ;
let icons = Object . assign ( { } , this . folderIcons [ 0 ] ) ;
let autounread = false ;
let color1 = [ "0" , "0" , "0" ] ;
let color2 = [ "255" , "255" , "255" ] ;
let color3 = null ;
let color4 = null ;
let servers = [ ] ;
this . showFolderSettings ( this . createFolderDiv ( { folderID , folderName , position , iconID , icons , autounread , color1 , color2 , color3 , color4 , servers } ) ) ;
2018-10-11 10:21:26 +02:00
this . updateFolderPositions ( ) ;
}
2019-01-26 22:45:19 +01:00
createFolderDiv ( data ) {
let folderdiv = BDFDB . htmlToElement ( this . folderIconMarkup ) ;
let serversandfolders = document . querySelectorAll ( ` div ${ BDFDB . dotCN . guildseparator } :not(.folderseparator) ~ div ${ BDFDB . dotCN . guild } ` ) ;
let insertnode = serversandfolders [ data . position > serversandfolders . length - 1 ? serversandfolders . length - 1 : data . position ] ;
insertnode . parentElement . insertBefore ( folderdiv , insertnode ) ;
folderdiv . id = data . folderID ;
BDFDB . addClass ( folderdiv , "closed" ) ;
folderdiv . querySelector ( BDFDB . dotCN . avataricon ) . style . setProperty ( "background-image" , ` url( ${ data . icons . closedicon } ) ` ) ;
folderdiv . addEventListener ( "click" , ( ) => {
if ( BDFDB . getData ( "closeOtherFolders" , this , "settings" ) ) {
document . querySelectorAll ( ".folder.open" ) . forEach ( folder => {
if ( folder != folderdiv ) this . openCloseFolder ( folder ) ;
} ) ;
}
this . openCloseFolder ( folderdiv ) ;
} ) ;
folderdiv . addEventListener ( "mouseenter" , ( ) => {
let newdata = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( ! newdata || ! newdata . folderName ) return ;
let bgColor = BDFDB . colorCONVERT ( newdata . color3 , "RGB" ) ;
let fontColor = BDFDB . colorCONVERT ( newdata . color4 , "RGB" ) ;
BDFDB . createTooltip ( newdata . folderName , folderdiv , { type : "right" , selector : "guild-folder-tooltip" , style : ` color: ${ fontColor } !important; background-color: ${ bgColor } !important; border-color: ${ bgColor } !important; ` } ) ;
} ) ;
folderdiv . addEventListener ( "contextmenu" , e => {
let newdata = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( ! newdata ) return ;
let folderContext = BDFDB . htmlToElement ( this . folderContextMarkup ) ;
let autounreadinput = folderContext . querySelector ( ".autounreadfolder-item input" ) ;
autounreadinput . checked = newdata . autounread ;
folderContext . querySelector ( ".autounreadfolder-item" ) . addEventListener ( "click" , ( ) => {
autounreadinput . checked = ! autounreadinput . checked ;
newdata . autounread = autounreadinput . checked ;
BDFDB . saveData ( newdata . folderID , newdata , this , "folders" ) ;
} ) ;
folderContext . querySelector ( ".foldersettings-item" ) . addEventListener ( "click" , ( ) => {
folderContext . remove ( ) ;
this . showFolderSettings ( folderdiv ) ;
} ) ;
folderContext . querySelector ( ".createfolder-item" ) . addEventListener ( "click" , ( ) => {
folderContext . remove ( ) ;
this . createNewFolder ( folderdiv ) ;
} ) ;
folderContext . querySelector ( ".removefolder-item" ) . addEventListener ( "click" , ( ) => {
folderContext . remove ( ) ;
this . removeFolder ( folderdiv ) ;
} ) ;
let unreadServers = BDFDB . readUnreadServerList ( this . readIncludedServerList ( folderdiv ) ) ;
if ( unreadServers . length > 0 ) {
let unreaditem = folderContext . querySelector ( ".unreadfolder-item" ) ;
BDFDB . removeClass ( unreaditem , BDFDB . disCN . contextmenuitemdisabled ) ;
unreaditem . addEventListener ( "click" , ( ) => {
folderContext . remove ( ) ;
2019-02-04 11:22:37 +01:00
BDFDB . markGuildAsRead ( unreadServers ) ;
2019-01-26 22:45:19 +01:00
} ) ;
}
BDFDB . appendContextMenu ( folderContext , e ) ;
} ) ;
folderdiv . addEventListener ( "mousedown" , e => {
let x = e . pageX , y = e . pageY ;
let mousemove = e2 => {
if ( Math . sqrt ( ( x - e2 . pageX ) * * 2 ) > 20 || Math . sqrt ( ( y - e2 . pageY ) * * 2 ) > 20 ) {
document . removeEventListener ( "mousemove" , mousemove ) ;
document . removeEventListener ( "mouseup" , mouseup ) ;
let guildswrap = document . querySelector ( ` ${ BDFDB . dotCN . guildswrapper } :not(.foldercontent) ${ BDFDB . dotCN . guilds } ` ) ;
if ( ! guildswrap ) return ;
let hovele = null ;
let placeholder = BDFDB . htmlToElement ( ` <div class=" ${ BDFDB . disCNS . guild + BDFDB . disCN . guildplaceholder } folderplaceholder"></div> ` ) ;
let dragpreview = this . createDragPreview ( folderdiv , e ) ;
let dragging = e3 => {
BDFDB . removeEles ( placeholder ) ;
BDFDB . toggleEles ( folderdiv , false ) ;
this . updateDragPreview ( dragpreview , e3 ) ;
hovele = BDFDB . getParentEle ( BDFDB . dotCN . guild + ".folder" , e3 . target ) ;
if ( hovele ) guildswrap . insertBefore ( placeholder , hovele . nextSibling ) ;
2018-10-11 10:21:26 +02:00
else {
2019-01-26 22:45:19 +01:00
hovele = BDFDB . getParentEle ( BDFDB . dotCN . guild , e3 . target ) ;
if ( hovele && BDFDB . getReactValue ( hovele , "return.memoizedProps.guild" ) && guildswrap . contains ( hovele ) ) {
guildswrap . insertBefore ( placeholder , hovele . nextSibling ) ;
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
} ;
let releasing = e3 => {
document . removeEventListener ( "mousemove" , dragging ) ;
document . removeEventListener ( "mouseup" , releasing ) ;
BDFDB . removeEles ( placeholder , dragpreview ) ;
BDFDB . toggleEles ( folderdiv , true ) ;
if ( hovele ) {
guildswrap . insertBefore ( folderdiv , hovele . nextSibling ) ;
this . updateFolderPositions ( folderdiv ) ;
}
} ;
document . addEventListener ( "mousemove" , dragging ) ;
document . addEventListener ( "mouseup" , releasing ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
} ;
let mouseup = ( ) => {
document . removeEventListener ( "mousemove" , mousemove ) ;
document . removeEventListener ( "mouseup" , mouseup ) ;
} ;
document . addEventListener ( "mousemove" , mousemove ) ;
document . addEventListener ( "mouseup" , mouseup ) ;
} ) ;
this . addHoverBehaviour ( folderdiv ) ;
BDFDB . saveData ( data . folderID , data , this , "folders" ) ;
this . updateFolderNotifications ( folderdiv ) ;
return folderdiv ;
}
generateID ( prefix ) {
let data = BDFDB . loadAllData ( this , prefix + "s" ) ;
let id = prefix + "_" + Math . round ( Math . random ( ) * 10000000000000000 ) ;
return data [ id ] ? this . generateID ( prefix ) : id ;
}
addServerToFolder ( info , folderdiv ) {
if ( ! info || ! folderdiv ) return ;
let guilddiv = BDFDB . getServerDiv ( info ) ;
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( ! guilddiv || ! data || data . servers . includes ( info . id ) ) return ;
data . servers . push ( info . id ) ;
BDFDB . saveData ( folderdiv . id , data , this , "folders" ) ;
this . hideServer ( guilddiv , folderdiv ) ;
this . updateCopyInFolderContent ( guilddiv , folderdiv ) ;
this . updateFolderNotifications ( folderdiv ) ;
BDFDB . showToast ( this . labels . toast _addserver _text . replace ( "${servername}" , info . name ) . replace ( "${foldername}" , data . folderName ? " " + data . folderName : "" ) , { type : "success" } ) ;
}
removeServerFromFolder ( info , folderdiv ) {
if ( ! info || ! folderdiv ) return ;
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( ! data ) return ;
BDFDB . removeFromArray ( data . servers , info . id ) ;
BDFDB . saveData ( folderdiv . id , data , this , "folders" ) ;
BDFDB . removeEles ( this . foldercontent . querySelectorAll ( ` [guild=" ${ info . id } "] ` ) ) ;
this . unhideServer ( BDFDB . getServerDiv ( info ) ) ;
this . updateFolderNotifications ( folderdiv ) ;
BDFDB . showToast ( this . labels . toast _removeserver _text . replace ( "${servername}" , info . name ) . replace ( "${foldername}" , data . folderName ? " " + data . folderName : "" ) , { type : "danger" } ) ;
}
removeFolder ( folderdiv ) {
if ( ! folderdiv ) return ;
this . readIncludedServerList ( folderdiv ) . forEach ( guilddiv => { this . unhideServer ( guilddiv ) ; } ) ;
BDFDB . removeData ( folderdiv . id , this , "folders" ) ;
this . closeFolderContent ( folderdiv ) ;
folderdiv . remove ( ) ;
this . updateFolderPositions ( ) ;
}
getFolderOfServer ( idOrInfoOrEle ) {
if ( ! idOrInfoOrEle ) return ;
let id = Node . prototype . isPrototypeOf ( idOrInfoOrEle ) ? BDFDB . getServerID ( idOrInfoOrEle ) : ( typeof idOrInfoOrEle == "object" ? idOrInfoOrEle . id : idOrInfoOrEle ) ;
if ( ! id ) return ;
let folders = BDFDB . loadAllData ( this , "folders" ) ;
for ( let folderid in folders ) for ( let serverid of folders [ folderid ] . servers ) if ( serverid == id ) return document . querySelector ( "#" + folderid ) ;
return null ;
}
hideServer ( guilddiv , folderdiv ) {
if ( ! Node . prototype . isPrototypeOf ( guilddiv ) || ! folderdiv ) return ;
guilddiv . setAttribute ( "folder" , folderdiv . id ) ;
BDFDB . toggleEles ( guilddiv , false ) ;
if ( guilddiv . ServerFoldersChangeObserver && typeof guilddiv . ServerFoldersChangeObserver . disconnect == "function" ) guilddiv . ServerFoldersChangeObserver . disconnect ( ) ;
guilddiv . ServerFoldersChangeObserver = new MutationObserver ( ( changes , _ ) => {
changes . forEach (
( change , i ) => {
let updatefolder = false ;
if ( change . type == "attributes" && change . attributeName == "class" && BDFDB . containsClass ( change . target , BDFDB . disCN . guild ) ) updatefolder = true ;
if ( change . type == "characterData" && change . target . parentElement && BDFDB . containsClass ( change . target . parentElement , BDFDB . disCN . badge ) ) updatefolder = true ;
else if ( change . addedNodes . length ) change . addedNodes . forEach ( node => { if ( node . tagName && BDFDB . containsClass ( node , BDFDB . disCN . badge ) ) updatefolder = true ; } ) ;
else if ( change . removedNodes . length ) change . removedNodes . forEach ( node => { if ( node . tagName && BDFDB . containsClass ( node , BDFDB . disCN . badge ) ) updatefolder = true ; } ) ;
this . updateCopyInFolderContent ( guilddiv , folderdiv ) ;
if ( updatefolder ) this . updateFolderNotifications ( folderdiv ) ;
}
) ;
} ) ;
guilddiv . ServerFoldersChangeObserver . observe ( guilddiv , { attributes : true , childList : true , characterData : true , subtree : true } ) ;
}
unhideServer ( guilddiv ) {
if ( ! Node . prototype . isPrototypeOf ( guilddiv ) ) return ;
guilddiv . removeAttribute ( "folder" ) ;
BDFDB . toggleEles ( guilddiv , true ) ;
if ( guilddiv . ServerFoldersChangeObserver && typeof guilddiv . ServerFoldersChangeObserver . disconnect == "function" ) guilddiv . ServerFoldersChangeObserver . disconnect ( ) ;
delete guilddiv . ServerFoldersChangeObserver ;
}
toggleFolderContent ( forceOpenClose ) {
if ( ! this . foldercontent ) return ;
forceOpenClose = forceOpenClose === undefined ? BDFDB . containsClass ( this . foldercontent , "foldercontentclosed" ) : forceOpenClose ;
BDFDB . toggleClass ( this . foldercontent , "foldercontentopen" , forceOpenClose ) ;
BDFDB . toggleClass ( this . foldercontent , "foldercontentclosed" , ! forceOpenClose ) ;
}
openCloseFolder ( folderdiv ) {
if ( ! folderdiv ) return ;
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( ! data ) return ;
let isClosed = ! BDFDB . containsClass ( folderdiv , "open" ) ;
if ( isClosed ) {
let includedServers = this . readIncludedServerList ( folderdiv ) ;
if ( includedServers . length == 0 ) return ;
BDFDB . addClass ( folderdiv , "open" ) ;
BDFDB . removeClass ( folderdiv , "closed" ) ;
this . toggleFolderContent ( true ) ;
let containsguilds = this . foldercontent . querySelectorAll ( BDFDB . dotCN . guild ) . length ;
let settings = BDFDB . getAllData ( this , "settings" ) ;
setTimeout ( ( ) => {
if ( settings . addSeparators && containsguilds ) this . foldercontentguilds . appendChild ( BDFDB . htmlToElement ( ` <div class=" ${ BDFDB . disCN . guildseparator } folderseparator" folder=" ${ folderdiv . id } "></div> ` ) ) ;
includedServers . forEach ( guilddiv => { this . updateCopyInFolderContent ( guilddiv , folderdiv ) ; } ) ;
} , settings . closeOtherFolders && containsguilds ? 300 : 0 ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
else this . closeFolderContent ( folderdiv ) ;
folderdiv . querySelector ( BDFDB . dotCN . avataricon ) . style . setProperty ( "background-image" , ` url( ${ isClosed ? data . icons . openicon : data . icons . closedicon } ) ` ) ;
}
closeFolderContent ( folderdiv ) {
if ( ! folderdiv ) return ;
BDFDB . removeClass ( folderdiv , "open" ) ;
BDFDB . addClass ( folderdiv , "closed" ) ;
let includedCopies = this . foldercontent . querySelectorAll ( ` [folder=" ${ folderdiv . id } "] ` ) ;
for ( let copy of includedCopies ) copy . removeAttribute ( "folder" ) ;
if ( ! this . foldercontent . querySelector ( "[folder]" ) ) {
this . toggleFolderContent ( false ) ;
setTimeout ( ( ) => {
let settings = BDFDB . getAllData ( this , "settings" ) ;
if ( settings . closeOtherFolders ) BDFDB . removeEles ( includedCopies ) ;
else if ( ! settings . closeOtherFolders && ! document . querySelector ( ".folder.open" ) ) BDFDB . removeEles ( includedCopies ) ;
} , 300 ) ;
}
else BDFDB . removeEles ( includedCopies ) ;
let firstchild = this . foldercontentguilds . firstElementChild ;
if ( BDFDB . containsClass ( firstchild , "folderseparator" ) ) BDFDB . removeEles ( firstchild ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
updateCopyInFolderContent ( guilddiv , folderdiv ) {
if ( ! guilddiv || ! folderdiv ) return ;
if ( BDFDB . containsClass ( folderdiv , "open" ) ) {
let info = this . GuildUtils . getGuild ( BDFDB . getServerID ( guilddiv ) ) ;
if ( ! info ) return ;
let oldCopy = this . foldercontent . querySelector ( ` [guild=" ${ info . id } "] ` ) ;
2018-10-11 10:21:26 +02:00
if ( oldCopy ) {
2019-01-26 22:45:19 +01:00
this . foldercontentguilds . insertBefore ( this . createCopyOfServer ( guilddiv , folderdiv ) , oldCopy ) ;
BDFDB . removeEles ( oldCopy ) ;
2018-10-11 10:21:26 +02:00
}
else {
2019-01-26 22:45:19 +01:00
let sameFolderCopies = this . foldercontent . querySelectorAll ( ` [folder=" ${ folderdiv . id } "] ` ) ;
let insertNode = sameFolderCopies . length > 0 ? sameFolderCopies [ sameFolderCopies . length - 1 ] . nextSibling : null ;
this . foldercontentguilds . insertBefore ( this . createCopyOfServer ( guilddiv , folderdiv ) , insertNode ) ;
2018-10-11 10:21:26 +02:00
}
}
}
2019-01-26 22:45:19 +01:00
createCopyOfServer ( guilddiv , folderdiv ) {
if ( ! guilddiv || ! folderdiv ) return ;
let info = this . GuildUtils . getGuild ( BDFDB . getServerID ( guilddiv ) ) ;
if ( ! info ) return ;
let guildcopy = guilddiv . cloneNode ( true ) ;
guildcopy . setAttribute ( "guild" , info . id ) ;
BDFDB . addClass ( guildcopy , "copy" ) ;
BDFDB . toggleEles ( guildcopy , true ) ;
guildcopy . addEventListener ( "mouseenter" , ( ) => {
let folderData = BDFDB . loadData ( folderdiv . id , this , "folders" ) || { } ;
let EditServersData = BDFDB . isPluginEnabled ( "EditServers" ) ? ( BDFDB . loadData ( info . id , "EditServers" , "servers" ) || { } ) : { } ;
let bgColor = BDFDB . colorCONVERT ( EditServersData . color3 || ( folderData . copyTooltipColor ? folderData . color3 : null ) , "RGB" ) ;
let fontColor = BDFDB . colorCONVERT ( EditServersData . color4 || ( folderData . copyTooltipColor ? folderData . color4 : null ) , "RGB" ) ;
BDFDB . createTooltip ( EditServersData . name || info . name , guildcopy , { type : "right" , selector : ( ! BDFDB . isObjectEmpty ( EditServersData ) ? "EditUsers-tooltip" : "" ) , style : ` color: ${ fontColor } !important; background-color: ${ bgColor } !important; border-color: ${ bgColor } !important; ` } ) ;
} ) ;
guildcopy . addEventListener ( "click" , e => {
e . preventDefault ( ) ;
if ( BDFDB . pressedKeys . includes ( 46 ) ) this . removeServerFromFolder ( info , folderdiv ) ;
else {
let settings = BDFDB . getAllData ( this , "settings" ) ;
if ( settings . closeAllFolders ) document . querySelectorAll ( ".folder.open" ) . forEach ( openFolder => { this . openCloseFolder ( openFolder ) ; } ) ;
else if ( settings . closeTheFolder ) this . openCloseFolder ( folderdiv ) ;
guilddiv . querySelector ( "a" ) . click ( ) ;
}
} ) ;
guildcopy . addEventListener ( "contextmenu" , e => {
BDFDB . openGuildContextMenu ( guilddiv , e ) ;
} ) ;
guildcopy . addEventListener ( "mousedown" , e => {
let x = e . pageX , y = e . pageY ;
let mousemove = e2 => {
if ( Math . sqrt ( ( x - e2 . pageX ) * * 2 ) > 20 || Math . sqrt ( ( y - e2 . pageY ) * * 2 ) > 20 ) {
document . removeEventListener ( "mousemove" , mousemove ) ;
document . removeEventListener ( "mouseup" , mouseup ) ;
let hovcopy = null ;
let placeholder = BDFDB . htmlToElement ( ` <div class=" ${ BDFDB . disCNS . guild + BDFDB . disCN . guildplaceholder } copyplaceholder"></div> ` ) ;
let dragpreview = this . createDragPreview ( guilddiv , e ) ;
let dragging = e3 => {
BDFDB . removeEles ( placeholder ) ;
BDFDB . toggleEles ( guildcopy , false ) ;
this . updateDragPreview ( dragpreview , e3 ) ;
if ( this . foldercontent . contains ( e3 . target ) ) {
hovcopy = BDFDB . containsClass ( e3 . target , "folderseparator" ) ? e3 . target : BDFDB . getParentEle ( BDFDB . dotCN . guild + ".copy" , e3 . target ) ;
if ( hovcopy && hovcopy . getAttribute ( "folder" ) == folderdiv . id ) this . foldercontentguilds . insertBefore ( placeholder , hovcopy . nextSibling ) ;
else hovcopy = null ;
}
2018-10-11 10:21:26 +02:00
} ;
2019-01-26 22:45:19 +01:00
let releasing = e3 => {
document . removeEventListener ( "mousemove" , dragging ) ;
document . removeEventListener ( "mouseup" , releasing ) ;
BDFDB . removeEles ( placeholder , dragpreview ) ;
BDFDB . toggleEles ( guildcopy , true ) ;
let dropfolderdiv = BDFDB . getParentEle ( BDFDB . dotCN . guild + ".folder" , e3 . target ) ;
if ( dropfolderdiv && dropfolderdiv != folderdiv ) {
this . removeServerFromFolder ( info , folderdiv ) ;
this . addServerToFolder ( info , dropfolderdiv ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
else if ( hovcopy ) {
this . foldercontentguilds . insertBefore ( guildcopy , hovcopy . nextSibling ) ;
this . updateServerPositions ( folderdiv ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
} ;
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 ) ;
} ) ;
let copyinner = guildcopy . querySelector ( BDFDB . dotCN . guildinner ) ;
let isselected = BDFDB . containsClass ( guildcopy , BDFDB . disCN . guildselected ) ;
let hasicon = ! BDFDB . containsClass ( guildcopy . querySelector ( BDFDB . dotCN . guildicon ) , BDFDB . disCN . avatarnoicon ) ;
guildcopy . querySelector ( "a" ) . setAttribute ( "draggable" , false ) ;
copyinner . style . setProperty ( "border-radius" , isselected ? "15px" : "25px" ) ;
copyinner . style . setProperty ( "background-color" , hasicon ? null : BDFDB . colorCONVERT ( this . DiscordConstants . Colors [ isselected ? "BRAND_PURPLE" : "CHANNELS_GREY" ] , "RGB" ) ) ;
this . addHoverBehaviour ( guildcopy ) ;
return guildcopy ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
createDragPreview ( div , e ) {
if ( ! Node . prototype . isPrototypeOf ( div ) ) return ;
let dragpreview = div . cloneNode ( true ) ;
BDFDB . addClass ( dragpreview , "serverfolders-dragpreview" ) ;
BDFDB . toggleEles ( dragpreview , false ) ;
dragpreview . style . setProperty ( "pointer-events" , "none" , "important" ) ;
dragpreview . style . setProperty ( "left" , e . clientX - 25 + "px" , "important" ) ;
dragpreview . style . setProperty ( "top" , e . clientY - 25 + "px" , "important" ) ;
document . querySelector ( BDFDB . dotCN . appmount ) . appendChild ( dragpreview ) ;
return dragpreview ;
}
updateDragPreview ( dragpreview , e ) {
if ( ! Node . prototype . isPrototypeOf ( dragpreview ) ) return ;
BDFDB . toggleEles ( dragpreview , true ) ;
dragpreview . style . setProperty ( "left" , e . clientX - 25 + "px" , "important" ) ;
dragpreview . style . setProperty ( "top" , e . clientY - 25 + "px" , "important" ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
updateFolderPositions ( ) {
2019-01-26 22:45:19 +01:00
let serverAndFolders = document . querySelectorAll ( ` div ${ BDFDB . dotCN . guildseparator } :not(.folderseparator) ~ div ${ BDFDB . dotCN . guild } ` ) ;
2018-10-11 10:21:26 +02:00
for ( let i = 0 ; i < serverAndFolders . length ; i ++ ) {
2019-01-26 22:45:19 +01:00
let folderdiv = BDFDB . getParentEle ( BDFDB . dotCN . guild + ".folder" , serverAndFolders [ i ] ) ;
if ( folderdiv ) {
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
2018-10-11 10:21:26 +02:00
if ( data ) {
data . position = i ;
2019-01-26 22:45:19 +01:00
BDFDB . saveData ( folderdiv . id , data , this , "folders" ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
}
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
updateServerPositions ( folderdiv ) {
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
if ( data ) {
let servers = Array . from ( this . foldercontent . querySelectorAll ( ` ${ BDFDB . dotCN . guild } .copy[folder=" ${ folderdiv . id } "] ` ) ) . map ( div => { return div . getAttribute ( "guild" ) ; } ) ;
for ( let serverid of servers ) BDFDB . removeFromArray ( data . servers , serverid ) ;
data . servers = BDFDB . removeCopiesFromArray ( servers . concat ( data . servers ) ) ;
BDFDB . saveData ( folderdiv . id , data , this , "folders" ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
updateFolderNotifications ( folderdiv ) {
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
var a = performance . now ( ) ;
if ( ! data ) return ;
let includedServers = this . readIncludedServerList ( folderdiv ) ;
let unreadServers = BDFDB . readUnreadServerList ( includedServers ) ;
2019-02-04 11:22:37 +01:00
if ( unreadServers . length > 0 && data . autounread ) BDFDB . markGuildAsRead ( unreadServers ) ;
2019-01-26 22:45:19 +01:00
else {
let badgeAmount = 0 ;
let audioEnabled = false ;
let videoEnabled = false ;
includedServers . forEach ( div => {
let badge = div . querySelector ( BDFDB . dotCN . badge ) ;
if ( badge ) badgeAmount += parseInt ( badge . innerText ) ;
if ( BDFDB . containsClass ( div , BDFDB . disCN . guildaudio ) ) audioEnabled = true ;
if ( BDFDB . containsClass ( div , BDFDB . disCN . guildvideo ) ) videoEnabled = true ;
} ) ;
BDFDB . toggleClass ( folderdiv , BDFDB . disCN . guildunread , unreadServers . length > 0 ) ;
BDFDB . toggleClass ( folderdiv , BDFDB . disCN . guildaudio , audioEnabled ) ;
BDFDB . toggleClass ( folderdiv , BDFDB . disCN . guildvideo , videoEnabled ) ;
let notifications = folderdiv . querySelector ( ".folder" + BDFDB . dotCN . badge + ".notifications" ) ;
notifications . innerText = badgeAmount ;
BDFDB . toggleEles ( notifications , badgeAmount > 0 ) ;
let amount = folderdiv . querySelector ( ".folder" + BDFDB . dotCN . badge + ".count" ) ;
amount . innerText = includedServers . length ;
BDFDB . toggleEles ( amount , includedServers . length > 0 && BDFDB . getData ( "showCountBadge" , this , "settings" ) ) ;
if ( BDFDB . containsClass ( folderdiv , "open" ) && ! document . querySelector ( ".foldercontent [folder='" + folderdiv . id + "']" ) ) this . openCloseFolder ( folderdiv ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
readIncludedServerList ( folderdiv ) {
let data = BDFDB . loadData ( folderdiv . id , this , "folders" ) ;
let includedServers = [ ] ;
if ( data ) for ( let id of data . servers ) {
let div = BDFDB . getServerDiv ( id ) ;
if ( div && includedServers . indexOf ( div ) == - 1 ) includedServers . push ( div ) ;
2018-10-11 10:21:26 +02:00
}
return includedServers ;
}
2019-01-26 22:45:19 +01:00
addHoverBehaviour ( div ) {
/* based on stuff from Zerebos */
let divinner = div . querySelector ( BDFDB . dotCN . guildinner ) ;
let divicon = div . querySelector ( BDFDB . dotCN . guildicon ) ;
let backgroundColor = new this . Animations . Value ( 0 ) ;
backgroundColor
. interpolate ( {
inputRange : [ 0 , 1 ] ,
outputRange : [ this . DiscordConstants . Colors . CHANNELS _GREY , this . DiscordConstants . Colors . BRAND _PURPLE ]
} )
. addListener ( ( value ) => {
if ( BDFDB . containsClass ( divicon , BDFDB . disCN . avatarnoicon ) ) {
let comp = BDFDB . colorCONVERT ( value . value , "RGBCOMP" ) ;
if ( comp ) divinner . style . setProperty ( "background-color" , ` rgb( ${ comp [ 0 ] } , ${ comp [ 1 ] } , ${ comp [ 2 ] } ) ` ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
} ) ;
let borderRadius = new this . Animations . Value ( 0 ) ;
borderRadius
. interpolate ( {
inputRange : [ 0 , 1 ] ,
outputRange : [ 25 , 15 ]
} )
. addListener ( ( value ) => {
divinner . style . setProperty ( "border-radius" , ` ${ value . value } px ` ) ;
} ) ;
let animate = ( v ) => {
this . Animations . parallel ( [
this . Animations . timing ( backgroundColor , { toValue : v , duration : 200 } ) ,
this . Animations . spring ( borderRadius , { toValue : v , friction : 3 } )
] ) . start ( ) ;
2018-10-11 10:21:26 +02:00
} ;
2019-01-26 22:45:19 +01:00
div . addEventListener ( "mouseenter" , ( ) => { animate ( 1 ) ; } )
div . addEventListener ( "mouseleave" , ( ) => { if ( ! BDFDB . containsClass ( div , BDFDB . disCN . guildselected ) ) animate ( 0 ) ; } ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
getSettingsPanel ( ) {
2019-01-26 22:45:19 +01:00
if ( ! global . BDFDB || typeof BDFDB != "object" || ! BDFDB . loaded || ! this . started ) return ;
let settings = BDFDB . getAllData ( this , "settings" ) ;
let settingshtml = ` <div class=" ${ this . name } -settings DevilBro-settings"><div class=" ${ BDFDB . disCNS . titledefault + BDFDB . disCNS . title + BDFDB . disCNS . size18 + BDFDB . disCNS . height24 + BDFDB . disCNS . weightnormal + BDFDB . disCN . marginbottom8 } "> ${ this . name } </div><div class="DevilBro-settings-inner"> ` ;
2018-10-11 10:21:26 +02:00
for ( let key in settings ) {
2019-01-26 22:45:19 +01:00
settingshtml += ` <div class=" ${ BDFDB . disCNS . flex + BDFDB . disCNS . flex2 + BDFDB . disCNS . horizontal + BDFDB . disCNS . horizontal2 + BDFDB . disCNS . directionrow + BDFDB . disCNS . justifystart + BDFDB . disCNS . aligncenter + BDFDB . disCNS . nowrap + BDFDB . disCN . marginbottom8 } " style="flex: 1 1 auto;"><h3 class=" ${ BDFDB . disCNS . titledefault + BDFDB . disCNS . title + BDFDB . disCNS . marginreset + BDFDB . disCNS . weightmedium + BDFDB . disCNS . size16 + BDFDB . disCNS . height24 + BDFDB . disCN . flexchild } " style="flex: 1 1 auto;"> ${ this . defaults . settings [ key ] . description } </h3><div class=" ${ BDFDB . disCNS . flexchild + BDFDB . disCNS . switchenabled + BDFDB . disCNS . switch + BDFDB . disCNS . switchvalue + BDFDB . disCNS . switchsizedefault + BDFDB . disCNS . switchsize + BDFDB . disCN . switchthemedefault } " style="flex: 0 0 auto;"><input type="checkbox" value="settings ${ key } " class=" ${ BDFDB . disCNS . switchinnerenabled + BDFDB . disCN . switchinner } settings-switch" ${ settings [ key ] ? " checked" : "" } ></div></div> ` ;
2018-10-11 10:21:26 +02:00
}
settingshtml += ` <div class=" ${ BDFDB . disCNS . flex + BDFDB . disCNS . flex2 + BDFDB . disCNS . horizontal + BDFDB . disCNS . horizontal2 + BDFDB . disCNS . directionrow + BDFDB . disCNS . justifystart + BDFDB . disCNS . aligncenter + BDFDB . disCNS . nowrap + BDFDB . disCN . marginbottom8 } " style="flex: 0 0 auto;"><h3 class=" ${ BDFDB . disCNS . titledefault + BDFDB . disCNS . title + BDFDB . disCNS . marginreset + BDFDB . disCNS . weightmedium + BDFDB . disCNS . size16 + BDFDB . disCNS . height24 + BDFDB . disCN . flexchild } " style="flex: 1 1 auto;">Reset all Folders.</h3><button type="button" class=" ${ BDFDB . disCNS . flexchild + BDFDB . disCNS . button + BDFDB . disCNS . buttonlookfilled + BDFDB . disCNS . buttoncolorred + BDFDB . disCNS . buttonsizemedium + BDFDB . disCN . buttongrow } reset-button" style="flex: 0 0 auto;"><div class=" ${ BDFDB . disCN . buttoncontents } ">Reset</div></button></div> ` ;
settingshtml += ` <div class=" ${ BDFDB . disCNS . flex + BDFDB . disCNS . flex2 + BDFDB . disCNS . horizontal + BDFDB . disCNS . horizontal2 + BDFDB . disCNS . directionrow + BDFDB . disCNS . justifystart + BDFDB . disCNS . aligncenter + BDFDB . disCNS . nowrap + BDFDB . disCN . marginbottom8 } " style="flex: 0 0 auto;"><h3 class=" ${ BDFDB . disCNS . titledefault + BDFDB . disCNS . title + BDFDB . disCNS . marginreset + BDFDB . disCNS . weightmedium + BDFDB . disCNS . size16 + BDFDB . disCNS . height24 + BDFDB . disCN . flexchild } " style="flex: 1 1 auto;">Remove all custom Icons.</h3><button type="button" class=" ${ BDFDB . disCNS . flexchild + BDFDB . disCNS . button + BDFDB . disCNS . buttonlookfilled + BDFDB . disCNS . buttoncolorred + BDFDB . disCNS . buttonsizemedium + BDFDB . disCN . buttongrow } removecustom-button" style="flex: 0 0 auto;"><div class=" ${ BDFDB . disCN . buttoncontents } ">Remove</div></button></div> ` ;
2019-01-26 22:45:19 +01:00
settingshtml += ` </div></div> ` ;
let settingspanel = BDFDB . htmlToElement ( settingshtml ) ;
BDFDB . initElements ( settingspanel , this ) ;
BDFDB . addEventListener ( this , settingspanel , "click" , ".reset-button" , ( ) => {
BDFDB . openConfirmModal ( this , "Are you sure you want to delete all folders?" , ( ) => {
BDFDB . removeAllData ( this , "folders" ) ;
this . resetAllElements ( ) ;
} ) ;
} ) ;
BDFDB . addEventListener ( this , settingspanel , "click" , ".removecustom-button" , ( ) => {
BDFDB . openConfirmModal ( this , "Are you sure you want to remove all custom icons?" , ( ) => {
BDFDB . removeAllData ( this , "customicons" ) ;
} ) ;
} ) ;
2018-10-11 10:21:26 +02:00
return settingspanel ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
onSettingsClosed ( ) {
2019-01-26 22:45:19 +01:00
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
this . foldercontent . querySelectorAll ( BDFDB . dotCN . guild + ".folder" ) . forEach ( folderdiv => { this . updateFolderNotifications ( folderdiv ) ; } ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
setLabelsByLanguage ( ) {
switch ( BDFDB . getDiscordLanguage ( ) . id ) {
case "hr" : //croatian
return {
toast _addserver _text : "${servername} je dodan u mapu${foldername}." ,
toast _removeserver _text : "${servername} je uklonjena iz mape${foldername}." ,
servercontext _serverfolders _text : "Poslužitelj mapu" ,
serversubmenu _createfolder _text : "Izradi mapu" ,
serversubmenu _removefromfolder _text : "Ukloni poslužitelj iz mape" ,
foldercontext _unreadfolder _text : "Označi sve kao pročitano" ,
foldercontext _autounreadfolder _text : "Auto: Označite kao pročitano" ,
foldercontext _foldersettings _text : "Postavke map" ,
foldercontext _removefolder _text : "Izbriši mapu" ,
modal _header _text : "Postavke mapa" ,
modal _foldername _text : "Naziv mape" ,
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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Koristite iste boje za poslužitelj u mapi" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Pregled ikona"
2018-10-11 10:21:26 +02:00
} ;
case "da" : //danish
return {
toast _addserver _text : "${servername} er blevet tilføjet til mappe${foldername}." ,
toast _removeserver _text : "${servername} er blevet fjernet fra mappen${foldername}." ,
servercontext _serverfolders _text : "Servermapper" ,
serversubmenu _createfolder _text : "Opret mappe" ,
serversubmenu _removefromfolder _text : "Fjern server fra mappe" ,
foldercontext _unreadfolder _text : "Markér alle som læst" ,
foldercontext _autounreadfolder _text : "Auto: Markér som læst" ,
foldercontext _foldersettings _text : "Mappeindstillinger" ,
foldercontext _removefolder _text : "Slet mappe" ,
modal _header _text : "Mappindstillinger" ,
modal _foldername _text : "Mappenavn" ,
modal _tabheader1 _text : "Mappe" ,
modal _tabheader2 _text : "Mappefarve" ,
modal _tabheader3 _text : "Tooltipfarve" ,
modal _tabheader4 _text : "Brugerdefinerede ikoner" ,
modal _iconpicker _text : "Mappevalg" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Brug de samme farver til server på mappen" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Ikon forhåndsvisning"
2018-10-11 10:21:26 +02:00
} ;
case "de" : //german
return {
toast _addserver _text : "${servername} wurde dem Ordner${foldername} hinzugefügt." ,
toast _removeserver _text : "${servername} wurde aus dem Ordner${foldername} entfernt." ,
servercontext _serverfolders _text : "Serverordner" ,
serversubmenu _createfolder _text : "Ordner erzeugen" ,
serversubmenu _removefromfolder _text : "Server aus Ordner entfernen" ,
foldercontext _unreadfolder _text : "Alle als gelesen markieren" ,
foldercontext _autounreadfolder _text : "Auto: Als gelesen markieren" ,
foldercontext _foldersettings _text : "Ordnereinstellungen" ,
foldercontext _removefolder _text : "Ordner löschen" ,
modal _header _text : "Ordnereinstellungen" ,
modal _foldername _text : "Ordnername" ,
modal _tabheader1 _text : "Ordner" ,
modal _tabheader2 _text : "Ordnerfarbe" ,
modal _tabheader3 _text : "Tooltipfarbe" ,
modal _tabheader4 _text : "Eigene Icons" ,
modal _iconpicker _text : "Ordnerauswahl" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Benutze dieselben Farben für alle Server des Ordners" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Iconvorschau"
2018-10-11 10:21:26 +02:00
} ;
case "es" : //spanish
return {
toast _addserver _text : "${servername} ha sido agregado a la carpeta${foldername}." ,
toast _removeserver _text : "${servername} ha sido eliminado de la carpeta${foldername}." ,
servercontext _serverfolders _text : "Carpetas de servidor" ,
serversubmenu _createfolder _text : "Crear carpeta" ,
serversubmenu _removefromfolder _text : "Eliminar servidor de la carpeta" ,
foldercontext _unreadfolder _text : "Marcar todo como leido" ,
foldercontext _autounreadfolder _text : "Auto: Marcar como leído" ,
foldercontext _foldersettings _text : "Ajustes de carpeta" ,
foldercontext _removefolder _text : "Eliminar carpeta" ,
modal _header _text : "Ajustes de carpeta" ,
modal _foldername _text : "Nombre de la 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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Usa los mismos colores para el servidor de la carpeta" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Vista previa del icono"
2018-10-11 10:21:26 +02:00
} ;
case "fr" : //french
return {
toast _addserver _text : "${servername} a été ajouté au dossier${foldername}." ,
toast _removeserver _text : "${servername} a été supprimé du dossier${foldername}." ,
servercontext _serverfolders _text : "Dossiers du serveur" ,
serversubmenu _createfolder _text : "Créer le dossier" ,
serversubmenu _removefromfolder _text : "Supprimer le serveur du dossier" ,
foldercontext _unreadfolder _text : "Tout marquer comme lu" ,
foldercontext _autounreadfolder _text : "Auto: Marquer comme lu" ,
foldercontext _foldersettings _text : "Paramètres du dossier" ,
foldercontext _removefolder _text : "Supprimer le dossier" ,
modal _header _text : "Paramètres du dossier" ,
modal _foldername _text : "Nom de 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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Utilisez les mêmes couleurs pour le serveur du dossier" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Aperçu de l'icône"
2018-10-11 10:21:26 +02:00
} ;
case "it" : //italian
return {
toast _addserver _text : "${servername} è stato aggiunto alla cartella${foldername}." ,
toast _removeserver _text : "${servername} è stato rimosso dalla cartella${foldername}." ,
servercontext _serverfolders _text : "Cartelle del server" ,
serversubmenu _createfolder _text : "Creare una cartella" ,
serversubmenu _removefromfolder _text : "Rimuovere il server dalla cartella" ,
foldercontext _unreadfolder _text : "Segna tutti come letti" ,
foldercontext _autounreadfolder _text : "Auto: Contrassegna come letto" ,
foldercontext _foldersettings _text : "Impostazioni cartella" ,
foldercontext _removefolder _text : "Elimina cartella" ,
modal _header _text : "Impostazioni cartella" ,
modal _foldername _text : "Nome della 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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Usa gli stessi colori per il server della cartella" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Icona anteprima"
2018-10-11 10:21:26 +02:00
} ;
case "nl" : //dutch
return {
toast _addserver _text : "${servername} is toegevoegd aan de map${foldername}." ,
toast _removeserver _text : "${servername} is verwijderd uit de map${foldername}." ,
servercontext _serverfolders _text : "Servermappen" ,
serversubmenu _createfolder _text : "Map aanmaken" ,
serversubmenu _removefromfolder _text : "Server uit map verwijderen" ,
foldercontext _unreadfolder _text : "Alles als gelezen markeren" ,
foldercontext _autounreadfolder _text : "Auto: Markeren als gelezen" ,
foldercontext _foldersettings _text : "Mapinstellingen" ,
foldercontext _removefolder _text : "Verwijder map" ,
modal _header _text : "Mapinstellingen" ,
modal _foldername _text : "Mapnaam" ,
modal _tabheader1 _text : "Map" ,
modal _tabheader2 _text : "Mapkleur" ,
modal _tabheader3 _text : "Tooltipkleur" ,
modal _tabheader4 _text : "Aangepaste keuze" ,
modal _iconpicker _text : "Map keuze" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Gebruik dezelfde kleuren voor de server van de map" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Voorbeeld van keuze"
2018-10-11 10:21:26 +02:00
} ;
case "no" : //norwegian
return {
toast _addserver _text : "${servername} er lagt til i mappe${foldername}." ,
toast _removeserver _text : "${servername} er fjernet fra mappen${foldername}." ,
servercontext _serverfolders _text : "Servermapper" ,
serversubmenu _createfolder _text : "Lag mappe" ,
serversubmenu _removefromfolder _text : "Fjern server fra mappe" ,
foldercontext _unreadfolder _text : "Marker alle som lest" ,
foldercontext _autounreadfolder _text : "Auto: Merk som les" ,
foldercontext _foldersettings _text : "Mappinnstillinger" ,
foldercontext _removefolder _text : "Slett mappe" ,
modal _header _text : "Mappinnstillinger" ,
modal _foldername _text : "Mappenavn" ,
modal _tabheader1 _text : "Mappe" ,
modal _tabheader2 _text : "Mappefarge" ,
modal _tabheader3 _text : "Tooltipfarge" ,
modal _tabheader4 _text : "Tilpassede ikoner" ,
modal _iconpicker _text : "Mappevalg" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Bruk de samme fargene til serveren til mappen" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Ikon forhåndsvisning"
2018-10-11 10:21:26 +02:00
} ;
case "pl" : //polish
return {
toast _addserver _text : "${servername} został dodany do folderu${foldername}." ,
toast _removeserver _text : "${servername} został usunięty z folderu${foldername}." ,
servercontext _serverfolders _text : "Foldery serwera" ,
serversubmenu _createfolder _text : "Utwórz folder" ,
serversubmenu _removefromfolder _text : "Usuń serwer z folderu" ,
foldercontext _unreadfolder _text : "Oznacz wszystkie jako przeczytane" ,
foldercontext _autounreadfolder _text : "Auto: Oznacz jako przeczytane" ,
foldercontext _foldersettings _text : "Ustawienia folderu" ,
foldercontext _removefolder _text : "Usuń folder" ,
modal _header _text : "Ustawienia folderu" ,
modal _foldername _text : "Nazwa folderu" ,
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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Użyj tych samych kolorów dla serwera folderu" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Podgląd ikony"
2018-10-11 10:21:26 +02:00
} ;
case "pt-BR" : //portuguese (brazil)
return {
toast _addserver _text : "${servername} foi adicionado à pasta${foldername}." ,
toast _removeserver _text : "${servername} foi removido da pasta${foldername}." ,
servercontext _serverfolders _text : "Pastas de servidores" ,
serversubmenu _createfolder _text : "Criar pasta" ,
serversubmenu _removefromfolder _text : "Remover servidor da pasta" ,
foldercontext _unreadfolder _text : "Marcar tudo como lido" ,
foldercontext _autounreadfolder _text : "Auto: Marcar como lido" ,
foldercontext _foldersettings _text : "Configurações da pasta" ,
foldercontext _removefolder _text : "Excluir pasta" ,
modal _header _text : "Configurações da pasta" ,
modal _foldername _text : "Nome da 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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Use as mesmas cores para o servidor da pasta" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Pré-visualização de ícones"
2018-10-11 10:21:26 +02:00
} ;
case "fi" : //finnish
return {
toast _addserver _text : "${servername} on lisätty kansioon${foldername}." ,
toast _removeserver _text : "${servername} on poistettu kansioon${foldername}." ,
servercontext _serverfolders _text : "Palvelinkansiot" ,
serversubmenu _createfolder _text : "Luo kansio" ,
serversubmenu _removefromfolder _text : "Poista palvelin kansioista" ,
foldercontext _unreadfolder _text : "Merkitse kaikki luetuksi" ,
foldercontext _autounreadfolder _text : "Auto: merkitse luettavaksi" ,
foldercontext _foldersettings _text : "Kansion kansio" ,
foldercontext _removefolder _text : "Poista kansio" ,
modal _header _text : "Kansion kansio" ,
modal _foldername _text : "Kansion nimi" ,
modal _tabheader1 _text : "Kansio" ,
modal _tabheader2 _text : "Kansionväri" ,
modal _tabheader3 _text : "Tooltipväri" ,
modal _tabheader4 _text : "Mukautetut kuvakkeet" ,
modal _iconpicker _text : "Kansion valinta" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Käytä samoja värejä kansion palvelimelle" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Kuvakkeen esikatselu"
2018-10-11 10:21:26 +02:00
} ;
case "sv" : //swedish
return {
toast _addserver _text : "${servername} har lagts till i mapp${foldername}." ,
toast _removeserver _text : "${servername} har tagits bort från mappen${foldername}." ,
servercontext _serverfolders _text : "Servermappar" ,
serversubmenu _createfolder _text : "Skapa mapp" ,
serversubmenu _removefromfolder _text : "Ta bort servern från mappen" ,
foldercontext _unreadfolder _text : "Markera allt som läst" ,
foldercontext _autounreadfolder _text : "Auto: Markera som Läs" ,
foldercontext _foldersettings _text : "Mappinställningar" ,
foldercontext _removefolder _text : "Ta bort mapp" ,
modal _header _text : "Mappinställningar" ,
modal _foldername _text : "Mappnamn" ,
modal _tabheader1 _text : "Mapp" ,
modal _tabheader2 _text : "Mappfärg" ,
modal _tabheader3 _text : "Tooltipfärg" ,
modal _tabheader4 _text : "Anpassade ikoner" ,
modal _iconpicker _text : "Mappval" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Använd samma färger för mappen på mappen" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Ikon förhandsvisning"
2018-10-11 10:21:26 +02:00
} ;
case "tr" : //turkish
return {
toast _addserver _text : "${servername} klasörü${foldername} eklendi." ,
toast _removeserver _text : "${servername} klasörü${foldername} kaldı rı ldı " ,
servercontext _serverfolders _text : "Sunucu klasörleri" ,
serversubmenu _createfolder _text : "Klasör oluşturun" ,
serversubmenu _removefromfolder _text : "Sunucuyu klasörden kaldı r" ,
foldercontext _unreadfolder _text : "Tümünü Oku olarak işaretle" ,
foldercontext _autounreadfolder _text : "Oto: Okundu Olarak İşaretle" ,
foldercontext _foldersettings _text : "Klasör Ayarları " ,
foldercontext _removefolder _text : "Klasörü sil" ,
modal _header _text : "Klasör Ayarları " ,
modal _foldername _text : "Klasör adı " ,
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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Klasörün sunucusu için aynı renkleri kullanı n" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Simge önizleme"
2018-10-11 10:21:26 +02:00
} ;
case "cs" : //czech
return {
toast _addserver _text : "${servername} byl přidán do složky${foldername}." ,
toast _removeserver _text : "${servername} byl odstraněn ze složky${foldername}." ,
servercontext _serverfolders _text : "Složky serveru" ,
serversubmenu _createfolder _text : "Vytvořit složky" ,
serversubmenu _removefromfolder _text : "Odstranit server ze složky" ,
foldercontext _unreadfolder _text : "Označit vše jako přečtené" ,
foldercontext _autounreadfolder _text : "Auto: Označit jako přečtené" ,
foldercontext _foldersettings _text : "Nastavení složky" ,
foldercontext _removefolder _text : "Smazat složky" ,
modal _header _text : "Nastavení složky" ,
modal _foldername _text : "Název 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" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Použijte stejné barvy pro server složky" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Náhled ikony"
2018-10-11 10:21:26 +02:00
} ;
case "bg" : //bulgarian
return {
toast _addserver _text : "${servername} е добавен към папката${foldername}." ,
toast _removeserver _text : "${servername} е премахнат от папката${foldername}." ,
servercontext _serverfolders _text : "Сървърни папки" ,
serversubmenu _createfolder _text : "Създай папка" ,
serversubmenu _removefromfolder _text : "Премахване на сървър от папка" ,
foldercontext _unreadfolder _text : "Маркирай всички като прочетени" ,
foldercontext _autounreadfolder _text : "Авто: Маркиране като четене" ,
foldercontext _foldersettings _text : "Настройки папка" ,
foldercontext _removefolder _text : "Изтриване на папка" ,
modal _header _text : "Настройки папка" ,
modal _foldername _text : "Име на папка" ,
modal _tabheader1 _text : "Папка" ,
modal _tabheader2 _text : "Цвят на папка" ,
modal _tabheader3 _text : "Цвят на подсказка" ,
modal _tabheader4 _text : "Персонализирани икони" ,
modal _iconpicker _text : "Избор на папки" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Използвайте същите цветове за сървъра на папката" ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "Цвят основнен на папка" ,
modal _colorpicker2 _text : "цвят вторичен на папка" ,
modal _colorpicker3 _text : "Цвят на подсказка" ,
modal _colorpicker4 _text : "Цвят на шрифта" ,
modal _customopen _text : "Отворена икона" ,
modal _customclosed _text : "Затворена икона" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Икона Преглед"
2018-10-11 10:21:26 +02:00
} ;
case "ru" : //russian
return {
toast _addserver _text : "${servername} добавлен в папку${foldername}." ,
toast _removeserver _text : "${servername} был удален из папки${foldername}." ,
servercontext _serverfolders _text : "Папки сервера" ,
serversubmenu _createfolder _text : "Создать папки" ,
serversubmenu _removefromfolder _text : "Удаление сервера из папки" ,
foldercontext _unreadfolder _text : "Отметить все как прочитанное" ,
foldercontext _autounreadfolder _text : "Авто: Отметить как прочитанное" ,
foldercontext _foldersettings _text : "Настройки папки" ,
foldercontext _removefolder _text : "Удалить папки" ,
modal _header _text : "Настройки папки" ,
modal _foldername _text : "Имя папки" ,
modal _tabheader1 _text : "Папка" ,
modal _tabheader2 _text : "Цвет папки" ,
modal _tabheader3 _text : "Цвет подсказка" ,
modal _tabheader4 _text : "Пользовательские значки" ,
modal _iconpicker _text : "Выбор папки" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Используйте те же цвета для сервера папки" ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "Цвет основной папки" ,
modal _colorpicker2 _text : "Цвет вторичной папки" ,
modal _colorpicker3 _text : "Цвет подсказка" ,
modal _colorpicker4 _text : "Цвет шрифта" ,
modal _customopen _text : "Открытая иконка" ,
modal _customclosed _text : "Закрытая иконка" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Иконка Просмотр"
2018-10-11 10:21:26 +02:00
} ;
case "uk" : //ukrainian
return {
toast _addserver _text : "${servername} було додано до папки${foldername}." ,
toast _removeserver _text : "${servername} був вилучений з папки${foldername}." ,
servercontext _serverfolders _text : "Папки сервера" ,
serversubmenu _createfolder _text : "Створити папки" ,
serversubmenu _removefromfolder _text : "Видалити сервер із папки" ,
foldercontext _unreadfolder _text : "Позначити як прочитане" ,
foldercontext _autounreadfolder _text : "Авто: Позначити як прочитане" ,
foldercontext _foldersettings _text : "Параметри папки" ,
foldercontext _removefolder _text : "Видалити папки" ,
modal _header _text : "Параметри папки" ,
modal _foldername _text : "Ім'я папки" ,
modal _tabheader1 _text : "Папки" ,
modal _tabheader2 _text : "Колір папки" ,
modal _tabheader3 _text : "Колір підказка" ,
modal _tabheader4 _text : "Користувальницькі іконки" ,
modal _iconpicker _text : "Вибір папки" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Використовуйте ті ж кольори для сервера папки" ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "Колір основної папки" ,
modal _colorpicker2 _text : "Колір вторинного папки" ,
modal _colorpicker3 _text : "Колір підказка" ,
modal _colorpicker4 _text : "Колір шрифту" ,
modal _customopen _text : "Відкрита ікона" ,
modal _customclosed _text : "Закрита ікона" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Піктограма попереднього перегляду"
2018-10-11 10:21:26 +02:00
} ;
case "ja" : //japanese
return {
toast _addserver _text : "${servername} がフォルダ${foldername} に追加されました。" ,
toast _removeserver _text : "${servername} がフォルダ${foldername} から削除されました。" ,
servercontext _serverfolders _text : "サーバーフォルダ" ,
serversubmenu _createfolder _text : "フォルダーを作る" ,
serversubmenu _removefromfolder _text : "フォルダからサーバーを削除する" ,
foldercontext _unreadfolder _text : "すべてを読むようにマークする" ,
foldercontext _autounreadfolder _text : "自動: 読み取りとしてマークする" ,
foldercontext _foldersettings _text : "フォルダ設定" ,
foldercontext _removefolder _text : "フォルダを削除する" ,
modal _header _text : "フォルダ設定" ,
modal _foldername _text : "フォルダ名" ,
modal _tabheader1 _text : "フォルダ" ,
modal _tabheader2 _text : "フォルダの色" ,
modal _tabheader3 _text : "ツールチップの色" ,
modal _tabheader4 _text : "カスタムアイコン" ,
modal _iconpicker _text : "フォルダの選択" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "フォルダのサーバーに同じ色を使う" ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "プライマリフォルダの色" ,
modal _colorpicker2 _text : "セカンダリフォルダの色" ,
modal _colorpicker3 _text : "ツールチップの色" ,
modal _colorpicker4 _text : "フォントの色" ,
modal _customopen _text : "開いたアイコン" ,
modal _customclosed _text : "クローズドアイコン" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "アイコンのプレビュー"
2018-10-11 10:21:26 +02:00
} ;
case "zh-TW" : //chinese (traditional)
return {
toast _addserver _text : "${servername} 已被添加到文件夾${foldername}." ,
toast _removeserver _text : "${servername} 已從文件夾${foldername} 中刪除." ,
servercontext _serverfolders _text : "服務器文件夾" ,
serversubmenu _createfolder _text : "創建文件夾" ,
serversubmenu _removefromfolder _text : "從服務器中刪除服務器" ,
foldercontext _unreadfolder _text : "標記為已讀" ,
foldercontext _autounreadfolder _text : "自動: 標記為已讀" ,
foldercontext _foldersettings _text : "文件夾設置" ,
foldercontext _removefolder _text : "刪除文件夾" ,
modal _header _text : "文件夾設置" ,
modal _foldername _text : "文件夾名稱" ,
modal _tabheader1 _text : "夾" ,
modal _tabheader2 _text : "文件夾顏色" ,
modal _tabheader3 _text : "工具提示顏色" ,
modal _tabheader4 _text : "自定義圖標" ,
modal _iconpicker _text : "文件夾選擇" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "對文件夾的服務器使用相同的顏色" ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "主文件夾顏色" ,
modal _colorpicker2 _text : "輔助文件夾顏色" ,
modal _colorpicker3 _text : "工具提示顏色" ,
modal _colorpicker4 _text : "字體顏色" ,
modal _customopen _text : "打開的圖標" ,
modal _customclosed _text : "封閉的圖標" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "圖標預覽"
2018-10-11 10:21:26 +02:00
} ;
case "ko" : //korean
return {
toast _addserver _text : "${servername} 가 폴더${foldername} 에 추가되었습니다." ,
toast _removeserver _text : "${servername} 가 폴더${foldername} 에서 제거되었습니다." ,
servercontext _serverfolders _text : "서버 폴더" ,
serversubmenu _createfolder _text : "폴더 만들기" ,
serversubmenu _removefromfolder _text : "폴더에서 서버 제거" ,
foldercontext _unreadfolder _text : "모두 읽은 상태로 표시" ,
foldercontext _autounreadfolder _text : "자동: 읽은 상태로 표시" ,
foldercontext _foldersettings _text : "폴더 설정" ,
foldercontext _removefolder _text : "폴더 삭제" ,
modal _header _text : "폴더 설정" ,
modal _foldername _text : "폴더 이름" ,
modal _tabheader1 _text : "폴더" ,
modal _tabheader2 _text : "폴더 색" ,
modal _tabheader3 _text : "툴팁 색깔" ,
modal _tabheader4 _text : "사용자 정의 아이콘" ,
modal _iconpicker _text : "폴더 선택" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "폴더의 서버에 대해 동일한 색상을 사용하십시오." ,
2018-10-11 10:21:26 +02:00
modal _colorpicker1 _text : "기본 폴더 색" ,
modal _colorpicker2 _text : "보조 폴더 색" ,
modal _colorpicker3 _text : "툴팁 색깔" ,
modal _colorpicker4 _text : "글꼴 색깔" ,
modal _customopen _text : "열린 아이콘" ,
modal _customclosed _text : "닫힌 아이콘" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "아이콘 미리보기"
2018-10-11 10:21:26 +02:00
} ;
default : //default: english
return {
toast _addserver _text : "${servername} has been added to the folder${foldername}." ,
toast _removeserver _text : "${servername} has been removed from the folder${foldername}." ,
servercontext _serverfolders _text : "Serverfolders" ,
serversubmenu _createfolder _text : "Create Folder" ,
serversubmenu _removefromfolder _text : "Remove Server From Folder" ,
foldercontext _unreadfolder _text : "Mark All As Read" ,
foldercontext _autounreadfolder _text : "Auto: Mark As Read" ,
foldercontext _foldersettings _text : "Foldersettings" ,
foldercontext _removefolder _text : "Delete Folder" ,
modal _header _text : "Foldersettings" ,
modal _foldername _text : "Foldername" ,
modal _tabheader1 _text : "Folder" ,
modal _tabheader2 _text : "Foldercolor" ,
modal _tabheader3 _text : "Tooltipcolor" ,
modal _tabheader4 _text : "Custom Icons" ,
modal _iconpicker _text : "Folderchoice" ,
2019-01-26 22:45:19 +01:00
modal _copytooltipcolor _text : "Use same Colors for Servers of the Folder" ,
2018-10-11 10:21:26 +02:00
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" ,
2019-01-26 22:45:19 +01:00
modal _custompreview _text : "Iconpreview"
2018-10-11 10:21:26 +02:00
} ;
}
}
}
} ;