stuff
This commit is contained in:
parent
0772edc866
commit
4939cb6c9a
File diff suppressed because one or more lines are too long
|
@ -122,6 +122,16 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BDFDB.generateID = function (array) {
|
||||||
|
array = Array.isArray(array) ? array : null;
|
||||||
|
let id = Math.floor(Math.random() * 10000000000000000);
|
||||||
|
if (array && array.includes(id)) return BDFDB.generateID(array);
|
||||||
|
else {
|
||||||
|
array.push(id);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
BDFDB.addObserver = function (plugin, eleOrSelec, observer, config = {childList: true}) {
|
BDFDB.addObserver = function (plugin, eleOrSelec, observer, config = {childList: true}) {
|
||||||
if (!BDFDB.isObject(plugin) || !eleOrSelec || !observer) return;
|
if (!BDFDB.isObject(plugin) || !eleOrSelec || !observer) return;
|
||||||
if (BDFDB.isObjectEmpty(plugin.observers)) plugin.observers = {};
|
if (BDFDB.isObjectEmpty(plugin.observers)) plugin.observers = {};
|
||||||
|
@ -560,6 +570,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var itemlayers = [];
|
||||||
BDFDB.appendItemLayer = function (node, anker, options = {}) {
|
BDFDB.appendItemLayer = function (node, anker, options = {}) {
|
||||||
var itemlayercontainernative = document.querySelector(BDFDB.dotCN.itemlayercontainer);
|
var itemlayercontainernative = document.querySelector(BDFDB.dotCN.itemlayercontainer);
|
||||||
if (!itemlayercontainernative || !Node.prototype.isPrototypeOf(node) || !anker || !Node.prototype.isPrototypeOf(anker) || !document.contains(anker)) return null;
|
if (!itemlayercontainernative || !Node.prototype.isPrototypeOf(node) || !anker || !Node.prototype.isPrototypeOf(anker) || !document.contains(anker)) return null;
|
||||||
|
@ -569,7 +580,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
BDFDB.addClass(itemlayercontainer, "BDFDB-itemlayercontainer");
|
BDFDB.addClass(itemlayercontainer, "BDFDB-itemlayercontainer");
|
||||||
itemlayercontainernative.parentElement.insertBefore(itemlayercontainer, itemlayercontainernative.nextSibling);
|
itemlayercontainernative.parentElement.insertBefore(itemlayercontainer, itemlayercontainernative.nextSibling);
|
||||||
}
|
}
|
||||||
var id = Math.round(Math.random() * 10000000000000000);
|
var id = BDFDB.generateID(itemlayers);
|
||||||
var itemlayer = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.itemlayer} BDFDB-itemlayer itemlayer-${id}"></div>`);
|
var itemlayer = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.itemlayer} BDFDB-itemlayer itemlayer-${id}"></div>`);
|
||||||
itemlayer.appendChild(node);
|
itemlayer.appendChild(node);
|
||||||
itemlayercontainer.appendChild(itemlayer);
|
itemlayercontainer.appendChild(itemlayer);
|
||||||
|
@ -588,6 +599,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
var ankermatch = nodes.indexOf(anker) > -1;
|
var ankermatch = nodes.indexOf(anker) > -1;
|
||||||
var parentmatch = nodes.some(n => n.contains(anker));
|
var parentmatch = nodes.some(n => n.contains(anker));
|
||||||
if (ownmatch || ankermatch || parentmatch) {
|
if (ownmatch || ankermatch || parentmatch) {
|
||||||
|
BDFDB.removeFromArray(itemlayers, id);
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
itemlayer.remove();
|
itemlayer.remove();
|
||||||
BDFDB.removeLocalStyle('BDFDBcustomItemLayer' + id, itemlayercontainer);
|
BDFDB.removeLocalStyle('BDFDBcustomItemLayer' + id, itemlayercontainer);
|
||||||
|
@ -599,11 +611,12 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
observer.observe(document.body, {subtree:true, childList:true});
|
observer.observe(document.body, {subtree:true, childList:true});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var notificationbars = [];
|
||||||
BDFDB.createNotificationsBar = function (text, options = {}) {
|
BDFDB.createNotificationsBar = function (text, options = {}) {
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
var layers = document.querySelector(BDFDB.dotCN.layers);
|
var layers = document.querySelector(BDFDB.dotCN.layers);
|
||||||
if (!layers) return;
|
if (!layers) return;
|
||||||
var id = Math.round(Math.random() * 10000000000000000);
|
var id = BDFDB.generateID(notificationbars);
|
||||||
var notice = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.notice} BDFDB-notice notice-${id}"><div class="${BDFDB.disCN.noticedismiss}" style="height:36px !important; position: absolute !important; top: 0 !important; right: 0 !important; left: unset !important;"></div><span class="notice-message"></span></div>`);
|
var notice = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.notice} BDFDB-notice notice-${id}"><div class="${BDFDB.disCN.noticedismiss}" style="height:36px !important; position: absolute !important; top: 0 !important; right: 0 !important; left: unset !important;"></div><span class="notice-message"></span></div>`);
|
||||||
layers.parentElement.insertBefore(notice, layers);
|
layers.parentElement.insertBefore(notice, layers);
|
||||||
var noticemessage = notice.querySelector('.notice-message');
|
var noticemessage = notice.querySelector('.notice-message');
|
||||||
|
@ -625,7 +638,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
if (options.btn || options.button) notice.appendChild(BDFDB.htmlToElement(`<button class="${BDFDB.disCNS.noticebutton + BDFDB.disCNS.titlesize14 + BDFDB.disCN.weightmedium}">${options.btn || options.button}</button>`));
|
if (options.btn || options.button) notice.appendChild(BDFDB.htmlToElement(`<button class="${BDFDB.disCNS.noticebutton + BDFDB.disCNS.titlesize14 + BDFDB.disCN.weightmedium}">${options.btn || options.button}</button>`));
|
||||||
if (options.id) notice.id = options.id.split(' ').join('');
|
if (options.id) notice.id = options.id.split(' ').join('');
|
||||||
if (options.selector) BDFDB.addClass(notice, options.selector);
|
if (options.selector) BDFDB.addClass(notice, options.selector);
|
||||||
if (options.css) BDFDB.appendLocalStyle('BDFDBcustomnotibar' + id, options.css);
|
if (options.css) BDFDB.appendLocalStyle('BDFDBcustomnotificationbar' + id, options.css);
|
||||||
if (options.style) notice.style = options.style;
|
if (options.style) notice.style = options.style;
|
||||||
if (options.html === true) noticemessage.innerHTML = text;
|
if (options.html === true) noticemessage.innerHTML = text;
|
||||||
else {
|
else {
|
||||||
|
@ -654,7 +667,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
var fontcolor = comp[0] > 180 && comp[1] > 180 && comp[2] > 180 ? '#000' : '#FFF';
|
var fontcolor = comp[0] > 180 && comp[1] > 180 && comp[2] > 180 ? '#000' : '#FFF';
|
||||||
var backgroundcolor = BDFDB.colorCONVERT(comp, 'HEX');
|
var backgroundcolor = BDFDB.colorCONVERT(comp, 'HEX');
|
||||||
var filter = comp[0] > 180 && comp[1] > 180 && comp[2] > 180 ? 'brightness(0%)' : 'brightness(100%)';
|
var filter = comp[0] > 180 && comp[1] > 180 && comp[2] > 180 ? 'brightness(0%)' : 'brightness(100%)';
|
||||||
BDFDB.appendLocalStyle('BDFDBcustomnotibarColorCorrection' + id, `.BDFDB-notice.notice-${id}{background-color:${backgroundcolor} !important;}.BDFDB-notice.notice-${id} .notice-message {color:${fontcolor} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticebutton} {color:${fontcolor} !important;border-color:${BDFDB.colorSETALPHA(fontcolor,0.25,'RGBA')} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticebutton}:hover {color:${backgroundcolor} !important;background-color:${fontcolor} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticedismiss} {filter:${filter} !important;}`);
|
BDFDB.appendLocalStyle('BDFDBcustomnotificationbarColorCorrection' + id, `.BDFDB-notice.notice-${id}{background-color:${backgroundcolor} !important;}.BDFDB-notice.notice-${id} .notice-message {color:${fontcolor} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticebutton} {color:${fontcolor} !important;border-color:${BDFDB.colorSETALPHA(fontcolor,0.25,'RGBA')} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticebutton}:hover {color:${backgroundcolor} !important;background-color:${fontcolor} !important;}.BDFDB-notice.notice-${id} ${BDFDB.dotCN.noticedismiss} {filter:${filter} !important;}`);
|
||||||
}
|
}
|
||||||
else BDFDB.addClass(notice, BDFDB.disCN.noticedefault);
|
else BDFDB.addClass(notice, BDFDB.disCN.noticedefault);
|
||||||
}
|
}
|
||||||
|
@ -672,8 +685,9 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
notice.style.setProperty('overflow', 'hidden', 'important');
|
notice.style.setProperty('overflow', 'hidden', 'important');
|
||||||
notice.style.setProperty('height', '0px', 'important');
|
notice.style.setProperty('height', '0px', 'important');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
BDFDB.removeLocalStyle('BDFDBcustomnotibar' + id);
|
BDFDB.removeFromArray(notificationbars, id);
|
||||||
BDFDB.removeLocalStyle('BDFDBcustomnotibarColorCorrection' + id);
|
BDFDB.removeLocalStyle('BDFDBcustomnotificationbar' + id);
|
||||||
|
BDFDB.removeLocalStyle('BDFDBcustomnotificationbarColorCorrection' + id);
|
||||||
notice.remove();
|
notice.remove();
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
@ -1988,7 +2002,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
if (guild) {
|
if (guild) {
|
||||||
let selected = LibraryModules.LastGuildStore.getGuildId() == guild.id;
|
let selected = LibraryModules.LastGuildStore.getGuildId() == guild.id;
|
||||||
let unread = LibraryModules.UnreadGuildUtils.hasUnread(guild.id);
|
let unread = LibraryModules.UnreadGuildUtils.hasUnread(guild.id);
|
||||||
let randomid = Math.round(Math.random() * 10000000000000000);
|
|
||||||
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} ${selected ? (' ' + BDFDB.disCN.guildiconselected) : ''}" 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.disCNS.guildiconchildwrapper + 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></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} ${selected ? (' ' + BDFDB.disCN.guildiconselected) : ''}" 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.disCNS.guildiconchildwrapper + 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></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);
|
let divinner = div.querySelector(BDFDB.dotCN.guildcontainer);
|
||||||
let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem);
|
let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem);
|
||||||
|
@ -3346,10 +3359,12 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
return selectMenu;
|
return selectMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var modals = [];
|
||||||
BDFDB.openModal = function (plugin, config) {
|
BDFDB.openModal = function (plugin, config) {
|
||||||
if (!BDFDB.isObject(plugin) || !BDFDB.isObject(config)) return;
|
if (!BDFDB.isObject(plugin) || !BDFDB.isObject(config)) return;
|
||||||
var contentchildren = [], footerchildren = [], modalprops, cancels = [], closeModal = _ => {
|
var modal, id, contentchildren = [], footerchildren = [], modalprops, cancels = [], closeModal = _ => {
|
||||||
if (typeof config.onClose == 'function') config.onClose();
|
if (id) BDFDB.removeFromArray(modals, id);
|
||||||
|
if (typeof config.onClose == 'function') config.onClose(modal);
|
||||||
if (BDFDB.isObject(modalprops) && typeof modalprops.onClose == 'function') modalprops.onClose();
|
if (BDFDB.isObject(modalprops) && typeof modalprops.onClose == 'function') modalprops.onClose();
|
||||||
};
|
};
|
||||||
if (typeof config.text == 'string') {
|
if (typeof config.text == 'string') {
|
||||||
|
@ -3365,79 +3380,96 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
else if (BDFDB.React.isValidElement(config.html)) contentchildren.push(config.html);
|
else if (BDFDB.React.isValidElement(config.html)) contentchildren.push(config.html);
|
||||||
}
|
}
|
||||||
if (typeof config.onClose != 'function') config.onClose = _ => {};
|
if (typeof config.onClose != 'function') config.onClose = _ => {};
|
||||||
if (Array.isArray(config.buttons)) for (let button of config.buttons) if (button.contents) {
|
if (typeof config.onOpen != 'function') config.onOpen = _ => {};
|
||||||
let color = typeof button.color == 'string' && LibraryComponents.Button.Colors[button.color.toUpperCase()];
|
if (Array.isArray(config.buttons)) for (let button of config.buttons) {
|
||||||
let look = typeof button.look == 'string' && LibraryComponents.Button.Looks[button.look.toUpperCase()];
|
let contents = typeof button.contents == 'string' ? button.contents : null;
|
||||||
let click = typeof button.click == 'function' ? button.click : _ => {};
|
let type = typeof button.type == 'string' ? button.type : null;
|
||||||
|
if (contents || type) {
|
||||||
|
let color = typeof button.color == 'string' && LibraryComponents.Button.Colors[button.color.toUpperCase()];
|
||||||
|
let look = typeof button.look == 'string' && LibraryComponents.Button.Looks[button.look.toUpperCase()];
|
||||||
|
let click = typeof button.click == 'function' ? button.click : _ => {};
|
||||||
|
|
||||||
if (button.cancel) cancels.push(click);
|
if (button.cancel) cancels.push(click);
|
||||||
|
|
||||||
footerchildren.push(BDFDB.React.createDiscordElement(LibraryComponents.Button, {
|
footerchildren.push(BDFDB.React.createDiscordElement(LibraryComponents.Button, {
|
||||||
type: 'button',
|
type: 'button',
|
||||||
look: look || (color ? LibraryComponents.Button.Looks.FILLED : LibraryComponents.Button.Looks.LINK),
|
className: type || "",
|
||||||
color: color ? color : LibraryComponents.Button.Colors.PRIMARY,
|
look: look || (color ? LibraryComponents.Button.Looks.FILLED : LibraryComponents.Button.Looks.LINK),
|
||||||
onClick: _ => {
|
color: color ? color : LibraryComponents.Button.Colors.PRIMARY,
|
||||||
click();
|
onClick: _ => {
|
||||||
if (button.close) {
|
click(modal);
|
||||||
for (let cancel of cancels) if (cancel != click) cancel();
|
if (button.close) {
|
||||||
closeModal();
|
for (let cancel of cancels) if (cancel != click) cancel(modal);
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}, null, contents || 'placeholder'));
|
||||||
}, null, button.contents));
|
}
|
||||||
}
|
}
|
||||||
|
if (contentchildren.length) {
|
||||||
if (contentchildren.length) LibraryModules.ModalUtils.openModal(props => {
|
let callbacktick = 0, callbackinterval = setInterval(_ => {
|
||||||
modalprops = props;
|
if (callbacktick > 60) clearInterval(callbackinterval);
|
||||||
let name = plugin.name || (typeof plugin.getName == "function" ? plugin.getName() : null);
|
else if ((modal = document.querySelector(`${BDFDB.dotCN.itemlayercontainer} .BDFDB-modal-${id}`)) != null) {
|
||||||
name = typeof name == 'string' ? name : null;
|
clearInterval(callbackinterval);
|
||||||
let size = typeof config.size == 'string' && LibraryComponents.ModalComponents.ModalSize[config.size.toUpperCase()];
|
BDFDB.initElements(modal);
|
||||||
return BDFDB.React.createElement(function (e) {
|
if (typeof config.onOpen == 'function') config.onOpen(modal);
|
||||||
return BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalRoot, {
|
}
|
||||||
className: `BDFDB-modal ${name ? name + '-modal' : ''} ${config.selector ? config.selector : ''}`.trim(),
|
else callbacktick++;
|
||||||
size: size ? size : LibraryComponents.ModalComponents.ModalSize.SMALL,
|
}, 1000);
|
||||||
transitionState: e.transitionState
|
LibraryModules.ModalUtils.openModal(props => {
|
||||||
}, null, [
|
modalprops = props;
|
||||||
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalHeader, {
|
id = BDFDB.generateID(modals);
|
||||||
separator: false
|
let name = plugin.name || (typeof plugin.getName == "function" ? plugin.getName() : null);
|
||||||
|
name = typeof name == 'string' ? name : null;
|
||||||
|
let size = typeof config.size == 'string' && LibraryComponents.ModalComponents.ModalSize[config.size.toUpperCase()];
|
||||||
|
return BDFDB.React.createElement(function (e) {
|
||||||
|
return BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalRoot, {
|
||||||
|
className: `BDFDB-modal BDFDB-modal-${id} ${name ? name + '-modal' : ''} ${config.selector ? config.selector : ''}`.trim(),
|
||||||
|
size: size ? size : LibraryComponents.ModalComponents.ModalSize.SMALL,
|
||||||
|
transitionState: e.transitionState
|
||||||
}, null, [
|
}, null, [
|
||||||
BDFDB.React.createDiscordElement(LibraryComponents.Flex.Child, {
|
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalHeader, {
|
||||||
grow: 1,
|
separator: false
|
||||||
shrink: 1
|
|
||||||
}, null, [
|
}, null, [
|
||||||
BDFDB.React.createDiscordElement(LibraryComponents.FormComponents.FormTitle, {
|
BDFDB.React.createDiscordElement(LibraryComponents.Flex.Child, {
|
||||||
tag: LibraryComponents.FormComponents.FormTitle.Tags.H4
|
grow: 1,
|
||||||
}, null, typeof config.header == 'string' ? config.header : ""),
|
shrink: 1
|
||||||
LibraryComponents.TextElement.default({
|
}, null, [
|
||||||
size: LibraryComponents.TextElement.Sizes.SMALL,
|
BDFDB.React.createDiscordElement(LibraryComponents.FormComponents.FormTitle, {
|
||||||
color: LibraryComponents.TextElement.Colors.PRIMARY,
|
tag: LibraryComponents.FormComponents.FormTitle.Tags.H4
|
||||||
children: [typeof config.subheader == 'string' ? config.subheader : (name || "")]
|
}, null, typeof config.header == 'string' ? config.header : ""),
|
||||||
|
LibraryComponents.TextElement.default({
|
||||||
|
size: LibraryComponents.TextElement.Sizes.SMALL,
|
||||||
|
color: LibraryComponents.TextElement.Colors.PRIMARY,
|
||||||
|
children: [typeof config.subheader == 'string' ? config.subheader : (name || "")]
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalCloseButton, {
|
||||||
|
onClick: _ => {
|
||||||
|
for (let cancel of cancels) cancel(modal);
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalCloseButton, {
|
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalContent, {}, null, contentchildren),
|
||||||
onClick: _ => {
|
footerchildren.length ? BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalFooter, {}, null, footerchildren) : null
|
||||||
for (let cancel of cancels) cancel();
|
])
|
||||||
closeModal();
|
}, props);
|
||||||
}
|
}, {
|
||||||
})
|
onCloseRequest: _ => {
|
||||||
]),
|
for (let cancel of cancels) cancel(modal);
|
||||||
BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalContent, {}, null, contentchildren),
|
closeModal();
|
||||||
footerchildren.length ? BDFDB.React.createDiscordElement(LibraryComponents.ModalComponents.ModalFooter, {}, null, footerchildren) : null
|
}
|
||||||
])
|
});
|
||||||
}, props);
|
}
|
||||||
}, {
|
|
||||||
onCloseRequest: _ => {
|
|
||||||
for (let cancel of cancels) cancel();
|
|
||||||
closeModal();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BDFDB.openConfirmModal = function (plugin, text, callback) {
|
BDFDB.openConfirmModal = function (plugin, text, callback) {
|
||||||
if (!BDFDB.isObject(plugin) || typeof text != 'string') return;
|
if (!BDFDB.isObject(plugin) || typeof text != 'string') return;
|
||||||
callback = typeof callback == 'function' ? callback : _ => {};
|
callback = typeof callback == 'function' ? callback : _ => {};
|
||||||
BDFDB.openModal(plugin, {text, header:'Are you sure?', selector:'BDFDB-confirmmodal', buttons:[
|
BDFDB.openModal(plugin, {text, header:'Are you sure?', selector:'BDFDB-confirmmodal', buttons:[
|
||||||
{contents:BDFDB.LanguageStrings.OKAY, close:true, color:"RED", click:callback},
|
{type:"btn-ok", close:true, color:"RED", click:callback},
|
||||||
{contents:BDFDB.LanguageStrings.CANCEL, close:true}
|
{type:"btn-cancel", close:true}
|
||||||
]});
|
]});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5940,9 +5972,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
position: relative !important;
|
position: relative !important;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
.BDFDB-modal ${BDFDB.dotCN.modalsizelarge} {
|
|
||||||
max-height: 80vh;
|
|
||||||
}
|
|
||||||
.BDFDB-modal ${BDFDB.dotCN.title + BDFDB.notCN.cursorpointer},
|
.BDFDB-modal ${BDFDB.dotCN.title + BDFDB.notCN.cursorpointer},
|
||||||
.BDFDB-settings ${BDFDB.dotCN.title + BDFDB.notCN.cursorpointer} {
|
.BDFDB-settings ${BDFDB.dotCN.title + BDFDB.notCN.cursorpointer} {
|
||||||
cursor: default !important;
|
cursor: default !important;
|
||||||
|
@ -6677,7 +6706,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
BDFDB.addObserver(BDFDB, document.querySelector(BDFDB.dotCN.itemlayercontainer), {name:"layerObserverBDFDB", instance:
|
BDFDB.addObserver(BDFDB, document.querySelector(BDFDB.dotCN.itemlayercontainer), {name:"layerObserverBDFDB", instance:
|
||||||
new MutationObserver(changes => {changes.forEach(change => {change.addedNodes.forEach(node => {
|
new MutationObserver(changes => {changes.forEach(change => {change.addedNodes.forEach(node => {
|
||||||
if (node.tagName && (BDFDB.containsClass(node, BDFDB.disCN.contextmenu) || (node = node.querySelector(BDFDB.dotCN.contextmenu)) != null)) BDFDB.initElements(node);
|
if (node.tagName && (BDFDB.containsClass(node, BDFDB.disCN.contextmenu) || (node = node.querySelector(BDFDB.dotCN.contextmenu)) != null)) BDFDB.initElements(node);
|
||||||
else if (node.tagName && (BDFDB.containsClass(node, 'BDFDB-modal') || (node = node.querySelector('.BDFDB-modal')) != null)) BDFDB.initElements(node);
|
|
||||||
})})})
|
})})})
|
||||||
}, {childList: true});
|
}, {childList: true});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue