stuff
This commit is contained in:
parent
afb7a48ee6
commit
c1b8488635
File diff suppressed because one or more lines are too long
|
@ -1815,7 +1815,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
if (Node.prototype.isPrototypeOf(eleOrInfoOrId)) return BDFDB.getParentEle(BDFDB.dotCN.guildouter, eleOrInfoOrId);
|
||||
else {
|
||||
let id = typeof eleOrInfoOrId == 'object' ? eleOrInfoOrId.id : eleOrInfoOrId;
|
||||
if (id) return BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(`${BDFDB.dotCNS.guilds + BDFDB.dotCN.guildiconwrapper}[href*="/channels/${id}"]`)) || BDFDB.createServerDivCopy(id);
|
||||
if (id) return BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(`${BDFDB.dotCNS.guilds + BDFDB.dotCN.guildiconwrapper}[href*="/channels/${id}"]`)) || BDFDB.createServerDivCopy(id, {pill: true, hover: true, click: true, menu: true});
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
@ -1828,15 +1828,15 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
return null;
|
||||
};
|
||||
|
||||
BDFDB.createServerDivCopy = function (infoOrId, functionality = {pill: false, hover: false, click:false, menu:false}) {
|
||||
BDFDB.createServerDivCopy = function (infoOrId, functionality = {pill: false, hover: false, click:false, menu:false, size:null}) {
|
||||
let id = typeof infoOrId == 'object' ? infoOrId.id : infoOrId;
|
||||
let guild = id ? LibraryModules.GuildStore.getGuild(id) : null;
|
||||
if (guild) {
|
||||
let randomid = Math.round(Math.random() * 10000000000000000);
|
||||
let div = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguild}" style="border-radius: 50%; overflow: hidden;"><div class="${BDFDB.disCNS.guildpill + BDFDB.disCN.guildpillwrapper}"><span class="${BDFDB.disCN.guildpillitem}" style="opacity: 0; height: 8px; transform: translate3d(0px, 0px, 0px);"></span></div><div class="${BDFDB.disCN.guildcontainer}" draggable="false"><div class="${BDFDB.disCN.guildinner}"><svg width="48" height="48" viewBox="0 0 48 48" class="${BDFDB.disCN.guildsvg}"><mask id="" fill="black" x="0" y="0" width="48" height="48"><path d="M48 24C48 37.2548 37.2548 48 24 48C10.7452 48 0 37.2548 0 24C0 10.7452 10.7452 0 24 0C37.2548 0 48 10.7452 48 24Z" fill="white"></path><rect x="28" y="-4" width="24" height="24" rx="12" ry="12" transform="translate(20 -20)" fill="black"></rect><rect x="28" y="28" width="24" height="24" rx="12" ry="12" transform="translate(20 20)" fill="black"></rect></mask><foreignObject mask="" x="0" y="0" width="48" height="48"><a class="${BDFDB.disCN.guildiconwrapper}" aria-label="${guild.name}" draggable="false">${guild.icon ? `<img class="${BDFDB.disCN.guildicon}" src="${BDFDB.getGuildIcon(guild.id)}?size=128" alt="" width="48" height="48" draggable="false" aria-hidden="true"></img>` : `<div class="${BDFDB.disCN.guildiconacronym}" aria-hidden="true" style="font-size: ${guild.acronym.length > 5 ? 10 : (guild.acronym.length > 4 ? 12 : (guild.acronym.length > 3 ? 14 : (guild.acronym.length > 1 ? 16 : 18)))}px;">${guild.acronym}</div>`}</a></foreignObject></svg><div class="${BDFDB.disCN.guildbadgewrapper}"></div></div></div><div class="${BDFDB.disCN.guildedgewrapper}" aria-hidden="true"><span class="${BDFDB.disCN.guildedge}"></span><span class="${BDFDB.disCN.guildedgemiddle}"></span><span class="${BDFDB.disCN.guildedge}"></span></div></div>`);
|
||||
let div = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguild}"><div class="${BDFDB.disCNS.guildpill + BDFDB.disCN.guildpillwrapper}"><span class="${BDFDB.disCN.guildpillitem}" style="opacity: 0; height: 8px; transform: translate3d(0px, 0px, 0px);"></span></div><div class="${BDFDB.disCN.guildcontainer}" draggable="false" style="border-radius: 50%; overflow: hidden;"><div class="${BDFDB.disCN.guildinner}"><svg width="48" height="48" viewBox="0 0 48 48" class="${BDFDB.disCN.guildsvg}"><mask id="" fill="black" x="0" y="0" width="48" height="48"><path d="M48 24C48 37.2548 37.2548 48 24 48C10.7452 48 0 37.2548 0 24C0 10.7452 10.7452 0 24 0C37.2548 0 48 10.7452 48 24Z" fill="white"></path><rect x="28" y="-4" width="24" height="24" rx="12" ry="12" transform="translate(20 -20)" fill="black"></rect><rect x="28" y="28" width="24" height="24" rx="12" ry="12" transform="translate(20 20)" fill="black"></rect></mask><foreignObject mask="" x="0" y="0" width="48" height="48"><a class="${BDFDB.disCN.guildiconwrapper}" aria-label="${guild.name}"${functionality.click ? ' href="channels/"' + guild.id + '/' + LibraryModules.LastChannelStore.getChannelId(guild.id) + '"' : ''} draggable="false">${guild.icon ? `<img class="${BDFDB.disCN.guildicon}" src="${BDFDB.getGuildIcon(guild.id)}?size=128" alt="" width="48" height="48" draggable="false" aria-hidden="true"></img>` : `<div class="${BDFDB.disCN.guildiconacronym}" aria-hidden="true" style="font-size: ${guild.acronym.length > 5 ? 10 : (guild.acronym.length > 4 ? 12 : (guild.acronym.length > 3 ? 14 : (guild.acronym.length > 1 ? 16 : 18)))}px;">${guild.acronym}</div>`}</a></foreignObject></svg><div class="${BDFDB.disCN.guildbadgewrapper}"></div></div></div><div class="${BDFDB.disCN.guildedgewrapper}" aria-hidden="true"><span class="${BDFDB.disCN.guildedge}"></span><span class="${BDFDB.disCN.guildedgemiddle}"></span><span class="${BDFDB.disCN.guildedge}"></span></div></div>`);
|
||||
let divinner = div.querySelector(BDFDB.dotCN.guildcontainer);
|
||||
BDFDB.toggleEles(div.querySelector(BDFDB.dotCN.guildpillwrapper), functionality.pill);
|
||||
if (functionality.hover) {
|
||||
let divinner = div.querySelector(BDFDB.dotCN.guildcontainer);
|
||||
let diviconwrapper = div.querySelector(BDFDB.dotCN.guildiconwrapper);
|
||||
let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem);
|
||||
|
||||
|
@ -1845,7 +1845,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
let borderRadius = new LibraryModules.Animations.Value(0);
|
||||
borderRadius
|
||||
.interpolate({inputRange: [0, 1], outputRange: [50, 30]})
|
||||
.addListener((value) => {diviconwrapper.style.setProperty("border-radius", `${value.value}%`);});
|
||||
.addListener((value) => {divinner.style.setProperty("border-radius", `${value.value}%`);});
|
||||
|
||||
let pillHeight = new LibraryModules.Animations.Value(0);
|
||||
pillHeight
|
||||
|
@ -1884,12 +1884,38 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
}
|
||||
});
|
||||
}
|
||||
if (functionality.click) div.addEventListener("click", e => {LibraryModules.GuildUtils.transitionToGuildSync(guild.id);});
|
||||
if (functionality.menu) div.addEventListener("contextmenu", e => {BDFDB.openGuildContextMenu(guild.id, e);});
|
||||
if (functionality.click) divinner.addEventListener("click", e => {
|
||||
BDFDB.stopEvent(e);
|
||||
LibraryModules.GuildUtils.transitionToGuildSync(guild.id);
|
||||
if (typeof functionality.click == "function") functionality.click();
|
||||
});
|
||||
if (functionality.menu) divinner.addEventListener("contextmenu", e => {
|
||||
BDFDB.openGuildContextMenu(guild.id, e);
|
||||
if (typeof functionality.menu == "function") functionality.menu();
|
||||
});
|
||||
if (functionality.size) {
|
||||
div.style.setProperty("margin", "0", "important");
|
||||
div.style.setProperty("width", functionality.size + "px", "important");
|
||||
div.style.setProperty("height", functionality.size + "px", "important");
|
||||
}
|
||||
return div;
|
||||
}
|
||||
else return null;
|
||||
};
|
||||
|
||||
BDFDB.openGuildContextMenu = function (eleOrInfoOrId, e = BDFDB.mousePosition) {
|
||||
let id = Node.prototype.isPrototypeOf(eleOrInfoOrId) ? BDFDB.getServerID(eleOrInfoOrId) : typeof eleOrInfoOrId == 'object' ? eleOrInfoOrId.id : eleOrInfoOrId;
|
||||
let guild = LibraryModules.GuildStore.getGuild(id);
|
||||
if (guild) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
|
||||
return BDFDB.React.createElement(BDFDB.WebModules.findByName("GuildContextMenu"), Object.assign({}, e, {
|
||||
type: LibraryModules.DiscordConstants.ContextMenuTypes.GUILD_ICON_BAR,
|
||||
guild: guild,
|
||||
badge: LibraryModules.MentionUtils.getMentionCount(guild.id),
|
||||
link: LibraryModules.DiscordConstants.Routes.CHANNEL(guild.id, LibraryModules.LastChannelStore.getChannelId(guild.id)),
|
||||
selected: guild.id == LibraryModules.LastGuildStore.getGuildId()
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
BDFDB.readChannelList = function () {
|
||||
var found = [], ins = BDFDB.getOwnerInstance({node:document.querySelector(BDFDB.dotCN.channels), name:['ChannelCategoryItem', 'ChannelItem', 'PrivateChannel'], all:true, noCopies:true, depth:99999999, time:99999999});
|
||||
|
@ -3034,20 +3060,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
hint.style.setProperty('max-width', '32px', 'important');
|
||||
}
|
||||
};
|
||||
|
||||
BDFDB.openGuildContextMenu = function (eleOrInfoOrId, e = BDFDB.mousePosition) {
|
||||
let id = Node.prototype.isPrototypeOf(eleOrInfoOrId) ? BDFDB.getServerID(eleOrInfoOrId) : typeof eleOrInfoOrId == 'object' ? eleOrInfoOrId.id : eleOrInfoOrId;
|
||||
let guild = LibraryModules.GuildStore.getGuild(id);
|
||||
if (guild) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
|
||||
return BDFDB.React.createElement(BDFDB.WebModules.findByName("GuildContextMenu"), Object.assign({}, e, {
|
||||
type: LibraryModules.DiscordConstants.ContextMenuTypes.GUILD_ICON_BAR,
|
||||
guild: guild,
|
||||
badge: LibraryModules.MentionUtils.getMentionCount(guild.id),
|
||||
link: LibraryModules.DiscordConstants.Routes.CHANNEL(guild.id, LibraryModules.LastChannelStore.getChannelId(guild.id)),
|
||||
selected: guild.id == LibraryModules.LastGuildStore.getGuildId()
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
BDFDB.createMessageOptionPopout = function (button) {
|
||||
if (!button) return;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class EmojiStatistics {
|
||||
getName () {return "EmojiStatistics";}
|
||||
|
||||
getVersion () {return "2.8.3";}
|
||||
getVersion () {return "2.8.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,8 +11,7 @@ class EmojiStatistics {
|
|||
|
||||
initConstructor () {
|
||||
this.changelog = {
|
||||
"added":[["Total Amounts","Added the total amount in the header title for each category"]],
|
||||
"fixed":[["Reload","Fixed the issue where clicking a sever in the statistics modal would reload Discord"]]
|
||||
"fixed":[["Context Menu & Tooltips","fixed"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -333,7 +332,7 @@ class EmojiStatistics {
|
|||
}
|
||||
}
|
||||
var emojiEntry = BDFDB.htmlToElement(this.emojiserverEntryMarkup);
|
||||
emojiEntry.querySelector(".modal-emojiserver-icon").appendChild(this.createCopyOfServer(info));
|
||||
emojiEntry.querySelector(".modal-emojiserver-icon").appendChild(BDFDB.createServerDivCopy(info, {click: () => {BDFDB.removeEles(emojiInformationModal);}, menu: true, size: 48}));
|
||||
emojiEntry.querySelector(".modal-emojiname-label").innerText = info.name || "";
|
||||
emojiEntry.querySelector(".modal-emojitotal-label").innerText = amountGlobal + amountLocal;
|
||||
emojiEntry.querySelector(".modal-emojiglobal-label").innerText = amountGlobal;
|
||||
|
@ -368,24 +367,6 @@ class EmojiStatistics {
|
|||
}
|
||||
}
|
||||
|
||||
createCopyOfServer (info) {
|
||||
let serverCopy = info.div.cloneNode(true);
|
||||
BDFDB.removeEles(serverCopy.querySelectorAll(BDFDB.dotCNC.guildpill + BDFDB.dotCNC.guildbadgewrapper + "mask"));
|
||||
serverCopy.style.setProperty("margin", "0");
|
||||
serverCopy.style.setProperty("width", "48px");
|
||||
serverCopy.style.setProperty("height", "48px");
|
||||
serverCopy.style.setProperty("overflow", "hidden");
|
||||
serverCopy.style.setProperty("border-radius", "50%");
|
||||
serverCopy.querySelector("foreignObject").removeAttribute("mask");
|
||||
BDFDB.toggleEles(serverCopy, true);
|
||||
serverCopy.addEventListener("click", e => {
|
||||
BDFDB.stopEvent(e);
|
||||
info.div.querySelector("a").click();
|
||||
});
|
||||
serverCopy.addEventListener("contextmenu", e => {BDFDB.openGuildContextMenu(info.div, e);});
|
||||
return serverCopy;
|
||||
}
|
||||
|
||||
setLabelsByLanguage () {
|
||||
switch (BDFDB.getDiscordLanguage().id) {
|
||||
case "hr": //croatian
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ServerHider {
|
||||
getName () {return "ServerHider";}
|
||||
|
||||
getVersion () {return "6.0.7";}
|
||||
getVersion () {return "6.0.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -249,7 +249,7 @@ class ServerHider {
|
|||
container.appendChild(entry);
|
||||
let name = entry.querySelector(".serverhiderName");
|
||||
name.innerText = info.name || "";
|
||||
name.parentElement.insertBefore(this.createCopyOfServer(info), name);
|
||||
name.parentElement.insertBefore(BDFDB.createServerDivCopy(info, {click: () => {BDFDB.removeEles(serverHiderModal);}, menu: true, size: 48}), name);
|
||||
let hidecheckbox = entry.querySelector(".serverhiderCheckbox");
|
||||
hidecheckbox.checked = !BDFDB.isEleHidden(info.div);
|
||||
hidecheckbox.addEventListener("click", e => {
|
||||
|
@ -260,24 +260,6 @@ class ServerHider {
|
|||
BDFDB.appendModal(serverHiderModal);
|
||||
}
|
||||
|
||||
createCopyOfServer (info) {
|
||||
let serverCopy = info.div.cloneNode(true);
|
||||
BDFDB.removeEles(serverCopy.querySelectorAll(BDFDB.dotCNC.guildpill + BDFDB.dotCNC.guildbadgewrapper + "mask"));
|
||||
serverCopy.style.setProperty("margin", "0");
|
||||
serverCopy.style.setProperty("width", "48px");
|
||||
serverCopy.style.setProperty("height", "48px");
|
||||
serverCopy.style.setProperty("overflow", "hidden");
|
||||
serverCopy.style.setProperty("border-radius", "50%");
|
||||
serverCopy.querySelector("foreignObject").removeAttribute("mask");
|
||||
BDFDB.toggleEles(serverCopy, true);
|
||||
serverCopy.addEventListener("click", e => {
|
||||
BDFDB.stopEvent(e);
|
||||
info.div.querySelector("a").click();
|
||||
});
|
||||
serverCopy.addEventListener("contextmenu", e => {BDFDB.openGuildContextMenu(info.div, e);});
|
||||
return serverCopy;
|
||||
}
|
||||
|
||||
toggleServer (info, target, visible) {
|
||||
if (!info || !target) return;
|
||||
let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter, target);
|
||||
|
|
Loading…
Reference in New Issue