Update ServerFolders.plugin.js

This commit is contained in:
Mirco Wittrien 2019-11-28 11:26:27 +01:00
parent dea870ccf3
commit 7bcbcf081c
1 changed files with 16 additions and 44 deletions

View File

@ -3,7 +3,7 @@
class ServerFolders {
getName () {return "ServerFolders";}
getVersion () {return "6.6.0";}
getVersion () {return "6.6.2";}
getAuthor () {return "DevilBro";}
@ -66,22 +66,10 @@ class ServerFolders {
top: -10px;
right: -10px;
}
${BDFDB.dotCN.guildfolder}[style*="background-image"] {
background-color: transparent !important;
background-position: center !important;
background-size: cover !important;
background-repeat: no-repeat !important;
transiton: unset !important;
}
${BDFDB.dotCN.guildfolder}[style*="background-image"] ${BDFDB.dotCN.guildfoldericonwrapper},
${BDFDB.dotCN.guildfolderexpandendbackground},
${BDFDB.dotCN.guildfolderexpandedguilds} {
display: none !important;
}
${BDFDB.dotCN.guildupperbadge}.count {
left: 0px;
right: unset;
}
${BDFDB.dotCN._serverfoldersdragpreview} {
pointer-events: none !important;
position: absolute !important;
@ -107,20 +95,6 @@ class ServerFolders {
width: 100% !important;
}`;
this.dragPlaceholderMarkup =
`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguild} foldercopyplaceholder">
<div class="${BDFDB.disCNS.guildpillwrapper + BDFDB.disCN.guildpill}">
<span class="${BDFDB.disCN.guildpillitem}"></span>
</div>
<div tabindex="0" class="${BDFDB.disCNS.guildcontainer + BDFDB.disCN.guildinner}" role="button">
<svg width="48" height="48" viewBox="0 0 48 48" class="${BDFDB.disCN.guildplaceholdermask}">
<foreignObject mask="url(#svg-mask-squircle)" x="0" y="0" width="48" height="48">
<div class="${BDFDB.disCN.guildplaceholder}"></div>
</foreignObject>
</svg>
</div>
</div>`;
this.folderIcons = [
{openicon:`<path d="M 200,390 H 955 L 795,770 H 200 Z" fill="REPLACE_FILL2"/><path d="M 176.6,811 C 163.9,811 155.1,802.6 155,784.7 V 212.9 C 157.9,190.5 169,179.8 195.9,176 h 246 c 20.3,3.2 34.5,18.7 41,28.6 C 494.9,228.3 492.9,240.4 494,266 l 313.6,1.3 c 17.6,0.4 23.3,3.7 23.3,3.7 8.6,4.2 14.8,10.7 19,19.5 C 856.3,319.5 854,360 854,360 h 108.9 c 4.4,2.4 13.7,1.2 11.8,23.5 L 815.8,789.4 c -2.1,5.2 -12.5,13.6 -18.7,16.1 -6.8,2.7 -18.5,5.5 -23.9,5.5 z M 767,759 897,430 H 360 L 230,759 Z" fill="REPLACE_FILL1"/>`,
closedicon:`<path d="M 175,320 V 790 H 820 V 320 Z" fill="REPLACE_FILL2"/><path d="M 183,811 c -12.2,-0.6 -17.9,-4.8 -21.5,-8.2 C 159.5,801 154.8,792.6 155,779.7 V 215.6 c 3.3,-14.1 9.3,-21.4 15.1,-26.4 7.4,-6.3 16,-11.6 36.7,-13.2 h 237.3 c 23.3,6 32.2,18.7 38.7,28.6 7.6,11.7 9.4,18.6 10.3,41.4 L 494,266 h 313.4 c 16.9,0.1 23.5,5.1 23.5,5.1 8.6,4.2 14.5,10.9 19,19.5 0,0 3.7,7.5 3.1,19.8 V 777.2 c -1.1,9 -4.1,13.7 -4.1,13.7 -4.2,8.6 -10.7,14.8 -19.5,19 L 823.3,811 Z m 602.8,-55 c 2.8,-1.7 6.9,-4.5 8.9,-7.4 2.4,-3.6 5,-10.8 5.4,-24.7 V 362 c -0.2,-10.9 -4.2,-16.3 -4.2,-16.3 -2,-3 -5.9,-6.8 -8.7,-8.6 0,0 -5.8,-3 -12.7,-3.2 h -548.1 c -7.8,0 -13.9,3.6 -13.9,3.6 -3,2 -7.3,6.7 -8.4,17.3 v 386.4 c 2.8,10.4 7.5,16 13.6,17.7 h 544.9 c 11,-0.2 18.4,-1.9 23.3,-3 z" fill="REPLACE_FILL1"/>`},
@ -161,12 +135,17 @@ class ServerFolders {
theme: BDFDB.LibraryComponents.ScrollerVertical.Themes.GHOST_HAIRLINE,
children: this.props.folders.map(folderId => {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderId);
let data = plugin.getFolderConfig(folderId);
return folder.guildIds.map(guildId => {
return [
this.draggedGuild == guildId ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Guild, {
guild: BDFDB.LibraryModules.GuildStore.getGuild(guildId),
state: true,
list: true,
tooltipConfig: data.copyTooltipColor && {
backgroundColor: data.color3,
fontColor: data.color4
},
onClick: event => {
if (BDFDB.InternalData.pressedKeys.includes(46)) {
BDFDB.ListenerUtils.stopEvent(event);
@ -620,23 +599,16 @@ class ServerFolders {
}
this.folderStates[e.instance.props.folderId] = state;
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "ListItemTooltip"});
if (index > -1) {
let isgradient3 = data.color3 && BDFDB.ObjectUtils.is(data.color3);
let isgradient4 = data.color4 && BDFDB.ObjectUtils.is(data.color4);
let bgColor = data.color3 ? (!isgradient3 ? BDFDB.ColorUtils.convert(data.color3, "RGBA") : BDFDB.ColorUtils.createGradient(data.color3)) : "";
let fontColor = data.color4 ? (!isgradient4 ? BDFDB.ColorUtils.convert(data.color4, "RGBA") : BDFDB.ColorUtils.createGradient(data.color4)) : "";
let folderName = e.instance.props.folderName || BDFDB.FolderUtils.getDefaultName(e.instance.props.folderId);
children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.StringUtils.htmlEscape(folderName)}</span>` : folderName,
tooltipConfig: {
type: "right",
list: true,
html: isgradient4,
style: `${isgradient4 ? '' : `color: ${fontColor} !important; `}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(data.color3[0], "RGBA") : bgColor} !important;`
},
children: children[index].props.children
});
}
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: e.instance.props.folderName || BDFDB.FolderUtils.getDefaultName(e.instance.props.folderId),
tooltipConfig: {
type: "right",
list: true,
backgroundColor: data.color3,
fontColor: data.color4
},
children: children[index].props.children
});
if (e.instance.props.expanded || data.useCloseIcon) {
let folderIcons = this.loadAllIcons(), icontype = e.instance.props.expanded ? "openicon" : "closedicon";
let icon = folderIcons[data.iconID] ? (!folderIcons[data.iconID].customID ? this.createBase64SVG(folderIcons[data.iconID][icontype], data.color1, data.color2) : folderIcons[data.iconID][icontype]) : null;