werq
This commit is contained in:
parent
6bba63cea6
commit
51eb421b16
1546
Plugins/BDFDB.js
1546
Plugins/BDFDB.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -144,8 +144,8 @@ class BadgesEverywhere {
|
|||
label: this.defaults.badges[flag].name,
|
||||
value: badges[flag],
|
||||
labelchildren: [
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.htmlToElement(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionplaying}" style="all: unset !important;">${Array.isArray(this.defaults.badges[flag].types) ? this.defaults.badges[flag].types.map(rank => this.createBadge("settings", flag, rank)).join("") : this.createBadge("settings", flag)}</span>`)),
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.htmlToElement(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;">${Array.isArray(this.defaults.badges[flag].types) ? this.defaults.badges[flag].types.map(rank => this.createBadge("settings", flag, rank)).join("") : this.createBadge("settings", flag)}</span>`))
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.DOMUtils.create(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionplaying}" style="all: unset !important;">${Array.isArray(this.defaults.badges[flag].types) ? this.defaults.badges[flag].types.map(rank => this.createBadge("settings", flag, rank)).join("") : this.createBadge("settings", flag)}</span>`)),
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.DOMUtils.create(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;">${Array.isArray(this.defaults.badges[flag].types) ? this.defaults.badges[flag].types.map(rank => this.createBadge("settings", flag, rank)).join("") : this.createBadge("settings", flag)}</span>`))
|
||||
]
|
||||
}));
|
||||
for (let flag in indicators) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
|
@ -155,8 +155,8 @@ class BadgesEverywhere {
|
|||
label: this.defaults.indicators[flag].name,
|
||||
value: indicators[flag],
|
||||
labelchildren: [
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.htmlToElement(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionplaying}" style="all: unset !important;">${this.createBadge("settings", flag)}</span>`)),
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.htmlToElement(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;">${this.createBadge("settings", flag)}</span>`))
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.DOMUtils.create(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionplaying}" style="all: unset !important;">${this.createBadge("settings", flag)}</span>`)),
|
||||
BDFDB.ReactUtils.elementToReact(BDFDB.DOMUtils.create(`<span class="BE-badges BE-badges-settings ${BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;">${this.createBadge("settings", flag)}</span>`))
|
||||
]
|
||||
}));
|
||||
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
|
||||
|
@ -204,7 +204,7 @@ class BadgesEverywhere {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".BE-badges");
|
||||
BDFDB.DOMUtils.remove(".BE-badges");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -265,15 +265,15 @@ class BadgesEverywhere {
|
|||
}
|
||||
|
||||
addToWrapper (info, wrapper, type) {
|
||||
BDFDB.removeEles(wrapper.querySelectorAll(".BE-badges"));
|
||||
BDFDB.DOMUtils.remove(wrapper.querySelectorAll(".BE-badges"));
|
||||
let badges = BDFDB.DataUtils.get(this, "badges");
|
||||
let indicators = BDFDB.DataUtils.get(this, "indicators");
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
|
||||
let badgewrapper = BDFDB.htmlToElement(`<span class="BE-badges BE-badges-${type} ${!settings.useColoredVersion || (header && !BDFDB.containsClass(header, BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important; display: flex !important; flex-direction: row !important;"></span>`);
|
||||
let header = BDFDB.DOMUtils.getParent(BDFDB.dotCN.userpopoutheader, wrapper);
|
||||
let badgewrapper = BDFDB.DOMUtils.create(`<span class="BE-badges BE-badges-${type} ${!settings.useColoredVersion || (header && !BDFDB.DOMUtils.containsClass(header, BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important; display: flex !important; flex-direction: row !important;"></span>`);
|
||||
for (let flag in this.defaults.badges) {
|
||||
if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
|
||||
let badge = BDFDB.htmlToElement(this.createBadge(type, flag, flag == this.boostflag ? BDFDB.LibraryModules.GuildBoostUtils.getUserLevel(this.loadedusers[info.id].premium_guild_since) : ""));
|
||||
let badge = BDFDB.DOMUtils.create(this.createBadge(type, flag, flag == this.boostflag ? BDFDB.LibraryModules.GuildBoostUtils.getUserLevel(this.loadedusers[info.id].premium_guild_since) : ""));
|
||||
badgewrapper.appendChild(badge);
|
||||
badge.addEventListener("mouseenter", () => {
|
||||
let text = this.defaults.badges[flag].name;
|
||||
|
@ -285,7 +285,7 @@ class BadgesEverywhere {
|
|||
}
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id);
|
||||
if (indicators.CURRENT_GUILD_BOOST && member && member.premiumSince) {
|
||||
let badge = BDFDB.htmlToElement(this.createBadge(type, "CURRENT_GUILD_BOOST"));
|
||||
let badge = BDFDB.DOMUtils.create(this.createBadge(type, "CURRENT_GUILD_BOOST"));
|
||||
badgewrapper.appendChild(badge);
|
||||
badge.addEventListener("mouseenter", () => {
|
||||
BDFDB.TooltipUtils.create(badge, settings.showNitroDate ? BDFDB.LanguageUtils.LanguageStringsFormat("PREMIUM_GUILD_SUBSCRIPTION_TOOLTIP", new Date(member.premiumSince)) : "Boosting current server", {type:"top", style:"white-space: nowrap; max-width: unset"});
|
||||
|
@ -296,7 +296,7 @@ class BadgesEverywhere {
|
|||
header.firstElementChild.appendChild(badgewrapper);
|
||||
let popout = header.parentElement.parentElement;
|
||||
if (popout.style.transform.indexOf("translateY(-1") == -1) {
|
||||
let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.getRects(popout);
|
||||
let arect = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.DOMUtils.getRects(popout);
|
||||
popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class BetterFriendCount {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".betterfriendcount-badge");
|
||||
BDFDB.DOMUtils.remove(".betterfriendcount-badge");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class BetterNsfwTag {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".NSFW-tag");
|
||||
BDFDB.DOMUtils.remove(".NSFW-tag");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class BetterNsfwTag {
|
|||
processChannelItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel && instance.props.channel.nsfw) {
|
||||
let channelname = wrapper.querySelector(BDFDB.dotCN.channelname);
|
||||
if (channelname) channelname.parentElement.insertBefore(BDFDB.htmlToElement(`<span class="NSFW-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(241, 71, 71); top: 0px; min-width: 28px;">NSFW</span>`), channelname.nextElementSibling);
|
||||
if (channelname) channelname.parentElement.insertBefore(BDFDB.DOMUtils.create(`<span class="NSFW-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(241, 71, 71); top: 0px; min-width: 28px;">NSFW</span>`), channelname.nextElementSibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class BetterSearchPage {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
return settingspanel;
|
||||
|
@ -117,7 +117,7 @@ class BetterSearchPage {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
|
||||
BDFDB.DOMUtils.remove(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -132,14 +132,14 @@ class BetterSearchPage {
|
|||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
|
||||
BDFDB.DOMUtils.remove(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
}
|
||||
|
||||
addNewControls (pagination, searchId) {
|
||||
if (!pagination || !searchId || document.querySelector(".BSP-pagination, .BSP-pagination-button, .BSP-pagination-jumpinput")) return;
|
||||
let searchResultsWrapper = BDFDB.getParentEle(BDFDB.dotCN.searchresultswrapper, pagination);
|
||||
let searchResultsWrapper = BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchresultswrapper, pagination);
|
||||
if (!searchResultsWrapper) return;
|
||||
let numbers = pagination.textContent.replace(/[\s\.\,]/g,"").split(/[^\d]/).filter(n => n);
|
||||
let currentpage = parseInt(numbers[0]);
|
||||
|
@ -152,21 +152,21 @@ class BetterSearchPage {
|
|||
if (currentpage == 201) BDFDB.NotificationUtils.toast("Discord doesn't allow you to go further than page 201.",{type:"error"});
|
||||
maxpage = 201;
|
||||
}
|
||||
if (currentpage == maxpage && maxpage == 201) BDFDB.addClass(pagination.querySelector(BDFDB.dotCN.searchresultspaginationnext), BDFDB.disCN.searchresultspaginationdisabled);
|
||||
if (currentpage == maxpage && maxpage == 201) BDFDB.DOMUtils.addClass(pagination.querySelector(BDFDB.dotCN.searchresultspaginationnext), BDFDB.disCN.searchresultspaginationdisabled);
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
for (let btn of pagination.querySelectorAll(BDFDB.dotCNC.searchresultspaginationprevious + BDFDB.dotCN.searchresultspaginationnext)) BDFDB.addClass(btn, "pagination-button");
|
||||
for (let btn of pagination.querySelectorAll(BDFDB.dotCNC.searchresultspaginationprevious + BDFDB.dotCN.searchresultspaginationnext)) BDFDB.DOMUtils.addClass(btn, "pagination-button");
|
||||
if (settings.addFirstLast) {
|
||||
pagination.insertBefore(BDFDB.htmlToElement(`<div aria-label="First" class="${currentpage == 1 ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-first"></div>`), pagination.firstElementChild);
|
||||
pagination.appendChild(BDFDB.htmlToElement(`<div aria-label="Last" class="${currentpage == maxpage ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-last"></div>`));
|
||||
pagination.insertBefore(BDFDB.DOMUtils.create(`<div aria-label="First" class="${currentpage == 1 ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-first"></div>`), pagination.firstElementChild);
|
||||
pagination.appendChild(BDFDB.DOMUtils.create(`<div aria-label="Last" class="${currentpage == maxpage ? BDFDB.disCNS.searchresultspaginationdisabled : ""}pagination-button BSP-pagination-button BSP-pagination-last"></div>`));
|
||||
}
|
||||
if (settings.addJumpTo) {
|
||||
pagination.appendChild(BDFDB.htmlToElement(`<div class="inputNumberWrapper inputNumberWrapperMini BSP-pagination-jumpinput ${BDFDB.disCN.inputwrapper}"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="1" max="${maxpage}" placeholder="${currentpage}" value="${currentpage}" class="${BDFDB.disCNS.inputmini + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div>`));
|
||||
pagination.appendChild(BDFDB.htmlToElement(`<div aria-label="Go To" class="pagination-button BSP-pagination-button BSP-pagination-jump"></div>`));
|
||||
pagination.appendChild(BDFDB.DOMUtils.create(`<div class="inputNumberWrapper inputNumberWrapperMini BSP-pagination-jumpinput ${BDFDB.disCN.inputwrapper}"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="1" max="${maxpage}" placeholder="${currentpage}" value="${currentpage}" class="${BDFDB.disCNS.inputmini + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div>`));
|
||||
pagination.appendChild(BDFDB.DOMUtils.create(`<div aria-label="Go To" class="pagination-button BSP-pagination-button BSP-pagination-jump"></div>`));
|
||||
}
|
||||
BDFDB.initElements(pagination, this);
|
||||
if (settings.cloneToTheTop) {
|
||||
let BSPpaginaton = pagination.cloneNode(true);
|
||||
BDFDB.addClass(BSPpaginaton, "BSP-pagination");
|
||||
BDFDB.DOMUtils.addClass(BSPpaginaton, "BSP-pagination");
|
||||
searchResultsWrapper.insertBefore(BSPpaginaton, searchResultsWrapper.firstElementChild);
|
||||
BDFDB.initElements(BSPpaginaton, this);
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ class CharCounter {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".charcounter");
|
||||
BDFDB.removeClasses("charcounter-added");
|
||||
BDFDB.DOMUtils.remove(".charcounter");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("charcounter-added");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class CharCounter {
|
|||
}
|
||||
|
||||
processNote (instance, wrapper, returnvalue) {
|
||||
this.appendCounter(wrapper.firstElementChild, BDFDB.containsClass(wrapper, BDFDB.disCN.usernotepopout) ? "popout" : (BDFDB.containsClass(wrapper, BDFDB.disCN.usernoteprofile) ? "profile" : null), false);
|
||||
this.appendCounter(wrapper.firstElementChild, BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.usernotepopout) ? "popout" : (BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.usernoteprofile) ? "profile" : null), false);
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
|
@ -148,13 +148,13 @@ class CharCounter {
|
|||
|
||||
processChangeNickname (instance, wrapper, returnvalue) {
|
||||
let reset = wrapper.querySelector(BDFDB.dotCN.reset);
|
||||
if (reset && BDFDB.getInnerText(reset.firstElementChild) == BDFDB.LanguageUtils.LanguageStrings.RESET_NICKNAME) this.appendCounter(wrapper.querySelector(BDFDB.dotCN.inputdefault), "nickname", false);
|
||||
if (reset && BDFDB.DOMUtils.getText(reset.firstElementChild) == BDFDB.LanguageUtils.LanguageStrings.RESET_NICKNAME) this.appendCounter(wrapper.querySelector(BDFDB.dotCN.inputdefault), "nickname", false);
|
||||
}
|
||||
|
||||
appendCounter (input, type, parsing) {
|
||||
if (!input || !type) return;
|
||||
BDFDB.removeEles(input.parentElement.querySelectorAll("#charcounter"));
|
||||
var counter = BDFDB.htmlToElement(`<div id="charcounter" class="charcounter ${type}"></div>`);
|
||||
BDFDB.DOMUtils.remove(input.parentElement.querySelectorAll("#charcounter"));
|
||||
var counter = BDFDB.DOMUtils.create(`<div id="charcounter" class="charcounter ${type}"></div>`);
|
||||
input.parentElement.appendChild(counter);
|
||||
|
||||
var updateCounter = () => {
|
||||
|
@ -164,7 +164,7 @@ class CharCounter {
|
|||
counter.innerText = inputlength + "/" + (this.maxLenghts[type] || 2000) + (!seleclength ? "" : " (" + seleclength + ")");
|
||||
};
|
||||
|
||||
BDFDB.addClass(input.parentElement.parentElement, "charcounter-added");
|
||||
BDFDB.DOMUtils.addClass(input.parentElement.parentElement, "charcounter-added");
|
||||
if (type == "nickname") input.setAttribute("maxlength", 32);
|
||||
BDFDB.ListenerUtils.add(this, input, "keydown click change", e => {
|
||||
clearTimeout(input.charcountertimeout);
|
||||
|
|
|
@ -111,7 +111,7 @@ class ChatAliases {
|
|||
}
|
||||
settingshtml += `</div></div><div class="BDFDB-settings-inner-list alias-list ${BDFDB.disCN.marginbottom8}">`;
|
||||
for (let word in this.aliases) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.encodeToHTML(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.encodeToHTML(this.aliases[word].replace)}">`;
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.StringUtils.htmlEscape(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.StringUtils.htmlEscape(this.aliases[word].replace)}">`;
|
||||
for (let config in this.defaults.configs) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset} BDFDB-tablecheckbox" table-id="aliases" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${this.aliases[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class ChatAliases {
|
|||
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will replace words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will replace words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will replace words that are exactly the replaceword. apple to pear => applepie stays applepie</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will replace words anywhere they appear. apple to pear => applepieapple to pearpiepear</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Autoc: Will appear in the Autocomplete Menu (if enabled).</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Regex: Will treat the entered wordvalue as a regular expression. <a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover}" target="_blank" href="https://regexr.com/">Help</a></div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">File: If the replacevalue is a filepath it will try to upload the file located at the filepath.</div></div>`;
|
||||
settingshtml += `</div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -165,7 +165,7 @@ class ChatAliases {
|
|||
this.aliases = BDFDB.DataUtils.load(this, "words");
|
||||
|
||||
BDFDB.ListenerUtils.add(document, "click", e => {
|
||||
if (!e.target.tagName === "TEXTAREA") BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
if (!e.target.tagName === "TEXTAREA") BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
});
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
|
@ -177,7 +177,7 @@ class ChatAliases {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class ChatAliases {
|
|||
|
||||
var containerhtml = ``;
|
||||
for (let word in this.aliases) {
|
||||
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.encodeToHTML(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.encodeToHTML(this.aliases[word].replace)}">`;
|
||||
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} word-name" value="${BDFDB.StringUtils.htmlEscape(word)}"><input type="text" word="${word}" action="edit" class="${BDFDB.disCNS.gamename + BDFDB.disCN.gamenameinput} replace-name" value="${BDFDB.StringUtils.htmlEscape(this.aliases[word].replace)}">`;
|
||||
for (let config in this.defaults.configs) {
|
||||
containerhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset} BDFDB-tablecheckbox" table-id="aliases" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${this.aliases[word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
|
||||
}
|
||||
|
@ -283,9 +283,9 @@ class ChatAliases {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
|
@ -354,7 +354,7 @@ class ChatAliases {
|
|||
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
|
||||
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
|
||||
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteAliasesRow")) {
|
||||
if (BDFDB.DOMUtils.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteAliasesRow")) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
this.swapWordWithAlias(textarea);
|
||||
}
|
||||
|
@ -362,12 +362,12 @@ class ChatAliases {
|
|||
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
|
||||
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteAliasesSelector)");
|
||||
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
|
||||
if (BDFDB.containsClass(selected, "autocompleteAliasesSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteAliasesSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
|
||||
|
@ -379,7 +379,7 @@ class ChatAliases {
|
|||
textarea.ChatAliasAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea);},100);
|
||||
}
|
||||
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, textarea, "click", e => {
|
||||
if (settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea);});
|
||||
|
@ -391,7 +391,7 @@ class ChatAliases {
|
|||
if (!textarea.value || textarea.parentElement.querySelector(".autocompleteAliasesRow")) return;
|
||||
let words = textarea.value.split(/\s/);
|
||||
let lastword = words[words.length-1].trim();
|
||||
if (words.length == 1 && BDFDB.BdUtils.isPluginEnabled("WriteUpperCase")) {
|
||||
if (words.length == 1 && BDFDB.BDUtils.isPluginEnabled("WriteUpperCase")) {
|
||||
let first = lastword.charAt(0);
|
||||
if (first === first.toUpperCase() && lastword.toLowerCase().indexOf("http") == 0) {
|
||||
lastword = lastword.charAt(0).toLowerCase() + lastword.slice(1);
|
||||
|
@ -418,30 +418,30 @@ class ChatAliases {
|
|||
if (!BDFDB.ObjectUtils.isEmpty(matchedaliases)) {
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
|
||||
if (!autocompletemenu) {
|
||||
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteAliases"><div class="${BDFDB.disCN.autocompleteinner}"></div></div>`);
|
||||
autocompletemenu = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteAliases"><div class="${BDFDB.disCN.autocompleteinner}"></div></div>`);
|
||||
textarea.parentElement.appendChild(autocompletemenu);
|
||||
autocompletemenu = autocompletemenu.firstElementChild;
|
||||
}
|
||||
else {
|
||||
amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
|
||||
}
|
||||
let autocompleterowheader = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">Aliases: <strong class="lastword">${BDFDB.encodeToHTML(lastword)}</strong></div></div></div>`);
|
||||
let autocompleterowheader = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">Aliases: <strong class="lastword">${BDFDB.StringUtils.htmlEscape(lastword)}</strong></div></div></div>`);
|
||||
autocompletemenu.appendChild(autocompleterowheader);
|
||||
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
|
||||
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
});
|
||||
|
||||
for (let word in matchedaliases) {
|
||||
if (amount-- < 1) break;
|
||||
let autocompleterow = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.flexchild} aliasword" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)}</div><div class="${BDFDB.disCNS.autocompletedescription + BDFDB.disCN.flexchild}">${BDFDB.encodeToHTML(matchedaliases[word].replace)}</div></div></div></div>`);
|
||||
let autocompleterow = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.flexchild} aliasword" style="flex: 1 1 auto;">${BDFDB.StringUtils.htmlEscape(word)}</div><div class="${BDFDB.disCNS.autocompletedescription + BDFDB.disCN.flexchild}">${BDFDB.StringUtils.htmlEscape(matchedaliases[word].replace)}</div></div></div></div>`);
|
||||
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithAlias(textarea);});
|
||||
autocompletemenu.appendChild(autocompleterow);
|
||||
}
|
||||
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
|
||||
BDFDB.addClass(autocompletemenu.querySelector(".autocompleteAliasesRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(autocompletemenu.querySelector(".autocompleteAliasesRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ class ChatAliases {
|
|||
let aliasword = textarea.parentElement.querySelector(".autocompleteAliasesRow " + BDFDB.dotCN.autocompleteselected + " .aliasword").innerText;
|
||||
let lastword = textarea.parentElement.querySelector(".autocompleteAliasesRow .lastword").innerText;
|
||||
if (aliasword && lastword) {
|
||||
BDFDB.removeEles(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
|
||||
textarea.focus();
|
||||
textarea.selectionStart = textarea.value.length - lastword.length;
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
@ -493,14 +493,14 @@ class ChatAliases {
|
|||
useAliases (string, aliases, files, singleword) {
|
||||
for (let word in aliases) {
|
||||
let aliasdata = aliases[word];
|
||||
let escpAlias = aliasdata.regex ? word : BDFDB.regEscape(word);
|
||||
let escpAlias = aliasdata.regex ? word : BDFDB.StringUtils.regEscape(word);
|
||||
let result = true, replaced = false, tempstring1 = string, tempstring2 = "";
|
||||
let regstring = aliasdata.exact ? "^" + escpAlias + "$" : escpAlias;
|
||||
while (result != null) {
|
||||
result = new RegExp(regstring, (aliasdata.case ? "" : "i") + (aliasdata.exact ? "" : "g")).exec(tempstring1);
|
||||
if (result) {
|
||||
replaced = true;
|
||||
let replace = aliasdata.file ? "" : BDFDB.insertNRST(aliasdata.replace);
|
||||
let replace = aliasdata.file ? "" : BDFDB.StringUtils.insertNRST(aliasdata.replace);
|
||||
if (result.length > 1) for (var i = 1; i < result.length; i++) replace = replace.replace(new RegExp("\\\\" + i + "|\\$" + i, "g"), result[i]);
|
||||
tempstring2 += tempstring1.slice(0, result.index + result[0].length).replace(result[0], replace);
|
||||
tempstring1 = tempstring1.slice(result.index + result[0].length);
|
||||
|
@ -521,7 +521,7 @@ class ChatAliases {
|
|||
}
|
||||
|
||||
openAddModal (wordvalue) {
|
||||
let chataliasesAddModal = BDFDB.htmlToElement(this.chataliasesAddModalMarkup);
|
||||
let chataliasesAddModal = BDFDB.DOMUtils.create(this.chataliasesAddModalMarkup);
|
||||
let wordvalueinput = chataliasesAddModal.querySelector("#input-wordvalue");
|
||||
let replacevalueinput = chataliasesAddModal.querySelector("#input-replacevalue");
|
||||
let addbutton = chataliasesAddModal.querySelector(".btn-add");
|
||||
|
@ -548,14 +548,14 @@ class ChatAliases {
|
|||
else {
|
||||
addbutton.disabled = false;
|
||||
addbutton.style.removeProperty("pointer-events");
|
||||
BDFDB.removeEles(".chataliases-disabled-tooltip");
|
||||
BDFDB.DOMUtils.remove(".chataliases-disabled-tooltip");
|
||||
}
|
||||
BDFDB.removeClass(validinputs, "invalid");
|
||||
BDFDB.DOMUtils.removeClass(validinputs, "invalid");
|
||||
};
|
||||
let addDisabledTooltip = (invalidinputs, type) => {
|
||||
BDFDB.removeEles(".chataliases-disabled-tooltip");
|
||||
BDFDB.DOMUtils.remove(".chataliases-disabled-tooltip");
|
||||
addbutton.disabled = true;
|
||||
BDFDB.addClass(invalidinputs, "invalid");
|
||||
BDFDB.DOMUtils.addClass(invalidinputs, "invalid");
|
||||
addbutton.style.setProperty("pointer-events", "none", "important");
|
||||
BDFDB.TooltipUtils.create(addbutton, "Choose a " + type, {type: "right", color: "red", selector: "chataliases-disabled-tooltip"});
|
||||
};
|
||||
|
@ -563,7 +563,7 @@ class ChatAliases {
|
|||
replacevalueinput.addEventListener("input", checkInputs);
|
||||
|
||||
BDFDB.ListenerUtils.addToChildren(chataliasesAddModal, "click", BDFDB.dotCNC.backdrop + BDFDB.dotCNC.modalclose + ".btn-add", () => {
|
||||
BDFDB.removeEles(".chataliases-disabled-tooltip");
|
||||
BDFDB.DOMUtils.remove(".chataliases-disabled-tooltip");
|
||||
});
|
||||
|
||||
addbutton.addEventListener("click", e => {
|
||||
|
|
|
@ -124,7 +124,7 @@ class ChatFilter {
|
|||
}
|
||||
settingshtml += `</div></div><div class="BDFDB-settings-inner-list ${rtype}-list">`;
|
||||
for (let word in this.words[rtype]) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)} (${BDFDB.encodeToHTML(this.words[rtype][word].replace)})</div>`
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.StringUtils.htmlEscape(word)} (${BDFDB.StringUtils.htmlEscape(this.words[rtype][word].replace)})</div>`
|
||||
for (let config in this.defaults.configs) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" rtype="${rtype}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${this.words[rtype][word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class ChatFilter {
|
|||
settingshtml += `<div class="BDFDB-settings-inner-list info-container" ${infoHidden ? "style='display:none;'" : ""}><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Case: Will block/censor words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Case: Will block/censor words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Exact: Will block/censor words that are exactly the selected word. apple => apple, not applepie or pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Not Exact: Will block/censor all words containing the selected word. apple => apple, applepie and pineapple</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">Empty: Ignores the default and set replace word and removes the word/message instead.</div></div>`;
|
||||
settingshtml += `</div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -205,7 +205,7 @@ class ChatFilter {
|
|||
|
||||
var containerhtml = ``;
|
||||
for (let word in this.words[rtype]) {
|
||||
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.encodeToHTML(word)} (${BDFDB.encodeToHTML(this.words[rtype][word].replace)})</div>`
|
||||
containerhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis}" style="flex: 1 1 auto;">${BDFDB.StringUtils.htmlEscape(word)} (${BDFDB.StringUtils.htmlEscape(this.words[rtype][word].replace)})</div>`
|
||||
for (let config in this.defaults.configs) {
|
||||
containerhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input word="${word}" rtype="${rtype}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${this.words[rtype][word][config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
|
||||
}
|
||||
|
@ -275,9 +275,9 @@ class ChatFilter {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
|
@ -325,7 +325,7 @@ class ChatFilter {
|
|||
}
|
||||
|
||||
hideMessage (message) {
|
||||
if (message.tagName && !BDFDB.containsClass(message, "blocked", "censored", false)) {
|
||||
if (message.tagName && !BDFDB.DOMUtils.containsClass(message, "blocked", "censored", false)) {
|
||||
var orightml = message.innerHTML;
|
||||
var newhtml = "";
|
||||
|
||||
|
@ -367,10 +367,10 @@ class ChatFilter {
|
|||
if (blocked) break;
|
||||
}
|
||||
if (blocked) {
|
||||
if (settings.hideMessage.blocked) BDFDB.toggleEles(message, false);
|
||||
newhtml = BDFDB.encodeToHTML(blockedReplace);
|
||||
if (settings.hideMessage.blocked) BDFDB.DOMUtils.hide(message);
|
||||
newhtml = BDFDB.StringUtils.htmlEscape(blockedReplace);
|
||||
message.innerHTML = newhtml;
|
||||
BDFDB.addClass(message, "blocked");
|
||||
BDFDB.DOMUtils.addClass(message, "blocked");
|
||||
message.ChatFilterOriginalHTML = orightml;
|
||||
message.ChatFilterNewHTML = newhtml;
|
||||
|
||||
|
@ -384,7 +384,7 @@ class ChatFilter {
|
|||
strings.forEach((string,i) => {
|
||||
if (this.testForEmoji(string, reg)) {
|
||||
censored = true;
|
||||
strings[i] = BDFDB.encodeToHTML(censoredReplace);
|
||||
strings[i] = BDFDB.StringUtils.htmlEscape(censoredReplace);
|
||||
if (strings[i+1] && strings[i+1].indexOf("<input") == 0) {
|
||||
strings[i+1] = "";
|
||||
if (strings[i-1] && strings[i-1].indexOf("<span") == 0) strings[i-1] = "";
|
||||
|
@ -396,7 +396,7 @@ class ChatFilter {
|
|||
url = url ? url.split('"')[0] : null;
|
||||
if (reg.test(url)) {
|
||||
censored = true;
|
||||
strings = [BDFDB.encodeToHTML(censoredReplace)];
|
||||
strings = [BDFDB.StringUtils.htmlEscape(censoredReplace)];
|
||||
}
|
||||
}
|
||||
else if (string.indexOf("<") != 0) {
|
||||
|
@ -405,7 +405,7 @@ class ChatFilter {
|
|||
let wordWithoutSpecial = word.replace(/[\?\¿\!\¡\.\"]/g, "");
|
||||
if (word && reg.test(word) || wordWithoutSpecial && reg.test(wordWithoutSpecial)) {
|
||||
censored = true;
|
||||
newstring.push(BDFDB.encodeToHTML(censoredReplace));
|
||||
newstring.push(BDFDB.StringUtils.htmlEscape(censoredReplace));
|
||||
}
|
||||
else {
|
||||
newstring.push(word);
|
||||
|
@ -418,7 +418,7 @@ class ChatFilter {
|
|||
if (censored) {
|
||||
newhtml = strings.join("");
|
||||
message.innerHTML = newhtml;
|
||||
BDFDB.addClass(message, "censored");
|
||||
BDFDB.DOMUtils.addClass(message, "censored");
|
||||
message.ChatFilterOriginalHTML = orightml;
|
||||
message.ChatFilterNewHTML = newhtml;
|
||||
|
||||
|
@ -430,7 +430,7 @@ class ChatFilter {
|
|||
}
|
||||
|
||||
createReg (word, config) {
|
||||
return new RegExp(BDFDB.encodeToHTML(config.exact ? "^" + BDFDB.regEscape(word) + "$" : BDFDB.regEscape(word)), config.case ? "" : "i");
|
||||
return new RegExp(BDFDB.StringUtils.htmlEscape(config.exact ? "^" + BDFDB.StringUtils.regEscape(word) + "$" : BDFDB.StringUtils.regEscape(word)), config.case ? "" : "i");
|
||||
}
|
||||
|
||||
testForEmoji (string, reg) {
|
||||
|
@ -443,8 +443,8 @@ class ChatFilter {
|
|||
|
||||
resetMessage (message) {
|
||||
message.innerHTML = message.ChatFilterOriginalHTML;
|
||||
BDFDB.removeClass(message, "blocked", "censored", "revealed");
|
||||
BDFDB.toggleEles(message, true);
|
||||
BDFDB.DOMUtils.removeClass(message, "blocked", "censored", "revealed");
|
||||
BDFDB.DOMUtils.show(message);
|
||||
delete message.ChatFilterOriginalHTML;
|
||||
delete message.ChatFilterNewHTML;
|
||||
message.removeEventListener("click", message.clickChatFilterListener);
|
||||
|
@ -454,12 +454,12 @@ class ChatFilter {
|
|||
message.removeEventListener("click", message.clickChatFilterListener);
|
||||
if (addListener) {
|
||||
message.clickChatFilterListener = () => {
|
||||
if (BDFDB.containsClass(message, "revealed")) {
|
||||
BDFDB.removeClass(message, "revealed");
|
||||
if (BDFDB.DOMUtils.containsClass(message, "revealed")) {
|
||||
BDFDB.DOMUtils.removeClass(message, "revealed");
|
||||
message.innerHTML = message.ChatFilterNewHTML;
|
||||
}
|
||||
else {
|
||||
BDFDB.addClass(message, "revealed");
|
||||
BDFDB.DOMUtils.addClass(message, "revealed");
|
||||
message.innerHTML = message.ChatFilterOriginalHTML;
|
||||
}
|
||||
};
|
||||
|
@ -468,7 +468,7 @@ class ChatFilter {
|
|||
}
|
||||
|
||||
openAddModal (wordvalue) {
|
||||
let chatfilterAddModal = BDFDB.htmlToElement(this.chatfilterAddModalMarkup);
|
||||
let chatfilterAddModal = BDFDB.DOMUtils.create(this.chatfilterAddModalMarkup);
|
||||
let wordvalueinput = chatfilterAddModal.querySelector("#input-wordvalue");
|
||||
let replacevalueinput = chatfilterAddModal.querySelector("#input-replacevalue");
|
||||
let addbutton = chatfilterAddModal.querySelector(".btn-add");
|
||||
|
@ -480,20 +480,20 @@ class ChatFilter {
|
|||
wordvalueinput.addEventListener("input", () => {
|
||||
if (!wordvalueinput.value.trim()) {
|
||||
addbutton.disabled = true;
|
||||
BDFDB.addClass(wordvalueinput, "invalid");
|
||||
BDFDB.DOMUtils.addClass(wordvalueinput, "invalid");
|
||||
addbutton.style.setProperty("pointer-events", "none", "important");
|
||||
BDFDB.TooltipUtils.create(wordvalueinput, "Choose a Wordvalue", {type: "right", color: "red", selector: "chatfilter-disabled-tooltip"});
|
||||
}
|
||||
else {
|
||||
addbutton.disabled = false;
|
||||
BDFDB.removeClass(wordvalueinput, "invalid");
|
||||
BDFDB.DOMUtils.removeClass(wordvalueinput, "invalid");
|
||||
addbutton.style.removeProperty("pointer-events");
|
||||
BDFDB.removeEles(".chatfilter-disabled-tooltip");
|
||||
BDFDB.DOMUtils.remove(".chatfilter-disabled-tooltip");
|
||||
}
|
||||
});
|
||||
|
||||
BDFDB.ListenerUtils.addToChildren(chatfilterAddModal, "click", BDFDB.dotCNC.backdrop + BDFDB.dotCNC.modalclose + ".btn-add", () => {
|
||||
BDFDB.removeEles(".chatfilter-disabled-tooltip");
|
||||
BDFDB.DOMUtils.remove(".chatfilter-disabled-tooltip");
|
||||
});
|
||||
|
||||
addbutton.addEventListener("click", e => {
|
||||
|
|
|
@ -66,7 +66,7 @@ class CompleteTimestamps {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -111,7 +111,7 @@ class CompleteTimestamps {
|
|||
BDFDB.ListenerUtils.add(this, document, "mouseenter", BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagecontent, e => {
|
||||
if (BDFDB.DataUtils.get(this, "settings", "showOnHover")) {
|
||||
let message = e.currentTarget;
|
||||
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, message);
|
||||
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, message);
|
||||
if (!messagegroup || !messagegroup.tagName) return;
|
||||
let info = this.getMessageData(message, messagegroup);
|
||||
if (!info || !info.timestamp || !info.timestamp._i) return;
|
||||
|
@ -139,10 +139,10 @@ class CompleteTimestamps {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".complete-timestamp-divider");
|
||||
BDFDB.removeClasses("complete-timestamp");
|
||||
BDFDB.DOMUtils.remove(".complete-timestamp-divider");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("complete-timestamp");
|
||||
|
||||
BDFDB.removeLocalStyle(this.name + "CompactCorrection");
|
||||
BDFDB.DOMUtils.removeLocalStyle(this.name + "CompactCorrection");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -169,9 +169,9 @@ class CompleteTimestamps {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
saveSelectChoice (selectWrap, type, choice) {
|
||||
|
@ -206,13 +206,13 @@ class CompleteTimestamps {
|
|||
}
|
||||
|
||||
changeTimestamp (stamp) {
|
||||
if (!stamp.className || stamp.className.toLowerCase().indexOf("timestamp") == -1 || BDFDB.containsClass(stamp, "complete-timestamp")) return;
|
||||
if (!stamp.className || stamp.className.toLowerCase().indexOf("timestamp") == -1 || BDFDB.DOMUtils.containsClass(stamp, "complete-timestamp")) return;
|
||||
let time = stamp.getAttribute("datetime");
|
||||
if (time) {
|
||||
this.setMaxWidth();
|
||||
BDFDB.addClass(stamp, "complete-timestamp");
|
||||
stamp.parentElement.insertBefore(BDFDB.htmlToElement(`<span class="complete-timestamp-divider arabic-fix" style="display: inline !important; height: 0 !important; width: 0 !important; font-size: 0 !important; user-select: none !important;">ARABIC FIX</span>`), stamp);
|
||||
BDFDB.setInnerText(stamp, this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices", "creationDateLang")].id, time));
|
||||
BDFDB.DOMUtils.addClass(stamp, "complete-timestamp");
|
||||
stamp.parentElement.insertBefore(BDFDB.DOMUtils.create(`<span class="complete-timestamp-divider arabic-fix" style="display: inline !important; height: 0 !important; width: 0 !important; font-size: 0 !important; user-select: none !important;">ARABIC FIX</span>`), stamp);
|
||||
BDFDB.DOMUtils.setText(stamp, this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices", "creationDateLang")].id, time));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,11 +284,11 @@ class CompleteTimestamps {
|
|||
let timestamp = document.querySelector(BDFDB.dotCN.messagetimestampcompact);
|
||||
if (timestamp) {
|
||||
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
|
||||
let testtimestamp = BDFDB.htmlToElement(`<time class="${timestamp.className}" style="width: auto !important;">${this.getTimestamp(this.languages[choice].id, new Date(253402124399995))}</time>`);
|
||||
let testtimestamp = BDFDB.DOMUtils.create(`<time class="${timestamp.className}" style="width: auto !important;">${this.getTimestamp(this.languages[choice].id, new Date(253402124399995))}</time>`);
|
||||
document.body.appendChild(testtimestamp);
|
||||
let width = BDFDB.getRects(testtimestamp).width + 5;
|
||||
let width = BDFDB.DOMUtils.getRects(testtimestamp).width + 5;
|
||||
testtimestamp.remove();
|
||||
BDFDB.appendLocalStyle(this.name + "CompactCorrection", `
|
||||
BDFDB.DOMUtils.appendLocalStyle(this.name + "CompactCorrection", `
|
||||
${BDFDB.dotCN.messagetimestampcompact} {
|
||||
width: ${width}px !important;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ class CompleteTimestamps {
|
|||
}
|
||||
`);
|
||||
}
|
||||
else BDFDB.removeLocalStyle(this.name + "CompactCorrection");
|
||||
else BDFDB.DOMUtils.removeLocalStyle(this.name + "CompactCorrection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class CopyRawMessage {
|
|||
children: [
|
||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||
hint: BDFDB.BdUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BdUtils.getPlugin("MessageUtilities").getActiveShortcutString("Copy_Raw") : null,
|
||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("Copy_Raw") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-copyraw-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
|
@ -100,7 +100,7 @@ class CopyRawMessage {
|
|||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.ReactUtils.getValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
let optionPopoutButton = BDFDB.DOMUtils.create(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class CreationDate {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -137,7 +137,7 @@ class CreationDate {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".creationDate");
|
||||
BDFDB.DOMUtils.remove(".creationDate");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -162,9 +162,9 @@ class CreationDate {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
saveSelectChoice (selectWrap, type, choice) {
|
||||
|
@ -195,18 +195,18 @@ class CreationDate {
|
|||
if (!info || !container || container.querySelector(".creationDate")) return;
|
||||
let addTimestamp = (timestamp) => {
|
||||
if (document.contains(container)) {
|
||||
BDFDB.removeEles(container.querySelectorAll(".creationDate"));
|
||||
BDFDB.DOMUtils.remove(container.querySelectorAll(".creationDate"));
|
||||
if (BDFDB.ObjectUtils.is(container.CreationDateObserver)) container.CreationDateObserver.disconnect();
|
||||
let choice = BDFDB.DataUtils.get(this, "choices", "creationDateLang");
|
||||
let nametag = container.querySelector(BDFDB.dotCN.nametag);
|
||||
container.insertBefore(BDFDB.htmlToElement(`<div class="creationDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 8 !important;"><div class="BDFDB-textscroll">${this.labels.createdat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
container.insertBefore(BDFDB.DOMUtils.create(`<div class="creationDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.DOMUtils.getRects(BDFDB.DOMUtils.getParent(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 8 !important;"><div class="BDFDB-textscroll">${this.labels.createdat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
BDFDB.initElements(container, this);
|
||||
if (popout && popout.style.transform.indexOf("translateY(-1") == -1) {
|
||||
let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.getRects(popout);
|
||||
let arect = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.DOMUtils.getRects(popout);
|
||||
popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
|
||||
}
|
||||
container.CreationDateObserver = new MutationObserver((changes, _) => {changes.forEach((change, i) => {change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
});});});
|
||||
container.CreationDateObserver.observe(container, {childList: true, subtree:true});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class DisplayServersAsChannels {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -82,17 +82,17 @@ class DisplayServersAsChannels {
|
|||
if (this.started) return;
|
||||
BDFDB.PluginUtils.init(this);
|
||||
|
||||
BDFDB.addClass(document.body, "DSAC-styled");
|
||||
BDFDB.DOMUtils.addClass(document.body, "DSAC-styled");
|
||||
|
||||
this.addCSS();
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
|
||||
BDFDB.ListenerUtils.add(this, document, "mouseenter", BDFDB.dotCN.guildouter, e => {
|
||||
if (e.currentTarget.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *")) BDFDB.appendLocalStyle("HideAllToolTips" + this.name, `${BDFDB.dotCN.tooltip} {display: none !important;}`);
|
||||
if (e.currentTarget.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *")) BDFDB.DOMUtils.appendLocalStyle("HideAllToolTips" + this.name, `${BDFDB.dotCN.tooltip} {display: none !important;}`);
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, document, "mouseleave", BDFDB.dotCN.guildouter, e => {
|
||||
if (e.currentTarget.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *") && !document.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *:hover")) BDFDB.removeLocalStyle("HideAllToolTips" + this.name);
|
||||
if (e.currentTarget.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *") && !document.querySelector(BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill + "+ *:hover")) BDFDB.DOMUtils.removeLocalStyle("HideAllToolTips" + this.name);
|
||||
});
|
||||
}
|
||||
else console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
|
||||
|
@ -102,12 +102,12 @@ class DisplayServersAsChannels {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeClasses("DSAC-styled");
|
||||
BDFDB.removeEles(".DSAC-verification-badge, .DSAC-name, .DSAC-icon");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("DSAC-styled");
|
||||
BDFDB.DOMUtils.remove(".DSAC-verification-badge, .DSAC-name, .DSAC-icon");
|
||||
|
||||
BDFDB.removeLocalStyle("HideAllToolTips" + this.name);
|
||||
BDFDB.DOMUtils.removeLocalStyle("HideAllToolTips" + this.name);
|
||||
|
||||
BDFDB.removeLocalStyle("DSACStyle" + this.name);
|
||||
BDFDB.DOMUtils.removeLocalStyle("DSACStyle" + this.name);
|
||||
|
||||
for (let changedSVG of document.querySelectorAll(BDFDB.dotCN.guildsvg + "[DSAC-oldViewBox")) {
|
||||
changedSVG.setAttribute("viewBox", changedSVG.getAttribute("DSAC-oldViewBox"));
|
||||
|
@ -123,7 +123,7 @@ class DisplayServersAsChannels {
|
|||
|
||||
processGuilds (instance, wrapper, returnvalue) {
|
||||
var observer = new MutationObserver((changes, _) => {changes.forEach((change, i) => {if (change.addedNodes) {change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.guildouter) && !node.querySelector(BDFDB.dotCN.guildserror)) {
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.guildouter) && !node.querySelector(BDFDB.dotCN.guildserror)) {
|
||||
this.changeServer(BDFDB.GuildUtils.getData(node));
|
||||
}
|
||||
if (node && node.tagName && (node = node.querySelector(BDFDB.dotCN.guildbuttoncontainer)) != null) {
|
||||
|
@ -160,8 +160,8 @@ class DisplayServersAsChannels {
|
|||
if (!info || !info.div) return;
|
||||
var guildfoldericonwrapper = info.div.querySelector(BDFDB.dotCNC.guildfoldericonwrapperexpanded + BDFDB.dotCN.guildfoldericonwrapperclosed);
|
||||
if (guildfoldericonwrapper) {
|
||||
BDFDB.removeEles(guildfoldericonwrapper.parentElement.querySelectorAll(".DSAC-name"));
|
||||
guildfoldericonwrapper.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(info.folderName || BDFDB.LanguageUtils.LanguageStrings.GUILD_FOLDER_NAME)}</div>`), guildfoldericonwrapper);
|
||||
BDFDB.DOMUtils.remove(guildfoldericonwrapper.parentElement.querySelectorAll(".DSAC-name"));
|
||||
guildfoldericonwrapper.parentElement.insertBefore(BDFDB.DOMUtils.create(`<div class="DSAC-name">${BDFDB.StringUtils.htmlEscape(info.folderName || BDFDB.LanguageUtils.LanguageStrings.GUILD_FOLDER_NAME)}</div>`), guildfoldericonwrapper);
|
||||
}
|
||||
this.changeSVG(info.div);
|
||||
}
|
||||
|
@ -170,11 +170,11 @@ class DisplayServersAsChannels {
|
|||
if (!info || !info.div) return;
|
||||
var guildsvg = info.div.querySelector(BDFDB.dotCN.guildsvg);
|
||||
if (guildsvg) {
|
||||
BDFDB.removeEles(guildsvg.parentElement.querySelectorAll(".DSAC-verification-badge, .DSAC-name"));
|
||||
BDFDB.DOMUtils.remove(guildsvg.parentElement.querySelectorAll(".DSAC-verification-badge, .DSAC-name"));
|
||||
if (info.features && info.features.has("VERIFIED")) {
|
||||
guildsvg.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), guildsvg);
|
||||
guildsvg.parentElement.insertBefore(BDFDB.DOMUtils.create(this.verificationBadgeMarkup), guildsvg);
|
||||
}
|
||||
guildsvg.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(info.name || "")}</div>`), guildsvg);
|
||||
guildsvg.parentElement.insertBefore(BDFDB.DOMUtils.create(`<div class="DSAC-name">${BDFDB.StringUtils.htmlEscape(info.name || "")}</div>`), guildsvg);
|
||||
}
|
||||
this.changeSVG(info.div);
|
||||
}
|
||||
|
@ -183,8 +183,8 @@ class DisplayServersAsChannels {
|
|||
if (!div) return;
|
||||
var homebutton = div.querySelector(BDFDB.dotCN.guildiconchildwrapper);
|
||||
if (homebutton) {
|
||||
BDFDB.removeEles(homebutton.querySelectorAll(".DSAC-name"));
|
||||
homebutton.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(BDFDB.LanguageUtils.LanguageStrings.HOME)}</div>`), homebutton.firstElementChild);
|
||||
BDFDB.DOMUtils.remove(homebutton.querySelectorAll(".DSAC-name"));
|
||||
homebutton.insertBefore(BDFDB.DOMUtils.create(`<div class="DSAC-name">${BDFDB.StringUtils.htmlEscape(BDFDB.LanguageUtils.LanguageStrings.HOME)}</div>`), homebutton.firstElementChild);
|
||||
}
|
||||
this.changeSVG(div);
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ class DisplayServersAsChannels {
|
|||
if (!div) return;
|
||||
var guildbuttoninner = div.querySelector(BDFDB.dotCN.guildbuttoninner);
|
||||
if (guildbuttoninner) {
|
||||
BDFDB.removeEles(guildbuttoninner.querySelectorAll(".DSAC-name"));
|
||||
guildbuttoninner.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(BDFDB.ReactUtils.findValue(div, "text", {up:true}) || "")}</div>`), guildbuttoninner.firstElementChild);
|
||||
BDFDB.DOMUtils.remove(guildbuttoninner.querySelectorAll(".DSAC-name"));
|
||||
guildbuttoninner.insertBefore(BDFDB.DOMUtils.create(`<div class="DSAC-name">${BDFDB.StringUtils.htmlEscape(BDFDB.ReactUtils.findValue(div, "text", {up:true}) || "")}</div>`), guildbuttoninner.firstElementChild);
|
||||
}
|
||||
this.changeSVG(div);
|
||||
}
|
||||
|
@ -209,14 +209,14 @@ class DisplayServersAsChannels {
|
|||
|
||||
changeError (div) {
|
||||
if (!div) return;
|
||||
BDFDB.removeEles(div.querySelectorAll(".DSAC-name, .DSAC-icon"));
|
||||
div.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">Server Outage</div>`), div.firstChild);
|
||||
div.appendChild(BDFDB.htmlToElement(`<div class="DSAC-icon">!</div>`));
|
||||
BDFDB.DOMUtils.remove(div.querySelectorAll(".DSAC-name, .DSAC-icon"));
|
||||
div.insertBefore(BDFDB.DOMUtils.create(`<div class="DSAC-name">Server Outage</div>`), div.firstChild);
|
||||
div.appendChild(BDFDB.DOMUtils.create(`<div class="DSAC-icon">!</div>`));
|
||||
}
|
||||
|
||||
addCSS () {
|
||||
var listwidth = BDFDB.DataUtils.get(this, "amounts", "serverListWidth");
|
||||
BDFDB.appendLocalStyle("DSACStyle" + this.name, `
|
||||
BDFDB.DOMUtils.appendLocalStyle("DSACStyle" + this.name, `
|
||||
.DSAC-styled ${BDFDB.dotCN.guildswrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildsscrollerwrap},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guilds},
|
||||
|
|
|
@ -129,7 +129,7 @@ class EditChannels {
|
|||
try {this.forceUpdateAll();} catch (err) {}
|
||||
BDFDB.DataUtils.save(data, this, "channels");
|
||||
|
||||
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class EditChannels {
|
|||
// begin of own functions
|
||||
|
||||
onChannelContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.channel && !BDFDB.getParentEle(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
if (instance.props && instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
|
||||
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
|
@ -235,7 +235,7 @@ class EditChannels {
|
|||
|
||||
data.name = channelnameinput.value.trim() || null;
|
||||
|
||||
data.color = BDFDB.getSwatchColor(modal, 1);
|
||||
data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
|
||||
console.log(data.color);
|
||||
if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
|
||||
if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
|
||||
|
@ -267,7 +267,7 @@ class EditChannels {
|
|||
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
|
||||
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
|
||||
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditChannelsRow")) {
|
||||
if (BDFDB.DOMUtils.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditChannelsRow")) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
this.swapWordWithMention(textarea);
|
||||
}
|
||||
|
@ -275,12 +275,12 @@ class EditChannels {
|
|||
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
|
||||
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditChannelsSelector)");
|
||||
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
|
||||
if (BDFDB.containsClass(selected, "autocompleteEditChannelsSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteEditChannelsSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
|
||||
|
@ -292,7 +292,7 @@ class EditChannels {
|
|||
textarea.EditChannelsAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100);
|
||||
}
|
||||
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, textarea, "click", e => {
|
||||
if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);});
|
||||
|
@ -344,11 +344,11 @@ class EditChannels {
|
|||
else {
|
||||
if (channel.type == 1) channel = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]) || channel;
|
||||
if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
|
||||
if (BDFDB.BdUtils.isPluginEnabled("EditUsers")) BDFDB.BdUtils.getPlugin("EditUsers").changeName(channel, channelname);
|
||||
if (BDFDB.BDUtils.isPluginEnabled("EditUsers")) BDFDB.BDUtils.getPlugin("EditUsers").changeName(channel, channelname);
|
||||
else {
|
||||
channelname.style.removeProperty("color");
|
||||
channelname.style.removeProperty("background");
|
||||
BDFDB.setInnerText(channelname, channel.name || channel.username);
|
||||
BDFDB.DOMUtils.setText(channelname, channel.name || channel.username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ class EditChannels {
|
|||
let title = document.head.querySelector("title");
|
||||
if (title && channel && channel.type != 1) {
|
||||
let data = this.getChannelData(channel.id, channel.parent_id, title);
|
||||
BDFDB.setInnerText(title, "@" + (data.name || channel.name));
|
||||
BDFDB.DOMUtils.setText(title, "@" + (data.name || channel.name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,23 +423,23 @@ class EditChannels {
|
|||
let color = this.chooseColor(channelname, data.color);
|
||||
if (isgradient) {
|
||||
channelname.style.setProperty("color", BDFDB.ColorUtils.convert(data.color[Object.keys(data.color)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(channelname, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(color)} !important;">${BDFDB.encodeToHTML(data.name || info.name)}</span>`));
|
||||
BDFDB.DOMUtils.setText(channelname, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(color)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.name)}</span>`));
|
||||
}
|
||||
else {
|
||||
channelname.style.setProperty("color", color, "important");
|
||||
BDFDB.setInnerText(channelname, data.name || info.name);
|
||||
BDFDB.DOMUtils.setText(channelname, data.name || info.name);
|
||||
}
|
||||
let iconparent = BDFDB.containsClass(channelname, BDFDB.disCN.quickswitchresultmatch) ? channelname.parentElement.parentElement : channelname.parentElement;
|
||||
if (!BDFDB.containsClass(channelname, BDFDB.disCN.autocompletedescription)) {
|
||||
let iconparent = BDFDB.DOMUtils.containsClass(channelname, BDFDB.disCN.quickswitchresultmatch) ? channelname.parentElement.parentElement : channelname.parentElement;
|
||||
if (!BDFDB.DOMUtils.containsClass(channelname, BDFDB.disCN.autocompletedescription)) {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
iconparent.querySelectorAll('svg [stroke]:not([stroke="none"]').forEach(icon => {
|
||||
let iconcolor = color && BDFDB.getParentEle(BDFDB.dotCN.channelheadertitle, icon) ? BDFDB.ColorUtils.setAlpha(isgradient ? color[0] : color, 0.6) : (isgradient ? color[0] : color);
|
||||
let iconcolor = color && BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelheadertitle, icon) ? BDFDB.ColorUtils.setAlpha(isgradient ? color[0] : color, 0.6) : (isgradient ? color[0] : color);
|
||||
if (!icon.getAttribute("oldstroke")) icon.setAttribute("oldstroke", icon.getAttribute("stroke"));
|
||||
icon.setAttribute("stroke", iconcolor && settings.changeChannelIcon ? iconcolor : icon.getAttribute("oldstroke"), "important");
|
||||
icon.style.setProperty("stroke", iconcolor && settings.changeChannelIcon ? iconcolor : icon.getAttribute("oldstroke"), "important");
|
||||
});
|
||||
iconparent.querySelectorAll('svg [fill]:not([fill="none"]').forEach(icon => {
|
||||
let iconcolor = color && BDFDB.getParentEle(BDFDB.dotCN.channelheadertitle, icon) ? BDFDB.ColorUtils.setAlpha(isgradient ? color[0] : color, 0.6) : (isgradient ? color[0] : color);
|
||||
let iconcolor = color && BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelheadertitle, icon) ? BDFDB.ColorUtils.setAlpha(isgradient ? color[0] : color, 0.6) : (isgradient ? color[0] : color);
|
||||
if (!icon.getAttribute("oldfill")) icon.setAttribute("oldfill", icon.getAttribute("fill"));
|
||||
icon.setAttribute("fill", iconcolor && settings.changeChannelIcon ? iconcolor : icon.getAttribute("oldfill"), "important");
|
||||
icon.style.setProperty("fill", iconcolor && settings.changeChannelIcon ? iconcolor : icon.getAttribute("oldfill"), "important");
|
||||
|
@ -452,7 +452,7 @@ class EditChannels {
|
|||
channelname.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
|
||||
changes.forEach(
|
||||
(change, i) => {
|
||||
if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1 || change.type == "attributes" && change.attributeName == "style" && BDFDB.containsClass(change.target, BDFDB.disCN.channelheaderheaderbartitle)) {
|
||||
if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1 || change.type == "attributes" && change.attributeName == "style" && BDFDB.DOMUtils.containsClass(change.target, BDFDB.disCN.channelheaderheaderbartitle)) {
|
||||
channelname.EditChannelsChangeObserver.disconnect();
|
||||
this.changeChannel(info, channelname);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ class EditChannels {
|
|||
}
|
||||
change();
|
||||
if (hoverlistener) {
|
||||
let wrapper = info.type == 4 ? BDFDB.getParentEle(BDFDB.dotCN.categorywrapper, channelname) : BDFDB.getParentEle(BDFDB.dotCN.channelwrapper, channelname);
|
||||
let wrapper = info.type == 4 ? BDFDB.DOMUtils.getParent(BDFDB.dotCN.categorywrapper, channelname) : BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelwrapper, channelname);
|
||||
if (wrapper) {
|
||||
wrapper.removeEventListener("mouseover", wrapper.mouseoverListenerEditChannels);
|
||||
wrapper.removeEventListener("mouseout", wrapper.mouseoutListenerEditChannels);
|
||||
|
@ -491,11 +491,11 @@ class EditChannels {
|
|||
if (data.name || data.color || channelname.getAttribute("changed-by-editchannels")) {
|
||||
if (BDFDB.ObjectUtils.is(data.color)) {
|
||||
channelname.style.setProperty("color", BDFDB.ColorUtils.convert(data.color[Object.keys(data.color)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(channelname, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(this.chooseColor(channelname, data.color))} !important;">${BDFDB.encodeToHTML("#" + (data.name || info.name))}</span>`));
|
||||
BDFDB.DOMUtils.setText(channelname, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(this.chooseColor(channelname, data.color))} !important;">${BDFDB.StringUtils.htmlEscape("#" + (data.name || info.name))}</span>`));
|
||||
}
|
||||
else {
|
||||
channelname.style.setProperty("color", this.chooseColor(channelname, data.color), "important");
|
||||
BDFDB.setInnerText(channelname, "#" + (data.name || info.name));
|
||||
BDFDB.DOMUtils.setText(channelname, "#" + (data.name || info.name));
|
||||
}
|
||||
if (data.name || data.color) {
|
||||
channelname.setAttribute("changed-by-editchannels", true);
|
||||
|
@ -551,24 +551,24 @@ class EditChannels {
|
|||
mention.style.setProperty("background", color0_1, "important");
|
||||
if (isgradient) {
|
||||
mention.style.setProperty("color", BDFDB.ColorUtils.convert(data.color[Object.keys(data.color)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(mention, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${color} !important;">${BDFDB.encodeToHTML(name)}</span>`));
|
||||
BDFDB.DOMUtils.setText(mention, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${color} !important;">${BDFDB.StringUtils.htmlEscape(name)}</span>`));
|
||||
}
|
||||
else {
|
||||
mention.style.setProperty("color", color, "important");
|
||||
BDFDB.setInnerText(mention, name);
|
||||
BDFDB.DOMUtils.setText(mention, name);
|
||||
}
|
||||
}
|
||||
function colorHover() {
|
||||
mention.style.setProperty("background", color0_7, "important");
|
||||
mention.style.setProperty("color", data.color ? "#FFFFFF" : null, "important");
|
||||
BDFDB.setInnerText(mention, name);
|
||||
BDFDB.DOMUtils.setText(mention, name);
|
||||
}
|
||||
}
|
||||
|
||||
chooseColor (channelname, color) {
|
||||
if (color && channelname) {
|
||||
let hovered = channelname.EditChannelsHovered;
|
||||
channelname = BDFDB.containsClass(channelname, BDFDB.disCN.channelname) ? channelname.parentElement.parentElement : channelname;
|
||||
channelname = BDFDB.DOMUtils.containsClass(channelname, BDFDB.disCN.channelname) ? channelname.parentElement.parentElement : channelname;
|
||||
let classname = channelname.className ? channelname.className.toLowerCase() : "";
|
||||
if (classname.indexOf("muted") > -1 || classname.indexOf("locked") > -1) color = BDFDB.ColorUtils.change(color, -0.5);
|
||||
else if (hovered || classname.indexOf("selected") > -1 || classname.indexOf("hovered") > -1 || classname.indexOf("unread") > -1 || classname.indexOf("connected") > -1) color = BDFDB.ColorUtils.change(color, 0.5);
|
||||
|
@ -590,15 +590,15 @@ class EditChannels {
|
|||
}
|
||||
if (allenabled) return data;
|
||||
let key = null;
|
||||
if (BDFDB.getParentEle(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
|
||||
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mentionwrapper)) key = "changeInMentions";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.guildchannels, wrapper)) key = "changeInChannelList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInChannelHeader";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.recentmentionspopout, wrapper)) key = "changeInRecentMentions";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.guildsettingsinvitecard, wrapper)) key = "changeInInviteLog";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
|
||||
else if (BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mentionwrapper)) key = "changeInMentions";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildchannels, wrapper)) key = "changeInChannelList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInChannelHeader";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.recentmentionspopout, wrapper)) key = "changeInRecentMentions";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsinvitecard, wrapper)) key = "changeInInviteLog";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
|
||||
return !key || settings[key] ? data : {};
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ class EditChannels {
|
|||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
|
||||
if (!autocompletemenu) {
|
||||
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditChannels"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.TEXT_CHANNELS_MATCHING.replace("{{prefix}}", BDFDB.encodeToHTML(lastword))}</strong></div></div></div></div></div>`);
|
||||
autocompletemenu = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditChannels"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.TEXT_CHANNELS_MATCHING.replace("{{prefix}}", BDFDB.StringUtils.htmlEscape(lastword))}</strong></div></div></div></div></div>`);
|
||||
textarea.parentElement.appendChild(autocompletemenu);
|
||||
autocompletemenu = autocompletemenu.firstElementChild;
|
||||
}
|
||||
|
@ -632,21 +632,21 @@ class EditChannels {
|
|||
|
||||
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
|
||||
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
});
|
||||
|
||||
for (let data of channelarray) {
|
||||
if (amount-- < 1) break;
|
||||
let color = BDFDB.ColorUtils.convert(data.color, "RGBA");
|
||||
let catcolor = BDFDB.ColorUtils.convert(data.catdata.color, "RGBA");
|
||||
let autocompleterow = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div channelid="${data.channel.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="${BDFDB.disCN.autocompleteicon}"><path class="${BDFDB.disCN.autocompleteiconforeground}" d="M2.27333333,12 L2.74666667,9.33333333 L0.08,9.33333333 L0.313333333,8 L2.98,8 L3.68666667,4 L1.02,4 L1.25333333,2.66666667 L3.92,2.66666667 L4.39333333,0 L5.72666667,0 L5.25333333,2.66666667 L9.25333333,2.66666667 L9.72666667,0 L11.06,0 L10.5866667,2.66666667 L13.2533333,2.66666667 L13.02,4 L10.3533333,4 L9.64666667,8 L12.3133333,8 L12.08,9.33333333 L9.41333333,9.33333333 L8.94,12 L7.60666667,12 L8.08,9.33333333 L4.08,9.33333333 L3.60666667,12 L2.27333333,12 L2.27333333,12 Z M5.02,4 L4.31333333,8 L8.31333333,8 L9.02,4 L5.02,4 L5.02,4 Z" transform="translate(1.333 2)" ${settings.changeChannelIcon && color ? ('fill="' + color + '" oldfill="currentColor" style="fill: ' + color + ' !important;"') : 'fill="currentColor"'}></path></svg><div class="${BDFDB.disCN.marginleft4}" changed-by-editchannels="true" style="flex: 1 1 auto;${color ? (' color: ' + color + ' !important;') : ''}">${BDFDB.encodeToHTML(data.name || data.channel.name)}</div>${data.category ? '<div class="${BDFDB.disCN.autocompletedescription}"' + (catcolor ? (' style="color: ' + catcolor + ' !important;"') : '') + '>' + BDFDB.encodeToHTML(data.catdata.name || data.category.name) + '</div>' : ''}</div></div></div>`);
|
||||
let autocompleterow = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditChannelsRow"><div channelid="${data.channel.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditChannelsSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="${BDFDB.disCN.autocompleteicon}"><path class="${BDFDB.disCN.autocompleteiconforeground}" d="M2.27333333,12 L2.74666667,9.33333333 L0.08,9.33333333 L0.313333333,8 L2.98,8 L3.68666667,4 L1.02,4 L1.25333333,2.66666667 L3.92,2.66666667 L4.39333333,0 L5.72666667,0 L5.25333333,2.66666667 L9.25333333,2.66666667 L9.72666667,0 L11.06,0 L10.5866667,2.66666667 L13.2533333,2.66666667 L13.02,4 L10.3533333,4 L9.64666667,8 L12.3133333,8 L12.08,9.33333333 L9.41333333,9.33333333 L8.94,12 L7.60666667,12 L8.08,9.33333333 L4.08,9.33333333 L3.60666667,12 L2.27333333,12 L2.27333333,12 Z M5.02,4 L4.31333333,8 L8.31333333,8 L9.02,4 L5.02,4 L5.02,4 Z" transform="translate(1.333 2)" ${settings.changeChannelIcon && color ? ('fill="' + color + '" oldfill="currentColor" style="fill: ' + color + ' !important;"') : 'fill="currentColor"'}></path></svg><div class="${BDFDB.disCN.marginleft4}" changed-by-editchannels="true" style="flex: 1 1 auto;${color ? (' color: ' + color + ' !important;') : ''}">${BDFDB.StringUtils.htmlEscape(data.name || data.channel.name)}</div>${data.category ? '<div class="${BDFDB.disCN.autocompletedescription}"' + (catcolor ? (' style="color: ' + catcolor + ' !important;"') : '') + '>' + BDFDB.StringUtils.htmlEscape(data.catdata.name || data.category.name) + '</div>' : ''}</div></div></div>`);
|
||||
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithMention(textarea);});
|
||||
autocompletemenu.appendChild(autocompleterow);
|
||||
}
|
||||
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
|
||||
BDFDB.addClass(autocompletemenu.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(autocompletemenu.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ class EditChannels {
|
|||
let words = textarea.value.split(/\s/);
|
||||
let lastword = words[words.length-1].trim();
|
||||
if (channelid && lastword) {
|
||||
BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
|
||||
textarea.focus();
|
||||
textarea.selectionStart = textarea.value.length - lastword.length;
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
|
|
@ -180,10 +180,10 @@ class EditServers {
|
|||
|
||||
processGuildIconWrapper (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
let icon = wrapper.classList && BDFDB.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
|
||||
let icon = wrapper.classList && BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
|
||||
if (!icon) return;
|
||||
this.changeGuildIcon(instance.props.guild, icon);
|
||||
if (BDFDB.getParentEle(BDFDB.dotCN.friendscolumn, icon)) this.changeTooltip(instance.props.guild, icon.parentElement, "top");
|
||||
if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.friendscolumn, icon)) this.changeTooltip(instance.props.guild, icon.parentElement, "top");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ class EditServers {
|
|||
this.updateGuildSidebar();
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
if (guildid) {
|
||||
let ServerFolders = BDFDB.BdUtils.getPlugin("ServerFolders", true);
|
||||
let ServerFolders = BDFDB.BDUtils.getPlugin("ServerFolders", true);
|
||||
if (ServerFolders) {
|
||||
let folder = ServerFolders.getFolderOfGuildId(guildid);
|
||||
if (folder) ServerFolders.updateGuildInFolderContent(folder.folderId, guildid);
|
||||
|
@ -391,15 +391,15 @@ class EditServers {
|
|||
|
||||
data.name = guildnameinput.value.trim() || null;
|
||||
data.shortName = guildacronyminput.value.trim() || null;
|
||||
data.url = (!data.removeIcon && BDFDB.containsClass(guildiconinput, BDFDB.disCN.inputsuccess) ? guildiconinput.value.trim() : null) || null;
|
||||
data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(guildiconinput, BDFDB.disCN.inputsuccess) ? guildiconinput.value.trim() : null) || null;
|
||||
data.removeIcon = removeiconinput.checked;
|
||||
data.banner = (!data.removeBanner && BDFDB.containsClass(guildbannerinput, BDFDB.disCN.inputsuccess) ? guildbannerinput.value.trim() : null) || null;
|
||||
data.banner = (!data.removeBanner && BDFDB.DOMUtils.containsClass(guildbannerinput, BDFDB.disCN.inputsuccess) ? guildbannerinput.value.trim() : null) || null;
|
||||
data.removeBanner = removebannerinput.checked && info.id != "410787888507256842";
|
||||
|
||||
data.color1 = BDFDB.getSwatchColor(modal, 1);
|
||||
data.color2 = BDFDB.getSwatchColor(modal, 2);
|
||||
data.color3 = BDFDB.getSwatchColor(modal, 3);
|
||||
data.color4 = BDFDB.getSwatchColor(modal, 4);
|
||||
data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
|
||||
data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
|
||||
data.color3 = BDFDB.ColorUtils.getSwatchColor(modal, 3);
|
||||
data.color4 = BDFDB.ColorUtils.getSwatchColor(modal, 4);
|
||||
|
||||
let changed = false;
|
||||
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "servers", info.id);
|
||||
|
@ -414,14 +414,14 @@ class EditServers {
|
|||
let input = BDFDB.ReactUtils.findDOMNode(instance).firstElementChild;
|
||||
clearTimeout(instance.checkTimeout);
|
||||
if (url == null || !url.trim()) {
|
||||
if (input) BDFDB.removeEles(input.tooltip);
|
||||
if (input) BDFDB.DOMUtils.remove(input.tooltip);
|
||||
instance.props.inputClassName = null;
|
||||
instance.forceUpdate();
|
||||
}
|
||||
else instance.checkTimeout = setTimeout(() => {
|
||||
BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
|
||||
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
|
||||
if (input) BDFDB.removeEles(input.tooltip);
|
||||
if (input) BDFDB.DOMUtils.remove(input.tooltip);
|
||||
instance.props.inputClassName = BDFDB.disCN.inputsuccess;
|
||||
}
|
||||
else {
|
||||
|
@ -436,9 +436,9 @@ class EditServers {
|
|||
|
||||
createNoticeTooltip (input, isinvalid = false) {
|
||||
if (!input) return;
|
||||
BDFDB.removeEles(input.tooltip);
|
||||
var invalid = isinvalid || BDFDB.containsClass(input, BDFDB.disCN.inputerror);
|
||||
var valid = invalid ? false : BDFDB.containsClass(input, BDFDB.disCN.inputsuccess);
|
||||
BDFDB.DOMUtils.remove(input.tooltip);
|
||||
var invalid = isinvalid || BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputerror);
|
||||
var valid = invalid ? false : BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputsuccess);
|
||||
if (invalid || valid) input.tooltip = BDFDB.TooltipUtils.create(input, invalid ? this.labels.modal_invalidurl_text : this.labels.modal_validurl_text, {type:"right", selector:"notice-tooltip", color: invalid ? "red" : "green"});
|
||||
}
|
||||
|
||||
|
@ -450,13 +450,13 @@ class EditServers {
|
|||
if (data.name || data.color2 || guildname.getAttribute("changed-by-editservers")) {
|
||||
if (BDFDB.ObjectUtils.is(data.color2)) {
|
||||
guildname.style.setProperty("color", BDFDB.ColorUtils.convert(data.color2[Object.keys(data.color2)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(guildname, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.encodeToHTML(data.name || info.name)}</span>`));
|
||||
BDFDB.DOMUtils.setText(guildname, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.name)}</span>`));
|
||||
}
|
||||
else {
|
||||
guildname.style.setProperty("color", BDFDB.ColorUtils.convert(data.color2, "RGBA"), "important");
|
||||
BDFDB.setInnerText(guildname, data.name || info.name);
|
||||
BDFDB.DOMUtils.setText(guildname, data.name || info.name);
|
||||
}
|
||||
if (data.name && BDFDB.containsClass(guildname, BDFDB.disCN.guildheadername) && BDFDB.DataUtils.get(this, "settings", "addOriginalTooltip")) {
|
||||
if (data.name && BDFDB.DOMUtils.containsClass(guildname, BDFDB.disCN.guildheadername) && BDFDB.DataUtils.get(this, "settings", "addOriginalTooltip")) {
|
||||
guildname.mouseenterListenerEditChannels = () => {
|
||||
BDFDB.TooltipUtils.create(guildname.parentElement, info.name, {type:"right", selector:"EditServers-tooltip", hide:true});
|
||||
};
|
||||
|
@ -482,27 +482,27 @@ class EditServers {
|
|||
let url = data.url || BDFDB.GuildUtils.getIcon(info.id);
|
||||
let name = data.name || info.name || "";
|
||||
let shortname = data.url ? "" : (data.shortName || (info.icon && !data.removeIcon ? "" : info.acronym));
|
||||
if (BDFDB.containsClass(icon.parentElement, BDFDB.disCN.guildiconwrapper)) icon.parentElement.setAttribute("aria-label", name);
|
||||
if (BDFDB.DOMUtils.containsClass(icon.parentElement, BDFDB.disCN.guildiconwrapper)) icon.parentElement.setAttribute("aria-label", name);
|
||||
if (icon.tagName == "IMG") {
|
||||
icon.setAttribute("src", data.removeIcon ? null : url);
|
||||
let removeicon = data.removeIcon && BDFDB.containsClass(icon, BDFDB.disCN.guildicon);
|
||||
BDFDB.toggleEles(icon, !removeicon);
|
||||
BDFDB.removeEles(icon.parentElement.querySelector(".fake-guildacronym"));
|
||||
let removeicon = data.removeIcon && BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.guildicon);
|
||||
BDFDB.DOMUtils.toggle(icon, !removeicon);
|
||||
BDFDB.DOMUtils.remove(icon.parentElement.querySelector(".fake-guildacronym"));
|
||||
if (removeicon) {
|
||||
let fakeicon = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildiconchildwrapper + BDFDB.disCN.guildiconacronym} fake-guildacronym" aria-label="Server Acronym"></div>`);
|
||||
let fakeicon = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.guildiconchildwrapper + BDFDB.disCN.guildiconacronym} fake-guildacronym" aria-label="Server Acronym"></div>`);
|
||||
if (data.color1) {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) fakeicon.style.setProperty("background-image", BDFDB.ColorUtils.createGradient(data.color1));
|
||||
else fakeicon.style.setProperty("background-color", BDFDB.ColorUtils.convert(data.color1, "RGBA"));
|
||||
}
|
||||
if (data.color2) fakeicon.style.setProperty("color", BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color2) ? data.color2[Object.keys(data.color2)[0]] : data.color2, "RGBA"));
|
||||
BDFDB.setInnerText(fakeicon, BDFDB.ObjectUtils.is(data.color2) ? BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.encodeToHTML(shortname)}</span>`) : shortname);
|
||||
BDFDB.DOMUtils.setText(fakeicon, BDFDB.ObjectUtils.is(data.color2) ? BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.StringUtils.htmlEscape(shortname)}</span>`) : shortname);
|
||||
icon.parentElement.appendChild(fakeicon);
|
||||
fakeicon.style.setProperty("font-size", this.getFontSize(fakeicon));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!data.removeIcon && !shortname && url) {
|
||||
BDFDB.setInnerText(icon, "");
|
||||
BDFDB.DOMUtils.setText(icon, "");
|
||||
icon.style.setProperty("background-image", `url(${url})`);
|
||||
}
|
||||
else {
|
||||
|
@ -515,10 +515,10 @@ class EditServers {
|
|||
icon.style.removeProperty("background-color");
|
||||
}
|
||||
if (data.color2) icon.style.setProperty("color", BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color2) ? data.color2[Object.keys(data.color2)[0]] : data.color2, "RGBA"));
|
||||
BDFDB.setInnerText(icon, BDFDB.ObjectUtils.is(data.color2) ? BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.encodeToHTML(shortname)}</span>`) : shortname);
|
||||
BDFDB.DOMUtils.setText(icon, BDFDB.ObjectUtils.is(data.color2) ? BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color2)} !important;">${BDFDB.StringUtils.htmlEscape(shortname)}</span>`) : shortname);
|
||||
}
|
||||
icon.style.setProperty("font-size", this.getFontSize(icon));
|
||||
BDFDB.toggleClass(icon, this.getNoIconClasses(icon), !icon.style.getPropertyValue("background-image") || BDFDB.ObjectUtils.is(data.color1));
|
||||
BDFDB.DOMUtils.toggleClass(icon, this.getNoIconClasses(icon), !icon.style.getPropertyValue("background-image") || BDFDB.ObjectUtils.is(data.color1));
|
||||
if (data.url && !data.removeIcon) {
|
||||
icon.style.setProperty("background-position", "center");
|
||||
icon.style.setProperty("background-size", "cover");
|
||||
|
@ -546,7 +546,7 @@ class EditServers {
|
|||
let data = this.getGuildData(info.id, wrapper);
|
||||
wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditServers);
|
||||
if (data.name || data.color3 || data.color4) {
|
||||
let ServerFolders = BDFDB.BdUtils.getPlugin("ServerFolders", true);
|
||||
let ServerFolders = BDFDB.BDUtils.getPlugin("ServerFolders", true);
|
||||
let folder = ServerFolders ? ServerFolders.getFolderOfGuildId(info.id) : null;
|
||||
let folderData = folder ? BDFDB.DataUtils.load("ServerFolders", "folders", folder.folderId) : null;
|
||||
let color3 = data.color3 || (folderData && folderData.copyTooltipColor ? folderData.color3 : null);
|
||||
|
@ -556,7 +556,7 @@ class EditServers {
|
|||
var bgColor = color3 ? (!isgradient3 ? BDFDB.ColorUtils.convert(color3, "RGBA") : BDFDB.ColorUtils.createGradient(color3)) : "";
|
||||
var fontColor = color4 ? (!isgradient4 ? BDFDB.ColorUtils.convert(color4, "RGBA") : BDFDB.ColorUtils.createGradient(color4)) : "";
|
||||
wrapper.tooltipListenerEditServers = () => {
|
||||
BDFDB.TooltipUtils.create(wrapper, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.encodeToHTML(data.name || info.name)}</span>` : (data.name || info.name), {type, selector:"EditServers-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(color3[0], "RGBA") : bgColor} !important;`, html:isgradient3});
|
||||
BDFDB.TooltipUtils.create(wrapper, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.name)}</span>` : (data.name || info.name), {type, selector:"EditServers-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(color3[0], "RGBA") : bgColor} !important;`, html:isgradient3});
|
||||
};
|
||||
wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditServers);
|
||||
if (document.querySelector(BDFDB.dotCN.guildcontainer + ":hover") == wrapper) wrapper.tooltipListenerEditServers();
|
||||
|
@ -565,7 +565,7 @@ class EditServers {
|
|||
|
||||
getFontSize (icon) {
|
||||
if (icon.style.getPropertyValue("background-image") && icon.style.getPropertyValue("background-image").indexOf("linear-gradient(") == -1) return null;
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.guildicon) || BDFDB.containsClass(icon, BDFDB.disCN.guildiconacronym)) {
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.guildicon) || BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.guildiconacronym)) {
|
||||
var shortname = icon.firstElementChild ? icon.firstElementChild.innerText : icon.innerText;
|
||||
if (shortname) {
|
||||
if (shortname.length > 5) return "10px";
|
||||
|
@ -575,17 +575,17 @@ class EditServers {
|
|||
else if (shortname.length == 1) return "18px";
|
||||
}
|
||||
}
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizexlarge)) return "12px";
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizelarge)) return "10px";
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemedium)) return "8px";
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizesmall)) return "4.8px";
|
||||
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemini)) return "4px";
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.avatariconsizexlarge)) return "12px";
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.avatariconsizelarge)) return "10px";
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.avatariconsizemedium)) return "8px";
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.avatariconsizesmall)) return "4.8px";
|
||||
else if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.avatariconsizemini)) return "4px";
|
||||
return "10px";
|
||||
}
|
||||
|
||||
getNoIconClasses (icon) {
|
||||
let noiconclasses = [BDFDB.disCN.avatarnoicon];
|
||||
if (BDFDB.containsClass(icon, BDFDB.disCN.userprofilelistavatar)) noiconclasses.push(BDFDB.disCN.userprofilelistguildavatarwithouticon);
|
||||
if (BDFDB.DOMUtils.containsClass(icon, BDFDB.disCN.userprofilelistavatar)) noiconclasses.push(BDFDB.disCN.userprofilelistguildavatarwithouticon);
|
||||
return noiconclasses;
|
||||
}
|
||||
|
||||
|
@ -600,10 +600,10 @@ class EditServers {
|
|||
}
|
||||
if (allenabled) return data;
|
||||
let key = null;
|
||||
if (BDFDB.getParentEle(BDFDB.dotCN.guilds, wrapper)) key = "changeInGuildList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.userprofile, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.friends, wrapper)) key = "changeInMutualGuilds";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.guildheader, wrapper)) key = "changeInGuildHeader";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guilds, wrapper)) key = "changeInGuildList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofile, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.friends, wrapper)) key = "changeInMutualGuilds";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildheader, wrapper)) key = "changeInGuildHeader";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
|
||||
return !key || settings[key] ? data : {};
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ class EditUsers {
|
|||
try {this.forceUpdateAll();} catch (err) {}
|
||||
BDFDB.DataUtils.save(data, this, "users");
|
||||
|
||||
BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -377,14 +377,14 @@ class EditUsers {
|
|||
|
||||
data.name = usernameinput.value.trim() || null;
|
||||
data.tag = usertaginput.value.trim() || null;
|
||||
data.url = (!data.removeIcon && BDFDB.containsClass(useravatarinput, BDFDB.disCN.inputsuccess) ? useravatarinput.value.trim() : null) || null;
|
||||
data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(useravatarinput, BDFDB.disCN.inputsuccess) ? useravatarinput.value.trim() : null) || null;
|
||||
data.removeIcon = removeiconinput.checked;
|
||||
data.ignoreTagColor = ignoretagcolorinput.checked;
|
||||
|
||||
data.color1 = BDFDB.getSwatchColor(modal, 1);
|
||||
data.color2 = BDFDB.getSwatchColor(modal, 2);
|
||||
data.color3 = BDFDB.getSwatchColor(modal, 3);
|
||||
data.color4 = BDFDB.getSwatchColor(modal, 4);
|
||||
data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
|
||||
data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
|
||||
data.color3 = BDFDB.ColorUtils.getSwatchColor(modal, 3);
|
||||
data.color4 = BDFDB.ColorUtils.getSwatchColor(modal, 4);
|
||||
|
||||
let changed = false;
|
||||
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "users", info.id);
|
||||
|
@ -412,7 +412,7 @@ class EditUsers {
|
|||
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
|
||||
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
|
||||
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
|
||||
if (BDFDB.DOMUtils.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
this.swapWordWithMention(textarea);
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ class EditUsers {
|
|||
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
|
||||
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditUsersSelector)");
|
||||
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
|
||||
if (BDFDB.containsClass(selected, "autocompleteEditUsersSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteEditUsersSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(next, BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
|
||||
|
@ -437,7 +437,7 @@ class EditUsers {
|
|||
textarea.EditUsersAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100);
|
||||
}
|
||||
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, textarea, "click", e => {
|
||||
if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);});
|
||||
|
@ -504,9 +504,9 @@ class EditUsers {
|
|||
if (username) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id) || {};
|
||||
this.changeName(message.author, username, channel.guild_id);
|
||||
if (!BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messageheadercompact)) this.changeAvatar(message.author, this.getAvatarDiv(wrapper));
|
||||
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addTag(message.author, wrapper, BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
|
||||
if (!BDFDB.DOMUtils.containsClass(wrapper.parentElement, BDFDB.disCN.messageheadercompact)) this.changeAvatar(message.author, this.getAvatarDiv(wrapper));
|
||||
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addTag(message.author, wrapper, BDFDB.DOMUtils.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ class EditUsers {
|
|||
let avatar = this.getAvatarDiv(wrapper);
|
||||
if (avatar) {
|
||||
this.changeAvatar(user, avatar);
|
||||
if (BDFDB.containsClass(avatar.parentElement, BDFDB.disCN.callvideo)) this.changeTooltip(user, avatar.parentElement, "left");
|
||||
if (BDFDB.DOMUtils.containsClass(avatar.parentElement, BDFDB.disCN.callvideo)) this.changeTooltip(user, avatar.parentElement, "left");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -634,11 +634,11 @@ class EditUsers {
|
|||
if (channel.type == 1) this.changeName(BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]), channelname);
|
||||
else {
|
||||
if (channelname.EditUsersChangeObserver && typeof channelname.EditUsersChangeObserver.disconnect == "function") channelname.EditUsersChangeObserver.disconnect();
|
||||
if (BDFDB.BdUtils.isPluginEnabled("EditChannels")) BDFDB.BdUtils.getPlugin("EditChannels").changeChannel(channel, channelname);
|
||||
if (BDFDB.BDUtils.isPluginEnabled("EditChannels")) BDFDB.BDUtils.getPlugin("EditChannels").changeChannel(channel, channelname);
|
||||
else {
|
||||
channelname.style.removeProperty("color");
|
||||
channelname.style.removeProperty("background");
|
||||
BDFDB.setInnerText(channelname, channel.name);
|
||||
BDFDB.DOMUtils.setText(channelname, channel.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ class EditUsers {
|
|||
processClickable (instance, wrapper, returnvalue) {
|
||||
if (!wrapper || !instance.props || !instance.props.className) return;
|
||||
if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
|
||||
if (BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
|
||||
if (BDFDB.DOMUtils.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
|
||||
let message = BDFDB.ReactUtils.findValue(wrapper.parentElement, "message", {up:true});
|
||||
if (message) {
|
||||
this.changeName(message.author, wrapper);
|
||||
|
@ -712,14 +712,14 @@ class EditUsers {
|
|||
let input = BDFDB.ReactUtils.findDOMNode(instance).firstElementChild;
|
||||
clearTimeout(instance.checkTimeout);
|
||||
if (url == null || !url.trim()) {
|
||||
if (input) BDFDB.removeEles(input.tooltip);
|
||||
if (input) BDFDB.DOMUtils.remove(input.tooltip);
|
||||
instance.props.inputClassName = null;
|
||||
instance.forceUpdate();
|
||||
}
|
||||
else instance.checkTimeout = setTimeout(() => {
|
||||
BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
|
||||
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
|
||||
if (input) BDFDB.removeEles(input.tooltip);
|
||||
if (input) BDFDB.DOMUtils.remove(input.tooltip);
|
||||
instance.props.inputClassName = BDFDB.disCN.inputsuccess;
|
||||
}
|
||||
else {
|
||||
|
@ -734,9 +734,9 @@ class EditUsers {
|
|||
|
||||
createNoticeTooltip (input, isinvalid = false) {
|
||||
if (!input) return;
|
||||
BDFDB.removeEles(input.tooltip);
|
||||
var invalid = isinvalid || BDFDB.containsClass(input, BDFDB.disCN.inputerror);
|
||||
var valid = invalid ? false : BDFDB.containsClass(input, BDFDB.disCN.inputsuccess);
|
||||
BDFDB.DOMUtils.remove(input.tooltip);
|
||||
var invalid = isinvalid || BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputerror);
|
||||
var valid = invalid ? false : BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputsuccess);
|
||||
if (invalid || valid) input.tooltip = BDFDB.TooltipUtils.create(input, invalid ? this.labels.modal_invalidurl_text : this.labels.modal_validurl_text, {type:"right", selector:"notice-tooltip", color: invalid ? "red" : "green"});
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,7 @@ class EditUsers {
|
|||
let info = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
if (info) {
|
||||
let data = this.getUserData(info.id, title);
|
||||
BDFDB.setInnerText(title, "@" + (data.name || info.username));
|
||||
BDFDB.DOMUtils.setText(title, "@" + (data.name || info.username));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -759,17 +759,17 @@ class EditUsers {
|
|||
let member = BDFDB.LibraryModules.MemberStore.getMember(guildid, info.id) || {};
|
||||
this.changeBotTags(data, username, member);
|
||||
if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
|
||||
let isBRCenabled = BDFDB.BdUtils.isPluginEnabled("BetterRoleColors");
|
||||
let usenick = !BDFDB.containsClass(username, BDFDB.disCN.userprofileusername) && !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname, BDFDB.disCN.accountinfodetails, false) && member.nick;
|
||||
let usemembercolor = !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname) && (BDFDB.containsClass(username, BDFDB.disCN.memberusername, BDFDB.disCN.messageusername, false) || isBRCenabled);
|
||||
let isBRCenabled = BDFDB.BDUtils.isPluginEnabled("BetterRoleColors");
|
||||
let usenick = !BDFDB.DOMUtils.containsClass(username, BDFDB.disCN.userprofileusername) && !BDFDB.DOMUtils.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname, BDFDB.disCN.accountinfodetails, false) && member.nick;
|
||||
let usemembercolor = !BDFDB.DOMUtils.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname) && (BDFDB.DOMUtils.containsClass(username, BDFDB.disCN.memberusername, BDFDB.disCN.messageusername, false) || isBRCenabled);
|
||||
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || (usenick ? member.nick : info.username))}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || (usenick ? member.nick : info.username))}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1 || (usemembercolor ? member.colorString : null), "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || (usenick ? member.nick : info.username));
|
||||
BDFDB.DOMUtils.setText(username, data.name || (usenick ? member.nick : info.username));
|
||||
}
|
||||
|
||||
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(data.color2) : BDFDB.ColorUtils.convert(data.color2, "RGBA"), "important");
|
||||
|
@ -795,11 +795,11 @@ class EditUsers {
|
|||
if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || member.nick || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1 || (BDFDB.BdUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null), "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || member.nick || info.username);
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null), "RGBA"), "important");
|
||||
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
|
||||
}
|
||||
if (data.name || data.color1) {
|
||||
username.setAttribute("changed-by-editusers", true);
|
||||
|
@ -819,16 +819,16 @@ class EditUsers {
|
|||
let data = this.getUserData(info.id, username);
|
||||
if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
|
||||
if (adddisc) {
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span ${data.color1 ? (BDFDB.ObjectUtils.is(data.color1) ? 'style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image:' + BDFDB.ColorUtils.createGradient(data.color1) + ' !important;"' : 'style="color:' + data.color1 + ' !important;"'): ''}>${BDFDB.encodeToHTML(data.name || info.username)}</span><span${typeof adddisc == "string" ? ' class="' + adddisc + '"' : ''}>#${info.discriminator}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span ${data.color1 ? (BDFDB.ObjectUtils.is(data.color1) ? 'style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image:' + BDFDB.ColorUtils.createGradient(data.color1) + ' !important;"' : 'style="color:' + data.color1 + ' !important;"'): ''}>${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span><span${typeof adddisc == "string" ? ' class="' + adddisc + '"' : ''}>#${info.discriminator}</span>`));
|
||||
}
|
||||
else {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || info.username);
|
||||
BDFDB.DOMUtils.setText(username, data.name || info.username);
|
||||
}
|
||||
}
|
||||
if (data.name || data.color1) {
|
||||
|
@ -844,11 +844,11 @@ class EditUsers {
|
|||
}
|
||||
|
||||
changeBotTags (data, username, member) {
|
||||
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) if (!BDFDB.containsClass(tag, "TRE-tag")) {
|
||||
let isBRCbottagsEnabled = BDFDB.ReactUtils.getValue(BDFDB.BdUtils.getPlugin("BetterRoleColors", true), "settings.modules.botTags");
|
||||
let tagcolor = BDFDB.ColorUtils.convert(data.color1 || (isBRCbottagsEnabled || BDFDB.containsClass(tag, "owner-tag-rolecolor") ? member.colorString : null), "RGBA");
|
||||
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) if (!BDFDB.DOMUtils.containsClass(tag, "TRE-tag")) {
|
||||
let isBRCbottagsEnabled = BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.botTags");
|
||||
let tagcolor = BDFDB.ColorUtils.convert(data.color1 || (isBRCbottagsEnabled || BDFDB.DOMUtils.containsClass(tag, "owner-tag-rolecolor") ? member.colorString : null), "RGBA");
|
||||
tagcolor = BDFDB.ColorUtils.isBright(tagcolor) ? BDFDB.ColorUtils.change(tagcolor, -0.3) : tagcolor;
|
||||
tag.style.setProperty(BDFDB.containsClass(tag, BDFDB.disCN.bottaginvert) ? "color" : "background-color", tagcolor, "important");
|
||||
tag.style.setProperty(BDFDB.DOMUtils.containsClass(tag, BDFDB.disCN.bottaginvert) ? "color" : "background-color", tagcolor, "important");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -860,7 +860,7 @@ class EditUsers {
|
|||
if (avatar.tagName == "IMG") avatar.setAttribute("src", data.removeIcon ? null : (data.url || BDFDB.UserUtils.getAvatar(info.id)));
|
||||
else {
|
||||
let url = data.removeIcon ? null : ("url(" + (data.url || BDFDB.UserUtils.getAvatar(info.id)) + ")");
|
||||
if (url && BDFDB.getParentEle(BDFDB.dotCN.userprofile, avatar) && url.search(/discordapp\.com\/avatars\/[0-9]*\/a_/) > -1) url = url.replace(".webp)", ".gif)");
|
||||
if (url && BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofile, avatar) && url.search(/discordapp\.com\/avatars\/[0-9]*\/a_/) > -1) url = url.replace(".webp)", ".gif)");
|
||||
avatar.style.setProperty("background-image", url);
|
||||
if (data.url && !data.removeIcon) {
|
||||
avatar.style.setProperty("background-position", "center");
|
||||
|
@ -882,7 +882,7 @@ class EditUsers {
|
|||
changeTooltip (info, wrapper, type) {
|
||||
if (!info || !wrapper || !wrapper.parentElement) return;
|
||||
let data = this.getUserData(info.id, wrapper);
|
||||
wrapper = BDFDB.containsClass(wrapper, BDFDB.disCN.guildicon) ? wrapper.parentElement.parentElement.parentElement : wrapper;
|
||||
wrapper = BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.guildicon) ? wrapper.parentElement.parentElement.parentElement : wrapper;
|
||||
wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditUsers);
|
||||
if (data.name) {
|
||||
wrapper.tooltipListenerEditUsers = () => {
|
||||
|
@ -893,20 +893,20 @@ class EditUsers {
|
|||
}
|
||||
|
||||
addTag (info, wrapper, selector = "", container) {
|
||||
if (!info || !wrapper || !wrapper.parentElement || BDFDB.containsClass(wrapper, BDFDB.disCN.accountinfodetails) || BDFDB.containsClass(wrapper, "discord-tag")) return;
|
||||
BDFDB.removeEles(wrapper.querySelectorAll(".EditUsers-tag"));
|
||||
if (!info || !wrapper || !wrapper.parentElement || BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.accountinfodetails) || BDFDB.DOMUtils.containsClass(wrapper, "discord-tag")) return;
|
||||
BDFDB.DOMUtils.remove(wrapper.querySelectorAll(".EditUsers-tag"));
|
||||
let data = this.getUserData(info.id, wrapper);
|
||||
if (data.tag) {
|
||||
let member = data.ignoreTagColor ? (BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {}) : {};
|
||||
let color3 = BDFDB.ObjectUtils.is(data.color3) && !data.ignoreTagColor ? BDFDB.ColorUtils.createGradient(data.color3) : BDFDB.ColorUtils.convert(!data.ignoreTagColor ? data.color3 : member.colorString, "RGBA");
|
||||
let color4 = BDFDB.ObjectUtils.is(data.color4) && !data.ignoreTagColor ? BDFDB.ColorUtils.createGradient(data.color4) : (!data.ignoreTagColor && data.color4 ? BDFDB.ColorUtils.convert(data.color4, "RGBA") : (color3 ? (BDFDB.ColorUtils.isBright(color3) ? "black" : "white") : null));
|
||||
let tag = document.createElement("span");
|
||||
let invert = container && !color3 && !color4 && container.firstElementChild && !(BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
|
||||
let invert = container && !color3 && !color4 && container.firstElementChild && !(BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
|
||||
tag.className = "EditUsers-tag " + (!invert ? BDFDB.disCN.bottagregular : BDFDB.disCN.bottaginvert) + (selector ? (" " + selector) : "");
|
||||
tag.style.setProperty("background", !invert ? color3 : color4, "important");
|
||||
let fontcolor = invert ? color3 : color4;
|
||||
let fontobj = invert ? data.color3 : data.color4;
|
||||
if (BDFDB.ObjectUtils.is(fontobj)) tag.appendChild(BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontcolor} !important;">${BDFDB.encodeToHTML(data.tag)}</span>`));
|
||||
if (BDFDB.ObjectUtils.is(fontobj)) tag.appendChild(BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontcolor} !important;">${BDFDB.StringUtils.htmlEscape(data.tag)}</span>`));
|
||||
else {
|
||||
tag.innerText = data.tag;
|
||||
tag.style.setProperty("color", fontcolor, "important");
|
||||
|
@ -917,14 +917,14 @@ class EditUsers {
|
|||
|
||||
changePrivateChannel (info, username) {
|
||||
if (!info || !username || !username.parentElement) return;
|
||||
let dmchannel = BDFDB.getParentEle(BDFDB.dotCN.dmchannel, username);
|
||||
let dmchannel = BDFDB.DOMUtils.getParent(BDFDB.dotCN.dmchannel, username);
|
||||
if (!dmchannel) return;
|
||||
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
|
||||
dmchannel.removeEventListener("mouseenter", dmchannel.mouseenterListenerEditUsers);
|
||||
dmchannel.removeEventListener("mouseleave", dmchannel.mouseleaveListenerEditUsers);
|
||||
let data = this.getUserData(info.id, username);
|
||||
if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
|
||||
if (username.EditUsersHovered || BDFDB.containsClass(dmchannel, BDFDB.disCN.namecontainerselected)) colorHover();
|
||||
if (username.EditUsersHovered || BDFDB.DOMUtils.containsClass(dmchannel, BDFDB.disCN.namecontainerselected)) colorHover();
|
||||
else colorDefault();
|
||||
|
||||
if (data.name || data.color1 || data.color2) {
|
||||
|
@ -949,22 +949,22 @@ class EditUsers {
|
|||
function colorDefault() {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.removeProperty("color");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.change(data.color1, -0.5))} !important;">${BDFDB.encodeToHTML(data.name || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.change(data.color1, -0.5))} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.change(data.color1, -0.5, "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || info.username);
|
||||
BDFDB.DOMUtils.setText(username, data.name || info.username);
|
||||
}
|
||||
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.change(data.color2, -0.5)) : BDFDB.ColorUtils.change(data.color2, -0.5, "RGBA"), "important");
|
||||
}
|
||||
function colorHover() {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.removeProperty("color");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || info.username);
|
||||
BDFDB.DOMUtils.setText(username, data.name || info.username);
|
||||
}
|
||||
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(data.color2) : BDFDB.ColorUtils.convert(data.color2, "RGBA"), "important");
|
||||
}
|
||||
|
@ -978,10 +978,10 @@ class EditUsers {
|
|||
mention.removeEventListener("mouseout", mention.mouseoutListenerEditUsers);
|
||||
let data = this.getUserData(info.id, mention);
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
|
||||
let name = "@" + (data.name ? data.name : (BDFDB.BdUtils.isPluginEnabled("RemoveNicknames") ? BDFDB.BdUtils.getPlugin("RemoveNicknames").getNewName(info, mention) : member.nick || info.username));
|
||||
let name = "@" + (data.name ? data.name : (BDFDB.BDUtils.isPluginEnabled("RemoveNicknames") ? BDFDB.BDUtils.getPlugin("RemoveNicknames").getNewName(info, mention) : member.nick || info.username));
|
||||
|
||||
let isgradient = data.color1 && BDFDB.ObjectUtils.is(data.color1);
|
||||
let datacolor = data.color1 || (BDFDB.BdUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null);
|
||||
let datacolor = data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null);
|
||||
let color = isgradient ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(datacolor, "RGBA");
|
||||
let color0_1 = isgradient ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.setAlpha(data.color1, 0.1, "RGBA")) : BDFDB.ColorUtils.setAlpha(datacolor, 0.1, "RGBA");
|
||||
let color0_7 = isgradient ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.setAlpha(data.color1, 0.7, "RGBA")) : BDFDB.ColorUtils.setAlpha(datacolor, 0.7, "RGBA");
|
||||
|
@ -1007,17 +1007,17 @@ class EditUsers {
|
|||
mention.style.setProperty("background", color0_1, "important");
|
||||
if (isgradient) {
|
||||
mention.style.removeProperty("color");
|
||||
BDFDB.setInnerText(mention, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${color} !important;">${BDFDB.encodeToHTML(name)}</span>`));
|
||||
BDFDB.DOMUtils.setText(mention, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${color} !important;">${BDFDB.StringUtils.htmlEscape(name)}</span>`));
|
||||
}
|
||||
else {
|
||||
mention.style.setProperty("color", color, "important");
|
||||
BDFDB.setInnerText(mention, name);
|
||||
BDFDB.DOMUtils.setText(mention, name);
|
||||
}
|
||||
}
|
||||
function colorHover() {
|
||||
mention.style.setProperty("background", color0_7, "important");
|
||||
mention.style.setProperty("color", data.color1 ? "#FFFFFF" : null, "important");
|
||||
BDFDB.setInnerText(mention, name);
|
||||
BDFDB.DOMUtils.setText(mention, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1052,22 +1052,22 @@ class EditUsers {
|
|||
function colorDefault() {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.removeProperty("color");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(!speaking ? BDFDB.ColorUtils.change(data.color1, -50) : data.color1)} !important;">${BDFDB.encodeToHTML(data.name || member.nick || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(!speaking ? BDFDB.ColorUtils.change(data.color1, -50) : data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
var color1 = data.color1 || (BDFDB.BdUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : "");
|
||||
var color1 = data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : "");
|
||||
username.style.setProperty("color", !speaking ? BDFDB.ColorUtils.change(color1, -50, "RGBA") : BDFDB.ColorUtils.convert(color1, "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || member.nick || info.username);
|
||||
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
|
||||
}
|
||||
}
|
||||
function colorHover() {
|
||||
if (BDFDB.ObjectUtils.is(data.color1)) {
|
||||
username.style.removeProperty("color");
|
||||
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || member.nick || info.username)}</span>`));
|
||||
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
|
||||
}
|
||||
else {
|
||||
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
|
||||
BDFDB.setInnerText(username, data.name || member.nick || info.username);
|
||||
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1100,26 +1100,26 @@ class EditUsers {
|
|||
if (allenabled) return data;
|
||||
|
||||
let key = null;
|
||||
if (!BDFDB.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
|
||||
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.guildouter, wrapper)) key = "changeInRecentDms";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.dmchannels, wrapper)) key = "changeInDmsList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInDmHeader";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.callavatarwrapper, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.callincoming, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.callcurrentcontainer, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.pictureinpicture, wrapper)) key = "changeInDmCalls";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.friends, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.userprofilebody, wrapper)) key = "changeInFriendList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.invitemodalinviterow, wrapper)) key = "changeInInviteList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.activityfeed, wrapper)) key = "changeInActivity";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.userpopout, wrapper)) key = "changeInUserPopout";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.userprofileheader, wrapper)) key = "changeInUserProfil";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.guildsettingsbannedcard, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.guildsettingsinvitecard, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.guildsettingsmembercard, wrapper)) key = "changeInMemberLog";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
|
||||
if (!BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
|
||||
else if (BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, wrapper)) key = "changeInRecentDms";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.dmchannels, wrapper)) key = "changeInDmsList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInDmHeader";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.callavatarwrapper, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.callincoming, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.callcurrentcontainer, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.pictureinpicture, wrapper)) key = "changeInDmCalls";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.friends, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofilebody, wrapper)) key = "changeInFriendList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.invitemodalinviterow, wrapper)) key = "changeInInviteList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.activityfeed, wrapper)) key = "changeInActivity";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.userpopout, wrapper)) key = "changeInUserPopout";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofileheader, wrapper)) key = "changeInUserProfil";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsbannedcard, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsinvitecard, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsmembercard, wrapper)) key = "changeInMemberLog";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
|
||||
else if (wrapper.parentElement == document.head) key = "changeInAppTitle";
|
||||
|
||||
if (!key || settings[key]) {
|
||||
|
@ -1146,7 +1146,7 @@ class EditUsers {
|
|||
if (userarray.length) {
|
||||
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
|
||||
if (!autocompletemenu) {
|
||||
autocompletemenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditUsers"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.MEMBERS_MATCHING.replace("{{prefix}}", BDFDB.encodeToHTML(lastword))}</strong></div></div></div></div></div>`);
|
||||
autocompletemenu = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditUsers"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.MEMBERS_MATCHING.replace("{{prefix}}", BDFDB.StringUtils.htmlEscape(lastword))}</strong></div></div></div></div></div>`);
|
||||
textarea.parentElement.appendChild(autocompletemenu);
|
||||
autocompletemenu = autocompletemenu.firstElementChild;
|
||||
}
|
||||
|
@ -1156,22 +1156,22 @@ class EditUsers {
|
|||
|
||||
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
|
||||
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
|
||||
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
|
||||
BDFDB.DOMUtils.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
|
||||
});
|
||||
|
||||
for (let data of userarray) {
|
||||
if (amount-- < 1) break;
|
||||
let status = BDFDB.UserUtils.getStatus(data.user.id);
|
||||
let isgradient = data.color1 && BDFDB.ObjectUtils.is(data.color1);
|
||||
let username = isgradient ? `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;"><span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.encodeToHTML(data.name || data.member.nick || data.user.username)}</span></div>` : `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;${data.color1 ? (' color: ' + BDFDB.ColorUtils.convert(data.color1, 'RGB') + ' !important;') : ''}">${BDFDB.encodeToHTML(data.name || data.member.nick || data.user.username)}</div>`;
|
||||
let autocompleterow = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div userid="${data.user.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${data.user.username}, ${BDFDB.LanguageUtils.LanguageStrings["STATUS_" + status.toUpperCase()]}" aria-hidden="false" style="width: 24px; height: 24px;"><svg width="30" height="24" viewBox="0 0 30 24" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="24" height="24" mask="url(#svg-mask-avatar-status-round-24)"><img src="${data.url || BDFDB.UserUtils.getAvatar(data.user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject><rect width="8" height="8" x="16" y="16" fill="${BDFDB.UserUtils.getStatusColor(status)}" mask="url(#svg-mask-status-${status})" class="${BDFDB.disCN.avatarpointerevents}"></rect></svg></div>${username}<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletedescription}" style="flex: 0 1 auto;"><div class="${BDFDB.disCN.autocompletedescriptionusername}">${BDFDB.encodeToHTML(data.user.username)}</div><div class="${BDFDB.disCN.autocompletedescriptiondiscriminator}">#${data.user.discriminator}</div></div></div></div></div>`);
|
||||
let username = isgradient ? `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;"><span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || data.member.nick || data.user.username)}</span></div>` : `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;${data.color1 ? (' color: ' + BDFDB.ColorUtils.convert(data.color1, 'RGB') + ' !important;') : ''}">${BDFDB.StringUtils.htmlEscape(data.name || data.member.nick || data.user.username)}</div>`;
|
||||
let autocompleterow = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div userid="${data.user.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${data.user.username}, ${BDFDB.LanguageUtils.LanguageStrings["STATUS_" + status.toUpperCase()]}" aria-hidden="false" style="width: 24px; height: 24px;"><svg width="30" height="24" viewBox="0 0 30 24" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="24" height="24" mask="url(#svg-mask-avatar-status-round-24)"><img src="${data.url || BDFDB.UserUtils.getAvatar(data.user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject><rect width="8" height="8" x="16" y="16" fill="${BDFDB.UserUtils.getStatusColor(status)}" mask="url(#svg-mask-status-${status})" class="${BDFDB.disCN.avatarpointerevents}"></rect></svg></div>${username}<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletedescription}" style="flex: 0 1 auto;"><div class="${BDFDB.disCN.autocompletedescriptionusername}">${BDFDB.StringUtils.htmlEscape(data.user.username)}</div><div class="${BDFDB.disCN.autocompletedescriptiondiscriminator}">#${data.user.discriminator}</div></div></div></div></div>`);
|
||||
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithMention(textarea);});
|
||||
autocompletemenu.appendChild(autocompleterow);
|
||||
}
|
||||
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
|
||||
BDFDB.addClass(autocompletemenu.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
BDFDB.DOMUtils.addClass(autocompletemenu.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1198,7 +1198,7 @@ class EditUsers {
|
|||
let username = selected.querySelector(BDFDB.dotCN.autocompletedescriptionusername).textContent;
|
||||
let discriminator = selected.querySelector(BDFDB.dotCN.autocompletedescriptiondiscriminator).textContent;
|
||||
let userid = selected.getAttribute("userid");
|
||||
BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
|
||||
textarea.focus();
|
||||
textarea.selectionStart = textarea.value.length - lastword.length;
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
|
|
@ -149,7 +149,7 @@ class EmojiStatistics {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -191,7 +191,7 @@ class EmojiStatistics {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".emoji-tooltip",".emojistatistics-button");
|
||||
BDFDB.DOMUtils.remove(".emoji-tooltip",".emojistatistics-button");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ class EmojiStatistics {
|
|||
this.loadEmojiList();
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (settings.enableEmojiStatisticsButton) {
|
||||
let emojiStatisticsButton = BDFDB.htmlToElement(`<div class="emojistatistics-button"></div>`);
|
||||
let emojiStatisticsButton = BDFDB.DOMUtils.create(`<div class="emojistatistics-button"></div>`);
|
||||
emojipickerdiversityselector.parentElement.insertBefore(emojiStatisticsButton, emojipickerdiversityselector);
|
||||
emojiStatisticsButton.addEventListener("click", () => {
|
||||
let close = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.return.return.return.stateNode.close");
|
||||
|
@ -231,7 +231,7 @@ class EmojiStatistics {
|
|||
if (settings.enableEmojiHovering) {
|
||||
BDFDB.ListenerUtils.add(this, wrapper, "mouseenter", BDFDB.dotCN.emojipickeremojiitem, e => {
|
||||
let data = this.emojiToServerList[e.target.style.getPropertyValue("background-image").replace('url("',"").replace('")',"")];
|
||||
if (data) BDFDB.TooltipUtils.create(e.target, `${BDFDB.encodeToHTML(data.emoji)}\n${BDFDB.encodeToHTML(data.server)}`, {type:"right",selector:"emoji-tooltip",delay:BDFDB.DataUtils.get(this, "amounts")}, "hoverDelay");
|
||||
if (data) BDFDB.TooltipUtils.create(e.target, `${BDFDB.StringUtils.htmlEscape(data.emoji)}\n${BDFDB.StringUtils.htmlEscape(data.server)}`, {type:"right",selector:"emoji-tooltip",delay:BDFDB.DataUtils.get(this, "amounts")}, "hoverDelay");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -249,14 +249,14 @@ class EmojiStatistics {
|
|||
}
|
||||
|
||||
showEmojiInformationModal () {
|
||||
var emojiInformationModal = BDFDB.htmlToElement(this.emojiInformationModalMarkup);
|
||||
var emojiInformationModal = BDFDB.DOMUtils.create(this.emojiInformationModalMarkup);
|
||||
|
||||
let titlescontainer = emojiInformationModal.querySelector(".titles");
|
||||
let entriescontainer = emojiInformationModal.querySelector(".entries");
|
||||
|
||||
if (!titlescontainer || !entriescontainer) return;
|
||||
|
||||
var titleEntry = BDFDB.htmlToElement(this.emojiserverTitlesMarkup);
|
||||
var titleEntry = BDFDB.DOMUtils.create(this.emojiserverTitlesMarkup);
|
||||
titlescontainer.appendChild(titleEntry);
|
||||
var entries = [], index = 0, totalGlobal = 0, totalLocal = 0, totalCopies = 0;
|
||||
BDFDB.ListenerUtils.addToChildren(titleEntry, "click", ".sorttitle-label ", e => {
|
||||
|
@ -287,8 +287,8 @@ class EmojiStatistics {
|
|||
amountLocal++;
|
||||
}
|
||||
}
|
||||
var emojiEntry = BDFDB.htmlToElement(this.emojiserverEntryMarkup);
|
||||
emojiEntry.querySelector(".emojiserver-icon").appendChild(BDFDB.GuildUtils.createCopy(info, {click: () => {BDFDB.removeEles(emojiInformationModal);}, menu: true, size: 48}));
|
||||
var emojiEntry = BDFDB.DOMUtils.create(this.emojiserverEntryMarkup);
|
||||
emojiEntry.querySelector(".emojiserver-icon").appendChild(BDFDB.GuildUtils.createCopy(info, {click: () => {BDFDB.DOMUtils.remove(emojiInformationModal);}, menu: true, size: 48}));
|
||||
emojiEntry.querySelector(".emojiname-label").innerText = info.name || "";
|
||||
emojiEntry.querySelector(".emojitotal-label").innerText = amountGlobal + amountLocal;
|
||||
emojiEntry.querySelector(".emojiglobal-label").innerText = amountGlobal;
|
||||
|
@ -316,9 +316,9 @@ class EmojiStatistics {
|
|||
}
|
||||
|
||||
updateAllEntries (entriescontainer, entries) {
|
||||
BDFDB.removeEles(entriescontainer.childNodes);
|
||||
BDFDB.DOMUtils.remove(entriescontainer.childNodes);
|
||||
for (let entry of entries) {
|
||||
if (entriescontainer.childElementCount) entriescontainer.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
if (entriescontainer.childElementCount) entriescontainer.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
entriescontainer.appendChild(entry.div);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class ForceImagePreviews {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".FIP-embed");
|
||||
BDFDB.DOMUtils.remove(".FIP-embed");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class ForceImagePreviews {
|
|||
}
|
||||
let checkedsrc = itemsrc.indexOf("imgur.com/") > -1 ? ("imgur.com/" + itemsrc.split("/")[3].split(".")[0]) : itemsrc;
|
||||
if (!accessory.querySelector(`${BDFDB.dotCN.embedimage}[href*="${checkedsrc}"],${BDFDB.dotCN.embedgifv}[href*="${checkedsrc}"]`)) {
|
||||
let embed = BDFDB.htmlToElement(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}"><a class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imagezoom + BDFDB.disCN.embedimage}" href="${itemsrc}" rel="noreferrer noopener" target="_blank" style="width: ${width}px; height: ${height}px;"><img src="${itemsrc}" style="width: ${width}px; height: ${height}px;"></a></div>`);
|
||||
let embed = BDFDB.DOMUtils.create(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}"><a class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imagezoom + BDFDB.disCN.embedimage}" href="${itemsrc}" rel="noreferrer noopener" target="_blank" style="width: ${width}px; height: ${height}px;"><img src="${itemsrc}" style="width: ${width}px; height: ${height}px;"></a></div>`);
|
||||
this.insertEmbed(embed, previmage, links, accessory);
|
||||
}
|
||||
this.addItemToAccessory(item, links, accessory);
|
||||
|
@ -111,11 +111,11 @@ class ForceImagePreviews {
|
|||
result = result.replace(/[\r|\n|\t]|[\s]{2,}/g, "");
|
||||
let width = 400;
|
||||
let height = Math.round(width*(result.split('<meta itemprop="height" content="')[1].split('"')[0]/result.split('<meta itemprop="width" content="')[1].split('"')[0]));
|
||||
let embed = BDFDB.htmlToElement(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}" style="max-width: 426px;"><div class="${BDFDB.disCN.embedpill}" style="background-color: rgb(255, 0, 0);"></div><div class="${BDFDB.disCN.embedinner}"><div class="${BDFDB.disCNS.embedcontent + BDFDB.disCN.flex}"><div class="${BDFDB.disCN.embedcontentinner}"><div class=""><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedproviderlink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedprovider + BDFDB.disCNS.titlesize12 + BDFDB.disCN.weightnormal}" href="https://www.youtube.com/" rel="noreferrer noopener" target="_blank">YouTube</a></div><div class="${BDFDB.disCNS.embedauthor + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter + BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedauthornamelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedauthorname + BDFDB.disCNS.weightmedium + BDFDB.disCN.titlesize14}" href="https://www.youtube.com${result.split('<div class="yt-user-info"><a href="')[1].split('"')[0]}" rel="noreferrer noopener" target="_blank">${BDFDB.encodeToHTML(result.split('<div class="yt-user-info"><a href="')[1].split('>')[1].split('<')[0])}</a></div><div class="${BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedtitlelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedtitle + BDFDB.disCNS.titlesize14 + BDFDB.disCN.weightmedium}" href="${itemsrc}" rel="noreferrer noopener" target="_blank">${BDFDB.encodeToHTML(result.split('<meta property="og:title" content="')[1].split('"')[0])}</a></div></div></div><div class="${BDFDB.disCNS.embedvideo + BDFDB.disCNS.embedimage + BDFDB.disCNS.embedmarginlarge + BDFDB.disCN.margintop8}" style="width: ${width}px; height: ${height}px;"><div class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imageclickable + BDFDB.disCN.embedvideoimagecomponent}" style="width: ${width}px; height: ${height}px;"><img alt="" src="${result.split('<link itemprop="thumbnailUrl" href="')[1].split('"')[0]}" style="width: ${width}px; height: ${height}px;"></div><div class="${BDFDB.disCN.embedvideoactions}"><div class="${BDFDB.disCN.embedcentercontent}"><div class="${BDFDB.disCN.iconactionswrapper}"><div tabindex="0" class="${BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" role="button"><svg name="Play" class="${BDFDB.disCNS.iconplay + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><polygon fill="currentColor" points="0 0 0 14 11 7" transform="translate(7 5)"></polygon></svg></div><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.anchorunderlineonhover + BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" href="${itemsrc}" rel="noreferrer noopener" target="_blank"><svg name="OpenExternal" class="${BDFDB.disCNS.iconexternalmargins + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" transform="translate(3.000000, 4.000000)" d="M16 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4v-2H2V4h14v10h-4v2h4c1.1 0 2-.9 2-2V2a2 2 0 0 0-2-2zM9 6l-4 4h3v6h2v-6h3L9 6z"></path></svg></a></div></div></div></div></div></div></div>`);
|
||||
let embed = BDFDB.DOMUtils.create(`<div class="FIP-embed ${BDFDB.disCNS.embed + BDFDB.disCN.embedwrapper}" style="max-width: 426px;"><div class="${BDFDB.disCN.embedpill}" style="background-color: rgb(255, 0, 0);"></div><div class="${BDFDB.disCN.embedinner}"><div class="${BDFDB.disCNS.embedcontent + BDFDB.disCN.flex}"><div class="${BDFDB.disCN.embedcontentinner}"><div class=""><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedproviderlink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedprovider + BDFDB.disCNS.titlesize12 + BDFDB.disCN.weightnormal}" href="https://www.youtube.com/" rel="noreferrer noopener" target="_blank">YouTube</a></div><div class="${BDFDB.disCNS.embedauthor + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter + BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedauthornamelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedauthorname + BDFDB.disCNS.weightmedium + BDFDB.disCN.titlesize14}" href="https://www.youtube.com${result.split('<div class="yt-user-info"><a href="')[1].split('"')[0]}" rel="noreferrer noopener" target="_blank">${BDFDB.StringUtils.htmlEscape(result.split('<div class="yt-user-info"><a href="')[1].split('>')[1].split('<')[0])}</a></div><div class="${BDFDB.disCNS.embedmargin + BDFDB.disCN.margintop4}"><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.embedtitlelink + BDFDB.disCNS.embedlink + BDFDB.disCNS.embedtitle + BDFDB.disCNS.titlesize14 + BDFDB.disCN.weightmedium}" href="${itemsrc}" rel="noreferrer noopener" target="_blank">${BDFDB.StringUtils.htmlEscape(result.split('<meta property="og:title" content="')[1].split('"')[0])}</a></div></div></div><div class="${BDFDB.disCNS.embedvideo + BDFDB.disCNS.embedimage + BDFDB.disCNS.embedmarginlarge + BDFDB.disCN.margintop8}" style="width: ${width}px; height: ${height}px;"><div class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imageclickable + BDFDB.disCN.embedvideoimagecomponent}" style="width: ${width}px; height: ${height}px;"><img alt="" src="${result.split('<link itemprop="thumbnailUrl" href="')[1].split('"')[0]}" style="width: ${width}px; height: ${height}px;"></div><div class="${BDFDB.disCN.embedvideoactions}"><div class="${BDFDB.disCN.embedcentercontent}"><div class="${BDFDB.disCN.iconactionswrapper}"><div tabindex="0" class="${BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" role="button"><svg name="Play" class="${BDFDB.disCNS.iconplay + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><polygon fill="currentColor" points="0 0 0 14 11 7" transform="translate(7 5)"></polygon></svg></div><a class="${BDFDB.disCNS.anchor + BDFDB.disCNS.anchorunderlineonhover + BDFDB.disCNS.iconwrapper + BDFDB.disCN.iconwrapperactive}" href="${itemsrc}" rel="noreferrer noopener" target="_blank"><svg name="OpenExternal" class="${BDFDB.disCNS.iconexternalmargins + BDFDB.disCN.icon}" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" transform="translate(3.000000, 4.000000)" d="M16 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4v-2H2V4h14v10h-4v2h4c1.1 0 2-.9 2-2V2a2 2 0 0 0-2-2zM9 6l-4 4h3v6h2v-6h3L9 6z"></path></svg></a></div></div></div></div></div></div></div>`);
|
||||
BDFDB.ListenerUtils.addToChildren(embed, "click", BDFDB.dotCN.iconplay, () => {
|
||||
let videowrapper = embed.querySelector(BDFDB.dotCN.embedvideo);
|
||||
BDFDB.removeEles(videowrapper.childNodes);
|
||||
videowrapper.appendChild(BDFDB.htmlToElement(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&autoplay=1&auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
|
||||
BDFDB.DOMUtils.remove(videowrapper.childNodes);
|
||||
videowrapper.appendChild(BDFDB.DOMUtils.create(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&autoplay=1&auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
|
||||
});
|
||||
this.insertEmbed(embed, previmage, links, accessory);
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ class ForceImagePreviews {
|
|||
prev = prev ? prev : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${previmage ? this.parseSrc(previmage.src) : void 0}"]`);
|
||||
next = next ? next : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${links[0] ? this.parseSrc(links[0].src) : void 0}"]`);
|
||||
let isempty = accessory.childElementCount == 0;
|
||||
if (BDFDB.containsClass(embed.firstElementChild, BDFDB.disCN.embedimage)) embed.style.setProperty("pointer-events", "none", "important");
|
||||
if (BDFDB.DOMUtils.containsClass(embed.firstElementChild, BDFDB.disCN.embedimage)) embed.style.setProperty("pointer-events", "none", "important");
|
||||
accessory.insertBefore(embed, prev ? prev.nextSibling : next);
|
||||
let scroller = document.querySelector(BDFDB.dotCNS.chat + BDFDB.dotCN.messages);
|
||||
if (scroller) scroller.scrollTop += (BDFDB.getRects(embed).height + (isempty ? 15 : 0));
|
||||
if (scroller) scroller.scrollTop += (BDFDB.DOMUtils.getRects(embed).height + (isempty ? 15 : 0));
|
||||
}
|
||||
|
||||
parseSrc (src) {
|
||||
|
|
|
@ -221,7 +221,7 @@ class FriendNotifications {
|
|||
BDFDB.DataUtils.save(friends, this, "friends");
|
||||
BDFDB.DataUtils.save(nonfriends, this, "nonfriends");
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -236,11 +236,11 @@ class FriendNotifications {
|
|||
}
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".settings-avatar", e => {
|
||||
this.changeNotificationType(e.currentTarget, false, !BDFDB.containsClass(e.currentTarget, "disabled", "desktop", false));
|
||||
this.changeNotificationType(e.currentTarget, false, !BDFDB.DOMUtils.containsClass(e.currentTarget, "disabled", "desktop", false));
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "contextmenu", ".settings-avatar", e => {
|
||||
if (!("Notification" in window)) return;
|
||||
this.changeNotificationType(e.currentTarget, true, !(BDFDB.containsClass(e.currentTarget, "disabled") || !BDFDB.containsClass(e.currentTarget, "desktop")));
|
||||
this.changeNotificationType(e.currentTarget, true, !(BDFDB.DOMUtils.containsClass(e.currentTarget, "disabled") || !BDFDB.DOMUtils.containsClass(e.currentTarget, "desktop")));
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".btn-batch", e => {
|
||||
this.changeAllNotificationTypes(settingspanel, e.currentTarget, true);
|
||||
|
@ -249,7 +249,7 @@ class FriendNotifications {
|
|||
this.changeAllNotificationTypes(settingspanel, e.currentTarget, false);
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.checkboxinput, e => {
|
||||
if (BDFDB.containsClass(e.target, "remove-user")) return;
|
||||
if (BDFDB.DOMUtils.containsClass(e.target, "remove-user")) return;
|
||||
this.changeNotificationConfig(e.currentTarget);
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".BDFDB-tableheadercolumn", e => {
|
||||
|
@ -263,7 +263,7 @@ class FriendNotifications {
|
|||
let group = e.currentTarget.getAttribute("group");
|
||||
if (id && group) {
|
||||
BDFDB.DataUtils.remove(this, group, id);
|
||||
BDFDB.removeEles(BDFDB.getParentEle(BDFDB.dotCN.hovercard, e.currentTarget));
|
||||
BDFDB.DOMUtils.remove(BDFDB.DOMUtils.getParent(BDFDB.dotCN.hovercard, e.currentTarget));
|
||||
this.SettingsUpdated = true;
|
||||
}
|
||||
});
|
||||
|
@ -278,7 +278,7 @@ class FriendNotifications {
|
|||
if (user) {
|
||||
let data = this.createDefaultConfig();
|
||||
BDFDB.DataUtils.save(data, this, "nonfriends", user.id);
|
||||
let hovercard = BDFDB.htmlToElement(this.createHoverCard(user, data, "nonfriends"));
|
||||
let hovercard = BDFDB.DOMUtils.create(this.createHoverCard(user, data, "nonfriends"));
|
||||
settingspanel.querySelector(".nonfriend-list").appendChild(hovercard);
|
||||
BDFDB.initElements(hovercard);
|
||||
this.SettingsUpdated = true;
|
||||
|
@ -339,7 +339,7 @@ class FriendNotifications {
|
|||
|
||||
createHoverCard (user, data, group) {
|
||||
let EUdata = BDFDB.DataUtils.load("EditUsers", "users", user.id) || {};
|
||||
var hovercardhtml = `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="settings-avatar${data.desktop ? " desktop" : ""}${data.disabled ? " disabled" : ""}" group="${group}" user-id="${user.id}" style="flex: 0 0 auto; background-image: url(${EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.UserUtils.getAvatar(user.id))});"></div><div class="BDFDB-textscrollwrapper" style="flex: 1 1 auto;"><div class="BDFDB-textscroll">${BDFDB.encodeToHTML(EUdata.name || user.username)}</div></div>`;
|
||||
var hovercardhtml = `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="settings-avatar${data.desktop ? " desktop" : ""}${data.disabled ? " disabled" : ""}" group="${group}" user-id="${user.id}" style="flex: 0 0 auto; background-image: url(${EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.UserUtils.getAvatar(user.id))});"></div><div class="BDFDB-textscrollwrapper" style="flex: 1 1 auto;"><div class="BDFDB-textscroll">${BDFDB.StringUtils.htmlEscape(EUdata.name || user.username)}</div></div>`;
|
||||
for (let config in this.defaults.notificationstrings) {
|
||||
hovercardhtml += `<div class="${BDFDB.disCNS.checkboxcontainer + BDFDB.disCN.marginreset} BDFDB-tablecheckbox" table-id="${group}" style="flex: 0 0 auto;"><label class="${BDFDB.disCN.checkboxwrapper}"><input user-id="${user.id}" group="${group}" config="${config}" type="checkbox" class="${BDFDB.disCN.checkboxinputdefault}"${data[config] ? " checked" : ""}><div class="${BDFDB.disCNS.checkbox + BDFDB.disCNS.flexcenter + BDFDB.disCNS.flex2 + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.checkboxround}"><svg name="Checkmark" width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><polyline stroke="transparent" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg></div></label></div>`;
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ class FriendNotifications {
|
|||
let data = BDFDB.DataUtils.load(this, group, id) || this.createDefaultConfig();
|
||||
data.desktop = desktopon;
|
||||
data.disabled = disableon;
|
||||
BDFDB.toggleClass(avatar, "desktop", desktopon);
|
||||
BDFDB.toggleClass(avatar, "disabled", disableon);
|
||||
BDFDB.DOMUtils.toggleClass(avatar, "desktop", desktopon);
|
||||
BDFDB.DOMUtils.toggleClass(avatar, "disabled", disableon);
|
||||
BDFDB.DataUtils.save(data, this, group, id);
|
||||
this.SettingsUpdated = true;
|
||||
}
|
||||
|
@ -368,10 +368,10 @@ class FriendNotifications {
|
|||
if (config == "desktop") {
|
||||
enable = !enable;
|
||||
for (let id in data) data[id].disabled = false;
|
||||
for (let avatar of settingspanel.querySelectorAll(`.settings-avatar[group="${group}"]`)) BDFDB.removeClass(avatar, "disabled");
|
||||
for (let avatar of settingspanel.querySelectorAll(`.settings-avatar[group="${group}"]`)) BDFDB.DOMUtils.removeClass(avatar, "disabled");
|
||||
}
|
||||
for (let id in data) data[id][config] = enable;
|
||||
for (let avatar of settingspanel.querySelectorAll(`.settings-avatar[group="${group}"]`)) BDFDB.toggleClass(avatar, config, enable);
|
||||
for (let avatar of settingspanel.querySelectorAll(`.settings-avatar[group="${group}"]`)) BDFDB.DOMUtils.toggleClass(avatar, config, enable);
|
||||
BDFDB.DataUtils.save(data, this, group);
|
||||
this.SettingsUpdated = true;
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ class FriendNotifications {
|
|||
let EUdata = BDFDB.DataUtils.load("EditUsers", "users", user.id) || {};
|
||||
let libstring = (this.defaults.notificationstrings[status.statusname].libstring ? BDFDB.LanguageUtils.LanguageStrings[this.defaults.notificationstrings[status.statusname].libstring] : (this.defaults.notificationstrings[status.statusname].statusname || "")).toLowerCase();
|
||||
let string = notificationstrings[status.statusname] || "$user changed status to $status";
|
||||
let toaststring = BDFDB.encodeToHTML(string).replace(/'{0,1}\$user'{0,1}/g, `<strong>${BDFDB.encodeToHTML(EUdata.name || user.username)}</strong>`).replace(/'{0,1}\$status'{0,1}/g, `<strong>${libstring}</strong>`);
|
||||
let toaststring = BDFDB.StringUtils.htmlEscape(string).replace(/'{0,1}\$user'{0,1}/g, `<strong>${BDFDB.StringUtils.htmlEscape(EUdata.name || user.username)}</strong>`).replace(/'{0,1}\$status'{0,1}/g, `<strong>${libstring}</strong>`);
|
||||
if (status.isactivity) toaststring = toaststring.replace(/'{0,1}\$song'{0,1}|'{0,1}\$game'{0,1}/g, `<strong>${status.name || status.details}</strong>`).replace(/'{0,1}\$artist'{0,1}/g, `<strong>${status.state}</strong>`);
|
||||
let avatar = EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.UserUtils.getAvatar(user.id));
|
||||
this.timeLog.push({string:toaststring, avatar, time: new Date()});
|
||||
|
@ -533,13 +533,13 @@ class FriendNotifications {
|
|||
}
|
||||
|
||||
showTimeLog () {
|
||||
let timeLogModal = BDFDB.htmlToElement(this.timeLogModalMarkup);
|
||||
let timeLogModal = BDFDB.DOMUtils.create(this.timeLogModalMarkup);
|
||||
let container = timeLogModal.querySelector(".entries");
|
||||
if (!container) return;
|
||||
let logs = this.timeLog.slice(0).reverse();
|
||||
for (let log of logs) {
|
||||
if (container.childElementCount) container.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.divider + BDFDB.disCN.marginbottom4}"></div>`));
|
||||
let entry = BDFDB.htmlToElement(this.logEntryMarkup);
|
||||
if (container.childElementCount) container.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.divider + BDFDB.disCN.marginbottom4}"></div>`));
|
||||
let entry = BDFDB.DOMUtils.create(this.logEntryMarkup);
|
||||
entry.querySelector(".log-time").innerText = `[${log.time.toLocaleTimeString()}]`;
|
||||
entry.querySelector(".log-avatar").style.setProperty("background-image", `url(${log.avatar})`);
|
||||
entry.querySelector(".log-description").innerHTML = log.string;
|
||||
|
|
|
@ -52,7 +52,7 @@ class GoogleSearchReplace {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
|
|
@ -150,12 +150,12 @@ class GoogleTranslateOption {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {
|
||||
let type = BDFDB.getParentEle(BDFDB.dotCN.select, e.currentTarget).getAttribute("type");
|
||||
let type = BDFDB.DOMUtils.getParent(BDFDB.dotCN.select, e.currentTarget).getAttribute("type");
|
||||
let menulanguages = this.defaults.choices[type].direction == "Output" ? BDFDB.ObjectUtils.filter(this.languages, lang => {return lang.id != "auto";}) : this.languages;
|
||||
BDFDB.openDropdownMenu(e, this.saveSelectChoice.bind(this), this.createSelectChoice.bind(this), menulanguages);
|
||||
});
|
||||
|
@ -204,7 +204,7 @@ class GoogleTranslateOption {
|
|||
this.resetMessage(message);
|
||||
});
|
||||
|
||||
BDFDB.removeEles(".translate-button", ".popout-googletranslate");
|
||||
BDFDB.DOMUtils.remove(".translate-button", ".popout-googletranslate");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -217,11 +217,11 @@ class GoogleTranslateOption {
|
|||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(instance.props.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let translated = BDFDB.containsClass(messagediv, "GTO-translated-message");
|
||||
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"MessagePinItem"});
|
||||
const translateUntranslateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
|
||||
hint: BDFDB.BdUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BdUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Translate_Message") : null,
|
||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Translate_Message") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${translated ? "untranslate" : "translate"}-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
|
@ -232,14 +232,14 @@ class GoogleTranslateOption {
|
|||
else children.push(translateUntranslateItem);
|
||||
let text = document.getSelection().toString();
|
||||
if (text) {
|
||||
let GSRstring = BDFDB.ReactUtils.getValue(BDFDB.BdUtils.getPlugin("GoogleSearchReplace", true), "labels.context_googlesearchreplace_text");
|
||||
let GSRstring = BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("GoogleSearchReplace", true), "labels.context_googlesearchreplace_text");
|
||||
let [children2, index2] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"SearchWithGoogle", props: GSRstring ? [["label", GSRstring]] : null});
|
||||
var foundtranslation, foundinput, foundoutput;
|
||||
const searchTranslationItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_googletranslateoption_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-searchtranslation-contextMenuItem`,
|
||||
action: e => {
|
||||
var item = BDFDB.getParentEle(BDFDB.dotCN.contextmenuitem, e.target);
|
||||
var item = BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenuitem, e.target);
|
||||
if (item) {
|
||||
var createTooltip = () => {
|
||||
BDFDB.TooltipUtils.create(item, `From ${foundinput.name}:\n${text}\n\nTo ${foundoutput.name}:\n${foundtranslation}`, {type:"right", selector:"googletranslate-tooltip"});
|
||||
|
@ -270,7 +270,7 @@ class GoogleTranslateOption {
|
|||
if (instance.props.message && instance.props.channel && instance.props.target && !popout.querySelector(`${this.name}-popoutMenuItem`)) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(instance.props.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let translated = BDFDB.containsClass(messagediv, "GTO-translated-message");
|
||||
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {props:[["label", [BDFDB.LanguageUtils.LanguageStrings.PIN, BDFDB.LanguageUtils.LanguageStrings.UNPIN]]]});
|
||||
const translateUntranslateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[translated ? "popout_untranslateoption_text" : "popout_translateoption_text"],
|
||||
|
@ -310,7 +310,7 @@ class GoogleTranslateOption {
|
|||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.setLanguages();
|
||||
BDFDB.removeEles(".translate-button");
|
||||
BDFDB.DOMUtils.remove(".translate-button");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, "ChannelTextArea");
|
||||
}
|
||||
}
|
||||
|
@ -321,17 +321,17 @@ class GoogleTranslateOption {
|
|||
if (textarea) {
|
||||
var buttoncontainer = wrapper.querySelector(BDFDB.dotCN.textareapickerbuttons);
|
||||
if (!buttoncontainer) return;
|
||||
var translateButton = BDFDB.htmlToElement(this.translateButtonMarkup);
|
||||
var translateButton = BDFDB.DOMUtils.create(this.translateButtonMarkup);
|
||||
translateButton.addEventListener("click", () => {
|
||||
this.openTranslatePopout(translateButton);
|
||||
});
|
||||
translateButton.addEventListener("contextmenu", () => {
|
||||
this.translating = !this.translating;
|
||||
BDFDB.toggleClass(document.querySelectorAll(BDFDB.dotCNS.textareawrapchat + ".translate-button"), "translating-active", this.translating);
|
||||
BDFDB.DOMUtils.toggleClass(document.querySelectorAll(BDFDB.dotCNS.textareawrapchat + ".translate-button"), "translating-active", this.translating);
|
||||
});
|
||||
buttoncontainer.insertBefore(translateButton, buttoncontainer.firstElementChild);
|
||||
BDFDB.addClass(translateButton, instance.props.type);
|
||||
BDFDB.toggleClass(translateButton, "translating-active", this.translating);
|
||||
BDFDB.DOMUtils.addClass(translateButton, instance.props.type);
|
||||
BDFDB.DOMUtils.toggleClass(translateButton, "translating-active", this.translating);
|
||||
BDFDB.ListenerUtils.add(this, textarea, "input", () => {
|
||||
if (this.doTranslate) {
|
||||
this.doTranslate = false;
|
||||
|
@ -364,7 +364,7 @@ class GoogleTranslateOption {
|
|||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.ReactUtils.getValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
let optionPopoutButton = BDFDB.DOMUtils.create(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
|
@ -373,13 +373,13 @@ class GoogleTranslateOption {
|
|||
|
||||
processMessageContent (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.channel) {
|
||||
let messagediv = BDFDB.getParentEle(".GTO-translated-message", wrapper);
|
||||
if (messagediv && !wrapper.querySelector(".GTO-translation")) BDFDB.removeClass(messagediv, "GTO-translated-message");
|
||||
let messagediv = BDFDB.DOMUtils.getParent(".GTO-translated-message", wrapper);
|
||||
if (messagediv && !wrapper.querySelector(".GTO-translation")) BDFDB.DOMUtils.removeClass(messagediv, "GTO-translated-message");
|
||||
}
|
||||
}
|
||||
|
||||
getMessageAndPos (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", target);
|
||||
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.childNodes).filter(n => n.nodeType != Node.TEXT_NODE).indexOf(messagediv) : -1;
|
||||
return {messagediv, pos};
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ class GoogleTranslateOption {
|
|||
var accessory = messagediv.querySelector(BDFDB.dotCN.messageaccessory);
|
||||
var embeddescriptions = messagediv.querySelectorAll(BDFDB.dotCN.embeddescription);
|
||||
var fakemarkup = markup.cloneNode(true);
|
||||
BDFDB.removeEles(fakemarkup.querySelectorAll(BDFDB.dotCNC.messageheadercompact + BDFDB.dotCN.messageedited));
|
||||
BDFDB.DOMUtils.remove(fakemarkup.querySelectorAll(BDFDB.dotCNC.messageheadercompact + BDFDB.dotCN.messageedited));
|
||||
let string = fakemarkup.innerHTML;
|
||||
if (embeddescriptions.length) for (let embeddescription of embeddescriptions) {
|
||||
string += "\n__________________ __________________ __________________\n";
|
||||
|
@ -402,12 +402,12 @@ class GoogleTranslateOption {
|
|||
}
|
||||
this.translateText(string, "context", (translation, input, output) => {
|
||||
if (translation) {
|
||||
BDFDB.addClass(messagediv, "GTO-translated-message");
|
||||
BDFDB.DOMUtils.addClass(messagediv, "GTO-translated-message");
|
||||
let translations = translation.split("\n__________________ __________________ __________________\n");
|
||||
let compactheader = markup.querySelector(BDFDB.dotCN.messageheadercompact);
|
||||
markup.insertBefore(BDFDB.htmlToElement(`<label class="GTO-translation">${translations.shift().replace(/\n/g, "BDFDB_GTO_PLACEHOLDER").replace(/\s/g, " ").replace(/BDFDB_GTO_PLACEHOLDER/g, "\n").replace(/> *(\n*) *</g, ">$1<").replace(/> +/g, "> ").replace(/ +</g, " <").replace(/> *([^ ]*) *<\//g, ">$1</").trim()}<time class="${BDFDB.disCN.messageedited} GTO-translated">(${this.labels.translated_watermark_text})</time></label>`), compactheader ? compactheader.nextSibling : markup.firstChild);
|
||||
markup.insertBefore(BDFDB.DOMUtils.create(`<label class="GTO-translation">${translations.shift().replace(/\n/g, "BDFDB_GTO_PLACEHOLDER").replace(/\s/g, " ").replace(/BDFDB_GTO_PLACEHOLDER/g, "\n").replace(/> *(\n*) *</g, ">$1<").replace(/> +/g, "> ").replace(/ +</g, " <").replace(/> *([^ ]*) *<\//g, ">$1</").trim()}<time class="${BDFDB.disCN.messageedited} GTO-translated">(${this.labels.translated_watermark_text})</time></label>`), compactheader ? compactheader.nextSibling : markup.firstChild);
|
||||
if (embeddescriptions.length) for (let embeddescription of embeddescriptions) {
|
||||
embeddescription.insertBefore(BDFDB.htmlToElement(`<label class="GTO-translation">${translations.shift().trim()}<time class="${BDFDB.disCN.messageedited} GTO-translated">(${this.labels.translated_watermark_text})</time></label>`), embeddescription.firstChild);
|
||||
embeddescription.insertBefore(BDFDB.DOMUtils.create(`<label class="GTO-translation">${translations.shift().trim()}<time class="${BDFDB.disCN.messageedited} GTO-translated">(${this.labels.translated_watermark_text})</time></label>`), embeddescription.firstChild);
|
||||
}
|
||||
BDFDB.ListenerUtils.addToChildren(messagediv, "mouseenter", BDFDB.dotCN.messageedited + ".GTO-translated", e => {
|
||||
BDFDB.TooltipUtils.create(e.currentTarget, `<div>From: ${input.name}</div><div>To: ${output.name}</div>`, {html:true, type:"top", selector:"translation-tooltip"});
|
||||
|
@ -419,8 +419,8 @@ class GoogleTranslateOption {
|
|||
}
|
||||
|
||||
resetMessage (messagediv) {
|
||||
BDFDB.removeEles(messagediv.querySelectorAll(".GTO-translation"));
|
||||
BDFDB.removeClass(messagediv, "GTO-translated-message");
|
||||
BDFDB.DOMUtils.remove(messagediv.querySelectorAll(".GTO-translation"));
|
||||
BDFDB.DOMUtils.removeClass(messagediv, "GTO-translated-message");
|
||||
}
|
||||
|
||||
translateText (text, type, callback) {
|
||||
|
@ -599,16 +599,16 @@ class GoogleTranslateOption {
|
|||
|
||||
openTranslatePopout (button) {
|
||||
let container = document.querySelector(BDFDB.dotCN.popouts);
|
||||
if (!container || BDFDB.containsClass(button, BDFDB.disCN.textareabuttonactive)) return;
|
||||
BDFDB.addClass(button, BDFDB.disCN.textareabuttonactive);
|
||||
let translatepopout = BDFDB.htmlToElement(this.translatePopoutMarkup);
|
||||
if (!container || BDFDB.DOMUtils.containsClass(button, BDFDB.disCN.textareabuttonactive)) return;
|
||||
BDFDB.DOMUtils.addClass(button, BDFDB.disCN.textareabuttonactive);
|
||||
let translatepopout = BDFDB.DOMUtils.create(this.translatePopoutMarkup);
|
||||
container.appendChild(translatepopout);
|
||||
let buttonrects = BDFDB.getRects(button);
|
||||
let buttonrects = BDFDB.DOMUtils.getRects(button);
|
||||
translatepopout.style.setProperty("left", buttonrects.left + buttonrects.width + "px");
|
||||
translatepopout.style.setProperty("top", buttonrects.top - buttonrects.height/2 + "px");
|
||||
|
||||
BDFDB.ListenerUtils.addToChildren(translatepopout, "click", BDFDB.dotCN.selectcontrol, e => {
|
||||
let type = BDFDB.getParentEle(BDFDB.dotCN.select, e.currentTarget).getAttribute("type");
|
||||
let type = BDFDB.DOMUtils.getParent(BDFDB.dotCN.select, e.currentTarget).getAttribute("type");
|
||||
let menulanguages = this.defaults.choices[type].direction == "Output" ? BDFDB.ObjectUtils.filter(this.languages, lang => {return lang.id != "auto";}) : this.languages;
|
||||
let menu = BDFDB.openDropdownMenu(e, this.saveSelectChoice.bind(this), this.createSelectChoice.bind(this), menulanguages, true);
|
||||
BDFDB.ListenerUtils.addToChildren(menu, "click", BDFDB.dotCN.giffavoritebutton, e => {
|
||||
|
@ -645,7 +645,7 @@ class GoogleTranslateOption {
|
|||
var translatecheckbox = translatepopout.querySelector("#translating-checkbox");
|
||||
translatecheckbox.checked = this.translating;
|
||||
translatecheckbox.addEventListener("click", () => {
|
||||
BDFDB.toggleClass(button, "translating-active", translatecheckbox.checked);
|
||||
BDFDB.DOMUtils.toggleClass(button, "translating-active", translatecheckbox.checked);
|
||||
this.translating = translatecheckbox.checked;
|
||||
});
|
||||
|
||||
|
@ -653,7 +653,7 @@ class GoogleTranslateOption {
|
|||
if (!translatepopout.contains(e.target)) {
|
||||
document.removeEventListener("mousedown", removePopout);
|
||||
translatepopout.remove();
|
||||
setTimeout(() => {BDFDB.removeClass(button, BDFDB.disCN.textareabuttonactive);},300);
|
||||
setTimeout(() => {BDFDB.DOMUtils.removeClass(button, BDFDB.disCN.textareabuttonactive);},300);
|
||||
}
|
||||
};
|
||||
document.addEventListener("mousedown", removePopout);
|
||||
|
|
|
@ -93,7 +93,7 @@ class ImageGallery {
|
|||
processImageModal (instance, wrapper, returnvalue, methodnames) {
|
||||
if (this.closemodal && instance.props && instance.props.onClose) instance.props.onClose();
|
||||
else if (methodnames.includes("componentDidMount")) {
|
||||
let modal = BDFDB.getParentEle(BDFDB.dotCN.modal, wrapper);
|
||||
let modal = BDFDB.DOMUtils.getParent(BDFDB.dotCN.modal, wrapper);
|
||||
if (!modal) return;
|
||||
let start = performance.now();
|
||||
let waitForImg = setInterval(() => {
|
||||
|
@ -102,7 +102,7 @@ class ImageGallery {
|
|||
clearInterval(waitForImg);
|
||||
let message = this.getMessageGroupOfImage(img);
|
||||
if (message) {
|
||||
BDFDB.addClass(modal, "image-gallery");
|
||||
BDFDB.DOMUtils.addClass(modal, "image-gallery");
|
||||
this.addImages(modal, message.querySelectorAll(BDFDB.dotCNS.imagewrapper + "img"), img);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class ImageGallery {
|
|||
}
|
||||
|
||||
addImages (modal, imgs, img) {
|
||||
BDFDB.removeEles(modal.querySelectorAll(`${BDFDB.dotCN.imagewrapper}.prev, ${BDFDB.dotCN.imagewrapper}.next`));
|
||||
BDFDB.DOMUtils.remove(modal.querySelectorAll(`${BDFDB.dotCN.imagewrapper}.prev, ${BDFDB.dotCN.imagewrapper}.next`));
|
||||
|
||||
let inner = modal.querySelector(BDFDB.dotCN.modalinner);
|
||||
|
||||
|
@ -155,7 +155,7 @@ class ImageGallery {
|
|||
modal.querySelector(BDFDB.dotCN.downloadlink).setAttribute("href", imagesrc);
|
||||
|
||||
var imagewrapper = modal.querySelector(BDFDB.dotCN.imagewrapper);
|
||||
BDFDB.addClass(imagewrapper, "current");
|
||||
BDFDB.DOMUtils.addClass(imagewrapper, "current");
|
||||
var imagewrapperimage = imagewrapper.querySelector("img");
|
||||
imagewrapperimage.setAttribute("src", imagesrc);
|
||||
|
||||
|
@ -173,8 +173,8 @@ class ImageGallery {
|
|||
}
|
||||
|
||||
createImage (modal, imgs, img, type) {
|
||||
var imagewrapper = BDFDB.htmlToElement(this.imageMarkup);
|
||||
BDFDB.addClass(imagewrapper, type);
|
||||
var imagewrapper = BDFDB.DOMUtils.create(this.imageMarkup);
|
||||
BDFDB.DOMUtils.addClass(imagewrapper, type);
|
||||
imagewrapper.addEventListener("click", () => {this.addImages(modal, imgs, img);});
|
||||
var imagewrapperimage = imagewrapper.querySelector("img");
|
||||
imagewrapperimage.setAttribute("src", this.getSrcOfImage(img));
|
||||
|
@ -183,7 +183,7 @@ class ImageGallery {
|
|||
}
|
||||
|
||||
resizeImage (container, src, img) {
|
||||
BDFDB.toggleEles(img, false);
|
||||
BDFDB.DOMUtils.hide(img);
|
||||
var temp = new Image();
|
||||
temp.src = src.src.split("?width=")[0];
|
||||
temp.onload = function () {
|
||||
|
@ -196,14 +196,14 @@ class ImageGallery {
|
|||
newHeight = temp.height > newHeight ? newHeight : temp.height;
|
||||
|
||||
var wrapper = img.parentElement;
|
||||
if (!BDFDB.containsClass(wrapper, "current")) wrapper.style.setProperty("top", (container.clientHeight - newHeight) / 2 + "px");
|
||||
if (!BDFDB.DOMUtils.containsClass(wrapper, "current")) wrapper.style.setProperty("top", (container.clientHeight - newHeight) / 2 + "px");
|
||||
wrapper.style.setProperty("width", newWidth + "px");
|
||||
wrapper.style.setProperty("height", newHeight + "px");
|
||||
|
||||
img.style.setProperty("width", newWidth + "px");
|
||||
img.style.setProperty("height", newHeight + "px");
|
||||
|
||||
BDFDB.toggleEles(img, true);
|
||||
BDFDB.DOMUtils.show(img);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class ImageZoom {
|
|||
img.removeAttribute("draggable");
|
||||
}
|
||||
|
||||
BDFDB.removeEles(".imagezoom-contextmenu", ".imagezoom-separator", ".imagezoom-settings", ".imagezoom-lense", ".imagezoom-backdrop");
|
||||
BDFDB.DOMUtils.remove(".imagezoom-contextmenu", ".imagezoom-separator", ".imagezoom-settings", ".imagezoom-lense", ".imagezoom-backdrop");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -94,18 +94,18 @@ class ImageZoom {
|
|||
|
||||
processImageModal (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentDidMount")) {
|
||||
let modal = BDFDB.getParentEle(BDFDB.dotCN.modal, wrapper);
|
||||
let modal = BDFDB.DOMUtils.getParent(BDFDB.dotCN.modal, wrapper);
|
||||
if (!modal) return;
|
||||
let inner = modal.querySelector(BDFDB.dotCN.modalinner);
|
||||
if (!inner) return;
|
||||
let start = performance.now();
|
||||
let waitForImg = setInterval(() => {
|
||||
let img = modal.querySelector(BDFDB.dotCNS.imagewrapper + "img," + BDFDB.dotCNS.imagewrapper + "video");
|
||||
if (img && img.src && !BDFDB.containsClass(img, BDFDB.disCN.imageplaceholder)) {
|
||||
if (img && img.src && !BDFDB.DOMUtils.containsClass(img, BDFDB.disCN.imageplaceholder)) {
|
||||
clearInterval(waitForImg);
|
||||
img.setAttribute("draggable", "false");
|
||||
inner.firstElementChild.appendChild(BDFDB.htmlToElement(`<span class="${BDFDB.disCN.downloadlink} imagezoom-separator" style="margin: 0px 5px;"> | </div>`));
|
||||
let settingslink = BDFDB.htmlToElement(`<span class="${BDFDB.disCN.downloadlink} imagezoom-settings">Zoom ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}</div>`);
|
||||
inner.firstElementChild.appendChild(BDFDB.DOMUtils.create(`<span class="${BDFDB.disCN.downloadlink} imagezoom-separator" style="margin: 0px 5px;"> | </div>`));
|
||||
let settingslink = BDFDB.DOMUtils.create(`<span class="${BDFDB.disCN.downloadlink} imagezoom-settings">Zoom ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}</div>`);
|
||||
inner.firstElementChild.appendChild(settingslink);
|
||||
let openContext = e => {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
@ -114,13 +114,13 @@ class ImageZoom {
|
|||
label: this.defaults.settings[type].name + ": " + settings[type] + this.defaults.settings[type].unit,
|
||||
className: `BDFDB-contextMenuSliderItem ${this.name}-contextMenuSliderItem ${this.name}-${type}-contextMenuSliderItem`,
|
||||
type,
|
||||
defaultValue: BDFDB.mapRange([this.defaults.settings[type].min, this.defaults.settings[type].max], [0, 100], settings[type]),
|
||||
defaultValue: BDFDB.NumberUtils.mapRange([this.defaults.settings[type].min, this.defaults.settings[type].max], [0, 100], settings[type]),
|
||||
onValueChange: value => {
|
||||
BDFDB.DataUtils.save(Math.round(BDFDB.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value)), this, "settings", type);
|
||||
BDFDB.DataUtils.save(Math.round(BDFDB.NumberUtils.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value)), this, "settings", type);
|
||||
},
|
||||
onValueRender: value => {
|
||||
setImmediate(() => {for (let slider of document.querySelectorAll(BDFDB.dotCN.contextmenuitemslider)) if (BDFDB.ReactUtils.getValue(slider, "return.memoizedProps.type") == type) {
|
||||
value = Math.round(BDFDB.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value));
|
||||
value = Math.round(BDFDB.NumberUtils.mapRange([0, 100], [this.defaults.settings[type].min, this.defaults.settings[type].max], value));
|
||||
let label = slider.querySelector(BDFDB.dotCN.contextmenulabel);
|
||||
if (label) label.innerText = this.defaults.settings[type].name + ": " + value + this.defaults.settings[type].unit;
|
||||
let bubble = slider.querySelector(BDFDB.dotCN.sliderbubble);
|
||||
|
@ -139,18 +139,18 @@ class ImageZoom {
|
|||
settingslink.addEventListener("contextmenu", openContext);
|
||||
img.ImageZoomMouseDownListener = e => {
|
||||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
BDFDB.appendLocalStyle("ImageZoomCrossHair", "* {cursor: crosshair !important;}");
|
||||
BDFDB.DOMUtils.appendLocalStyle("ImageZoomCrossHair", "* {cursor: crosshair !important;}");
|
||||
|
||||
let imgrects = BDFDB.getRects(img);
|
||||
let imgrects = BDFDB.DOMUtils.getRects(img);
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
|
||||
let lense = BDFDB.htmlToElement(`<div class="imagezoom-lense" style="clip-path: circle(${(settings.lensesize/2) + 2}px at center) !important; border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${settings.lensesize}px !important; height: ${settings.lensesize}px !important; position: fixed !important;"><div class="imagezoom-lense-inner" style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; clip-path: circle(${settings.lensesize/2}px at center) !important;"><${img.tagName} class="imagezoom-pane" src="${img.src}" style="width: ${imgrects.width * settings.zoomlevel}px; height: ${imgrects.height * settings.zoomlevel}px; position: fixed !important;"${img.tagName == "VIDEO" ? " loop autoplay" : ""}></${img.tagName}></div></div>`);
|
||||
let lense = BDFDB.DOMUtils.create(`<div class="imagezoom-lense" style="clip-path: circle(${(settings.lensesize/2) + 2}px at center) !important; border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${settings.lensesize}px !important; height: ${settings.lensesize}px !important; position: fixed !important;"><div class="imagezoom-lense-inner" style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; clip-path: circle(${settings.lensesize/2}px at center) !important;"><${img.tagName} class="imagezoom-pane" src="${img.src}" style="width: ${imgrects.width * settings.zoomlevel}px; height: ${imgrects.height * settings.zoomlevel}px; position: fixed !important;"${img.tagName == "VIDEO" ? " loop autoplay" : ""}></${img.tagName}></div></div>`);
|
||||
let pane = lense.querySelector(".imagezoom-pane");
|
||||
let backdrop = BDFDB.htmlToElement(`<div class="imagezoom-backdrop" style="background: rgba(0,0,0,0.2) !important;"></div>`);
|
||||
let backdrop = BDFDB.DOMUtils.create(`<div class="imagezoom-backdrop" style="background: rgba(0,0,0,0.2) !important;"></div>`);
|
||||
document.querySelector(BDFDB.dotCN.appmount).appendChild(lense);
|
||||
document.querySelector(BDFDB.dotCN.appmount).appendChild(backdrop);
|
||||
|
||||
let lenserects = BDFDB.getRects(lense), panerects = BDFDB.getRects(pane);
|
||||
let lenserects = BDFDB.DOMUtils.getRects(lense), panerects = BDFDB.DOMUtils.getRects(pane);
|
||||
let halfW = lenserects.width / 2, halfH = lenserects.height / 2;
|
||||
let minX = imgrects.left, maxX = minX + imgrects.width;
|
||||
let minY = imgrects.top, maxY = minY + imgrects.height;
|
||||
|
@ -168,10 +168,10 @@ class ImageZoom {
|
|||
pane.style.setProperty("top", imgrects.top + ((settings.zoomlevel - 1) * (imgrects.top - y - halfH)) + "px", "important");
|
||||
};
|
||||
let releasing = e2 => {
|
||||
BDFDB.removeLocalStyle('ImageZoomCrossHair');
|
||||
BDFDB.DOMUtils.removeLocalStyle('ImageZoomCrossHair');
|
||||
document.removeEventListener("mousemove", dragging);
|
||||
document.removeEventListener("mouseup", releasing);
|
||||
BDFDB.removeEles(lense, backdrop);
|
||||
BDFDB.DOMUtils.remove(lense, backdrop);
|
||||
};
|
||||
document.addEventListener("mousemove", dragging);
|
||||
document.addEventListener("mouseup", releasing);
|
||||
|
@ -184,7 +184,7 @@ class ImageZoom {
|
|||
}, 100);
|
||||
}
|
||||
else if (methodnames.includes("componentWillUnmount")) {
|
||||
BDFDB.removeEles(".imagezoom-contextmenu", ".imagezoom-separator", ".imagezoom-settings", ".imagezoom-lense", ".imagezoom-backdrop");
|
||||
BDFDB.DOMUtils.remove(".imagezoom-contextmenu", ".imagezoom-separator", ".imagezoom-settings", ".imagezoom-lense", ".imagezoom-backdrop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class JoinedAtDate {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -138,7 +138,7 @@ class JoinedAtDate {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".joinedAtDate");
|
||||
BDFDB.DOMUtils.remove(".joinedAtDate");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -163,9 +163,9 @@ class JoinedAtDate {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
saveSelectChoice (selectWrap, type, choice) {
|
||||
|
@ -199,18 +199,18 @@ class JoinedAtDate {
|
|||
if (!this.loadedusers[guildid]) this.loadedusers[guildid] = {};
|
||||
let addTimestamp = (timestamp) => {
|
||||
if (document.contains(container)) {
|
||||
BDFDB.removeEles(container.querySelectorAll(".joinedAtDate"));
|
||||
BDFDB.DOMUtils.remove(container.querySelectorAll(".joinedAtDate"));
|
||||
if (BDFDB.ObjectUtils.is(container.JoinedAtDateObserver)) container.JoinedAtDateObserver.disconnect();
|
||||
let choice = BDFDB.DataUtils.get(this, "choices", "joinedAtDateLang");
|
||||
let nametag = container.querySelector(BDFDB.dotCN.nametag);
|
||||
container.insertBefore(BDFDB.htmlToElement(`<div class="joinedAtDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 7 !important;"><div class="BDFDB-textscroll">${this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
container.insertBefore(BDFDB.DOMUtils.create(`<div class="joinedAtDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.DOMUtils.getRects(BDFDB.DOMUtils.getParent(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 7 !important;"><div class="BDFDB-textscroll">${this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
BDFDB.initElements(container, this);
|
||||
if (popout && popout.style.transform.indexOf("translateY(-1") == -1) {
|
||||
let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.getRects(popout);
|
||||
let arect = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.DOMUtils.getRects(popout);
|
||||
popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
|
||||
}
|
||||
container.JoinedAtDateObserver = new MutationObserver((changes, _) => {changes.forEach((change, i) => {change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
});});});
|
||||
container.JoinedAtDateObserver.observe(container, {childList: true, subtree:true});
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class LastMessageDate {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$hour will be replaced with the current hour</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$minute will be replaced with the current minutes</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$second will be replaced with the current seconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$msecond will be replaced with the current milliseconds</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$timemode will change $hour to a 12h format and will be replaced with AM/PM</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$year will be replaced with the current year</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$month will be replaced with the current month</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$day will be replaced with the current day</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameL will be replaced with the monthname in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$monthnameS will be replaced with the monthname in short format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayL will be replaced with the weekday in long format based on the Discord Language</div><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">$weekdayS will be replaced with the weekday in short format based on the Discord Language</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -145,7 +145,7 @@ class LastMessageDate {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".lastMessageDate");
|
||||
BDFDB.DOMUtils.remove(".lastMessageDate");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -170,9 +170,9 @@ class LastMessageDate {
|
|||
}
|
||||
|
||||
toggleInfo (ele) {
|
||||
BDFDB.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.toggleEles(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright);
|
||||
BDFDB.DOMUtils.toggle(ele.nextElementSibling);
|
||||
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
|
||||
}
|
||||
|
||||
saveSelectChoice (selectWrap, type, choice) {
|
||||
|
@ -208,18 +208,18 @@ class LastMessageDate {
|
|||
if (!this.loadedusers[guildid]) this.loadedusers[guildid] = {};
|
||||
let addTimestamp = (timestamp) => {
|
||||
if (document.contains(container)) {
|
||||
BDFDB.removeEles(container.querySelectorAll(".lastMessageDate"));
|
||||
BDFDB.DOMUtils.remove(container.querySelectorAll(".lastMessageDate"));
|
||||
if (BDFDB.ObjectUtils.is(container.LastMessageDateObserver)) container.LastMessageDateObserver.disconnect();
|
||||
let choice = BDFDB.DataUtils.get(this, "choices", "lastMessageDateLang");
|
||||
let nametag = container.querySelector(BDFDB.dotCN.nametag);
|
||||
container.insertBefore(BDFDB.htmlToElement(`<div class="lastMessageDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.getRects(BDFDB.getParentEle(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 6 !important;"><div class="BDFDB-textscroll">${this.labels.lastmessage_text.replace("{{time}}", timestamp == "never" ? "---" : this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
container.insertBefore(BDFDB.DOMUtils.create(`<div class="lastMessageDate BDFDB-textscrollwrapper ${BDFDB.disCN.textrow}" style="max-width: ${BDFDB.DOMUtils.getRects(BDFDB.DOMUtils.getParent(popout ? BDFDB.dotCN.userpopoutheader : BDFDB.dotCN.userprofileheaderinfo, container)).width - 20}px !important; order: 6 !important;"><div class="BDFDB-textscroll">${this.labels.lastmessage_text.replace("{{time}}", timestamp == "never" ? "---" : this.getTimestamp(this.languages[choice].id, timestamp))}</div></div>`), nametag ? nametag.nextSibling : null);
|
||||
BDFDB.initElements(container, this);
|
||||
if (popout && popout.style.transform.indexOf("translateY(-1") == -1) {
|
||||
let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.getRects(popout);
|
||||
let arect = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)), prect = BDFDB.DOMUtils.getRects(popout);
|
||||
popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
|
||||
}
|
||||
container.LastMessageDateObserver = new MutationObserver((changes, _) => {changes.forEach((change, i) => {change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.nametag)) addTimestamp(timestamp);
|
||||
});});});
|
||||
container.LastMessageDateObserver.observe(container, {childList: true, subtree:true});
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class MessageUtilities {
|
|||
if (this.defaults.settings[key].description) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + 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>`;
|
||||
}
|
||||
for (let action in bindings) {
|
||||
if (!this.defaults.bindings[action].plugin || BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings[action].plugin)) {
|
||||
if (!this.defaults.bindings[action].plugin || BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings[action].plugin)) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.divider + BDFDB.disCN.marginbottom4}"></div>`;
|
||||
settingshtml += `<div class="${action}-key-settings"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.bindings[action].name}:</h3>${toasts[action] != undefined ? `<h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Toast:</h5><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="toasts ${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${toasts[action] ? " checked" : ""}></div>` : ''}<h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Enabled:</h5><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 ${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[action] ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
|
||||
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 20%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">Click:</h5>${BDFDB.createSelectMenu(this.createSelectChoice(bindings[action].click), bindings[action].click, action + " click")}</div>`;
|
||||
|
@ -77,7 +77,7 @@ class MessageUtilities {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all key bindings.</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></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -146,7 +146,7 @@ class MessageUtilities {
|
|||
let changed = false;
|
||||
for (let itemlabel of menu.querySelectorAll(BDFDB.dotCN.contextmenulabel)) {
|
||||
let hint = itemlabel.parentElement.querySelector(BDFDB.dotCN.contextmenuhint);
|
||||
if (hint && !BDFDB.containsClass(hint, "BDFDB-contextMenuItemHint")) {
|
||||
if (hint && !BDFDB.DOMUtils.containsClass(hint, "BDFDB-contextMenuItemHint")) {
|
||||
let action = null;
|
||||
switch (itemlabel.innerText) {
|
||||
case BDFDB.LanguageUtils.LanguageStrings.COPY_MESSAGE_LINK:
|
||||
|
@ -212,15 +212,15 @@ class MessageUtilities {
|
|||
|
||||
startRecording (settingspanel, e) {
|
||||
let recorderWrap = e.currentTarget;
|
||||
if (BDFDB.containsClass(recorderWrap, BDFDB.disCN.hotkeyrecording)) return;
|
||||
if (BDFDB.DOMUtils.containsClass(recorderWrap, BDFDB.disCN.hotkeyrecording)) return;
|
||||
|
||||
let recorderInput = recorderWrap.querySelector("input");
|
||||
let recorderText = recorderWrap.querySelector(BDFDB.dotCN.hotkeytext);
|
||||
let action = recorderWrap.getAttribute("type");
|
||||
let option = recorderWrap.getAttribute("option");
|
||||
|
||||
BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
|
||||
BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
|
||||
BDFDB.DOMUtils.addClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
|
||||
BDFDB.DOMUtils.removeClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
|
||||
recorderText.innerText = BDFDB.LanguageUtils.LanguageStrings.SHORTCUT_RECORDER_BUTTON_RECORDING;
|
||||
|
||||
|
||||
|
@ -236,8 +236,8 @@ class MessageUtilities {
|
|||
binding[option] = parseInt(recorderWrap.getAttribute("value"));
|
||||
BDFDB.DataUtils.save(binding, this, "bindings", action);
|
||||
setTimeout(() => {
|
||||
BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
|
||||
BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
|
||||
BDFDB.DOMUtils.removeClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
|
||||
BDFDB.DOMUtils.addClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
|
||||
recorderText.innerText = BDFDB.LanguageUtils.LanguageStrings.SHORTCUT_RECORDER_BUTTON_EDIT;
|
||||
},100);
|
||||
};
|
||||
|
@ -365,36 +365,36 @@ class MessageUtilities {
|
|||
}
|
||||
|
||||
doNote ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.BdUtils.getPlugin(this.defaults.bindings.__Note_Message.plugin).addMessageToNotes(message, messagediv, channel);
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Note_Message.plugin).addMessageToNotes(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doTranslate ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.BdUtils.getPlugin(this.defaults.bindings.__Translate_Message.plugin).translateMessage(message, messagediv, channel);
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Translate_Message.plugin).translateMessage(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doQuote ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||
let quoteButton = messagediv.querySelector(".btn-quote");
|
||||
if (quoteButton) quoteButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
doCitate ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings.__Citate_Message.plugin)) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Citate_Message.plugin)) {
|
||||
let citarButton = messagediv.parentElement.querySelector(".citar-btn");
|
||||
if (citarButton) citarButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
doReveal ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(this.defaults.bindings.__Reveal_Spoilers.plugin)) {
|
||||
BDFDB.BdUtils.getPlugin(this.defaults.bindings.__Reveal_Spoilers.plugin).revealAllSpoilers(messagediv);
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Reveal_Spoilers.plugin)) {
|
||||
BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Reveal_Spoilers.plugin).revealAllSpoilers(messagediv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ class MessageUtilities {
|
|||
if (!this.isEventFired(name)) {
|
||||
this.fireEvent(name);
|
||||
if (key == 27 && BDFDB.DataUtils.get(this, "settings", "clearOnEscape")) {
|
||||
let instance = BDFDB.ReactUtils.findOwner(BDFDB.getParentEle(BDFDB.dotCNS.chat + "form", e.currentTarget), {name:"ChannelTextAreaForm", up:true});
|
||||
let instance = BDFDB.ReactUtils.findOwner(BDFDB.DOMUtils.getParent(BDFDB.dotCNS.chat + "form", e.currentTarget), {name:"ChannelTextAreaForm", up:true});
|
||||
if (instance) instance.setState({textValue:""});
|
||||
}
|
||||
this.cancelEvent(name);
|
||||
|
@ -423,7 +423,7 @@ class MessageUtilities {
|
|||
}
|
||||
|
||||
getMessageData (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", target) || BDFDB.getParentEle(BDFDB.dotCN.messagesystem, target);
|
||||
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", target) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagesystem, target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.childNodes).filter(n => n.nodeType != Node.TEXT_NODE).indexOf(messagediv) : -1;
|
||||
let instance = BDFDB.ReactUtils.getInstance(messagediv);
|
||||
let message = instance ? BDFDB.ReactUtils.findValue(instance, "message", {up:true}) : null;
|
||||
|
|
|
@ -56,7 +56,7 @@ class MoveablePopups {
|
|||
(change, i) => {
|
||||
if (change.addedNodes) {
|
||||
change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.popout)) {
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.popout)) {
|
||||
this.makeMoveable(node);
|
||||
}
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ class MoveablePopups {
|
|||
(change, i) => {
|
||||
if (change.addedNodes) {
|
||||
change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
|
||||
if (node && BDFDB.DOMUtils.containsClass(node, BDFDB.disCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
|
||||
this.makeMoveable(node.querySelector(BDFDB.dotCN.modalinner));
|
||||
}
|
||||
else if (node.tagName && node.querySelector(BDFDB.dotCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
|
||||
|
@ -107,14 +107,14 @@ class MoveablePopups {
|
|||
if (!e.ctrlKey) return;
|
||||
div.style.setProperty("position", "fixed", "important");
|
||||
this.dragging = true;
|
||||
var rects = BDFDB.getRects(div);
|
||||
var rects = BDFDB.DOMUtils.getRects(div);
|
||||
var transform = getComputedStyle(div,null).getPropertyValue("transform").replace(/[^0-9,-]/g,"").split(",");
|
||||
var left = rects.left - (transform.length > 4 ? parseFloat(transform[4]) : 0);
|
||||
var top = rects.top - (transform.length > 4 ? parseFloat(transform[5]) : 0);
|
||||
var oldX = e.pageX;
|
||||
var oldY = e.pageY;
|
||||
var mouseup = e2 => {
|
||||
BDFDB.removeLocalStyle("disableTextSelection");
|
||||
BDFDB.DOMUtils.removeLocalStyle("disableTextSelection");
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
document.removeEventListener("mousemove", mousemove);
|
||||
setTimeout(() => {this.dragging = false},1);
|
||||
|
|
|
@ -140,7 +140,7 @@ class NotificationSounds {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added songs.</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></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -178,11 +178,11 @@ class NotificationSounds {
|
|||
this.saveChoice(type, false);
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", "#input-unimplemented", e => {
|
||||
BDFDB.toggleEles(settingspanel.querySelectorAll(".unimplemented"), e.currentTarget.checked);
|
||||
BDFDB.DOMUtils.toggle(settingspanel.querySelectorAll(".unimplemented"), e.currentTarget.checked);
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "mousedown", BDFDB.dotCN.slidergrabber, e => {this.dragSlider(settingspanel,e);});
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {
|
||||
let type = BDFDB.getParentEle(BDFDB.dotCN.select, e.currentTarget).getAttribute("type").split(" ");
|
||||
let type = BDFDB.DOMUtils.getParent(BDFDB.dotCN.select, e.currentTarget).getAttribute("type").split(" ");
|
||||
let songSelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type[0]} song"]`);
|
||||
let categorySelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type[0]} category"]`);
|
||||
let menuaudios = type[1] == "song" ? this.audios[categorySelect.getAttribute("value")] : this.audios;
|
||||
|
@ -290,11 +290,11 @@ class NotificationSounds {
|
|||
openDropdownMenu (settingspanel, e) {
|
||||
let selectControl = e.currentTarget;
|
||||
let selectWrap = selectControl.parentElement;
|
||||
let plugincard = BDFDB.getParentEle("li", selectWrap);
|
||||
let plugincard = BDFDB.DOMUtils.getParent("li", selectWrap);
|
||||
|
||||
if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
|
||||
if (!plugincard || BDFDB.DOMUtils.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
|
||||
|
||||
BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
|
||||
BDFDB.DOMUtils.addClass(selectWrap, BDFDB.disCN.selectisopen);
|
||||
|
||||
var type = selectWrap.getAttribute("type");
|
||||
var option = selectWrap.getAttribute("option");
|
||||
|
@ -325,7 +325,7 @@ class NotificationSounds {
|
|||
if (e2.target.parentElement != selectMenu) {
|
||||
document.removeEventListener("mousedown", removeMenu);
|
||||
selectMenu.remove();
|
||||
setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
|
||||
setTimeout(() => {BDFDB.DOMUtils.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
|
||||
}
|
||||
};
|
||||
document.addEventListener("mousedown", removeMenu);
|
||||
|
@ -339,7 +339,7 @@ class NotificationSounds {
|
|||
menuhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectoption + isSelected}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}">${ele}</div></div>`
|
||||
}
|
||||
menuhtml += `</div></div>`;
|
||||
return BDFDB.htmlToElement(menuhtml);
|
||||
return BDFDB.DOMUtils.create(menuhtml);
|
||||
}
|
||||
|
||||
saveSelectChoice (selectWrap, type, choice) {
|
||||
|
@ -349,7 +349,7 @@ class NotificationSounds {
|
|||
this.choices[type[0]][type[1]] = choice;
|
||||
if (type[1] == "category") {
|
||||
this.choices[type[0]].song = Object.keys(this.audios[choice])[0];
|
||||
var settingspanel = BDFDB.getParentEle(".BDFDB-settings", selectWrap), songSelect = settingspanel ? settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type[0]} song"]`) : null;
|
||||
var settingspanel = BDFDB.DOMUtils.getParent(".BDFDB-settings", selectWrap), songSelect = settingspanel ? settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type[0]} song"]`) : null;
|
||||
if (songSelect) songSelect.outerHTML = BDFDB.createSelectMenu(this.createSelectChoice(this.choices[type[0]].song), this.choices[type[0]].song, type[0] + " song");
|
||||
|
||||
}
|
||||
|
@ -371,26 +371,26 @@ class NotificationSounds {
|
|||
var bar = slider.querySelector(BDFDB.dotCN.sliderbarfill);
|
||||
var type = slider.getAttribute("type");
|
||||
|
||||
BDFDB.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
|
||||
BDFDB.DOMUtils.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
|
||||
|
||||
var volume = 0;
|
||||
var sY = 0;
|
||||
var sHalfW = BDFDB.getRects(grabber).width/2;
|
||||
var sMinX = BDFDB.getRects(track).left;
|
||||
var sMaxX = sMinX + BDFDB.getRects(track).width;
|
||||
var bubble = BDFDB.htmlToElement(`<span class="${BDFDB.disCN.sliderbubble}">${Math.floor(this.choices[type].volume)}%</span>`);
|
||||
var sHalfW = BDFDB.DOMUtils.getRects(grabber).width/2;
|
||||
var sMinX = BDFDB.DOMUtils.getRects(track).left;
|
||||
var sMaxX = sMinX + BDFDB.DOMUtils.getRects(track).width;
|
||||
var bubble = BDFDB.DOMUtils.create(`<span class="${BDFDB.disCN.sliderbubble}">${Math.floor(this.choices[type].volume)}%</span>`);
|
||||
grabber.appendChild(bubble);
|
||||
var mouseup = () => {
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
document.removeEventListener("mousemove", mousemove);
|
||||
BDFDB.removeEles(bubble);
|
||||
BDFDB.removeLocalStyle("disableTextSelection");
|
||||
BDFDB.DOMUtils.remove(bubble);
|
||||
BDFDB.DOMUtils.removeLocalStyle("disableTextSelection");
|
||||
this.choices[type].volume = volume;
|
||||
this.saveChoice(type, true);
|
||||
};
|
||||
var mousemove = e2 => {
|
||||
sY = e2.clientX > sMaxX ? sMaxX - sHalfW : (e2.clientX < sMinX ? sMinX - sHalfW : e2.clientX - sHalfW);
|
||||
volume = BDFDB.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
|
||||
volume = BDFDB.NumberUtils.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
|
||||
grabber.style.setProperty("left", volume + "%");
|
||||
bar.style.setProperty("width", volume + "%");
|
||||
input.value = volume;
|
||||
|
|
|
@ -104,7 +104,7 @@ class OldTitleBar {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -160,7 +160,7 @@ class OldTitleBar {
|
|||
|
||||
this.patchMainScreen(BDFDB.DataUtils.get(this, "settings", "displayNative"));
|
||||
|
||||
BDFDB.addClass([document.body,document.querySelector(BDFDB.dotCN.titlebar)], "hidden-by-OTB");
|
||||
BDFDB.DOMUtils.addClass([document.body,document.querySelector(BDFDB.dotCN.titlebar)], "hidden-by-OTB");
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
|
@ -172,9 +172,9 @@ class OldTitleBar {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".headerbarOTB", ".settingsTitlebarOTB");
|
||||
BDFDB.DOMUtils.remove(".headerbarOTB", ".settingsTitlebarOTB");
|
||||
|
||||
BDFDB.removeClasses("hidden-by-OTB", "settingsTitlebarOTB-added");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("hidden-by-OTB", "settingsTitlebarOTB-added");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -200,17 +200,17 @@ class OldTitleBar {
|
|||
this.addSettingsTitleBar(wrapper);
|
||||
}
|
||||
else if (methodnames.includes("componentWillUnmount")) {
|
||||
BDFDB.removeEles(".settingsTitlebarOTB");
|
||||
BDFDB.removeClass(document.body, "settingsTitlebarOTB-added");
|
||||
BDFDB.DOMUtils.remove(".settingsTitlebarOTB");
|
||||
BDFDB.DOMUtils.removeClass(document.body, "settingsTitlebarOTB-added");
|
||||
this.addTitleBar();
|
||||
}
|
||||
}
|
||||
|
||||
addTitleBar () {
|
||||
BDFDB.removeEles(".headerbarOTB");
|
||||
BDFDB.DOMUtils.remove(".headerbarOTB");
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (BDFDB.DataUtils.get(this, "settings", "addOldBar")) {
|
||||
var headerbar = BDFDB.htmlToElement(`<span class="headerbarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></span>`);
|
||||
var headerbar = BDFDB.DOMUtils.create(`<span class="headerbarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></span>`);
|
||||
this.createButtons(headerbar);
|
||||
let headerbaricon = document.querySelector(BDFDB.dotCN.channelheaderchildren);
|
||||
if (headerbaricon) headerbaricon.parentElement.appendChild(headerbar);
|
||||
|
@ -219,10 +219,10 @@ class OldTitleBar {
|
|||
}
|
||||
|
||||
addSettingsTitleBar (settingspane) {
|
||||
BDFDB.removeEles(".settingsTitlebarOTB");
|
||||
BDFDB.DOMUtils.remove(".settingsTitlebarOTB");
|
||||
if (BDFDB.DataUtils.get(this, "settings", "addToSettings")) {
|
||||
BDFDB.addClass(document.body, "settingsTitlebarOTB-added");
|
||||
var settingsbar = BDFDB.htmlToElement(`<div class="settingsTitlebarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifyend + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></div>`);
|
||||
BDFDB.DOMUtils.addClass(document.body, "settingsTitlebarOTB-added");
|
||||
var settingsbar = BDFDB.DOMUtils.create(`<div class="settingsTitlebarOTB ${BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifyend + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}"></div>`);
|
||||
this.createButtons(settingsbar);
|
||||
settingspane.parentElement.appendChild(settingsbar);
|
||||
this.changeMaximizeButtons();
|
||||
|
@ -231,8 +231,8 @@ class OldTitleBar {
|
|||
|
||||
createButtons (bar) {
|
||||
if (BDFDB.DataUtils.get(this, "settings", "reloadButton")) {
|
||||
bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
|
||||
var reloadbutton = BDFDB.htmlToElement(this.reloadButtonMarkup);
|
||||
bar.appendChild(BDFDB.DOMUtils.create(this.dividerMarkup));
|
||||
var reloadbutton = BDFDB.DOMUtils.create(this.reloadButtonMarkup);
|
||||
bar.appendChild(reloadbutton);
|
||||
var reloadbuttonicon = reloadbutton.querySelector(BDFDB.dotCN.channelheadericon);
|
||||
reloadbuttonicon.addEventListener("click", () => {this.window.reload();});
|
||||
|
@ -240,20 +240,20 @@ class OldTitleBar {
|
|||
BDFDB.TooltipUtils.create(reloadbuttonicon, "Reload", {type:"bottom",selector:"reload-button-tooltip"});
|
||||
});
|
||||
}
|
||||
bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
|
||||
var minbutton = BDFDB.htmlToElement(this.minButtonMarkup);
|
||||
bar.appendChild(BDFDB.DOMUtils.create(this.dividerMarkup));
|
||||
var minbutton = BDFDB.DOMUtils.create(this.minButtonMarkup);
|
||||
bar.appendChild(minbutton);
|
||||
minbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.minimize();});
|
||||
var maxbutton = BDFDB.htmlToElement(this.maxButtonMarkup);
|
||||
var maxbutton = BDFDB.DOMUtils.create(this.maxButtonMarkup);
|
||||
bar.appendChild(maxbutton);
|
||||
maxbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {
|
||||
if (this.isMaximized()) this.window.unmaximize();
|
||||
else this.window.maximize();
|
||||
});
|
||||
var closebutton = BDFDB.htmlToElement(this.closeButtonMarkup);
|
||||
var closebutton = BDFDB.DOMUtils.create(this.closeButtonMarkup);
|
||||
bar.appendChild(closebutton);
|
||||
closebutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.close();});
|
||||
if (BDFDB.containsClass(bar, "settingsTitlebarOTB")) BDFDB.removeEles(bar.querySelector(".dividerOTB"));
|
||||
if (BDFDB.DOMUtils.containsClass(bar, "settingsTitlebarOTB")) BDFDB.DOMUtils.remove(bar.querySelector(".dividerOTB"));
|
||||
}
|
||||
|
||||
changeMaximizeButtons () {
|
||||
|
|
|
@ -61,7 +61,7 @@ class OwnerTag {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -107,9 +107,9 @@ class OwnerTag {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".owner-tag, .owner-tag-crown");
|
||||
BDFDB.DOMUtils.remove(".owner-tag, .owner-tag-crown");
|
||||
|
||||
BDFDB.removeLocalStyle(this.name + "HideCrown");
|
||||
BDFDB.DOMUtils.removeLocalStyle(this.name + "HideCrown");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ class OwnerTag {
|
|||
if (message && BDFDB.DataUtils.get(this, "settings", "addInChatWindow")) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
if (username) {
|
||||
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addOwnerTag(message.author, message.channel_id, username.parentElement, "chat", BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact, null);
|
||||
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addOwnerTag(message.author, message.channel_id, username.parentElement, "chat", BDFDB.DOMUtils.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ class OwnerTag {
|
|||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".owner-tag, .owner-tag-crown");
|
||||
BDFDB.DOMUtils.remove(".owner-tag, .owner-tag-crown");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
this.addHideCSS();
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class OwnerTag {
|
|||
|
||||
addOwnerTag (info, channelid, wrapper, type, selector = "", container) {
|
||||
if (!info || !wrapper || !wrapper.parentElement) return;
|
||||
BDFDB.removeEles(wrapper.querySelectorAll(".owner-tag, .owner-tag-crown"));
|
||||
BDFDB.DOMUtils.remove(wrapper.querySelectorAll(".owner-tag, .owner-tag-crown"));
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelid || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
if (!channel) return;
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
|
@ -170,10 +170,10 @@ class OwnerTag {
|
|||
if (!(isowner || (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", info.id)))) return;
|
||||
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, info.id) || {}) : {};
|
||||
if (!settings.useCrown) {
|
||||
let tag = BDFDB.htmlToElement(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.DataUtils.get(this, "inputs", isowner ? "ownTagName" : "ownAdminTagName")}</span>`);
|
||||
let invert = container && container.firstElementChild && !(BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
|
||||
BDFDB.addClass(tag, invert ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular);
|
||||
let EditUsersData = BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.BdUtils.getPlugin("EditUsers").getUserData(info.id, wrapper) : {};
|
||||
let tag = BDFDB.DOMUtils.create(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.DataUtils.get(this, "inputs", isowner ? "ownTagName" : "ownAdminTagName")}</span>`);
|
||||
let invert = container && container.firstElementChild && !(BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
|
||||
BDFDB.DOMUtils.addClass(tag, invert ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular);
|
||||
let EditUsersData = BDFDB.BDUtils.isPluginEnabled("EditUsers") ? BDFDB.BDUtils.getPlugin("EditUsers").getUserData(info.id, wrapper) : {};
|
||||
let tagcolor = BDFDB.ColorUtils.convert(EditUsersData.color1 || member.colorString, "RGBA");
|
||||
let isbright = BDFDB.ColorUtils.isBright(tagcolor);
|
||||
tagcolor = isbright ? (settings.useBlackFont ? tagcolor : BDFDB.ColorUtils.change(tagcolor, -0.3)) : tagcolor;
|
||||
|
@ -182,7 +182,7 @@ class OwnerTag {
|
|||
wrapper.insertBefore(tag, wrapper.querySelector(".TRE-tag,svg[name=MobileDevice]"));
|
||||
}
|
||||
else {
|
||||
let crown = BDFDB.htmlToElement(`<svg name="Crown" class="owner-tag-crown ${isowner ? "owner-tag-owner" : "owner-tag-admin"} ${BDFDB.disCN.memberownericon}" aria-hidden="false" width="24" height="24" viewBox="0 0 16 16"><g fill="none" fill-rule="evenodd"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.6572 5.42868C13.8879 5.29002 14.1806 5.30402 14.3973 5.46468C14.6133 5.62602 14.7119 5.90068 14.6473 6.16202L13.3139 11.4954C13.2393 11.7927 12.9726 12.0007 12.6666 12.0007H3.33325C3.02725 12.0007 2.76058 11.792 2.68592 11.4954L1.35258 6.16202C1.28792 5.90068 1.38658 5.62602 1.60258 5.46468C1.81992 5.30468 2.11192 5.29068 2.34325 5.42868L5.13192 7.10202L7.44592 3.63068C7.46173 3.60697 7.48377 3.5913 7.50588 3.57559C7.5192 3.56612 7.53255 3.55663 7.54458 3.54535L6.90258 2.90268C6.77325 2.77335 6.77325 2.56068 6.90258 2.43135L7.76458 1.56935C7.89392 1.44002 8.10658 1.44002 8.23592 1.56935L9.09792 2.43135C9.22725 2.56068 9.22725 2.77335 9.09792 2.90268L8.45592 3.54535C8.46794 3.55686 8.48154 3.56651 8.49516 3.57618C8.51703 3.5917 8.53897 3.60727 8.55458 3.63068L10.8686 7.10202L13.6572 5.42868ZM2.66667 12.6673H13.3333V14.0007H2.66667V12.6673Z" fill="${isowner ? "currentColor" : "#b3b3b3"}"></path></svg>`);
|
||||
let crown = BDFDB.DOMUtils.create(`<svg name="Crown" class="owner-tag-crown ${isowner ? "owner-tag-owner" : "owner-tag-admin"} ${BDFDB.disCN.memberownericon}" aria-hidden="false" width="24" height="24" viewBox="0 0 16 16"><g fill="none" fill-rule="evenodd"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.6572 5.42868C13.8879 5.29002 14.1806 5.30402 14.3973 5.46468C14.6133 5.62602 14.7119 5.90068 14.6473 6.16202L13.3139 11.4954C13.2393 11.7927 12.9726 12.0007 12.6666 12.0007H3.33325C3.02725 12.0007 2.76058 11.792 2.68592 11.4954L1.35258 6.16202C1.28792 5.90068 1.38658 5.62602 1.60258 5.46468C1.81992 5.30468 2.11192 5.29068 2.34325 5.42868L5.13192 7.10202L7.44592 3.63068C7.46173 3.60697 7.48377 3.5913 7.50588 3.57559C7.5192 3.56612 7.53255 3.55663 7.54458 3.54535L6.90258 2.90268C6.77325 2.77335 6.77325 2.56068 6.90258 2.43135L7.76458 1.56935C7.89392 1.44002 8.10658 1.44002 8.23592 1.56935L9.09792 2.43135C9.22725 2.56068 9.22725 2.77335 9.09792 2.90268L8.45592 3.54535C8.46794 3.55686 8.48154 3.56651 8.49516 3.57618C8.51703 3.5917 8.53897 3.60727 8.55458 3.63068L10.8686 7.10202L13.6572 5.42868ZM2.66667 12.6673H13.3333V14.0007H2.66667V12.6673Z" fill="${isowner ? "currentColor" : "#b3b3b3"}"></path></svg>`);
|
||||
crown.addEventListener("mouseenter", () => {
|
||||
BDFDB.TooltipUtils.create(crown, isowner ? (channel.type == 3 ? BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER : BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER) : BDFDB.LanguageUtils.LanguageStrings.ADMINISTRATOR, {type: "top"});
|
||||
});
|
||||
|
@ -192,7 +192,7 @@ class OwnerTag {
|
|||
|
||||
addHideCSS () {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (settings.hideNativeCrown || settings.useCrown) BDFDB.appendLocalStyle(this.name + "HideCrown", `${BDFDB.dotCNS.member + BDFDB.dotCN.memberownericon}:not(.owner-tag-crown) {display: none;}`);
|
||||
else BDFDB.removeLocalStyle(this.name + "HideCrown");
|
||||
if (settings.hideNativeCrown || settings.useCrown) BDFDB.DOMUtils.appendLocalStyle(this.name + "HideCrown", `${BDFDB.dotCNS.member + BDFDB.dotCN.memberownericon}:not(.owner-tag-crown) {display: none;}`);
|
||||
else BDFDB.DOMUtils.removeLocalStyle(this.name + "HideCrown");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class PersonalPins {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Delete all Notes.</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></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -186,7 +186,7 @@ class PersonalPins {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".popout-personalpins-notes", ".personalpins-sort-popout", ".notes-button");
|
||||
BDFDB.DOMUtils.remove(".popout-personalpins-notes", ".personalpins-sort-popout", ".notes-button");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ class PersonalPins {
|
|||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"MessagePinItem"});
|
||||
const pinUnpinItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[note ? "context_unpinoption_text" : "context_pinoption_text"],
|
||||
hint: BDFDB.BdUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BdUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Note_Message") : null,
|
||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Note_Message") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${note ? "unpin" : "pin"}-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
|
@ -286,7 +286,7 @@ class PersonalPins {
|
|||
if (wrapper.querySelector(".notes-button")) return;
|
||||
let search = wrapper.querySelector(BDFDB.dotCN.channelheadersearch);
|
||||
if (!search) return;
|
||||
let notesbutton = BDFDB.htmlToElement(this.notesButtonMarkup);
|
||||
let notesbutton = BDFDB.DOMUtils.create(this.notesButtonMarkup);
|
||||
search.parentElement.insertBefore(notesbutton, search);
|
||||
let icon = notesbutton.querySelector(BDFDB.dotCN.channelheadericon);
|
||||
icon.addEventListener("click", () => {
|
||||
|
@ -301,7 +301,7 @@ class PersonalPins {
|
|||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.ReactUtils.getValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
let optionPopoutButton = BDFDB.DOMUtils.create(`<div tabindex="0" class="${BDFDB.disCN.optionpopoutbutton}" aria-label="More Options" role="button"><svg name="OverflowMenu" class="${BDFDB.disCN.optionpopoutbuttonicon}" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0z"></path><path fill="currentColor" d="M12 16c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2zm0-6c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2-2-.8954305-2-2 .8954305-2 2-2z"></path></g></svg></div>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
|
@ -310,13 +310,13 @@ class PersonalPins {
|
|||
|
||||
openNotesPopout (button) {
|
||||
let container = document.querySelector(BDFDB.dotCN.popouts);
|
||||
if (!container || BDFDB.containsClass(button, BDFDB.disCN.channelheadericonselected)) return;
|
||||
BDFDB.addClass(button, BDFDB.disCN.channelheadericonselected);
|
||||
let notespopout = BDFDB.htmlToElement(this.notesPopoutMarkup);
|
||||
if (!container || BDFDB.DOMUtils.containsClass(button, BDFDB.disCN.channelheadericonselected)) return;
|
||||
BDFDB.DOMUtils.addClass(button, BDFDB.disCN.channelheadericonselected);
|
||||
let notespopout = BDFDB.DOMUtils.create(this.notesPopoutMarkup);
|
||||
notespopout.querySelector(BDFDB.dotCN.popoutheader).firstElementChild.appendChild(BDFDB.createSearchBar("small"));
|
||||
container.appendChild(notespopout);
|
||||
BDFDB.initElements(notespopout, this);
|
||||
let buttonrects = BDFDB.getRects(button);
|
||||
let buttonrects = BDFDB.DOMUtils.getRects(button);
|
||||
notespopout.style.setProperty("left", buttonrects.left + buttonrects.width/2 + "px");
|
||||
notespopout.style.setProperty("top", buttonrects.top + buttonrects.height + "px")
|
||||
notespopout.querySelectorAll(BDFDB.dotCN.tabbarheaderitem).forEach(tab => {tab.addEventListener("click", () => {
|
||||
|
@ -335,10 +335,10 @@ class PersonalPins {
|
|||
});
|
||||
|
||||
var removePopout = e => {
|
||||
if (!notespopout.contains(e.target) && !BDFDB.getParentEle(".personalpins-sort-popout", e.target)) {
|
||||
if (!notespopout.contains(e.target) && !BDFDB.DOMUtils.getParent(".personalpins-sort-popout", e.target)) {
|
||||
document.removeEventListener("mousedown", removePopout);
|
||||
notespopout.remove();
|
||||
setTimeout(() => {BDFDB.removeClass(button, BDFDB.disCN.channelheadericonselected);},300);
|
||||
setTimeout(() => {BDFDB.DOMUtils.removeClass(button, BDFDB.disCN.channelheadericonselected);},300);
|
||||
}
|
||||
};
|
||||
document.addEventListener("mousedown", removePopout);
|
||||
|
@ -347,7 +347,7 @@ class PersonalPins {
|
|||
}
|
||||
|
||||
addNotes (notespopout) {
|
||||
BDFDB.removeEles(notespopout.querySelectorAll(BDFDB.dotCNC.messagegroupwrapper + BDFDB.dotCN.messagespopoutchannelseparator));
|
||||
BDFDB.DOMUtils.remove(notespopout.querySelectorAll(BDFDB.dotCNC.messagegroupwrapper + BDFDB.dotCN.messagespopoutchannelseparator));
|
||||
let channel = BDFDB.ChannelUtils.getSelected();
|
||||
if (channel) {
|
||||
let guild_id = channel.guild_id ? channel.guild_id : "@me";
|
||||
|
@ -381,7 +381,7 @@ class PersonalPins {
|
|||
note.remove();
|
||||
}
|
||||
}
|
||||
BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
|
||||
BDFDB.DOMUtils.toggle(placeholder, container.firstElementChild == placeholder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -393,19 +393,19 @@ class PersonalPins {
|
|||
let user = BDFDB.LibraryModules.UserStore.getUser(noteData.author_id) || {};
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(noteData.guild_id, noteData.author_id) || {};
|
||||
let date = new Date(noteData.timestamp);
|
||||
let message = BDFDB.htmlToElement(this.messageMarkup);
|
||||
let messagedivider = BDFDB.htmlToElement(this.messageDividerMarkup);
|
||||
let message = BDFDB.DOMUtils.create(this.messageMarkup);
|
||||
let messagedivider = BDFDB.DOMUtils.create(this.messageDividerMarkup);
|
||||
container.insertBefore(message, container.firstChild);
|
||||
container.insertBefore(messagedivider, container.firstChild);
|
||||
let channelname = messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname);
|
||||
channelname.innerText = (noteData.guild_id == "@me" ? " @" : " #") + (channel.name || noteData.channel_name);
|
||||
if (noteData.guild_id != "@me" && BDFDB.BdUtils.isPluginEnabled("EditChannels")) {
|
||||
BDFDB.BdUtils.getPlugin("EditChannels").changeChannel2({id:noteData.channel_id,name:noteData.channel_name}, channelname);
|
||||
if (noteData.guild_id != "@me" && BDFDB.BDUtils.isPluginEnabled("EditChannels")) {
|
||||
BDFDB.BDUtils.getPlugin("EditChannels").changeChannel2({id:noteData.channel_id,name:noteData.channel_name}, channelname);
|
||||
}
|
||||
else if (noteData.guild_id == "@me" && BDFDB.BdUtils.isPluginEnabled("EditUsers")) {
|
||||
else if (noteData.guild_id == "@me" && BDFDB.BDUtils.isPluginEnabled("EditUsers")) {
|
||||
let dmuser_id = channel && channel.type == 1 ? channel.recipients[0] : noteData.dmuser_id;
|
||||
if (dmuser_id) {
|
||||
BDFDB.BdUtils.getPlugin("EditUsers").changeName2({id:dmuser_id,username:noteData.channel_name}, channelname);
|
||||
BDFDB.BDUtils.getPlugin("EditUsers").changeName2({id:dmuser_id,username:noteData.channel_name}, channelname);
|
||||
if (channelname.innerText.indexOf("@") != 0) channelname.innerText = "@" + channelname.innerText;
|
||||
}
|
||||
}
|
||||
|
@ -416,8 +416,8 @@ class PersonalPins {
|
|||
let username = message.querySelector(BDFDB.dotCN.messageusername);
|
||||
username.innerText = user.username || noteData.author_name;
|
||||
username.style.setProperty("color", member.colorString || noteData.color);
|
||||
if (BDFDB.BdUtils.isPluginEnabled("EditUsers")) {
|
||||
let EditUsers = BDFDB.BdUtils.getPlugin("EditUsers");
|
||||
if (BDFDB.BDUtils.isPluginEnabled("EditUsers")) {
|
||||
let EditUsers = BDFDB.BDUtils.getPlugin("EditUsers");
|
||||
EditUsers.changeName({id:noteData.author_id,username:noteData.author_name}, username, noteData.guild_id);
|
||||
if (user.id) EditUsers.changeAvatar({id:noteData.author_id,username:noteData.author_name}, avatar);
|
||||
EditUsers.addTag({id:noteData.author_id,username:noteData.author_name}, username.parentElement, " " + BDFDB.disCN.bottagnametag);
|
||||
|
@ -425,8 +425,8 @@ class PersonalPins {
|
|||
let timestamp = message.querySelector(BDFDB.dotCN.messagetimestampcozy);
|
||||
timestamp.innerText = date.toLocaleString(BDFDB.getDiscordLanguage().id);
|
||||
timestamp.setAttribute("datetime", date);
|
||||
if (BDFDB.BdUtils.isPluginEnabled("CompleteTimestamps") && BDFDB.DataUtils.load("CompleteTimestamps", "settings"), "showInChat") {
|
||||
BDFDB.BdUtils.getPlugin("CompleteTimestamps").changeTimestamp(timestamp);
|
||||
if (BDFDB.BDUtils.isPluginEnabled("CompleteTimestamps") && BDFDB.DataUtils.load("CompleteTimestamps", "settings"), "showInChat") {
|
||||
BDFDB.BDUtils.getPlugin("CompleteTimestamps").changeTimestamp(timestamp);
|
||||
}
|
||||
message.querySelector(BDFDB.dotCN.messagemarkup).innerHTML = noteData.markup.replace(`<span class="edited">`,`<span class="${BDFDB.disCN.messageedited}">`);
|
||||
message.querySelector(BDFDB.dotCN.messageaccessory).innerHTML = noteData.accessory;
|
||||
|
@ -453,9 +453,9 @@ class PersonalPins {
|
|||
else BDFDB.shake();
|
||||
});
|
||||
message.querySelector(BDFDB.dotCN.messagespopoutclosebutton).addEventListener("click", e => {
|
||||
BDFDB.removeEles(messagedivider, message);
|
||||
BDFDB.DOMUtils.remove(messagedivider, message);
|
||||
this.removeNoteData(noteData);
|
||||
BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
|
||||
BDFDB.DOMUtils.toggle(placeholder, container.firstElementChild == placeholder);
|
||||
});
|
||||
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".jump").addEventListener("click", e => {
|
||||
BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(noteData.guild_id, noteData.channel_id, noteData.id));
|
||||
|
@ -486,14 +486,14 @@ class PersonalPins {
|
|||
}
|
||||
|
||||
startYoutubeVideo (button) {
|
||||
let embedwrapper = BDFDB.getParentEle(BDFDB.dotCN.embedvideo, button);
|
||||
let embedwrapper = BDFDB.DOMUtils.getParent(BDFDB.dotCN.embedvideo, button);
|
||||
let ytlink = embedwrapper.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
|
||||
BDFDB.LibraryRequires.request(ytlink, (error, response, result) => {
|
||||
if (result && response.headers && typeof response.headers.server == "string" && response.headers.server.toUpperCase() == "YOUTUBE FRONTEND PROXY") {
|
||||
while (embedwrapper.firstChild) embedwrapper.firstChild.remove();
|
||||
let width = 400;
|
||||
let height = Math.round(width*(result.split('<meta itemprop="height" content="')[1].split('"')[0]/result.split('<meta itemprop="width" content="')[1].split('"')[0]));
|
||||
embedwrapper.appendChild(BDFDB.htmlToElement(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&autoplay=1&auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
|
||||
embedwrapper.appendChild(BDFDB.DOMUtils.create(`<iframe src="${result.split('<link itemprop="embedURL" href="')[1].split('"')[0]}?start=0&autoplay=1&auto_play=1" width="${width}" height="${height}" frameborder="0" allowfullscreen=""></iframe>`));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ class PersonalPins {
|
|||
}
|
||||
|
||||
getMessageAndPos (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target);
|
||||
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.childNodes).filter(n => n.nodeType != Node.TEXT_NODE).indexOf(messagediv) : -1;
|
||||
return {messagediv, pos};
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class PinDMs {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Unpin all DMs.</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></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -187,11 +187,11 @@ class PinDMs {
|
|||
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
|
||||
}
|
||||
|
||||
for (let info of BDFDB.DmUtils.getAll()) {
|
||||
for (let info of BDFDB.DMUtils.getAll()) {
|
||||
this.unhideNativeDM(info.id);
|
||||
if (info.div) info.div.removeEventListener("contextmenu", info.div.PinDMsContextMenuListener);
|
||||
}
|
||||
BDFDB.removeEles(".pinned-dm", ".dmplaceholder", ".pindms-dragpreview");
|
||||
BDFDB.DOMUtils.remove(".pinned-dm", ".dmplaceholder", ".pindms-dragpreview");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ class PinDMs {
|
|||
this.updatePinnedPositions("pinnedRecents");
|
||||
}
|
||||
else {
|
||||
BDFDB.removeEles(document.querySelector(`.pinned-dm[channelid="${id}"]`));
|
||||
BDFDB.DOMUtils.remove(document.querySelector(`.pinned-dm[channelid="${id}"]`));
|
||||
this.unhideNativeDM(id);
|
||||
BDFDB.DataUtils.remove(this, "pinnedRecents", id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
|
@ -281,8 +281,8 @@ class PinDMs {
|
|||
if (instance && instance.props && instance.props.ispin) {
|
||||
let id = BDFDB.ReactUtils.getValue(instance, "props.channel.id");
|
||||
wrapper.setAttribute("channelid", id);
|
||||
BDFDB.addClass(wrapper, "pinned");
|
||||
BDFDB.removeClass(BDFDB.ChannelUtils.getDiv(id), BDFDB.disCN.namecontainerselected);
|
||||
BDFDB.DOMUtils.addClass(wrapper, "pinned");
|
||||
BDFDB.DOMUtils.removeClass(BDFDB.ChannelUtils.getDiv(id), BDFDB.disCN.namecontainerselected);
|
||||
(wrapper.querySelector("a") || wrapper).setAttribute("draggable", false);
|
||||
wrapper.addEventListener("click", e => {
|
||||
let dmsscroller = document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller);
|
||||
|
@ -304,20 +304,20 @@ class PinDMs {
|
|||
let dmchannelswrap = document.querySelector(`${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller}`);
|
||||
if (!dmchannelswrap) return;
|
||||
let hovele = null;
|
||||
let placeholder = BDFDB.htmlToElement(`<a class="${BDFDB.disCNS.dmchannel + BDFDB.disCNS.namecontainer + BDFDB.disCN.namecontainerclickable} dmchannelplaceholder"><div class="${BDFDB.disCN.namecontainerlayout}"></div></a>`);
|
||||
let placeholder = BDFDB.DOMUtils.create(`<a class="${BDFDB.disCNS.dmchannel + BDFDB.disCNS.namecontainer + BDFDB.disCN.namecontainerclickable} dmchannelplaceholder"><div class="${BDFDB.disCN.namecontainerlayout}"></div></a>`);
|
||||
let dragpreview = this.createDragPreview(wrapper, e);
|
||||
let dragging = e3 => {
|
||||
BDFDB.removeEles(placeholder);
|
||||
BDFDB.toggleEles(wrapper, false);
|
||||
BDFDB.DOMUtils.remove(placeholder);
|
||||
BDFDB.DOMUtils.hide(wrapper);
|
||||
this.updateDragPreview(dragpreview, e3);
|
||||
hovele = BDFDB.getParentEle(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel + ".pinned", e3.target);
|
||||
hovele = BDFDB.DOMUtils.getParent(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel + ".pinned", e3.target);
|
||||
if (hovele) dmchannelswrap.insertBefore(placeholder, hovele.nextSibling);
|
||||
};
|
||||
let releasing = e3 => {
|
||||
document.removeEventListener("mousemove", dragging);
|
||||
document.removeEventListener("mouseup", releasing);
|
||||
BDFDB.removeEles(placeholder, dragpreview);
|
||||
BDFDB.toggleEles(wrapper, true);
|
||||
BDFDB.DOMUtils.remove(placeholder, dragpreview);
|
||||
BDFDB.DOMUtils.show(wrapper);
|
||||
if (hovele) {
|
||||
dmchannelswrap.insertBefore(wrapper, hovele.nextSibling);
|
||||
this.updatePinnedPositions("pinnedDMs");
|
||||
|
@ -350,7 +350,7 @@ class PinDMs {
|
|||
label: this.labels.context_pinguild_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-pinguild-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
this.addPinnedRecent(instance.props.channel.id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ class PinDMs {
|
|||
if (!id) return;
|
||||
let div = document.querySelector(`${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned[channelid="${id}"]`);
|
||||
if (div) {
|
||||
BDFDB.removeClass(div, "pinned");
|
||||
BDFDB.DOMUtils.removeClass(div, "pinned");
|
||||
div.removeAttribute("channelid");
|
||||
}
|
||||
BDFDB.DataUtils.remove(this, "pinnedDMs", id);
|
||||
|
@ -484,11 +484,11 @@ class PinDMs {
|
|||
}
|
||||
|
||||
addPinnedRecent (id) {
|
||||
let anker = document.querySelector("#bd-pub-li") || BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
let anker = document.querySelector("#bd-pub-li") || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
if (anker && !document.querySelector(`.pinned-dm[channelid="${id}"]`)) {
|
||||
let info = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
if (info) {
|
||||
let dmdiv = BDFDB.htmlToElement(this.recentDMMarkup);
|
||||
let dmdiv = BDFDB.DOMUtils.create(this.recentDMMarkup);
|
||||
let dmdivinner = dmdiv.querySelector(BDFDB.dotCN.guildinnerwrapper);
|
||||
let dmiconwrapper = dmdiv.querySelector(BDFDB.dotCN.guildiconwrapper);
|
||||
dmiconwrapper.style.setProperty("border-radius", BDFDB.LibraryModules.LastChannelStore.getChannelId() == id ? "30%" : "50%");
|
||||
|
@ -506,12 +506,12 @@ class PinDMs {
|
|||
dmname = dmname + BDFDB.LibraryModules.UserStore.getUser(dmuser_id).username;
|
||||
}
|
||||
}
|
||||
let EditUsersData = user && BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.BdUtils.getPlugin("EditUsers").getUserData(user.id, dmdiv) : {};
|
||||
if (!EditUsersData.removeIcon) avatar.setAttribute("src", `${EditUsersData.url || BDFDB.DmUtils.getIcon(id)}`);
|
||||
let EditUsersData = user && BDFDB.BDUtils.isPluginEnabled("EditUsers") ? BDFDB.BDUtils.getPlugin("EditUsers").getUserData(user.id, dmdiv) : {};
|
||||
if (!EditUsersData.removeIcon) avatar.setAttribute("src", `${EditUsersData.url || BDFDB.DMUtils.getIcon(id)}`);
|
||||
avatar.setAttribute("channel", dmname);
|
||||
if (user) avatar.setAttribute("user", user.username);
|
||||
dmdivinner.addEventListener("mouseenter", () => {
|
||||
let FreshEditUsersData = user && BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.BdUtils.getPlugin("EditUsers").getUserData(user.id, dmdiv) : {};
|
||||
let FreshEditUsersData = user && BDFDB.BDUtils.isPluginEnabled("EditUsers") ? BDFDB.BDUtils.getPlugin("EditUsers").getUserData(user.id, dmdiv) : {};
|
||||
BDFDB.TooltipUtils.create(dmdivinner, FreshEditUsersData.name || dmname, {selector:(BDFDB.ObjectUtils.isEmpty(FreshEditUsersData) ? "" : "EditUsers-tooltip"),type:"right"});
|
||||
});
|
||||
avatar.parentElement.addEventListener("click", e => {
|
||||
|
@ -532,8 +532,8 @@ class PinDMs {
|
|||
danger: true,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-unpinguild-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.removeEles(dmdiv);
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.DOMUtils.remove(dmdiv);
|
||||
this.unhideNativeDM(id);
|
||||
BDFDB.DataUtils.remove(this, "pinnedRecents", id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
|
@ -550,20 +550,20 @@ class PinDMs {
|
|||
document.removeEventListener("mousemove", mousemove);
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
let hovele = null;
|
||||
let placeholder = BDFDB.htmlToElement(this.dragPlaceholderMarkup);
|
||||
let placeholder = BDFDB.DOMUtils.create(this.dragPlaceholderMarkup);
|
||||
let dragpreview = this.createDragPreview(dmdiv, e);
|
||||
let dragging = e3 => {
|
||||
BDFDB.removeEles(placeholder);
|
||||
BDFDB.toggleEles(dmdiv, false);
|
||||
BDFDB.DOMUtils.remove(placeholder);
|
||||
BDFDB.DOMUtils.hide(dmdiv);
|
||||
this.updateDragPreview(dragpreview, e3);
|
||||
hovele = BDFDB.getParentEle(".pinned-dm", e3.target);
|
||||
hovele = BDFDB.DOMUtils.getParent(".pinned-dm", e3.target);
|
||||
if (hovele) hovele.parentElement.insertBefore(placeholder, hovele.nextSibling);
|
||||
};
|
||||
let releasing = e3 => {
|
||||
document.removeEventListener("mousemove", dragging);
|
||||
document.removeEventListener("mouseup", releasing);
|
||||
BDFDB.removeEles(placeholder, dragpreview);
|
||||
BDFDB.toggleEles(dmdiv, true);
|
||||
BDFDB.DOMUtils.remove(placeholder, dragpreview);
|
||||
BDFDB.DOMUtils.show(dmdiv);
|
||||
if (hovele) {
|
||||
hovele.parentElement.insertBefore(dmdiv, hovele.nextSibling);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
|
@ -590,10 +590,10 @@ class PinDMs {
|
|||
createDragPreview (div, e) {
|
||||
if (!Node.prototype.isPrototypeOf(div)) return;
|
||||
let dragpreview = div.cloneNode(true);
|
||||
BDFDB.addClass(dragpreview, "pindms-dragpreview");
|
||||
BDFDB.DOMUtils.addClass(dragpreview, "pindms-dragpreview");
|
||||
document.querySelector(BDFDB.dotCN.appmount).appendChild(dragpreview);
|
||||
let rects = BDFDB.getRects(dragpreview);
|
||||
BDFDB.toggleEles(dragpreview, false);
|
||||
let rects = BDFDB.DOMUtils.getRects(dragpreview);
|
||||
BDFDB.DOMUtils.hide(dragpreview);
|
||||
dragpreview.style.setProperty("pointer-events", "none", "important");
|
||||
dragpreview.style.setProperty("left", e.clientX - (rects.width/2) + "px", "important");
|
||||
dragpreview.style.setProperty("top", e.clientY - (rects.height/2) + "px", "important");
|
||||
|
@ -602,8 +602,8 @@ class PinDMs {
|
|||
|
||||
updateDragPreview (dragpreview, e) {
|
||||
if (!Node.prototype.isPrototypeOf(dragpreview)) return;
|
||||
BDFDB.toggleEles(dragpreview, true);
|
||||
let rects = BDFDB.getRects(dragpreview);
|
||||
BDFDB.DOMUtils.show(dragpreview);
|
||||
let rects = BDFDB.DOMUtils.getRects(dragpreview);
|
||||
dragpreview.style.setProperty("left", e.clientX - (rects.width/2) + "px", "important");
|
||||
dragpreview.style.setProperty("top", e.clientY - (rects.height/2) + "px", "important");
|
||||
}
|
||||
|
@ -624,13 +624,13 @@ class PinDMs {
|
|||
let count = BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(id);
|
||||
let showpin = BDFDB.DataUtils.get(this, "settings", "showPinIcon");
|
||||
|
||||
let dmdiv = BDFDB.DmUtils.getDiv(id);
|
||||
let dmdiv = BDFDB.DMUtils.getDiv(id);
|
||||
let pinneddmiconwrapper = pinneddmdiv.querySelector(BDFDB.dotCN.guildiconwrapper);
|
||||
let pinneddmdivpill = pinneddmdiv.querySelector(BDFDB.dotCN.guildpillitem);
|
||||
let iconbadge = pinneddmdiv.querySelector(BDFDB.dotCN.guildupperbadge);
|
||||
let notificationbadge = pinneddmdiv.querySelector(BDFDB.dotCN.guildlowerbadge);
|
||||
|
||||
BDFDB.toggleClass(pinneddmdiv, "has-new-messages", count > 0);
|
||||
BDFDB.DOMUtils.toggleClass(pinneddmdiv, "has-new-messages", count > 0);
|
||||
let selected = BDFDB.LibraryModules.LastChannelStore.getChannelId() == id;
|
||||
pinneddmiconwrapper.style.setProperty("border-radius", selected ? "30%" : "50%");
|
||||
if (pinneddmdivpill) {
|
||||
|
@ -639,11 +639,11 @@ class PinDMs {
|
|||
pinneddmdivpill.style.setProperty("transform", "translate3d(0px, 0px, 0px)");
|
||||
}
|
||||
|
||||
BDFDB.toggleEles(iconbadge, showpin);
|
||||
BDFDB.DOMUtils.toggle(iconbadge, showpin);
|
||||
notificationbadge.firstElementChild.innerText = count;
|
||||
notificationbadge.firstElementChild.style.setProperty("width", `${count > 99 ? 30 : (count > 9 ? 22 : 16)}px`);
|
||||
notificationbadge.firstElementChild.style.setProperty("padding-right", `${count > 99 ? 0 : (count > 9 ? 0 : 1)}px`);
|
||||
BDFDB.toggleEles(notificationbadge, count > 0);
|
||||
BDFDB.DOMUtils.toggle(notificationbadge, count > 0);
|
||||
|
||||
let masks = pinneddmdiv.querySelectorAll("mask rect");
|
||||
masks[0].setAttribute("transform", showpin ? "translate(0 0)" : "translate(20 -20)");
|
||||
|
@ -654,18 +654,18 @@ class PinDMs {
|
|||
}
|
||||
|
||||
hideNativeDM (id) {
|
||||
let dmdiv = BDFDB.DmUtils.getDiv(id);
|
||||
let dmdiv = BDFDB.DMUtils.getDiv(id);
|
||||
if (Node.prototype.isPrototypeOf(dmdiv)) {
|
||||
BDFDB.toggleEles(dmdiv, false);
|
||||
BDFDB.addClass(dmdiv, "hidden-by-pin");
|
||||
BDFDB.DOMUtils.hide(dmdiv);
|
||||
BDFDB.DOMUtils.addClass(dmdiv, "hidden-by-pin");
|
||||
}
|
||||
}
|
||||
|
||||
unhideNativeDM (id) {
|
||||
let dmdiv = BDFDB.DmUtils.getDiv(id);
|
||||
if (Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, "hidden-by-pin")) {
|
||||
BDFDB.toggleEles(dmdiv, true);
|
||||
BDFDB.removeClass(dmdiv, "hidden-by-pin");
|
||||
let dmdiv = BDFDB.DMUtils.getDiv(id);
|
||||
if (Node.prototype.isPrototypeOf(dmdiv) && BDFDB.DOMUtils.containsClass(dmdiv, "hidden-by-pin")) {
|
||||
BDFDB.DOMUtils.show(dmdiv);
|
||||
BDFDB.DOMUtils.removeClass(dmdiv, "hidden-by-pin");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ class PinDMs {
|
|||
}
|
||||
|
||||
setLabelsByLanguage () {
|
||||
switch (BDFDB.getDiscordLanguage().id) {
|
||||
switch (BDFDB.LanguageUtils.getLanguage().id) {
|
||||
case "hr": //croatian
|
||||
return {
|
||||
context_pindm_text: "Prikljucite Izravnu Poruku",
|
||||
|
|
|
@ -259,7 +259,7 @@ class PluginRepo {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added Plugins from your own list.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -318,7 +318,7 @@ class PluginRepo {
|
|||
clearInterval(this.updateInterval);
|
||||
clearTimeout(this.loading.timeout);
|
||||
|
||||
BDFDB.removeEles(".pluginrepo-notice",".bd-pluginrepobutton",".pluginrepo-loadingicon",BDFDB.dotCN.app + " > .repo-loadingwrapper:empty");
|
||||
BDFDB.DOMUtils.remove(".pluginrepo-notice",".bd-pluginrepobutton",".pluginrepo-loadingicon",BDFDB.dotCN.app + " > .repo-loadingwrapper:empty");
|
||||
|
||||
var frame = document.querySelector("iframe.discordSandbox");
|
||||
if (frame) {
|
||||
|
@ -352,7 +352,7 @@ class PluginRepo {
|
|||
if (!document.querySelector(".bd-pluginrepobutton") && window.PluginUpdates && window.PluginUpdates.plugins && instance._reactInternalFiber.key && instance._reactInternalFiber.key.split("-")[0] == "plugin") {
|
||||
var folderbutton = document.querySelector(BDFDB.dotCN._repofolderbutton);
|
||||
if (folderbutton) {
|
||||
var repoButton = BDFDB.htmlToElement(`<button class="${BDFDB.disCN._repofolderbutton} bd-pluginrepobutton">PluginRepo</button>`);
|
||||
var repoButton = BDFDB.DOMUtils.create(`<button class="${BDFDB.disCN._repofolderbutton} bd-pluginrepobutton">PluginRepo</button>`);
|
||||
repoButton.addEventListener("click", () => {
|
||||
this.openPluginRepoModal();
|
||||
});
|
||||
|
@ -374,7 +374,7 @@ class PluginRepo {
|
|||
if (!ownlist.includes(url)) {
|
||||
ownlist.push(url);
|
||||
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
|
||||
let entry = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-plugin"></div></div>`);
|
||||
let entry = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-plugin"></div></div>`);
|
||||
BDFDB.ListenerUtils.addToChildren(entry, "click", ".remove-plugin", e => {this.removePluginFromOwnList(e);});
|
||||
pluginList.appendChild(entry);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ class PluginRepo {
|
|||
removeAllFromOwnList (settingspanel) {
|
||||
BDFDB.openConfirmModal(this, "Are you sure you want to remove all added Plugins from your own list?", () => {
|
||||
BDFDB.DataUtils.save([], this, "ownlist", "ownlist");
|
||||
BDFDB.removeEles(settingspanel.querySelector(BDFDB.dotCN.hovercard));
|
||||
BDFDB.DOMUtils.remove(settingspanel.querySelector(BDFDB.dotCN.hovercard));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -403,14 +403,14 @@ class PluginRepo {
|
|||
return;
|
||||
}
|
||||
|
||||
var pluginRepoModal = BDFDB.htmlToElement(this.pluginRepoModalMarkup);
|
||||
var pluginRepoModal = BDFDB.DOMUtils.create(this.pluginRepoModalMarkup);
|
||||
var tabbar = pluginRepoModal.querySelector(BDFDB.dotCN.tabbar);
|
||||
tabbar.parentElement.insertBefore(BDFDB.createSearchBar("small"), tabbar.nextElementSibling);
|
||||
var hiddenSettings = BDFDB.DataUtils.load(this, "hidden");
|
||||
pluginRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || options.showOnlyOutdated;
|
||||
pluginRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !options.showOnlyOutdated;
|
||||
pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
|
||||
if (!BDFDB.BdUtils.isAutoLoadEnabled()) pluginRepoModal.querySelector("#RNMoption").remove();
|
||||
if (!BDFDB.BDUtils.isAutoLoadEnabled()) pluginRepoModal.querySelector("#RNMoption").remove();
|
||||
else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.DataUtils.load(this, "RNMstart", "RNMstart");
|
||||
|
||||
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
|
||||
|
@ -446,7 +446,7 @@ class PluginRepo {
|
|||
BDFDB.createSortPopout(e.currentTarget, this.orderPopoutMarkup, () => {this.sortEntries(pluginRepoModal);});
|
||||
});
|
||||
BDFDB.ListenerUtils.addToChildren(pluginRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=plugins]", e => {
|
||||
if (!BDFDB.containsClass(e.currentTarget, BDFDB.disCN.settingsitemselected) && pluginRepoModal.updateHidden) {
|
||||
if (!BDFDB.DOMUtils.containsClass(e.currentTarget, BDFDB.disCN.settingsitemselected) && pluginRepoModal.updateHidden) {
|
||||
delete pluginRepoModal.updateHidden;
|
||||
this.sortEntries(pluginRepoModal);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ class PluginRepo {
|
|||
pluginRepoModal.entries = {};
|
||||
for (let url in this.loadedPlugins) {
|
||||
let plugin = this.loadedPlugins[url];
|
||||
let instPlugin = BDFDB.BdUtils.getPlugin(plugin.getName);
|
||||
let instPlugin = BDFDB.BDUtils.getPlugin(plugin.getName);
|
||||
if (instPlugin && this.getString(instPlugin.getAuthor()).toUpperCase() == plugin.getAuthor.toUpperCase()) plugin.getState = this.getString(instPlugin.getVersion()) != plugin.getVersion ? 1 : 0;
|
||||
else plugin.getState = 2;
|
||||
let data = {
|
||||
|
@ -483,7 +483,7 @@ class PluginRepo {
|
|||
|
||||
addEntry (pluginRepoModal, container, data) {
|
||||
if (!pluginRepoModal || !container || !data) return;
|
||||
let entry = BDFDB.htmlToElement(this.pluginEntryMarkup);
|
||||
let entry = BDFDB.DOMUtils.create(this.pluginEntryMarkup);
|
||||
setEntryState(data.state);
|
||||
entry.setAttribute("data-name", data.name);
|
||||
entry.setAttribute("data-version", data.version);
|
||||
|
@ -492,9 +492,9 @@ class PluginRepo {
|
|||
entry.querySelector(BDFDB.dotCN._repoversion).innerHTML = data.version;
|
||||
entry.querySelector(BDFDB.dotCN._repoauthor).innerHTML = data.author;
|
||||
entry.querySelector(BDFDB.dotCN._repodescription).innerHTML = data.description;
|
||||
if (data.new == 0) entry.querySelector(BDFDB.dotCN._repoheadertitle).appendChild(BDFDB.htmlToElement(`<span class="newentries-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(250, 166, 26) !important; color: white !important; padding: 1px 3px; font-size: 10px; top: -2px;">NEW</span>`));
|
||||
if (data.new == 0) entry.querySelector(BDFDB.dotCN._repoheadertitle).appendChild(BDFDB.DOMUtils.create(`<span class="newentries-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(250, 166, 26) !important; color: white !important; padding: 1px 3px; font-size: 10px; top: -2px;">NEW</span>`));
|
||||
let favbutton = entry.querySelector(BDFDB.dotCN.giffavoritebutton);
|
||||
BDFDB.toggleClass(favbutton, BDFDB.disCN.giffavoriteselected, data.fav == 0);
|
||||
BDFDB.DOMUtils.toggleClass(favbutton, BDFDB.disCN.giffavoriteselected, data.fav == 0);
|
||||
favbutton.addEventListener("click", e => {
|
||||
let favorize = data.fav == 1;
|
||||
data.fav = favorize ? 0 : 1;
|
||||
|
@ -520,10 +520,10 @@ class PluginRepo {
|
|||
});
|
||||
let trashbutton = entry.querySelector(".trashIcon");
|
||||
trashbutton.addEventListener("click", e => {
|
||||
if (BDFDB.containsClass(entry, "outdated", "updated", false)) {
|
||||
if (BDFDB.DOMUtils.containsClass(entry, "outdated", "updated", false)) {
|
||||
setEntryState(2);
|
||||
this.deletePluginFile(data);
|
||||
if (!BDFDB.BdUtils.isAutoLoadEnabled()) this.stopPlugin(data);
|
||||
if (!BDFDB.BDUtils.isAutoLoadEnabled()) this.stopPlugin(data);
|
||||
}
|
||||
});
|
||||
trashbutton.addEventListener("mouseenter", e => {
|
||||
|
@ -539,9 +539,9 @@ class PluginRepo {
|
|||
|
||||
function setEntryState (state) {
|
||||
data.state = state;
|
||||
BDFDB.toggleClass(entry, "downloadable", state > 1);
|
||||
BDFDB.toggleClass(entry, "outdated", state == 1);
|
||||
BDFDB.toggleClass(entry, "updated", state < 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "downloadable", state > 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "outdated", state == 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "updated", state < 1);
|
||||
let downloadbutton = entry.querySelector(".btn-download");
|
||||
downloadbutton.innerText = state < 1 ? "Updated" : (state > 1 ? "Download" : "Outdated");
|
||||
downloadbutton.style.setProperty("background-color", "rgb(" + (state < 1 ? "67,181,129" : (state > 1 ? "114,137,218" : "241,71,71")) + ")", state > 1 ? "" : "important");
|
||||
|
@ -580,12 +580,12 @@ class PluginRepo {
|
|||
li.style.setProperty("order", pos, "important");
|
||||
}
|
||||
else li.style.removeProperty("order");
|
||||
BDFDB.toggleEles(li, pos > -1);
|
||||
BDFDB.DOMUtils.toggle(li, pos > -1);
|
||||
}
|
||||
}
|
||||
|
||||
loadPlugins () {
|
||||
BDFDB.removeEles("iframe.discordSandbox",".pluginrepo-loadingicon");
|
||||
BDFDB.DOMUtils.remove("iframe.discordSandbox",".pluginrepo-loadingicon");
|
||||
let settings = BDFDB.DataUtils.load(this, "settings");
|
||||
var getPluginInfo, createFrame, runInFrame;
|
||||
var frame, framerunning = false, framequeue = [], outdated = 0, newentries = 0, i = 0;
|
||||
|
@ -609,11 +609,11 @@ class PluginRepo {
|
|||
},1200000), amount:this.loading.amount+1};
|
||||
var loadingiconwrapper = document.querySelector(BDFDB.dotCN.app + "> .repo-loadingwrapper");
|
||||
if (!loadingiconwrapper) {
|
||||
loadingiconwrapper = BDFDB.htmlToElement(`<div class="repo-loadingwrapper"></div>`);
|
||||
loadingiconwrapper = BDFDB.DOMUtils.create(`<div class="repo-loadingwrapper"></div>`);
|
||||
document.querySelector(BDFDB.dotCN.app).appendChild(loadingiconwrapper);
|
||||
}
|
||||
var loadingicon = BDFDB.htmlToElement(this.pluginRepoIconMarkup);
|
||||
BDFDB.addClass(loadingicon, "pluginrepo-loadingicon");
|
||||
var loadingicon = BDFDB.DOMUtils.create(this.pluginRepoIconMarkup);
|
||||
BDFDB.DOMUtils.addClass(loadingicon, "pluginrepo-loadingicon");
|
||||
loadingicon.addEventListener("mouseenter", () => {
|
||||
BDFDB.TooltipUtils.create(loadingicon, this.getLoadingTooltipText(), {type:"left", delay:500, style:"max-width:unset;", selector:"pluginrepo-loading-tooltip"});
|
||||
});
|
||||
|
@ -623,16 +623,16 @@ class PluginRepo {
|
|||
getPluginInfo(() => {
|
||||
if (!this.started) {
|
||||
clearTimeout(this.loading.timeout);
|
||||
BDFDB.removeEles(frame);
|
||||
BDFDB.DOMUtils.remove(frame);
|
||||
if (frame && frame.messageReceived) window.removeEventListener("message", frame.messageReceived);
|
||||
return;
|
||||
}
|
||||
var finishCounter = 0, finishInterval = setInterval(() => {
|
||||
if ((framequeue.length == 0 && !framerunning) || finishCounter > 300 || !this.loading.is) {
|
||||
clearInterval(finishInterval);
|
||||
BDFDB.removeEles(frame, loadingicon, ".pluginrepo-loadingicon");
|
||||
BDFDB.DOMUtils.remove(frame, loadingicon, ".pluginrepo-loadingicon");
|
||||
if (frame && frame.messageReceived) window.removeEventListener("message", frame.messageReceived);
|
||||
if (!loadingiconwrapper.firstChild) BDFDB.removeEles(loadingiconwrapper);
|
||||
if (!loadingiconwrapper.firstChild) BDFDB.DOMUtils.remove(loadingiconwrapper);
|
||||
clearTimeout(this.loading.timeout);
|
||||
this.loading = {is:false, timeout:null, amount:this.loading.amount};
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Finished fetching Plugins.");
|
||||
|
@ -728,7 +728,7 @@ class PluginRepo {
|
|||
if (valid) {
|
||||
plugin.url = url;
|
||||
this.loadedPlugins[url] = plugin;
|
||||
let instPlugin = BDFDB.BdUtils.getPlugin(plugin.getName);
|
||||
let instPlugin = BDFDB.BDUtils.getPlugin(plugin.getName);
|
||||
if (instPlugin && this.getString(instPlugin.getAuthor()).toUpperCase() == plugin.getAuthor.toUpperCase() && this.getString(instPlugin.getVersion()) != plugin.getVersion && PluginUpdates && PluginUpdates.plugins && !PluginUpdates.plugins[url]) outdated++;
|
||||
if (!this.cachedPlugins.includes(url)) newentries++;
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ class PluginRepo {
|
|||
i++;
|
||||
var loadingtooltip = document.querySelector(".pluginrepo-loading-tooltip");
|
||||
if (loadingtooltip) {
|
||||
BDFDB.setInnerText(loadingtooltip, this.getLoadingTooltipText());
|
||||
BDFDB.DOMUtils.setText(loadingtooltip, this.getLoadingTooltipText());
|
||||
BDFDB.TooltipUtils.update(loadingtooltip);
|
||||
}
|
||||
getPluginInfo(callback);
|
||||
|
@ -750,7 +750,7 @@ class PluginRepo {
|
|||
createFrame = () => {
|
||||
var markup = this.frameMarkup;
|
||||
return new Promise(function(callback) {
|
||||
frame = BDFDB.htmlToElement(markup);
|
||||
frame = BDFDB.DOMUtils.create(markup);
|
||||
frame.startTimeout = setTimeout(() => {
|
||||
callback();
|
||||
},600000);
|
||||
|
@ -786,7 +786,7 @@ class PluginRepo {
|
|||
if (BDFDB.ObjectUtils.is(plugin)) {
|
||||
plugin.url = url;
|
||||
this.loadedPlugins[url] = plugin;
|
||||
let instPlugin = BDFDB.BdUtils.getPlugin(plugin.getName);
|
||||
let instPlugin = BDFDB.BDUtils.getPlugin(plugin.getName);
|
||||
if (instPlugin && this.getString(instPlugin.getAuthor()).toUpperCase() == plugin.getAuthor.toUpperCase() && this.getString(instPlugin.getVersion()) != plugin.getVersion) outdated++;
|
||||
if (!this.cachedPlugins.includes(url)) newentries++;
|
||||
}
|
||||
|
@ -855,14 +855,14 @@ class PluginRepo {
|
|||
}
|
||||
|
||||
createPluginFile (filename, content) {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BdUtils.getPluginsFolder(), filename), content, (error) => {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.NotificationUtils.toast(`Unable to save Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.NotificationUtils.toast(`Successfully saved Plugin "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
startPlugin (data) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(data.name) == false) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(data.name) == false) {
|
||||
window.pluginModule.startPlugin(data.name);
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Started Plugin " + data.name + ".");
|
||||
}
|
||||
|
@ -870,14 +870,14 @@ class PluginRepo {
|
|||
|
||||
deletePluginFile (data) {
|
||||
let filename = data.url.split("/").pop();
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BdUtils.getPluginsFolder(), filename), (error) => {
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), filename), (error) => {
|
||||
if (error) BDFDB.NotificationUtils.toast(`Unable to delete Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.NotificationUtils.toast(`Successfully deleted Plugin "${filename}".`);
|
||||
});
|
||||
}
|
||||
|
||||
stopPlugin (data) {
|
||||
if (BDFDB.BdUtils.isPluginEnabled(data.name) == true) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(data.name) == true) {
|
||||
window.pluginModule.stopPlugin(data.name);
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Stopped Plugin " + data.name + ".");
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ class ReadAllNotificationsButton {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".RANbutton-frame", ".RAMbutton");
|
||||
BDFDB.removeClasses("RAN-added", "RAM-added");
|
||||
BDFDB.DOMUtils.remove(".RANbutton-frame", ".RAMbutton");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("RAN-added", "RAM-added");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -131,15 +131,15 @@ class ReadAllNotificationsButton {
|
|||
|
||||
processGuilds (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentDidMount") || (methodnames.includes("componentDidUpdate") && document.querySelector(".bd-guild ~ .RANbutton-frame"))) {
|
||||
BDFDB.removeEles(".RANbutton-frame");
|
||||
BDFDB.DOMUtils.remove(".RANbutton-frame");
|
||||
let insertnode = this.getInsertNode();
|
||||
if (insertnode) {
|
||||
let ranbutton = BDFDB.htmlToElement(this.RANbuttonMarkup);
|
||||
let ranbutton = BDFDB.DOMUtils.create(this.RANbuttonMarkup);
|
||||
insertnode.parentElement.insertBefore(ranbutton, insertnode);
|
||||
ranbutton.addEventListener("click", () => {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (settings.includeGuilds) BDFDB.GuildUtils.markAsRead(settings.includeMuted ? BDFDB.GuildUtils.getAll() : BDFDB.GuildUtils.getUnread());
|
||||
if (settings.includeDMs) BDFDB.DmUtils.markAsRead(BDFDB.DmUtils.getAll());
|
||||
if (settings.includeDMs) BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll());
|
||||
});
|
||||
ranbutton.addEventListener("contextmenu", e => {
|
||||
const itemGroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
|
@ -149,7 +149,7 @@ class ReadAllNotificationsButton {
|
|||
label: this.labels.context_unreadguilds_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-unreadguilds-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getUnread());
|
||||
}
|
||||
}),
|
||||
|
@ -157,7 +157,7 @@ class ReadAllNotificationsButton {
|
|||
label: this.labels.context_pingedguilds_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-pingedguilds-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getPinged());
|
||||
}
|
||||
}),
|
||||
|
@ -165,7 +165,7 @@ class ReadAllNotificationsButton {
|
|||
label: this.labels.context_mutedguilds_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-mutedguilds-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getMuted());
|
||||
}
|
||||
}),
|
||||
|
@ -173,7 +173,7 @@ class ReadAllNotificationsButton {
|
|||
label: this.labels.context_guilds_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-guilds-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
this.addPinnedRecent(instance.props.channel.id);
|
||||
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getAll());
|
||||
}
|
||||
|
@ -182,15 +182,15 @@ class ReadAllNotificationsButton {
|
|||
label: this.labels.context_dms_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-dms-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.DmUtils.markAsRead(BDFDB.DmUtils.getAll());
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll());
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
BDFDB.openContextMenu(this, e, itemGroup);
|
||||
});
|
||||
BDFDB.addClass(wrapper, "RAN-added");
|
||||
BDFDB.DOMUtils.addClass(wrapper, "RAN-added");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,14 +202,14 @@ class ReadAllNotificationsButton {
|
|||
}
|
||||
|
||||
processRecentMentions (instance, wrapper, returnvalue) {
|
||||
BDFDB.removeEles(".RAMbutton");
|
||||
BDFDB.DOMUtils.remove(".RAMbutton");
|
||||
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT" && BDFDB.DataUtils.get(this, "settings", "addClearButton")) {
|
||||
let recentmentionstitle = wrapper.querySelector(BDFDB.dotCN.messagespopouttitle);
|
||||
if (recentmentionstitle) {
|
||||
let ranbutton = BDFDB.htmlToElement(this.RAMbuttonMarkup);
|
||||
let ranbutton = BDFDB.DOMUtils.create(this.RAMbuttonMarkup);
|
||||
recentmentionstitle.appendChild(ranbutton);
|
||||
ranbutton.addEventListener("click", () => {this.clearMentions(instance, wrapper);});
|
||||
BDFDB.addClass(wrapper, "RAM-added");
|
||||
BDFDB.DOMUtils.addClass(wrapper, "RAM-added");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ class ReadAllNotificationsButton {
|
|||
}
|
||||
|
||||
getInsertNode () {
|
||||
let homebutton = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
let homebutton = BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
if (!homebutton) return null;
|
||||
let nextsibling = homebutton.nextElementSibling, insertnode = null;
|
||||
while (nextsibling && insertnode == null) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class RemoveNicknames {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
;
|
||||
|
@ -113,7 +113,7 @@ class RemoveNicknames {
|
|||
let user = BDFDB.ReactUtils.getValue(instance, "props.user");
|
||||
if (user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.memberusername);
|
||||
if (username) BDFDB.setInnerText(username, this.getNewName(user, wrapper));
|
||||
if (username) BDFDB.DOMUtils.setText(username, this.getNewName(user, wrapper));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,28 +121,28 @@ class RemoveNicknames {
|
|||
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
|
||||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
if (username) BDFDB.setInnerText(username, this.getNewName(message.author, wrapper));
|
||||
if (username) BDFDB.DOMUtils.setText(username, this.getNewName(message.author, wrapper));
|
||||
}
|
||||
}
|
||||
|
||||
processTypingUsers (instance, wrapper, returnvalue) {
|
||||
let users = !instance.props.typingUsers ? [] : Object.keys(instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(id => id != null);
|
||||
wrapper.querySelectorAll("strong").forEach((username, i) => {
|
||||
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));
|
||||
if (users[i] && username) BDFDB.DOMUtils.setText(username, this.getNewName(users[i]));
|
||||
});
|
||||
}
|
||||
|
||||
processClickable (instance, wrapper, returnvalue) {
|
||||
if (!wrapper || !instance.props || !instance.props.className) return;
|
||||
if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
|
||||
if (BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
|
||||
if (BDFDB.DOMUtils.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
|
||||
let message = BDFDB.ReactUtils.findValue(wrapper.parentElement, "message", {up:true});
|
||||
if (message) {
|
||||
BDFDB.setInnerText(wrapper, this.getNewName(message.author, wrapper));
|
||||
BDFDB.DOMUtils.setText(wrapper, this.getNewName(message.author, wrapper));
|
||||
if (message.mentions.length == 1) {
|
||||
let seconduser = BDFDB.LibraryModules.UserStore.getUser(message.mentions[0]);
|
||||
let secondwrapper = wrapper.parentElement.querySelectorAll("a")[1];
|
||||
if (seconduser && secondwrapper) BDFDB.setInnerText(secondwrapper, this.getNewName(seconduser, wrapper));
|
||||
if (seconduser && secondwrapper) BDFDB.DOMUtils.setText(secondwrapper, this.getNewName(seconduser, wrapper));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,22 +151,22 @@ class RemoveNicknames {
|
|||
let render = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.return.stateNode.props.render");
|
||||
if (typeof render == "function") {
|
||||
var props = render().props;
|
||||
if (props && props.user) BDFDB.setInnerText(wrapper, "@" + this.getNewName(props.user, wrapper));
|
||||
else if (props && props.userId) BDFDB.setInnerText(wrapper, "@" + this.getNewName(BDFDB.LibraryModules.UserStore.getUser(props.userId), wrapper));
|
||||
if (props && props.user) BDFDB.DOMUtils.setText(wrapper, "@" + this.getNewName(props.user, wrapper));
|
||||
else if (props && props.userId) BDFDB.DOMUtils.setText(wrapper, "@" + this.getNewName(BDFDB.LibraryModules.UserStore.getUser(props.userId), wrapper));
|
||||
}
|
||||
}
|
||||
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
|
||||
let user = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.user");
|
||||
if (user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.voicename);
|
||||
if (username) BDFDB.setInnerText(username, this.getNewName(user, username));
|
||||
if (username) BDFDB.DOMUtils.setText(username, this.getNewName(user, username));
|
||||
}
|
||||
}
|
||||
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
|
||||
let user = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.user");
|
||||
if (user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.marginleft8);
|
||||
if (username) BDFDB.setInnerText(username, this.getNewName(user, username));
|
||||
if (username) BDFDB.DOMUtils.setText(username, this.getNewName(user, username));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class RemoveNicknames {
|
|||
if (!info) return null;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
|
||||
let EditUsersData = (BDFDB.BdUtils.isPluginEnabled("EditUsers") ? BDFDB.DataUtils.load("EditUsers", "users") : null, info.id) || {};
|
||||
let EditUsersData = (BDFDB.BDUtils.isPluginEnabled("EditUsers") ? BDFDB.DataUtils.load("EditUsers", "users") : null, info.id) || {};
|
||||
if (this.reseting || !member.nick || info.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || info.bot && !settings.replaceBots || this.ignoreElement(wrapper)) return EditUsersData.name || member.nick || info.username;
|
||||
var username = EditUsersData.name || info.username;
|
||||
return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;
|
||||
|
@ -197,12 +197,12 @@ class RemoveNicknames {
|
|||
if (allenabled) return false;
|
||||
|
||||
let key = null;
|
||||
if (!BDFDB.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
|
||||
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
|
||||
else if (BDFDB.getParentEle(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
if (!BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
|
||||
else if (BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
|
||||
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
|
||||
|
||||
if (!key || settings[key]) return true;
|
||||
return false;
|
||||
|
|
|
@ -140,7 +140,7 @@ class RepoControls {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -173,7 +173,7 @@ class RepoControls {
|
|||
if (this.started) return;
|
||||
BDFDB.PluginUtils.init(this);
|
||||
|
||||
this.dirs = {theme: BDFDB.BdUtils.getThemesFolder(), plugin: BDFDB.BdUtils.getPluginsFolder()};
|
||||
this.dirs = {theme: BDFDB.BDUtils.getThemesFolder(), plugin: BDFDB.BDUtils.getPluginsFolder()};
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ class RepoControls {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".repo-controls","#bd-settingspane-container .trashIcon");
|
||||
BDFDB.removeClasses("repocontrols-added");
|
||||
BDFDB.DOMUtils.remove(".repo-controls","#bd-settingspane-container .trashIcon");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("repocontrols-added");
|
||||
|
||||
for (let list of document.querySelectorAll(BDFDB.dotCNS._repolist)) {
|
||||
list.style.removeProperty("display");
|
||||
|
@ -235,7 +235,7 @@ class RepoControls {
|
|||
if (!name || !controls) return;
|
||||
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? BDFDB.LibraryRequires.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
|
||||
if (!path) return;
|
||||
let button = BDFDB.htmlToElement(this.editButtonMarkup);
|
||||
let button = BDFDB.DOMUtils.create(this.editButtonMarkup);
|
||||
button.addEventListener("click", () => {
|
||||
if (!BDFDB.LibraryRequires.electron.shell.openItem(path)) BDFDB.NotificationUtils.toast(`Unable to open ${type} "${name}".`, {type:"danger"});;
|
||||
});
|
||||
|
@ -252,7 +252,7 @@ class RepoControls {
|
|||
if (!name || !controls) return;
|
||||
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? BDFDB.LibraryRequires.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
|
||||
if (!path) return;
|
||||
let button = BDFDB.htmlToElement(this.deleteButtonMarkup);
|
||||
let button = BDFDB.DOMUtils.create(this.deleteButtonMarkup);
|
||||
button.addEventListener("click", () => {
|
||||
let deleteFile = () => {
|
||||
BDFDB.LibraryRequires.fs.unlink(path, (error) => {
|
||||
|
@ -273,14 +273,14 @@ class RepoControls {
|
|||
|
||||
addControls (type, container) {
|
||||
if (!type || !container) return;
|
||||
BDFDB.removeEles(".repo-controls");
|
||||
BDFDB.DOMUtils.remove(".repo-controls");
|
||||
|
||||
container.style.setProperty("display", "flex", "important");
|
||||
container.style.setProperty("flex-direction", "column", "important");
|
||||
|
||||
let sortings = BDFDB.DataUtils.get(this, "sortings");
|
||||
|
||||
let repocontrols = BDFDB.htmlToElement(this.repoControlsMarkup);
|
||||
let repocontrols = BDFDB.DOMUtils.create(this.repoControlsMarkup);
|
||||
repocontrols.insertBefore(BDFDB.createSearchBar("small"), repocontrols.firstElementChild);
|
||||
BDFDB.initElements(repocontrols, this);
|
||||
container.parentElement.insertBefore(repocontrols, container);
|
||||
|
@ -318,7 +318,7 @@ class RepoControls {
|
|||
});
|
||||
});
|
||||
|
||||
BDFDB.addClass(container, "repocontrols-added");
|
||||
BDFDB.DOMUtils.addClass(container, "repocontrols-added");
|
||||
|
||||
container.entries = {};
|
||||
for (let li of container.children) {
|
||||
|
@ -371,7 +371,7 @@ class RepoControls {
|
|||
}
|
||||
}
|
||||
else li.style.removeProperty("order");
|
||||
BDFDB.toggleEles(li, pos > -1);
|
||||
BDFDB.DOMUtils.toggle(li, pos > -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ class RepoControls {
|
|||
if (!wrapper || !wrapper.tagName) return;
|
||||
for (let ele of wrapper.querySelectorAll(BDFDB.dotCNC._reponame + BDFDB.dotCNC._repoauthor + BDFDB.dotCN._repodescription)) {
|
||||
var string = ele.firstElementChild ? ele.innerHTML : ele.innerText;
|
||||
if (BDFDB.containsClass(ele, BDFDB.disCN._repodescription)) {
|
||||
if (BDFDB.DOMUtils.containsClass(ele, BDFDB.disCN._repodescription)) {
|
||||
ele.style.display = "block";
|
||||
if (searchstring && searchstring.length > 2) ele.innerHTML = BDFDB.highlightText(string, searchstring);
|
||||
else ele.innerHTML = string;
|
||||
|
@ -397,8 +397,8 @@ class RepoControls {
|
|||
let switchinner = switchwrap.querySelector(BDFDB.dotCN._repocheckboxinner);
|
||||
let switchinput = switchwrap.querySelector(BDFDB.dotCN._repocheckbox);
|
||||
if (switchinner && switchinput) {
|
||||
if (BDFDB.containsClass(switchinner, BDFDB.disCN._repocheckboxchecked) && !enable) switchinput.click();
|
||||
else if (!BDFDB.containsClass(switchinner, BDFDB.disCN._repocheckboxchecked) && enable) switchinput.click();
|
||||
if (BDFDB.DOMUtils.containsClass(switchinner, BDFDB.disCN._repocheckboxchecked) && !enable) switchinput.click();
|
||||
else if (!BDFDB.DOMUtils.containsClass(switchinner, BDFDB.disCN._repocheckboxchecked) && enable) switchinput.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class RevealAllSpoilersOption {
|
|||
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", instance.props.target);
|
||||
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]", instance.props.target);
|
||||
if (!messagediv || !messagediv.querySelector(BDFDB.dotCN.spoilerhidden)) return;
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
|
||||
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
|
@ -70,7 +70,7 @@ class RevealAllSpoilersOption {
|
|||
children: [
|
||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Reveal all Spoilers",
|
||||
hint: BDFDB.BdUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BdUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Reveal_Spoilers") : null,
|
||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Reveal_Spoilers") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-reveal-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
|
@ -85,7 +85,7 @@ class RevealAllSpoilersOption {
|
|||
}
|
||||
|
||||
revealAllSpoilers (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target);
|
||||
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target);
|
||||
if (!messagediv) return;
|
||||
for (let spoiler of messagediv.querySelectorAll(BDFDB.dotCN.spoilerhidden)) spoiler.click();
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class ReverseImageSearch {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -106,14 +106,14 @@ class ReverseImageSearch {
|
|||
|
||||
onGuildContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.guild && instance.props.target) {
|
||||
let guildicon = BDFDB.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.guildicon);
|
||||
let guildicon = BDFDB.DOMUtils.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.guildicon);
|
||||
if (guildicon && BDFDB.DataUtils.get(this, "settings", "addGuildIconEntry")) this.appendItem(menu, returnvalue, guildicon.tagName == "IMG" ? guildicon.getAttribute("src") : guildicon.style.getPropertyValue("background-image"));
|
||||
}
|
||||
}
|
||||
|
||||
onUserContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.user && instance.props.target) {
|
||||
let avatar = BDFDB.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.avatar);
|
||||
let avatar = BDFDB.DOMUtils.containsClass(instance.props.target, BDFDB.disCN.avataricon) ? instance.props.target : instance.props.target.querySelector(BDFDB.dotCN.avatar);
|
||||
if (avatar && BDFDB.DataUtils.get(this, "settings", "addUserAvatarEntry")) this.appendItem(menu, returnvalue, avatar.tagName == "IMG" ? avatar.getAttribute("src") : avatar.style.getPropertyValue("background-image"));
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class ReverseImageSearch {
|
|||
if (instance.props.target.tagName == "A" && instance.props.message.embeds && instance.props.message.embeds[0] && instance.props.message.embeds[0].type == "image") {
|
||||
this.appendItem(menu, returnvalue, instance.props.target.href);
|
||||
}
|
||||
if (instance.props.target.tagName == "IMG" && BDFDB.containsClass(instance.props.target, "emoji", "emote", false) && BDFDB.DataUtils.get(this, "settings", "addEmojiEntry")) {
|
||||
if (instance.props.target.tagName == "IMG" && BDFDB.DOMUtils.containsClass(instance.props.target, "emoji", "emote", false) && BDFDB.DataUtils.get(this, "settings", "addEmojiEntry")) {
|
||||
this.appendItem(menu, returnvalue, instance.props.target.src);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ class SendLargeMessages {
|
|||
}
|
||||
|
||||
showSendModal (text) {
|
||||
let sendMessageModal = BDFDB.htmlToElement(this.sendMessageModalMarkup);
|
||||
let sendMessageModal = BDFDB.DOMUtils.create(this.sendMessageModalMarkup);
|
||||
let textinput = sendMessageModal.querySelector("#modal-inputtext");
|
||||
let warning = sendMessageModal.querySelector("#warning-message");
|
||||
let counter = sendMessageModal.querySelector("#character-counter");
|
||||
|
@ -247,7 +247,7 @@ class SendLargeMessages {
|
|||
sendMessage (text) {
|
||||
let textarea = document.querySelector(BDFDB.dotCNS.textareawrapchat + "textarea");
|
||||
if (textarea) {
|
||||
let instance = BDFDB.ReactUtils.findOwner(BDFDB.getParentEle(BDFDB.dotCNS.chat + "form", textarea), {name:"ChannelTextAreaForm", up:true});
|
||||
let instance = BDFDB.ReactUtils.findOwner(BDFDB.DOMUtils.getParent(BDFDB.dotCNS.chat + "form", textarea), {name:"ChannelTextAreaForm", up:true});
|
||||
if (instance) {
|
||||
instance.setState({textValue:text});
|
||||
BDFDB.triggerSend(textarea);
|
||||
|
|
|
@ -180,7 +180,7 @@ class ServerFolders {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + 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.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + 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>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -265,11 +265,11 @@ class ServerFolders {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent");
|
||||
BDFDB.DOMUtils.remove(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent");
|
||||
|
||||
let modal = document.querySelector(`.${this.name}-modal`);
|
||||
if (modal) {
|
||||
BDFDB.removeClass(modal, `${this.name}-modal`);
|
||||
BDFDB.DOMUtils.removeClass(modal, `${this.name}-modal`);
|
||||
let modalclose = modal.querySelector(BDFDB.dotCN.modalclose);
|
||||
if (modalclose) modalclose.click();
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ class ServerFolders {
|
|||
for (let folderinner of document.querySelectorAll(`${BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCN.guildfolderexpandendbackground} ~ ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildinner}`)) {
|
||||
folderinner.removeEventListener("mouseenter", folderinner.ServerFoldersTooltipListener);
|
||||
folderinner.removeEventListener("mousedown", folderinner.ServerFoldersClickListener);
|
||||
BDFDB.removeEles(folderinner.querySelectorAll(`${BDFDB.dotCN.guildupperbadge}.count`));
|
||||
BDFDB.DOMUtils.remove(folderinner.querySelectorAll(`${BDFDB.dotCN.guildupperbadge}.count`));
|
||||
}
|
||||
|
||||
for (let foldericon of document.querySelectorAll(BDFDB.dotCN.guildfolder)) {
|
||||
|
@ -343,7 +343,7 @@ class ServerFolders {
|
|||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-removefolder-contextMenuItem`,
|
||||
danger: true,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.closeContextMenu(BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.openConfirmModal(this, `Are you sure you want to remove the folder${folder.folderName ? (" '" + folder.folderName + '"') : ""}?`, () => {this.removeFolder(folderid);});
|
||||
}
|
||||
})
|
||||
|
@ -408,14 +408,14 @@ class ServerFolders {
|
|||
|
||||
processGuilds (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentWillUnmount")) {
|
||||
BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent");
|
||||
BDFDB.DOMUtils.remove(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent");
|
||||
delete this.foldercontent;
|
||||
delete this.foldercontentguilds;
|
||||
}
|
||||
if (methodnames.includes("componentDidMount")) {
|
||||
let process = () => {
|
||||
if (!wrapper.parentElement.querySelector(BDFDB.dotCN.guildswrapper + ".foldercontent")) {
|
||||
this.foldercontent = BDFDB.htmlToElement(this.folderContentMarkup);
|
||||
this.foldercontent = BDFDB.DOMUtils.create(this.folderContentMarkup);
|
||||
wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling);
|
||||
this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guildsscroller);
|
||||
this.toggleFolderContent();
|
||||
|
@ -443,15 +443,15 @@ class ServerFolders {
|
|||
if (state.expanded) setImmediate(() => {
|
||||
for (let guildid of instance.props.guildIds) this.updateGuildInFolderContent(state.folderId, guildid);
|
||||
if (this.clickedFolder == state.folderId && BDFDB.DataUtils.get(this, "settings", "closeOtherFolders")) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != state.folderId) {
|
||||
BDFDB.removeEles(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}[folderid="${openFolderId}"]`));
|
||||
BDFDB.DOMUtils.remove(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}[folderid="${openFolderId}"]`));
|
||||
BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
}
|
||||
this.addSeparator(state.folderId);
|
||||
this.toggleFolderContent();
|
||||
});
|
||||
else setTimeout(() => {
|
||||
BDFDB.removeEles(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}[folderid="${state.folderId}"]`));
|
||||
if (BDFDB.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.removeEles(this.foldercontentguilds.firstElementChild);
|
||||
BDFDB.DOMUtils.remove(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}[folderid="${state.folderId}"]`));
|
||||
if (BDFDB.DOMUtils.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.DOMUtils.remove(this.foldercontentguilds.firstElementChild);
|
||||
this.toggleFolderContent();
|
||||
}, BDFDB.LibraryModules.FolderUtils.getExpandedFolders().size > 0 ? 0 : 300);
|
||||
this.changeFolder(state.folderId, wrapper);
|
||||
|
@ -495,21 +495,21 @@ class ServerFolders {
|
|||
let root = wrapper.querySelector(BDFDB.dotCN.layermodal);
|
||||
let header = wrapper.querySelector(BDFDB.dotCN.modalheader);
|
||||
let form = wrapper.querySelector(BDFDB.dotCN.modalsubinner + " form");
|
||||
BDFDB.addClass(root, "BDFDB-modal", `${this.name}-modal`, BDFDB.disCN.layermodalmedium);
|
||||
BDFDB.removeClass(root, BDFDB.disCN.layermodalsmall);
|
||||
BDFDB.DOMUtils.addClass(root, "BDFDB-modal", `${this.name}-modal`, BDFDB.disCN.layermodalmedium);
|
||||
BDFDB.DOMUtils.removeClass(root, BDFDB.disCN.layermodalsmall);
|
||||
if (header) {
|
||||
clearInterval(this.settingsModalWait);
|
||||
header.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + 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.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader1_text}</div><div tab="icon" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader2_text}</div><div tab="tooltip" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader3_text}</div><div tab="custom" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader4_text}</div></div></div>`), header.nextElementSibling);
|
||||
header.parentElement.insertBefore(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + 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.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader1_text}</div><div tab="icon" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader2_text}</div><div tab="tooltip" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader3_text}</div><div tab="custom" class="${BDFDB.disCNS.settingsitem + BDFDB.disCN.tabbaritem}">${this.labels.modal_tabheader4_text}</div></div></div>`), header.nextElementSibling);
|
||||
}
|
||||
if (root && form) {
|
||||
form.setAttribute("tab", "folder");
|
||||
BDFDB.addClass(form, "tab-content", BDFDB.disCN.marginbottom8);
|
||||
for (let child of form.childNodes) if (form.firstElementChild != child) BDFDB.toggleEles(child, false);
|
||||
form.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_iconpicker_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} icons" style="flex: 1 1 auto;"></div></div>`));
|
||||
form.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="width: calc(100% - 10px);"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.labels.modal_usecloseicon_text}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-usecloseicon"></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.htmlToElement(`<div tab="icon" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker1_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker2_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.htmlToElement(`<div tab="tooltip" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker3_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker4_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="width: calc(100% - 10px);"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.labels.modal_copytooltipcolor_text}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-copytooltipcolor"></div></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.htmlToElement(`<div tab="custom" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_customopen_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" option="open" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" placeholder="Url or Filepath"></div><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}"></div><input type="file" option="open" accept="image/*" style="display:none!important;"></button></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_customclosed_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" option="closed" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" placeholder="Url or Filepath"></div><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}"></div><input type="file" option="closed" accept="image/*" style="display:none!important;"></button></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_custompreview_text}</h5></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifycenter + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="ui-icon-picker-icon preview nopic open"><div class="ui-picker-inner"></div></div><div class="ui-icon-picker-icon preview nopic closed" style="margin-left: 25px; margin-right: 25px;"><div class="ui-picker-inner"></div></div><div class="ui-icon-picker-icon preview nopic switching"><div class="ui-picker-inner"></div></div></div><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}"></div></button></div></div>`));
|
||||
BDFDB.DOMUtils.addClass(form, "tab-content", BDFDB.disCN.marginbottom8);
|
||||
for (let child of form.childNodes) if (form.firstElementChild != child) BDFDB.DOMUtils.hide(child);
|
||||
form.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_iconpicker_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} icons" style="flex: 1 1 auto;"></div></div>`));
|
||||
form.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="width: calc(100% - 10px);"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.labels.modal_usecloseicon_text}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-usecloseicon"></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.DOMUtils.create(`<div tab="icon" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker1_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker2_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.DOMUtils.create(`<div tab="tooltip" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstart + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker3_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_colorpicker4_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap} swatches" style="flex: 1 1 auto;"></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="width: calc(100% - 10px);"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.labels.modal_copytooltipcolor_text}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}" id="input-copytooltipcolor"></div></div></div>`));
|
||||
form.parentElement.appendChild(BDFDB.DOMUtils.create(`<div tab="custom" class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8} tab-content" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_customopen_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" option="open" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" placeholder="Url or Filepath"></div><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}"></div><input type="file" option="open" accept="image/*" style="display:none!important;"></button></div></div><div class="${BDFDB.disCN.marginbottom20}"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_customclosed_text}</h5><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><input type="text" option="closed" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}" placeholder="Url or Filepath"></div><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}"></div><input type="file" option="closed" accept="image/*" style="display:none!important;"></button></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCN.h5defaultmargin}">${this.labels.modal_custompreview_text}</h5></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifycenter + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><div class="ui-icon-picker-icon preview nopic open"><div class="ui-picker-inner"></div></div><div class="ui-icon-picker-icon preview nopic closed" style="margin-left: 25px; margin-right: 25px;"><div class="ui-picker-inner"></div></div><div class="ui-icon-picker-icon preview nopic switching"><div class="ui-picker-inner"></div></div></div><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}"></div></button></div></div>`));
|
||||
|
||||
let usecloseiconinput = root.querySelector("#input-usecloseicon");
|
||||
let copytooltipcolorinput = root.querySelector("#input-copytooltipcolor");
|
||||
|
@ -540,14 +540,14 @@ class ServerFolders {
|
|||
data.useCloseIcon = usecloseiconinput.checked;
|
||||
data.copyTooltipColor = copytooltipcolorinput.checked;
|
||||
|
||||
data.color1 = BDFDB.getSwatchColor(root, 1);
|
||||
data.color2 = BDFDB.getSwatchColor(root, 2);
|
||||
data.color3 = BDFDB.getSwatchColor(root, 3);
|
||||
data.color4 = BDFDB.getSwatchColor(root, 4);
|
||||
data.color1 = BDFDB.ColorUtils.getSwatchColor(root, 1);
|
||||
data.color2 = BDFDB.ColorUtils.getSwatchColor(root, 2);
|
||||
data.color3 = BDFDB.ColorUtils.getSwatchColor(root, 3);
|
||||
data.color4 = BDFDB.ColorUtils.getSwatchColor(root, 4);
|
||||
|
||||
if (!BDFDB.equals(olddata, data)) {
|
||||
let folderIcons = this.loadAllIcons();
|
||||
let isCustom = BDFDB.containsClass(selectedIcon, "custom");
|
||||
let isCustom = BDFDB.DOMUtils.containsClass(selectedIcon, "custom");
|
||||
data.icons.openicon = folderIcons[data.iconID] ? (!isCustom ? this.createBase64SVG(folderIcons[data.iconID].openicon, data.color1, data.color2) : folderIcons[data.iconID].openicon) : null;
|
||||
data.icons.closedicon = folderIcons[data.iconID] ? (!isCustom ? this.createBase64SVG(folderIcons[data.iconID].closedicon, data.color1, data.color2) : folderIcons[data.iconID].closedicon) : null;
|
||||
BDFDB.DataUtils.save(data, this, "folders", folderid);
|
||||
|
@ -607,20 +607,20 @@ class ServerFolders {
|
|||
successFetchIcon = () => {
|
||||
let iconpreview = modal.querySelector(".ui-icon-picker-icon.preview." + type);
|
||||
let iconpreviewinner = iconpreview.querySelector(".ui-picker-inner");
|
||||
BDFDB.removeClass(iconpreview, "nopic");
|
||||
BDFDB.DOMUtils.removeClass(iconpreview, "nopic");
|
||||
iconpreview.url = url;
|
||||
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")) {
|
||||
if (!BDFDB.DOMUtils.containsClass(iconpreviewopen, "nopic") && !BDFDB.DOMUtils.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");
|
||||
BDFDB.DOMUtils.removeClass(iconpreviewswitching, "nopic");
|
||||
iconpreviewswitchinginner.style.setProperty("background-image", iconpreviewopenimage);
|
||||
let switching = true;
|
||||
iconpreviewswitching.switchInterval = setInterval(() => {
|
||||
|
@ -635,7 +635,7 @@ class ServerFolders {
|
|||
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")) {
|
||||
if (!BDFDB.DOMUtils.containsClass(iconpreviewopen, "nopic") && !BDFDB.DOMUtils.containsClass(iconpreviewclosed, "nopic") && !BDFDB.DOMUtils.containsClass(iconpreviewswitching, "nopic")) {
|
||||
let customID = this.generateID("customicon");
|
||||
BDFDB.DataUtils.save({"openicon":iconpreviewopen.url,"closedicon":iconpreviewclosed.url,customID}, this, "customicons", customID);
|
||||
modal.querySelectorAll("input[type='text'][option]").forEach((input) => {input.value = "";});
|
||||
|
@ -644,11 +644,11 @@ class ServerFolders {
|
|||
let iconpreviewclosedinner = iconpreviewclosed.querySelector(".ui-picker-inner");
|
||||
let iconpreviewswitchinginner = iconpreviewswitching.querySelector(".ui-picker-inner");
|
||||
|
||||
BDFDB.addClass(iconpreviewopen, "nopic");
|
||||
BDFDB.DOMUtils.addClass(iconpreviewopen, "nopic");
|
||||
iconpreviewopeninner.style.removeProperty("background-image");
|
||||
BDFDB.addClass(iconpreviewclosed, "nopic");
|
||||
BDFDB.DOMUtils.addClass(iconpreviewclosed, "nopic");
|
||||
iconpreviewclosedinner.style.removeProperty("background-image");
|
||||
BDFDB.addClass(iconpreviewswitching, "nopic");
|
||||
BDFDB.DOMUtils.addClass(iconpreviewswitching, "nopic");
|
||||
iconpreviewswitchinginner.style.removeProperty("background-image");
|
||||
clearInterval(iconpreviewswitching.switchInterval);
|
||||
BDFDB.NotificationUtils.toast(`Custom Icon was added to selection.`, {type:"success"});
|
||||
|
@ -672,7 +672,7 @@ class ServerFolders {
|
|||
setIcons (modal, selection) {
|
||||
let wrapper = modal.querySelector(".icons");
|
||||
if (!wrapper) return;
|
||||
BDFDB.removeEles(wrapper.childNodes);
|
||||
BDFDB.DOMUtils.remove(wrapper.childNodes);
|
||||
|
||||
let folderIcons = this.loadAllIcons();
|
||||
for (let id in folderIcons) if (!folderIcons[id].customID) {
|
||||
|
@ -680,17 +680,17 @@ class ServerFolders {
|
|||
folderIcons[id].closedicon = this.createBase64SVG(folderIcons[id].closedicon);
|
||||
}
|
||||
|
||||
wrapper.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.margintop4}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifycenter + BDFDB.disCNS.alignstretch + BDFDB.disCN.wrap} ui-icon-picker-row" style="flex: 1 1 auto; display: flex; flex-wrap: wrap; overflow: visible !important;"><div class="ui-icon-picker-icon" value="-1"><div class="ui-picker-inner"><svg aria-hidden="false" width="50" height="50" viewBox="-2 -1 25 25" style="color: black;"><path fill="currentColor" d="M20 7H12L10.553 5.106C10.214 4.428 9.521 4 8.764 4H3C2.447 4 2 4.447 2 5V19C2 20.104 2.895 21 4 21H20C21.104 21 22 20.104 22 19V9C22 7.896 21.104 7 20 7Z"></path></svg></div></div>${Object.getOwnPropertyNames(folderIcons).map(id => `<div class="ui-icon-picker-icon${folderIcons[id].customID ? ' custom' : ''}" value="${id}"><div class="ui-picker-inner" style="background: url(${folderIcons[id].closedicon}) center/cover no-repeat;"></div>${folderIcons[id].customID ? '<div value="' + id + '" class="' + BDFDB.disCN.hovercardbutton + '"></div>' : ''}</div>`).join("")}</div></div>`));
|
||||
wrapper.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.margintop4}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifycenter + BDFDB.disCNS.alignstretch + BDFDB.disCN.wrap} ui-icon-picker-row" style="flex: 1 1 auto; display: flex; flex-wrap: wrap; overflow: visible !important;"><div class="ui-icon-picker-icon" value="-1"><div class="ui-picker-inner"><svg aria-hidden="false" width="50" height="50" viewBox="-2 -1 25 25" style="color: black;"><path fill="currentColor" d="M20 7H12L10.553 5.106C10.214 4.428 9.521 4 8.764 4H3C2.447 4 2 4.447 2 5V19C2 20.104 2.895 21 4 21H20C21.104 21 22 20.104 22 19V9C22 7.896 21.104 7 20 7Z"></path></svg></div></div>${Object.getOwnPropertyNames(folderIcons).map(id => `<div class="ui-icon-picker-icon${folderIcons[id].customID ? ' custom' : ''}" value="${id}"><div class="ui-picker-inner" style="background: url(${folderIcons[id].closedicon}) center/cover no-repeat;"></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 : -1}"]`), false, true);
|
||||
|
||||
BDFDB.ListenerUtils.addToChildren(wrapper, "click", ".ui-icon-picker-icon", e => {
|
||||
if (BDFDB.containsClass(e.target, BDFDB.disCN.hovercardbutton)) return;
|
||||
if (BDFDB.DOMUtils.containsClass(e.target, BDFDB.disCN.hovercardbutton)) return;
|
||||
setIcon(wrapper.querySelector(".ui-icon-picker-icon.selected"), false, false);
|
||||
setIcon(e.currentTarget, true, true);
|
||||
});
|
||||
BDFDB.ListenerUtils.addToChildren(wrapper, "click", BDFDB.dotCN.hovercardbutton, e => {
|
||||
if (BDFDB.containsClass(e.currentTarget.parentElement, "selected")) return;
|
||||
if (BDFDB.DOMUtils.containsClass(e.currentTarget.parentElement, "selected")) return;
|
||||
BDFDB.DataUtils.remove(this, "customicons", e.currentTarget.getAttribute("value"));
|
||||
e.currentTarget.parentElement.remove();
|
||||
BDFDB.NotificationUtils.toast(`Custom Icon was deleted.`, {type:"success"});
|
||||
|
@ -706,15 +706,15 @@ class ServerFolders {
|
|||
function setIcon (icon, hover, enable) {
|
||||
if (!icon) return;
|
||||
let id = icon.getAttribute("value");
|
||||
if (enable != undefined) BDFDB.toggleClass(icon, "selected", enable);
|
||||
if (enable != undefined) BDFDB.DOMUtils.toggleClass(icon, "selected", enable);
|
||||
if (hover) {
|
||||
if (folderIcons[id]) icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[id].openicon})`);
|
||||
if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)");
|
||||
if (BDFDB.DOMUtils.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 {
|
||||
if (folderIcons[id]) icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[id].closedicon})`);
|
||||
if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)");
|
||||
if (BDFDB.DOMUtils.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)");
|
||||
else icon.style.removeProperty("background-color");
|
||||
}
|
||||
}
|
||||
|
@ -761,9 +761,9 @@ class ServerFolders {
|
|||
toggleFolderContent (forceOpenClose) {
|
||||
if (!this.foldercontentguilds) return;
|
||||
forceOpenClose = forceOpenClose === undefined ? BDFDB.LibraryModules.FolderUtils.getExpandedFolders().size > 0 : forceOpenClose;
|
||||
BDFDB.toggleClass(this.foldercontent, "foldercontentopen", forceOpenClose);
|
||||
BDFDB.toggleClass(this.foldercontent, "foldercontentclosed", !forceOpenClose);
|
||||
BDFDB.toggleClass(document.body, "foldercontentopened", forceOpenClose);
|
||||
BDFDB.DOMUtils.toggleClass(this.foldercontent, "foldercontentopen", forceOpenClose);
|
||||
BDFDB.DOMUtils.toggleClass(this.foldercontent, "foldercontentclosed", !forceOpenClose);
|
||||
BDFDB.DOMUtils.toggleClass(document.body, "foldercontentopened", forceOpenClose);
|
||||
}
|
||||
|
||||
changeFolder (folderid, wrapper) {
|
||||
|
@ -775,11 +775,11 @@ class ServerFolders {
|
|||
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderid);
|
||||
let data = this.getFolderConfig(folderid);
|
||||
|
||||
BDFDB.removeEles(folderinner.querySelectorAll(`${BDFDB.dotCN.guildupperbadge}.count`));
|
||||
BDFDB.DOMUtils.remove(folderinner.querySelectorAll(`${BDFDB.dotCN.guildupperbadge}.count`));
|
||||
foldericon.parentElement.parentElement.style.removeProperty("-webkit-mask");
|
||||
|
||||
if (BDFDB.DataUtils.get(this, "settings", "showCountBadge")) {
|
||||
folderinner.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.guildupperbadge} count" style="opacity: 1; transform: translate(0px, 0px);"><div class="${BDFDB.disCN.guildbadgenumberbadge}" style="background-color: rgb(114, 137, 218); width: ${folder.guildIds.length > 99 ? 28 : (folder.guildIds.length > 9 ? 22 : 16)}px; padding-right: ${folder.guildIds.length > 99 ? 0 : (folder.guildIds.length > 9 ? 0 : 1)}px;">${folder.guildIds.length}</div></div>`));
|
||||
folderinner.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.guildupperbadge} count" style="opacity: 1; transform: translate(0px, 0px);"><div class="${BDFDB.disCN.guildbadgenumberbadge}" style="background-color: rgb(114, 137, 218); width: ${folder.guildIds.length > 99 ? 28 : (folder.guildIds.length > 9 ? 22 : 16)}px; padding-right: ${folder.guildIds.length > 99 ? 0 : (folder.guildIds.length > 9 ? 0 : 1)}px;">${folder.guildIds.length}</div></div>`));
|
||||
let width = folder.guildIds.length > 99 ? 36 : (folder.guildIds.length > 9 ? 30 : 24);
|
||||
foldericon.parentElement.parentElement.style.setProperty("-webkit-mask", `url(data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" fill="black" x="0" y="0" width="48" height="48"><path d="M ${width-7} 0 C ${width-5} 2 ${width-4} 5 ${width-4} 8 C ${width-4} ${width/1.8+3} 15 20 8 20 C 5 20 2 19 0 17 L 0 50 L 50 50 L 50 0 L 17 0 z"></path></svg>`)}) center/cover no-repeat`);
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ class ServerFolders {
|
|||
var fontColor = data.color4 ? (!isgradient4 ? BDFDB.ColorUtils.convert(data.color4, "RGBA") : BDFDB.ColorUtils.createGradient(data.color4)) : "";
|
||||
var folderName = folder.folderName || BDFDB.ReactUtils.getValue(wrapper, "return.stateNode.props.defaultFolderName");
|
||||
folderinner.ServerFoldersTooltipListener = () => {
|
||||
BDFDB.TooltipUtils.create(folderinner, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.encodeToHTML(folderName)}</span>` : folderName, {type:"right", selector:"ServerFolders-tooltip", style:`${isgradient4 ? '' : `color: ${fontColor} !important; `}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(data.color3[0], "RGBA") : bgColor} !important;`, html:isgradient3, hide:true});
|
||||
BDFDB.TooltipUtils.create(folderinner, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.StringUtils.htmlEscape(folderName)}</span>` : folderName, {type:"right", selector:"ServerFolders-tooltip", style:`${isgradient4 ? '' : `color: ${fontColor} !important; `}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(data.color3[0], "RGBA") : bgColor} !important;`, html:isgradient3, hide:true});
|
||||
};
|
||||
folderinner.addEventListener("mouseenter", folderinner.ServerFoldersTooltipListener);
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ class ServerFolders {
|
|||
if (!newCopy) return;
|
||||
else if (oldCopy) {
|
||||
this.foldercontentguilds.insertBefore(newCopy, oldCopy);
|
||||
BDFDB.removeEles(oldCopy);
|
||||
BDFDB.DOMUtils.remove(oldCopy);
|
||||
}
|
||||
else {
|
||||
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderid);
|
||||
|
@ -835,14 +835,14 @@ class ServerFolders {
|
|||
}
|
||||
this.foldercontentguilds.insertBefore(newCopy, insertNode);
|
||||
}
|
||||
if (BDFDB.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.removeEles(this.foldercontentguilds.firstElementChild);
|
||||
if (BDFDB.DOMUtils.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.DOMUtils.remove(this.foldercontentguilds.firstElementChild);
|
||||
}
|
||||
}
|
||||
|
||||
addSeparator (folderid) {
|
||||
if (!this.foldercontentguilds) return;
|
||||
if (!this.foldercontent.querySelector(`.folderseparatorouter[folderid="${folderid}"]`) && BDFDB.DataUtils.get(this, "settings", "addSeparators")) this.foldercontentguilds.insertBefore(BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguildseparator} folderseparatorouter" folderid="${folderid}"><div class="${BDFDB.disCN.guildseparator} folderseparator"></div></div>`), this.foldercontentguilds.querySelectorAll(`[folderid="${folderid}"]`)[0]);
|
||||
if (BDFDB.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.removeEles(this.foldercontentguilds.firstElementChild);
|
||||
if (!this.foldercontent.querySelector(`.folderseparatorouter[folderid="${folderid}"]`) && BDFDB.DataUtils.get(this, "settings", "addSeparators")) this.foldercontentguilds.insertBefore(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.guildouter + BDFDB.disCN._bdguildseparator} folderseparatorouter" folderid="${folderid}"><div class="${BDFDB.disCN.guildseparator} folderseparator"></div></div>`), this.foldercontentguilds.querySelectorAll(`[folderid="${folderid}"]`)[0]);
|
||||
if (BDFDB.DOMUtils.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.DOMUtils.remove(this.foldercontentguilds.firstElementChild);
|
||||
}
|
||||
|
||||
createBase64SVG (paths, color1 = "#000000", color2 = "#FFFFFF") {
|
||||
|
@ -878,7 +878,7 @@ class ServerFolders {
|
|||
let guildicon = guildcopy.querySelector(BDFDB.dotCN.guildicon);
|
||||
let guildpillitem = guildcopy.querySelector(BDFDB.dotCN.guildpillitem);
|
||||
if (!guildpillitem) {
|
||||
guildpillitem = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildpillwrapper + BDFDB.disCN.guildpill}"><span class="${BDFDB.disCN.guildpillitem}" style="opacity: 0; height: 8px; transform: translate3d(0px, 0px, 0px);"></span></div>`);
|
||||
guildpillitem = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.guildpillwrapper + BDFDB.disCN.guildpill}"><span class="${BDFDB.disCN.guildpillitem}" style="opacity: 0; height: 8px; transform: translate3d(0px, 0px, 0px);"></span></div>`);
|
||||
guildcopy.insertBefore(guildpillitem, guildcopy.firstElementChild);
|
||||
guildpillitem = guildpillitem.firstElementChild;
|
||||
}
|
||||
|
@ -897,8 +897,8 @@ class ServerFolders {
|
|||
guildcopy.querySelector("mask path").setAttribute("d", "M0 0 l50 0l0 50l-50 0l0 -50Z");
|
||||
guildcopy.querySelector("foreignObject").setAttribute("mask", "url(#SERVERFOLDERSCOPY" + guildid + ")");
|
||||
|
||||
BDFDB.addClass(guildcopy, "copy");
|
||||
BDFDB.toggleEles(guildcopy, true);
|
||||
BDFDB.DOMUtils.addClass(guildcopy, "copy");
|
||||
BDFDB.DOMUtils.show(guildcopy);
|
||||
|
||||
let pillvisible = guildpillitem && guildpillitem.style.getPropertyValue("opacity") != 0;
|
||||
|
||||
|
@ -946,7 +946,7 @@ class ServerFolders {
|
|||
};
|
||||
|
||||
guildcopyinner.addEventListener("mouseenter", () => {
|
||||
let EditServers = BDFDB.BdUtils.getPlugin("EditServers");
|
||||
let EditServers = BDFDB.BDUtils.getPlugin("EditServers");
|
||||
let ESdata = EditServers ? EditServers.getGuildData(guildid, guildcopyinner) : null;
|
||||
if (ESdata && (ESdata.name || ESdata.color3 || ESdata.color4)) EditServers.changeTooltip(guild, guildcopyinner, "right");
|
||||
else {
|
||||
|
@ -957,7 +957,7 @@ class ServerFolders {
|
|||
let isgradient4 = color4 && BDFDB.ObjectUtils.is(color4);
|
||||
let bgColor = color3 ? (!isgradient3 ? BDFDB.ColorUtils.convert(color3, "RGBA") : BDFDB.ColorUtils.createGradient(color3)) : "";
|
||||
let fontColor = color4 ? (!isgradient4 ? BDFDB.ColorUtils.convert(color4, "RGBA") : BDFDB.ColorUtils.createGradient(color4)) : "";
|
||||
BDFDB.TooltipUtils.create(guildcopyinner, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.encodeToHTML(guild.name)}</span>` : guild.name, {type:"right", selector:"guild-folder-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(color3[0], "RGBA") : bgColor} !important;`, html:isgradient3, hide:true});
|
||||
BDFDB.TooltipUtils.create(guildcopyinner, isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.StringUtils.htmlEscape(guild.name)}</span>` : guild.name, {type:"right", selector:"guild-folder-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.ColorUtils.convert(color3[0], "RGBA") : bgColor} !important;`, html:isgradient3, hide:true});
|
||||
}
|
||||
if (guildicon && guildicon.src && guild.icon && guild.icon.startsWith("a_") && guild.features.has("ANIMATED_ICON") && guildicon.src.includes("discordapp.com/icons/")) {
|
||||
guildicon.src = guildicon.src.replace(".webp", ".gif");
|
||||
|
@ -969,7 +969,7 @@ class ServerFolders {
|
|||
}
|
||||
});
|
||||
guildcopyinner.addEventListener("mouseleave", () => {
|
||||
if (guildicon && guildicon.src && guild.icon && guild.icon.startsWith("a_") && guild.features.has("ANIMATED_ICON") && guildicon.src.includes("discordapp.com/icons/") && !BDFDB.ReactUtils.getValue(BDFDB.BdUtils.getPlugin("AutoPlayGifs", true), "settings.guildList")) {
|
||||
if (guildicon && guildicon.src && guild.icon && guild.icon.startsWith("a_") && guild.features.has("ANIMATED_ICON") && guildicon.src.includes("discordapp.com/icons/") && !BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("AutoPlayGifs", true), "settings.guildList")) {
|
||||
guildicon.src = guildicon.src.replace(".gif", ".webp");
|
||||
}
|
||||
if (BDFDB.LibraryModules.LastGuildStore.getGuildId() != guildid) {
|
||||
|
@ -997,15 +997,15 @@ class ServerFolders {
|
|||
document.removeEventListener("mousemove", mousemove);
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
let hovcopy = null;
|
||||
let placeholder = BDFDB.htmlToElement(this.dragPlaceholderMarkup);
|
||||
let placeholder = BDFDB.DOMUtils.create(this.dragPlaceholderMarkup);
|
||||
let dragpreview = this.createDragPreview(guilddiv, e);
|
||||
|
||||
let dragging = e3 => {
|
||||
BDFDB.removeEles(placeholder);
|
||||
BDFDB.toggleEles(guildcopy, false);
|
||||
BDFDB.DOMUtils.remove(placeholder);
|
||||
BDFDB.DOMUtils.hide(guildcopy);
|
||||
this.updateDragPreview(dragpreview, e3);
|
||||
if (this.foldercontent.contains(e3.target)) {
|
||||
hovcopy = BDFDB.getParentEle(BDFDB.dotCN.guildouter, e3.target);
|
||||
hovcopy = BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, e3.target);
|
||||
if (hovcopy && hovcopy.getAttribute("folderid") == folderid) this.foldercontentguilds.insertBefore(placeholder, hovcopy.nextSibling);
|
||||
else hovcopy = null;
|
||||
}
|
||||
|
@ -1013,13 +1013,13 @@ class ServerFolders {
|
|||
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.guildfolderwrapper, e3.target);
|
||||
BDFDB.DOMUtils.remove(placeholder, dragpreview);
|
||||
BDFDB.DOMUtils.show(guildcopy);
|
||||
let dropfolderdiv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildfolderwrapper, e3.target);
|
||||
let newfolderid = dropfolderdiv ? BDFDB.FolderUtils.getId(dropfolderdiv) : null;
|
||||
if (newfolderid) {
|
||||
if (newfolderid != folderid) {
|
||||
BDFDB.removeEles(guildcopy);
|
||||
BDFDB.DOMUtils.remove(guildcopy);
|
||||
this.addGuildToFolder(newfolderid, guildid);
|
||||
}
|
||||
}
|
||||
|
@ -1067,7 +1067,7 @@ class ServerFolders {
|
|||
}
|
||||
|
||||
openFolderCreationMenu (guilds, initguildid) {
|
||||
let modal = BDFDB.htmlToElement(`<span class="${this.name}-modal BDFDB-modal"><div class="${BDFDB.disCN.backdrop}"></div><div class="${BDFDB.disCN.modal}"><div class="${BDFDB.disCN.modalinner}"><div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">${this.labels.serversubmenu_createfolder_text}</h4><div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div></div><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"></path><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"></path></g></svg></div></button></div><div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.scrollerthemeghosthairline}"><div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner} entries"></div></div><div class="${BDFDB.disCNS.flex + 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-done ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}"><div class="${BDFDB.disCN.buttoncontents}"></div></button><button type="button" class="btn-cancel ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlooklink + BDFDB.disCNS.buttoncolortransparent + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div></div></div></div></span>`);
|
||||
let modal = BDFDB.DOMUtils.create(`<span class="${this.name}-modal BDFDB-modal"><div class="${BDFDB.disCN.backdrop}"></div><div class="${BDFDB.disCN.modal}"><div class="${BDFDB.disCN.modalinner}"><div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;"><h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">${this.labels.serversubmenu_createfolder_text}</h4><div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.primary}"></div></div><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"></path><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"></path></g></svg></div></button></div><div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.modalcontent + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.scrollerthemeghosthairline}"><div class="${BDFDB.disCNS.scroller + BDFDB.disCN.modalsubinner} entries"></div></div><div class="${BDFDB.disCNS.flex + 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-done ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}"><div class="${BDFDB.disCN.buttoncontents}"></div></button><button type="button" class="btn-cancel ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlooklink + BDFDB.disCNS.buttoncolortransparent + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}"><div class="${BDFDB.disCN.buttoncontents}"></div></button></div></div></div></div></span>`);
|
||||
|
||||
let targetedguildsids = {};
|
||||
|
||||
|
@ -1079,8 +1079,8 @@ class ServerFolders {
|
|||
});
|
||||
|
||||
for (let guild of guilds) {
|
||||
if (container.firstElementChild) container.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
let entry = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} entry" style="flex: 1 1 auto;">${BDFDB.GuildUtils.createCopy(guild.id, {size: 48}).outerHTML}<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCNS.flexchild + BDFDB.disCN.overflowellipsis}" style="flex: 1 1 auto; white-space: nowrap;">${BDFDB.encodeToHTML(guild.name)}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}"></div></div>`);
|
||||
if (container.firstElementChild) container.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
let entry = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4} entry" style="flex: 1 1 auto;">${BDFDB.GuildUtils.createCopy(guild.id, {size: 48}).outerHTML}<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCNS.flexchild + BDFDB.disCN.overflowellipsis}" style="flex: 1 1 auto; white-space: nowrap;">${BDFDB.StringUtils.htmlEscape(guild.name)}</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" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}"></div></div>`);
|
||||
container.appendChild(entry);
|
||||
let switchinput = entry.querySelector(BDFDB.dotCN.switchinner);
|
||||
switchinput.checked = guild.id == initguildid;
|
||||
|
@ -1116,7 +1116,7 @@ class ServerFolders {
|
|||
|
||||
removeFolder (folderid) {
|
||||
BDFDB.DataUtils.remove(this, "folders", folderid);
|
||||
BDFDB.removeEles(this.foldercontentguilds.querySelector(`${BDFDB.dotCN.guildouter}[folderid="${folderid}"]`));
|
||||
BDFDB.DOMUtils.remove(this.foldercontentguilds.querySelector(`${BDFDB.dotCN.guildouter}[folderid="${folderid}"]`));
|
||||
let oldGuildFolders = Object.assign({}, BDFDB.LibraryModules.FolderStore.guildFolders);
|
||||
let guildFolders = [], guildPositions = [];
|
||||
for (let i in oldGuildFolders) {
|
||||
|
@ -1147,9 +1147,9 @@ class ServerFolders {
|
|||
}
|
||||
|
||||
removeGuildFromFolder (folderid, guildid) {
|
||||
BDFDB.removeEles(this.foldercontentguilds.querySelector(`${BDFDB.dotCN.guildouter}[folderid="${folderid}"][guildid="${guildid}"]`));
|
||||
BDFDB.DOMUtils.remove(this.foldercontentguilds.querySelector(`${BDFDB.dotCN.guildouter}[folderid="${folderid}"][guildid="${guildid}"]`));
|
||||
let sameFolderEles = this.foldercontentguilds.querySelectorAll(`[folderid="${folderid}"]`);
|
||||
if (sameFolderEles.length == 1 && BDFDB.containsClass(sameFolderEles[0], "folderseparatorouter")) BDFDB.removeEles(sameFolderEles[0]);
|
||||
if (sameFolderEles.length == 1 && BDFDB.DOMUtils.containsClass(sameFolderEles[0], "folderseparatorouter")) BDFDB.DOMUtils.remove(sameFolderEles[0]);
|
||||
let oldGuildFolders = Object.assign({}, BDFDB.LibraryModules.FolderStore.guildFolders);
|
||||
let guildFolders = [], guildPositions = [];
|
||||
for (let i in oldGuildFolders) {
|
||||
|
@ -1169,8 +1169,8 @@ class ServerFolders {
|
|||
createDragPreview (div, e) {
|
||||
if (!Node.prototype.isPrototypeOf(div)) return;
|
||||
let dragpreview = div.cloneNode(true);
|
||||
BDFDB.addClass(dragpreview, "serverfolders-dragpreview");
|
||||
BDFDB.toggleEles(dragpreview, false);
|
||||
BDFDB.DOMUtils.addClass(dragpreview, "serverfolders-dragpreview");
|
||||
BDFDB.DOMUtils.hide(dragpreview);
|
||||
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");
|
||||
|
@ -1180,7 +1180,7 @@ class ServerFolders {
|
|||
|
||||
updateDragPreview (dragpreview, e) {
|
||||
if (!Node.prototype.isPrototypeOf(dragpreview)) return;
|
||||
BDFDB.toggleEles(dragpreview, true);
|
||||
BDFDB.DOMUtils.show(dragpreview);
|
||||
dragpreview.style.setProperty("left", e.clientX - 25 + "px", "important");
|
||||
dragpreview.style.setProperty("top", e.clientY - 25 + "px", "important");
|
||||
}
|
||||
|
|
|
@ -85,14 +85,14 @@ class ServerHider {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Reset all Servers.</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></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "click", ".reset-button", () => {
|
||||
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
|
||||
BDFDB.DataUtils.remove(this, "servers");
|
||||
BDFDB.GuildUtils.getAll().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, false);});
|
||||
BDFDB.GuildUtils.getAll().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.DOMUtils.hide(info.div);});
|
||||
});
|
||||
});
|
||||
return settingspanel;
|
||||
|
@ -135,7 +135,7 @@ class ServerHider {
|
|||
|
||||
BDFDB.GuildUtils.getAll().forEach(info => {
|
||||
if (info.div.ServerHiderChangeObserver && typeof info.div.ServerHiderChangeObserver.disconnect == "function") info.div.ServerHiderChangeObserver.disconnect();
|
||||
if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, true);
|
||||
if (!info.div.getAttribute("folder")) BDFDB.DOMUtils.show(info.div);
|
||||
delete info.div.ServerHiderChanged;
|
||||
});
|
||||
|
||||
|
@ -201,7 +201,7 @@ class ServerHider {
|
|||
}
|
||||
|
||||
showServerModal () {
|
||||
let serverHiderModal = BDFDB.htmlToElement(this.serverHiderModalMarkup);
|
||||
let serverHiderModal = BDFDB.DOMUtils.create(this.serverHiderModalMarkup);
|
||||
let container = serverHiderModal.querySelector(".entries");
|
||||
if (!container) return;
|
||||
|
||||
|
@ -215,14 +215,14 @@ class ServerHider {
|
|||
|
||||
for (let info of BDFDB.GuildUtils.getAll()) {
|
||||
if (!info.div.getAttribute("folder")) {
|
||||
if (container.firstElementChild) container.appendChild(BDFDB.htmlToElement(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
let entry = BDFDB.htmlToElement(this.serverEntryMarkup);
|
||||
if (container.firstElementChild) container.appendChild(BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.divider}"></div>`));
|
||||
let entry = BDFDB.DOMUtils.create(this.serverEntryMarkup);
|
||||
container.appendChild(entry);
|
||||
let name = entry.querySelector(".serverhiderName");
|
||||
name.innerText = info.name || "";
|
||||
name.parentElement.insertBefore(BDFDB.GuildUtils.createCopy(info, {click: () => {BDFDB.removeEles(serverHiderModal);}, menu: true, size: 48}), name);
|
||||
name.parentElement.insertBefore(BDFDB.GuildUtils.createCopy(info, {click: () => {BDFDB.DOMUtils.remove(serverHiderModal);}, menu: true, size: 48}), name);
|
||||
let hidecheckbox = entry.querySelector(".serverhiderCheckbox");
|
||||
hidecheckbox.checked = !BDFDB.isEleHidden(info.div);
|
||||
hidecheckbox.checked = !BDFDB.DOMUtils.isHidden(info.div);
|
||||
hidecheckbox.addEventListener("click", e => {
|
||||
this.toggleServer(info, info.div, e.currentTarget.checked);
|
||||
});
|
||||
|
@ -233,9 +233,9 @@ class ServerHider {
|
|||
|
||||
toggleServer (info, target, visible) {
|
||||
if (!info || !target) return;
|
||||
let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter, target);
|
||||
let guilddiv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, target);
|
||||
if (!guilddiv || guilddiv.getAttribute("folder")) return;
|
||||
BDFDB.toggleEles(guilddiv, visible);
|
||||
BDFDB.DOMUtils.toggle(guilddiv, visible);
|
||||
let hiddenservers = BDFDB.DataUtils.load(this, "hiddenservers", "hiddenservers") || [];
|
||||
BDFDB.ArrayUtils.remove(hiddenservers, info.id);
|
||||
if (!visible) {
|
||||
|
@ -250,7 +250,7 @@ class ServerHider {
|
|||
}
|
||||
|
||||
isInFolder (id) {
|
||||
if (!BDFDB.BdUtils.isPluginEnabled("ServerFolders")) return false;
|
||||
if (!BDFDB.BDUtils.isPluginEnabled("ServerFolders")) return false;
|
||||
let folders = BDFDB.DataUtils.load("ServerFolders", "folders");
|
||||
for (let folderid in folders) if ((folders[folderid].servers || []).includes(id)) return true;
|
||||
return false;
|
||||
|
|
|
@ -121,7 +121,7 @@ class ShowHiddenChannels {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -163,7 +163,7 @@ class ShowHiddenChannels {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".container-hidden");
|
||||
BDFDB.DOMUtils.remove(".container-hidden");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ class ShowHiddenChannels {
|
|||
}
|
||||
|
||||
appendHiddenContainer (guild) {
|
||||
BDFDB.removeEles(".container-hidden");
|
||||
BDFDB.DOMUtils.remove(".container-hidden");
|
||||
if (!guild) return;
|
||||
this.currentGuild = guild.id;
|
||||
var allChannels = BDFDB.LibraryModules.ChannelStore.getChannels();
|
||||
|
@ -233,22 +233,22 @@ class ShowHiddenChannels {
|
|||
hiddenChannels.count = count;
|
||||
|
||||
if (count > 0) {
|
||||
var category = BDFDB.htmlToElement(this.categoryMarkup);
|
||||
var category = BDFDB.DOMUtils.create(this.categoryMarkup);
|
||||
var wrapper = category.querySelector(BDFDB.dotCN.categorywrapper);
|
||||
category.setAttribute("guild", guild.id);
|
||||
wrapper.addEventListener("click", () => {
|
||||
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorycollapsed);
|
||||
BDFDB.DOMUtils.toggleClass(wrapper, BDFDB.disCN.categorycollapsed);
|
||||
|
||||
var visibile = !BDFDB.containsClass(wrapper, BDFDB.disCN.categorycollapsed);
|
||||
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), visibile);
|
||||
var visibile = !BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.categorycollapsed);
|
||||
BDFDB.DOMUtils.toggle(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), visibile);
|
||||
BDFDB.DataUtils.save(visibile, this, "categorystatus", guild.id);
|
||||
});
|
||||
|
||||
for (let type in BDFDB.DiscordConstants.ChannelTypes) for (let hiddenChannel of hiddenChannels[BDFDB.DiscordConstants.ChannelTypes[type]]) this.createChannel(guild, category, hiddenChannel, type);
|
||||
|
||||
var isvisibile = BDFDB.DataUtils.load(this, "categorystatus", guild.id) === true;
|
||||
BDFDB.toggleClass(wrapper, BDFDB.disCN.categorycollapsed, !isvisibile);
|
||||
BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), isvisibile);
|
||||
BDFDB.DOMUtils.toggleClass(wrapper, BDFDB.disCN.categorycollapsed, !isvisibile);
|
||||
BDFDB.DOMUtils.toggle(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), isvisibile);
|
||||
|
||||
this.reappendHiddenContainer(guild, category);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ class ShowHiddenChannels {
|
|||
if (channellist) {
|
||||
BDFDB.ListenerUtils.remove(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault);
|
||||
if (settings.showForNormal) BDFDB.ListenerUtils.add(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault, e => {
|
||||
if (!BDFDB.containsClass(e.currentTarget, "hidden-channel")) {
|
||||
if (!BDFDB.DOMUtils.containsClass(e.currentTarget, "hidden-channel")) {
|
||||
var channel = BDFDB.ReactUtils.findValue(e.currentTarget, "channel");
|
||||
if (channel) this.showAccessRoles(guild, channel, e, true);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class ShowHiddenChannels {
|
|||
}
|
||||
|
||||
createChannel (guild, category, info, type) {
|
||||
let channel = BDFDB.htmlToElement(this.channelMarkup);
|
||||
let channel = BDFDB.DOMUtils.create(this.channelMarkup);
|
||||
channel.querySelector(BDFDB.dotCN.channelname).innerText = info.name;
|
||||
channel.querySelector(BDFDB.dotCNS.channelicon + "mask").setAttribute("id", `showHiddenChannelsMask${info.id}`);
|
||||
let iconinner = channel.querySelector(BDFDB.dotCNS.channelicon + ".hidden-icon-inner");
|
||||
|
@ -276,7 +276,7 @@ class ShowHiddenChannels {
|
|||
this.showAccessRoles(guild, info, e, false);
|
||||
});
|
||||
channel.addEventListener("click", () => {
|
||||
BDFDB.NotificationUtils.toast(`You can not ${this.channelMessage[type] ? this.channelMessage[type] : this.channelMessage.DEFAULT} <strong>${BDFDB.encodeToHTML(info.name)}</strong>.`, {type:"error", html:true});
|
||||
BDFDB.NotificationUtils.toast(`You can not ${this.channelMessage[type] ? this.channelMessage[type] : this.channelMessage.DEFAULT} <strong>${BDFDB.StringUtils.htmlEscape(info.name)}</strong>.`, {type:"error", html:true});
|
||||
});
|
||||
channel.addEventListener("contextmenu", e => {
|
||||
this.createHiddenObjContextMenu(guild, info, type, e);
|
||||
|
@ -342,10 +342,10 @@ class ShowHiddenChannels {
|
|||
}
|
||||
var htmlString = ``;
|
||||
if (settings.showChannelCategory && !allowed && channel.parent_id) {
|
||||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Category:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}"><div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-category" style="border-color: rgba(255, 255, 255, 0.6); height: unset !important; padding-top: 5px; padding-bottom: 5px; max-width: ${window.outerWidth/3}px; text-transform: uppercase;">${BDFDB.encodeToHTML(BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id).name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Category:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}"><div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-category" style="border-color: rgba(255, 255, 255, 0.6); height: unset !important; padding-top: 5px; padding-bottom: 5px; max-width: ${window.outerWidth/3}px; text-transform: uppercase;">${BDFDB.StringUtils.htmlEscape(BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id).name)}</div></div>`;
|
||||
}
|
||||
if (settings.showTopic && !allowed && channel.topic && channel.topic.replace(/[\t\n\r\s]/g, "")) {
|
||||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Topic:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}"><div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-topic" style="border-color: rgba(255, 255, 255, 0.6); height: unset !important; padding-top: 5px; padding-bottom: 5px; max-width: ${window.outerWidth/3}px">${BDFDB.encodeToHTML(channel.topic)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Topic:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}"><div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-topic" style="border-color: rgba(255, 255, 255, 0.6); height: unset !important; padding-top: 5px; padding-bottom: 5px; max-width: ${window.outerWidth/3}px">${BDFDB.StringUtils.htmlEscape(channel.topic)}</div></div>`;
|
||||
}
|
||||
if (settings.showVoiceUsers && channel.type == BDFDB.DiscordConstants.ChannelTypes.GUILD_VOICE && (!allowed || e.currentTarget.querySelector(BDFDB.dotCN.channelmodelocked))) {
|
||||
let voicestates = BDFDB.LibraryModules.VoiceUtils.getVoiceStatesForChannel(channel);
|
||||
|
@ -356,7 +356,7 @@ class ShowHiddenChannels {
|
|||
let member = BDFDB.LibraryModules.MemberStore.getMember(guild.id, voicestate.userId);
|
||||
if (user && member) {
|
||||
let color = member.colorString ? BDFDB.ColorUtils.convert(member.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-voiceuser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(member.nick || user.username)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-voiceuser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.StringUtils.htmlEscape(member.nick || user.username)}</div></div>`;
|
||||
}
|
||||
}
|
||||
htmlString += `</div>`;
|
||||
|
@ -366,11 +366,11 @@ class ShowHiddenChannels {
|
|||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Allowed Roles:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}">`;
|
||||
for (let role of allowedRoles) {
|
||||
let color = role.colorString ? BDFDB.ColorUtils.convert(role.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-allowedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(role.name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-allowedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.StringUtils.htmlEscape(role.name)}</div></div>`;
|
||||
}
|
||||
for (let role of overwrittenRoles) {
|
||||
let color = role.colorString ? BDFDB.ColorUtils.convert(role.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-overwrittenrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}" style="text-decoration: line-through !important;">${BDFDB.encodeToHTML(role.name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-overwrittenrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}" style="text-decoration: line-through !important;">${BDFDB.StringUtils.htmlEscape(role.name)}</div></div>`;
|
||||
}
|
||||
htmlString += `</div>`;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ class ShowHiddenChannels {
|
|||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Allowed Users:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}">`;
|
||||
for (let user of allowedUsers) {
|
||||
let color = user.colorString ? BDFDB.ColorUtils.convert(user.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-alloweduser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(user.nick || user.name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-alloweduser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.StringUtils.htmlEscape(user.nick || user.name)}</div></div>`;
|
||||
}
|
||||
htmlString += `</div>`;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ class ShowHiddenChannels {
|
|||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Denied Roles:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}">`;
|
||||
for (let role of deniedRoles) {
|
||||
let color = role.colorString ? BDFDB.ColorUtils.convert(role.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-deniedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(role.name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-deniedrole" style="border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.StringUtils.htmlEscape(role.name)}</div></div>`;
|
||||
}
|
||||
htmlString += `</div>`;
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ class ShowHiddenChannels {
|
|||
htmlString += `<div class="${BDFDB.disCN.marginbottom4}">Denied Users:</div><div class="${BDFDB.disCNS.flex2 + BDFDB.disCN.wrap}">`;
|
||||
for (let user of deniedUsers) {
|
||||
let color = user.colorString ? BDFDB.ColorUtils.convert(user.colorString, "RGBCOMP") : [255,255,255];
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-denieduser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.encodeToHTML(user.nick || user.name)}</div></div>`;
|
||||
htmlString += `<div class="${BDFDB.disCNS.userpopoutrole + BDFDB.disCNS.flex2 + BDFDB.disCNS.aligncenter} SHC-denieduser" style="padding-left: 0; border-color: rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.6);"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${user.username}" aria-hidden="false" style="width: 22px; height: 18px; z-index: 1003;"><svg width="18" height="18" viewBox="0 0 18 18" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="18" height="18" mask="url(#svg-mask-avatar-default)"><img src="${BDFDB.UserUtils.getAvatar(user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject></svg></div><div class="${BDFDB.disCN.userpopoutrolecircle}" style="background-color: rgb(${color[0]}, ${color[1]}, ${color[2]});"></div><div class="${BDFDB.disCNS.userpopoutrolename}">${BDFDB.StringUtils.htmlEscape(user.nick || user.name)}</div></div>`;
|
||||
}
|
||||
htmlString += `</div>`;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ class ShowHiddenChannels {
|
|||
var width = window.outerWidth/2;
|
||||
var tooltip = BDFDB.TooltipUtils.create(e.currentTarget, htmlString, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.DataUtils.get(this, "amounts", "hoverDelay")});
|
||||
var style = getComputedStyle(e.currentTarget);
|
||||
tooltip.style.setProperty("top", BDFDB.getRects(tooltip).top - style.paddingBottom.replace("px","")/2 + style.paddingTop.replace("px","")/2 + "px");
|
||||
tooltip.style.setProperty("top", BDFDB.DOMUtils.getRects(tooltip).top - style.paddingBottom.replace("px","")/2 + style.paddingTop.replace("px","")/2 + "px");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class ShowImageDetails {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -108,10 +108,10 @@ class ShowImageDetails {
|
|||
// begin of own functions
|
||||
|
||||
resetImage (image) {
|
||||
BDFDB.removeClass(image, "image-details-added");
|
||||
BDFDB.DOMUtils.removeClass(image, "image-details-added");
|
||||
image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
|
||||
let wrapper = image.parentElement;
|
||||
if (BDFDB.containsClass(wrapper, "image-details-wrapper")) {
|
||||
if (BDFDB.DOMUtils.containsClass(wrapper, "image-details-wrapper")) {
|
||||
wrapper.parentElement.insertBefore(image, wrapper);
|
||||
wrapper.remove();
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ class ShowImageDetails {
|
|||
processLazyImageZoomable (instance, image, returnvalue) {
|
||||
let attachment = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.return.memoizedProps.attachment");
|
||||
if (attachment && !attachment.filename.endsWith(".bdemote.png") && !attachment.filename.endsWith(".bdemote.gif")) {
|
||||
if (BDFDB.containsClass(image.parentElement.parentElement, BDFDB.disCN.spoilercontainer, BDFDB.disCN.spoilertext, false)) image = image.parentElement.parentElement;
|
||||
BDFDB.addClass(image, "image-details-added");
|
||||
if (BDFDB.DOMUtils.containsClass(image.parentElement.parentElement, BDFDB.disCN.spoilercontainer, BDFDB.disCN.spoilertext, false)) image = image.parentElement.parentElement;
|
||||
BDFDB.DOMUtils.addClass(image, "image-details-added");
|
||||
image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
|
||||
if (BDFDB.DataUtils.get(this, "settings", "showOnHover")) {
|
||||
image.mouseenterShowImageDetails = () => {
|
||||
|
@ -130,11 +130,11 @@ class ShowImageDetails {
|
|||
image.addEventListener("mouseenter", image.mouseenterShowImageDetails);
|
||||
}
|
||||
else {
|
||||
let imagedetailswrapper = BDFDB.htmlToElement(`<div class="image-details-wrapper"><div class="image-details"><a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover} image-details-link" title="${attachment.url}" href="${attachment.url}" target="_blank" rel="noreferrer noopener">${attachment.filename}</a><label class="image-details-size ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${BDFDB.formatBytes(attachment.size)}</label><label class="image-details-dimensions ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${attachment.width}x${attachment.height}px</label></div></div>`);
|
||||
let imagedetailswrapper = BDFDB.DOMUtils.create(`<div class="image-details-wrapper"><div class="image-details"><a class="${BDFDB.disCNS.anchor + BDFDB.disCN.anchorunderlineonhover} image-details-link" title="${attachment.url}" href="${attachment.url}" target="_blank" rel="noreferrer noopener">${attachment.filename}</a><label class="image-details-size ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${BDFDB.formatBytes(attachment.size)}</label><label class="image-details-dimensions ${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.modedefault + BDFDB.disCN.primary}">${attachment.width}x${attachment.height}px</label></div></div>`);
|
||||
image.parentElement.insertBefore(imagedetailswrapper, image);
|
||||
imagedetailswrapper.appendChild(image);
|
||||
let scroller = BDFDB.getParentEle(BDFDB.dotCN.messages, image);
|
||||
if (scroller) scroller.scrollTop += BDFDB.getRects(imagedetailswrapper).height - BDFDB.getRects(image).height;
|
||||
let scroller = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messages, image);
|
||||
if (scroller) scroller.scrollTop += BDFDB.DOMUtils.getRects(imagedetailswrapper).height - BDFDB.DOMUtils.getRects(image).height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class SpellCheck {
|
|||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -127,8 +127,8 @@ class SpellCheck {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".spellcheck-overlay");
|
||||
BDFDB.removeClasses("spellcheck-added");
|
||||
BDFDB.DOMUtils.remove(".spellcheck-overlay");
|
||||
BDFDB.DOMUtils.removeClassFromDOM("spellcheck-added");
|
||||
|
||||
this.killLanguageToast();
|
||||
|
||||
|
@ -161,7 +161,7 @@ class SpellCheck {
|
|||
}
|
||||
}
|
||||
if (true || !word && textarea.value) for (let error of textarea.parentElement.querySelectorAll(".spelling-error")) {
|
||||
let rects = BDFDB.getRects(error);
|
||||
let rects = BDFDB.DOMUtils.getRects(error);
|
||||
if (BDFDB.mousePosition.pageX > rects.x && BDFDB.mousePosition.pageX < (rects.x + rects.width) && BDFDB.mousePosition.pageY > rects.y && BDFDB.mousePosition.pageY < (rects.y + rects.height)) {
|
||||
word = error.innerText;
|
||||
break;
|
||||
|
@ -226,21 +226,21 @@ class SpellCheck {
|
|||
spellcheck.style.setProperty("mask", "none", "important");
|
||||
spellcheck.style.setProperty("pointer-events", "none", "important");
|
||||
spellcheck.style.setProperty("position", "absolute", "important");
|
||||
spellcheck.style.setProperty("left", BDFDB.getRects(textarea).left - BDFDB.getRects(wrapper).left + "px", "important");
|
||||
spellcheck.style.setProperty("width", BDFDB.getRects(textarea).width - style.paddingLeft - style.paddingRight + "px", "important");
|
||||
spellcheck.style.setProperty("left", BDFDB.DOMUtils.getRects(textarea).left - BDFDB.DOMUtils.getRects(wrapper).left + "px", "important");
|
||||
spellcheck.style.setProperty("width", BDFDB.DOMUtils.getRects(textarea).width - style.paddingLeft - style.paddingRight + "px", "important");
|
||||
spellcheck.style.setProperty("height", style.height, "important");
|
||||
|
||||
spellcheck.innerHTML = this.spellCheckText(textarea.value);
|
||||
spellcheck.scrollTop = textarea.scrollTop;
|
||||
}
|
||||
|
||||
var spellcheck = BDFDB.htmlToElement(this.spellCheckLayerMarkup);
|
||||
BDFDB.addClass(spellcheck, textarea.className);
|
||||
var spellcheck = BDFDB.DOMUtils.create(this.spellCheckLayerMarkup);
|
||||
BDFDB.DOMUtils.addClass(spellcheck, textarea.className);
|
||||
|
||||
textarea.setAttribute("spellcheck", false);
|
||||
|
||||
textarea.parentElement.appendChild(spellcheck);
|
||||
BDFDB.addClass(wrapper, "spellcheck-added");
|
||||
BDFDB.DOMUtils.addClass(wrapper, "spellcheck-added");
|
||||
|
||||
updateSpellcheck();
|
||||
BDFDB.ListenerUtils.add(this, textarea, "keyup", e => {
|
||||
|
@ -300,7 +300,7 @@ class SpellCheck {
|
|||
this.setDictionary(choice);
|
||||
BDFDB.DataUtils.save(choice, this, "choices", type);
|
||||
|
||||
var settingspanel = BDFDB.getParentEle(".BDFDB-settings", selectWrap), listcontainer = settingspanel ? settingspanel.querySelector(".word-list") : null;
|
||||
var settingspanel = BDFDB.DOMUtils.getParent(".BDFDB-settings", selectWrap), listcontainer = settingspanel ? settingspanel.querySelector(".word-list") : null;
|
||||
if (listcontainer) {
|
||||
var ownDictionary = BDFDB.DataUtils.load(this, "owndics", choice) || [];
|
||||
var containerhtml = ``;
|
||||
|
@ -351,7 +351,7 @@ class SpellCheck {
|
|||
string.replace(/\n/g, "\n ").split(" ").forEach(word => {
|
||||
let hasnewline = word.endsWith("\n");
|
||||
word = word.replace(/\n/g, "");
|
||||
htmlString.push(`<label class="${this.isWordNotInDictionary(word) ? "spelling-error" : "nospelling-error"}" style="color: transparent !important; text-shadow: none !important;">${BDFDB.encodeToHTML(word)}</label>${hasnewline ? "\n" : ""}`);
|
||||
htmlString.push(`<label class="${this.isWordNotInDictionary(word) ? "spelling-error" : "nospelling-error"}" style="color: transparent !important; text-shadow: none !important;">${BDFDB.StringUtils.htmlEscape(word)}</label>${hasnewline ? "\n" : ""}`);
|
||||
});
|
||||
return htmlString.join(" ").replace(/\n /g, "\n");
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ class StalkerNotifications {
|
|||
require("request")("https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/FriendNotifications/FriendNotifications.plugin.js", (error, response, body) => {
|
||||
if (error) BDFDB.NotificationUtils.toast(`Unable to download FriendNotifications.plugin.js.`, {type:"error"});
|
||||
else {
|
||||
require("fs").writeFile(require("path").join(BDFDB.BdUtils.getPluginsFolder(), "FriendNotifications.plugin.js"), body, (error) => {
|
||||
require("fs").writeFile(require("path").join(BDFDB.BDUtils.getPluginsFolder(), "FriendNotifications.plugin.js"), body, (error) => {
|
||||
if (!error) {
|
||||
BDFDB.NotificationUtils.toast(`Successfully downloaded FriendNotifications.plugin.js.`, {type:"success"});
|
||||
require("fs").unlinkSync(require("path").join(BDFDB.BdUtils.getPluginsFolder(), "StalkerNotifications.plugin.js"));
|
||||
require("fs").unlinkSync(require("path").join(BDFDB.BDUtils.getPluginsFolder(), "StalkerNotifications.plugin.js"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class SteamProfileLink {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".urlCheckFrame");
|
||||
BDFDB.DOMUtils.remove(".urlCheckFrame");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ class ThemeRepo {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all added Themes from your own list.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Reset</div></button></div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -384,7 +384,7 @@ class ThemeRepo {
|
|||
clearInterval(this.updateInterval);
|
||||
clearTimeout(this.loading.timeout);
|
||||
|
||||
BDFDB.removeEles("iframe.discordPreview",".themerepo-notice",".bd-themerepobutton",".themerepo-loadingicon",BDFDB.dotCN.app + " > .repo-loadingwrapper:empty");
|
||||
BDFDB.DOMUtils.remove("iframe.discordPreview",".themerepo-notice",".bd-themerepobutton",".themerepo-loadingicon",BDFDB.dotCN.app + " > .repo-loadingwrapper:empty");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ class ThemeRepo {
|
|||
if (!document.querySelector(".bd-themerepobutton") && window.PluginUpdates && window.PluginUpdates.plugins && instance._reactInternalFiber.key && instance._reactInternalFiber.key.split("-")[0] == "theme") {
|
||||
var folderbutton = document.querySelector(BDFDB.dotCN._repofolderbutton);
|
||||
if (folderbutton) {
|
||||
var repoButton = BDFDB.htmlToElement(`<button class="${BDFDB.disCN._repofolderbutton} bd-themerepobutton">ThemeRepo</button>`);
|
||||
var repoButton = BDFDB.DOMUtils.create(`<button class="${BDFDB.disCN._repofolderbutton} bd-themerepobutton">ThemeRepo</button>`);
|
||||
repoButton.addEventListener("click", () => {
|
||||
this.openThemeRepoModal();
|
||||
});
|
||||
|
@ -434,7 +434,7 @@ class ThemeRepo {
|
|||
if (!ownlist.includes(url)) {
|
||||
ownlist.push(url);
|
||||
BDFDB.DataUtils.save(ownlist, this, "ownlist", "ownlist");
|
||||
let entry = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-theme"></div></div>`);
|
||||
let entry = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.vertical + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCNS.margintop4 + BDFDB.disCNS.marginbottom4 + BDFDB.disCN.hovercard}"><div class="${BDFDB.disCN.hovercardinner}"><div class="${BDFDB.disCNS.description + BDFDB.disCNS.formtext + BDFDB.disCNS.note + BDFDB.disCNS.margintop4 + BDFDB.disCNS.modedefault + BDFDB.disCNS.primary + BDFDB.disCN.ellipsis} entryurl">${url}</div></div><div class="${BDFDB.disCN.hovercardbutton} remove-theme"></div></div>`);
|
||||
BDFDB.ListenerUtils.addToChildren(entry, "click", ".remove-theme", e => {this.removeThemeFromOwnList(e);});
|
||||
themeList.appendChild(entry);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ class ThemeRepo {
|
|||
removeAllFromOwnList (settingspanel) {
|
||||
BDFDB.openConfirmModal(this, "Are you sure you want to remove all added Themes from your own list?", () => {
|
||||
BDFDB.DataUtils.save([], this, "ownlist", "ownlist");
|
||||
BDFDB.removeEles(settingspanel.querySelector(BDFDB.dotCN.hovercard));
|
||||
BDFDB.DOMUtils.remove(settingspanel.querySelector(BDFDB.dotCN.hovercard));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ class ThemeRepo {
|
|||
toggle = false;
|
||||
break;
|
||||
}
|
||||
if (toggle) BDFDB.toggleEles(themeRepoModal);
|
||||
if (toggle) BDFDB.DOMUtils.toggle(themeRepoModal);
|
||||
}
|
||||
else if (e.which == 27) frame.remove();
|
||||
};
|
||||
|
@ -504,19 +504,19 @@ class ThemeRepo {
|
|||
|
||||
var createSelectChoice = index => {
|
||||
let theme = this.loadedThemes[this.generatorThemes[index-1]] || {name: "-----", author: "-----"};
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;"><strong>${BDFDB.encodeToHTML(theme.name)}</strong> by ${BDFDB.encodeToHTML(theme.author)}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;"><strong>${BDFDB.StringUtils.htmlEscape(theme.name)}</strong> by ${BDFDB.StringUtils.htmlEscape(theme.author)}</div>`;
|
||||
};
|
||||
|
||||
var saveSelectChoice = (selectWrap, type, index) => {
|
||||
let theme = this.loadedThemes[this.generatorThemes[index-1]] || {name: "-----", author: "-----"};
|
||||
selectWrap.querySelector(BDFDB.dotCN.title).innerHTML = `<strong>${BDFDB.encodeToHTML(theme.name)}</strong> by ${BDFDB.encodeToHTML(theme.author)}`;
|
||||
selectWrap.querySelector(BDFDB.dotCN.title).innerHTML = `<strong>${BDFDB.StringUtils.htmlEscape(theme.name)}</strong> by ${BDFDB.StringUtils.htmlEscape(theme.author)}`;
|
||||
themeRepoModal.querySelectorAll(".previewCheckbox").forEach(checkbox => {
|
||||
checkbox.checked = false;
|
||||
BDFDB.removeClass(checkbox.parentElement, BDFDB.disCN.switchvaluechecked);
|
||||
BDFDB.addClass(checkbox.parentElement, BDFDB.disCN.switchvalueunchecked);
|
||||
BDFDB.DOMUtils.removeClass(checkbox.parentElement, BDFDB.disCN.switchvaluechecked);
|
||||
BDFDB.DOMUtils.addClass(checkbox.parentElement, BDFDB.disCN.switchvalueunchecked);
|
||||
});
|
||||
let container = themeRepoModal.querySelector(".variables");
|
||||
BDFDB.removeEles(themeRepoModal.querySelectorAll(".varcontainer"));
|
||||
BDFDB.DOMUtils.remove(themeRepoModal.querySelectorAll(".varcontainer"));
|
||||
if (container && theme.fullcss) {
|
||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"NewTheme",checked:true,css:theme.fullcss},"*");
|
||||
this.createGeneratorVars(frame, container, theme);
|
||||
|
@ -526,8 +526,8 @@ class ThemeRepo {
|
|||
document.addEventListener("keyup", keyPressed);
|
||||
window.addEventListener("message", messageReceived);
|
||||
|
||||
var frame = BDFDB.htmlToElement(this.frameMarkup);
|
||||
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
|
||||
var frame = BDFDB.DOMUtils.create(this.frameMarkup);
|
||||
var themeRepoModal = BDFDB.DOMUtils.create(this.themeRepoModalMarkup);
|
||||
var tabbar = themeRepoModal.querySelector(BDFDB.dotCN.tabbar);
|
||||
tabbar.parentElement.insertBefore(BDFDB.createSearchBar("small"), tabbar.nextElementSibling);
|
||||
var hiddenSettings = BDFDB.DataUtils.load(this, "hidden");
|
||||
|
@ -542,7 +542,7 @@ class ThemeRepo {
|
|||
themeRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || options.showOnlyOutdated;
|
||||
themeRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !options.showOnlyOutdated;
|
||||
themeRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || options.showOnlyOutdated;
|
||||
if (!BDFDB.BdUtils.isAutoLoadEnabled()) themeRepoModal.querySelector("#RNMoption").remove();
|
||||
if (!BDFDB.BDUtils.isAutoLoadEnabled()) themeRepoModal.querySelector("#RNMoption").remove();
|
||||
else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.DataUtils.load(this, "RNMstart", "RNMstart");
|
||||
|
||||
if (options.forcedSort && this.sortings.sort[options.forcedSort]) {
|
||||
|
@ -587,7 +587,7 @@ class ThemeRepo {
|
|||
let newvalue = input.value;
|
||||
if (newvalue && newvalue.trim() && newvalue != oldvalue) {
|
||||
let varname = input.getAttribute("option");
|
||||
css = css.replace(new RegExp(`--${BDFDB.regEscape(varname)}(\\s*):(\\s*)${BDFDB.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varname)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
}
|
||||
}
|
||||
this.createThemeFile(data.name + ".theme.css", css);
|
||||
|
@ -635,7 +635,7 @@ class ThemeRepo {
|
|||
BDFDB.createSortPopout(e.currentTarget, this.orderPopoutMarkup, () => {this.sortEntries(themeRepoModal);});
|
||||
});
|
||||
BDFDB.ListenerUtils.addToChildren(themeRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=themes]", e => {
|
||||
if (!BDFDB.containsClass(e.currentTarget, BDFDB.disCN.settingsitemselected)) {
|
||||
if (!BDFDB.DOMUtils.containsClass(e.currentTarget, BDFDB.disCN.settingsitemselected)) {
|
||||
if (themeRepoModal.updateHidden) {
|
||||
delete themeRepoModal.updateHidden;
|
||||
this.sortEntries(themeRepoModal);
|
||||
|
@ -648,7 +648,7 @@ class ThemeRepo {
|
|||
themeRepoModal.entries = {};
|
||||
for (let url in this.loadedThemes) {
|
||||
let theme = this.loadedThemes[url];
|
||||
let instTheme = BDFDB.BdUtils.getTheme(theme.name);
|
||||
let instTheme = BDFDB.BDUtils.getTheme(theme.name);
|
||||
if (instTheme && instTheme.author.toUpperCase() == theme.author.toUpperCase()) theme.state = instTheme.version != theme.version ? 1 : 0;
|
||||
else theme.state = 2;
|
||||
let data = {
|
||||
|
@ -702,7 +702,7 @@ class ThemeRepo {
|
|||
vars = vars.split("}")[0];
|
||||
vars = vars.slice(2).split(/;--|\*\/--/);
|
||||
|
||||
var maxwidth = BDFDB.getRects(container).width - 80;
|
||||
var maxwidth = BDFDB.DOMUtils.getRects(container).width - 80;
|
||||
for (let varstr of vars) {
|
||||
varstr = varstr.split(":");
|
||||
let varname = varstr.shift().trim();
|
||||
|
@ -711,7 +711,7 @@ class ThemeRepo {
|
|||
if (varvalue) {
|
||||
let vardescription = varstr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim();
|
||||
vardescription = vardescription && vardescription.indexOf("*") == 0 ? vardescription.slice(1) : vardescription;
|
||||
let varcontainer = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} varcontainer" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild} BDFDB-textscrollwrapper" style="flex: 0 0 30%;"><div class="BDFDB-textscroll">${varname[0].toUpperCase() + varname.slice(1)}</div></h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${varname}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16} varinput"></div><button type="button" class="${BDFDB.disCN.colorpickerswatch} single-swatch" style="background-color: black;"></button><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}"></div><input type="file" accept="image/*" style="display:none!important;"></button></div>${vardescription ? `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.note + BDFDB.disCN.primary} BDFDB-textscrollwrapper" style="flex: 1 1 auto; max-width: ${maxwidth}px !important;"><div class="BDFDB-textscroll">${BDFDB.encodeToHTML(vardescription)}</div></div>` : ""}${vars[vars.length-1] == varstr ? '' : `<div class="${BDFDB.disCNS.divider + BDFDB.disCN.dividerdefault}"></div>`}</div>`);
|
||||
let varcontainer = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} varcontainer" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild} BDFDB-textscrollwrapper" style="flex: 0 0 30%;"><div class="BDFDB-textscroll">${varname[0].toUpperCase() + varname.slice(1)}</div></h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${varname}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16} varinput"></div><button type="button" class="${BDFDB.disCN.colorpickerswatch} single-swatch" style="background-color: black;"></button><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}"></div><input type="file" accept="image/*" style="display:none!important;"></button></div>${vardescription ? `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.note + BDFDB.disCN.primary} BDFDB-textscrollwrapper" style="flex: 1 1 auto; max-width: ${maxwidth}px !important;"><div class="BDFDB-textscroll">${BDFDB.StringUtils.htmlEscape(vardescription)}</div></div>` : ""}${vars[vars.length-1] == varstr ? '' : `<div class="${BDFDB.disCNS.divider + BDFDB.disCN.dividerdefault}"></div>`}</div>`);
|
||||
let varinput = varcontainer.querySelector(BDFDB.dotCN.input);
|
||||
varinput.value = varvalue;
|
||||
varinput.setAttribute("placeholder", varvalue);
|
||||
|
@ -727,10 +727,10 @@ class ThemeRepo {
|
|||
let color = iscomp ? BDFDB.ColorUtils.convert(varvalue.split(","), "RGB") : varvalue;
|
||||
swatch.style.setProperty("background-color", color, "important");
|
||||
swatch.addEventListener("click", e => {
|
||||
BDFDB.openColorPicker(varcontainer, e.currentTarget, color, {gradient:false, comp:iscomp, alpha:iscolor, callback:updatePreview});
|
||||
BDFDB.ColorUtils.openPicker(varcontainer, e.currentTarget, color, {gradient:false, comp:iscomp, alpha:iscolor, callback:updatePreview});
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(swatch);
|
||||
else BDFDB.DOMUtils.remove(swatch);
|
||||
if (isurlfile || isfile) {
|
||||
navigator.addEventListener("change", e => {
|
||||
let file = navigator.querySelector("input").files[0];
|
||||
|
@ -739,7 +739,7 @@ class ThemeRepo {
|
|||
updatePreview();
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(navigator);
|
||||
else BDFDB.DOMUtils.remove(navigator);
|
||||
|
||||
container.appendChild(varcontainer);
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ class ThemeRepo {
|
|||
let newvalue = input.value;
|
||||
if (newvalue && newvalue.trim() && newvalue != oldvalue) {
|
||||
let varname = input.getAttribute("option");
|
||||
css = css.replace(new RegExp(`--${BDFDB.regEscape(varname)}(\\s*):(\\s*)${BDFDB.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varname)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
}
|
||||
}
|
||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"NewTheme",checked:true,css},"*");
|
||||
|
@ -765,7 +765,7 @@ class ThemeRepo {
|
|||
|
||||
addEntry (frame, themeRepoModal, container, data) {
|
||||
if (!frame || !themeRepoModal || !container || !data) return;
|
||||
let entry = BDFDB.htmlToElement(this.themeEntryMarkup);
|
||||
let entry = BDFDB.DOMUtils.create(this.themeEntryMarkup);
|
||||
setEntryState(data.state);
|
||||
entry.setAttribute("data-name", data.name);
|
||||
entry.setAttribute("data-version", data.version);
|
||||
|
@ -774,9 +774,9 @@ class ThemeRepo {
|
|||
entry.querySelector(BDFDB.dotCN._repoversion).innerHTML = data.version;
|
||||
entry.querySelector(BDFDB.dotCN._repoauthor).innerHTML = data.author;
|
||||
entry.querySelector(BDFDB.dotCN._repodescription).innerHTML = data.description;
|
||||
if (data.new == 0) entry.querySelector(BDFDB.dotCN._repoheadertitle).appendChild(BDFDB.htmlToElement(`<span class="newentries-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(250, 166, 26) !important; color: white !important; padding: 1px 3px; font-size: 10px; top: -2px;">NEW</span>`));
|
||||
if (data.new == 0) entry.querySelector(BDFDB.dotCN._repoheadertitle).appendChild(BDFDB.DOMUtils.create(`<span class="newentries-tag ${BDFDB.disCNS.bottag + BDFDB.disCNS.bottagregular + BDFDB.disCN.bottagnametag}" style="background-color: rgb(250, 166, 26) !important; color: white !important; padding: 1px 3px; font-size: 10px; top: -2px;">NEW</span>`));
|
||||
let favbutton = entry.querySelector(BDFDB.dotCN.giffavoritebutton);
|
||||
BDFDB.toggleClass(favbutton, BDFDB.disCN.giffavoriteselected, data.fav == 0);
|
||||
BDFDB.DOMUtils.toggleClass(favbutton, BDFDB.disCN.giffavoriteselected, data.fav == 0);
|
||||
favbutton.addEventListener("click", e => {
|
||||
let favorize = data.fav == 1;
|
||||
data.fav = favorize ? 0 : 1;
|
||||
|
@ -802,10 +802,10 @@ class ThemeRepo {
|
|||
});
|
||||
let trashbutton = entry.querySelector(".trashIcon");
|
||||
trashbutton.addEventListener("click", e => {
|
||||
if (BDFDB.containsClass(entry, "outdated", "updated", false)) {
|
||||
if (BDFDB.DOMUtils.containsClass(entry, "outdated", "updated", false)) {
|
||||
setEntryState(2);
|
||||
this.deleteThemeFile(data);
|
||||
if (!BDFDB.BdUtils.isAutoLoadEnabled()) this.removeTheme(data);
|
||||
if (!BDFDB.BDUtils.isAutoLoadEnabled()) this.removeTheme(data);
|
||||
}
|
||||
});
|
||||
trashbutton.addEventListener("mouseenter", e => {
|
||||
|
@ -819,12 +819,12 @@ class ThemeRepo {
|
|||
entry.querySelector(".previewCheckbox").addEventListener("click", e => {
|
||||
themeRepoModal.querySelector(".generator-select " + BDFDB.dotCN.select).setAttribute('value', "-----");
|
||||
themeRepoModal.querySelector(".generator-select " + BDFDB.dotCN.title).innerHTML = `<strong>-----</strong> by -----`;
|
||||
BDFDB.removeEles(themeRepoModal.querySelectorAll(".varcontainer"));
|
||||
BDFDB.DOMUtils.remove(themeRepoModal.querySelectorAll(".varcontainer"));
|
||||
if (e.currentTarget.checked) themeRepoModal.querySelectorAll(".previewCheckbox").forEach(checkbox => {
|
||||
if (e.currentTarget != checkbox) {
|
||||
checkbox.checked = false;
|
||||
BDFDB.removeClass(checkbox.parentElement, BDFDB.disCN.switchvaluechecked);
|
||||
BDFDB.addClass(checkbox.parentElement, BDFDB.disCN.switchvalueunchecked);
|
||||
BDFDB.DOMUtils.removeClass(checkbox.parentElement, BDFDB.disCN.switchvaluechecked);
|
||||
BDFDB.DOMUtils.addClass(checkbox.parentElement, BDFDB.disCN.switchvalueunchecked);
|
||||
}
|
||||
});
|
||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"NewTheme",checked:e.currentTarget.checked,css:data.css},"*");
|
||||
|
@ -834,9 +834,9 @@ class ThemeRepo {
|
|||
|
||||
function setEntryState (state) {
|
||||
data.state = state;
|
||||
BDFDB.toggleClass(entry, "downloadable", state > 1);
|
||||
BDFDB.toggleClass(entry, "outdated", state == 1);
|
||||
BDFDB.toggleClass(entry, "updated", state < 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "downloadable", state > 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "outdated", state == 1);
|
||||
BDFDB.DOMUtils.toggleClass(entry, "updated", state < 1);
|
||||
let downloadbutton = entry.querySelector(".btn-download");
|
||||
downloadbutton.innerText = state < 1 ? "Updated" : (state > 1 ? "Download" : "Outdated");
|
||||
downloadbutton.style.setProperty("background-color", "rgb(" + (state < 1 ? "67,181,129" : (state > 1 ? "114,137,218" : "241,71,71")) + ")", state > 1 ? "" : "important");
|
||||
|
@ -875,12 +875,12 @@ class ThemeRepo {
|
|||
li.style.setProperty("order", pos, "important");
|
||||
}
|
||||
else li.style.removeProperty("order");
|
||||
BDFDB.toggleEles(li, pos > -1);
|
||||
BDFDB.DOMUtils.toggle(li, pos > -1);
|
||||
}
|
||||
}
|
||||
|
||||
loadThemes () {
|
||||
BDFDB.removeEles(".themerepo-loadingicon");
|
||||
BDFDB.DOMUtils.remove(".themerepo-loadingicon");
|
||||
let settings = BDFDB.DataUtils.load(this, "settings");
|
||||
var getThemeInfo, outdated = 0, newentries = 0, i = 0, NFLDreplace = null;
|
||||
var tags = ["name","description","author","version"];
|
||||
|
@ -908,11 +908,11 @@ class ThemeRepo {
|
|||
},1200000), amount:this.loading.amount+1};
|
||||
var loadingiconwrapper = document.querySelector(BDFDB.dotCN.app + "> .repo-loadingwrapper");
|
||||
if (!loadingiconwrapper) {
|
||||
loadingiconwrapper = BDFDB.htmlToElement(`<div class="repo-loadingwrapper"></div>`);
|
||||
loadingiconwrapper = BDFDB.DOMUtils.create(`<div class="repo-loadingwrapper"></div>`);
|
||||
document.querySelector(BDFDB.dotCN.app).appendChild(loadingiconwrapper);
|
||||
}
|
||||
var loadingicon = BDFDB.htmlToElement(this.themeRepoIconMarkup);
|
||||
BDFDB.addClass(loadingicon, "themerepo-loadingicon");
|
||||
var loadingicon = BDFDB.DOMUtils.create(this.themeRepoIconMarkup);
|
||||
BDFDB.DOMUtils.addClass(loadingicon, "themerepo-loadingicon");
|
||||
loadingicon.addEventListener("mouseenter", () => {
|
||||
BDFDB.TooltipUtils.create(loadingicon, this.getLoadingTooltipText(), {type:"left", delay:500, style:"max-width:unset;", selector:"themerepo-loading-tooltip"});
|
||||
});
|
||||
|
@ -923,8 +923,8 @@ class ThemeRepo {
|
|||
clearTimeout(this.loading.timeout);
|
||||
return;
|
||||
}
|
||||
BDFDB.removeEles(loadingicon, ".themerepo-loadingicon");
|
||||
if (!loadingiconwrapper.firstChild) BDFDB.removeEles(loadingiconwrapper);
|
||||
BDFDB.DOMUtils.remove(loadingicon, ".themerepo-loadingicon");
|
||||
if (!loadingiconwrapper.firstChild) BDFDB.DOMUtils.remove(loadingiconwrapper);
|
||||
clearTimeout(this.loading.timeout);
|
||||
this.loading = {is:false, timeout:null, amount:this.loading.amount};
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Finished fetching Themes.");
|
||||
|
@ -1009,7 +1009,7 @@ class ThemeRepo {
|
|||
theme.url = url;
|
||||
theme.requesturl = requesturl;
|
||||
this.loadedThemes[url] = theme;
|
||||
var instTheme = BDFDB.BdUtils.getTheme(theme.name);
|
||||
var instTheme = BDFDB.BDUtils.getTheme(theme.name);
|
||||
if (instTheme && instTheme.author.toUpperCase() == theme.author.toUpperCase() && instTheme.version != theme.version) outdated++;
|
||||
if (!this.cachedThemes.includes(url)) newentries++;
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ class ThemeRepo {
|
|||
i++;
|
||||
var loadingtooltip = document.querySelector(".themerepo-loading-tooltip");
|
||||
if (loadingtooltip) {
|
||||
BDFDB.setInnerText(loadingtooltip, this.getLoadingTooltipText());
|
||||
BDFDB.DOMUtils.setText(loadingtooltip, this.getLoadingTooltipText());
|
||||
BDFDB.TooltipUtils.update(loadingtooltip);
|
||||
}
|
||||
getThemeInfo(callback);
|
||||
|
@ -1047,16 +1047,16 @@ class ThemeRepo {
|
|||
}
|
||||
|
||||
createThemeFile (filename, content) {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BdUtils.getThemesFolder(), filename), content, (error) => {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.NotificationUtils.toast(`Unable to save Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.NotificationUtils.toast(`Successfully saved Theme "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
applyTheme (data) {
|
||||
if (BDFDB.BdUtils.isThemeEnabled(data.name) == false) {
|
||||
BDFDB.removeEles(`style#${data.name}`);
|
||||
document.head.appendChild(BDFDB.htmlToElement(`<style id=${data.name}>${data.css}</style>`));
|
||||
if (BDFDB.BDUtils.isThemeEnabled(data.name) == false) {
|
||||
BDFDB.DOMUtils.remove(`style#${data.name}`);
|
||||
document.head.appendChild(BDFDB.DOMUtils.create(`<style id=${data.name}>${data.css}</style>`));
|
||||
window.themeModule.enableTheme(data.name);
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Applied Theme " + data.name + ".");
|
||||
}
|
||||
|
@ -1064,15 +1064,15 @@ class ThemeRepo {
|
|||
|
||||
deleteThemeFile (data) {
|
||||
let filename = data.requesturl.split("/").pop();
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BdUtils.getThemesFolder(), filename), (error) => {
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), filename), (error) => {
|
||||
if (error) BDFDB.NotificationUtils.toast(`Unable to delete Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.NotificationUtils.toast(`Successfully deleted Theme "${filename}".`);
|
||||
});
|
||||
}
|
||||
|
||||
removeTheme (data) {
|
||||
if (BDFDB.BdUtils.isThemeEnabled(data.name) == true) {
|
||||
BDFDB.removeEles(`style#${data.name}`);
|
||||
if (BDFDB.BDUtils.isThemeEnabled(data.name) == true) {
|
||||
BDFDB.DOMUtils.remove(`style#${data.name}`);
|
||||
window.themeModule.disableTheme(data.name);
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Removed Theme " + data.name + ".");
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class ThemeSettings {
|
|||
if (this.started) return;
|
||||
BDFDB.PluginUtils.init(this);
|
||||
|
||||
this.dir = BDFDB.BdUtils.getThemesFolder();
|
||||
this.dir = BDFDB.BDUtils.getThemesFolder();
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class ThemeSettings {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".themes-settings-button",".themes-settings-footer");
|
||||
BDFDB.DOMUtils.remove(".themes-settings-button",".themes-settings-footer");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -79,18 +79,18 @@ class ThemeSettings {
|
|||
button.innerText = "Settings";
|
||||
footer.appendChild(button);
|
||||
button.addEventListener("click", () => {
|
||||
BDFDB.addClass(wrapper, BDFDB.disCN._reposettingsopen);
|
||||
BDFDB.removeClass(wrapper, BDFDB.disCN._reposettingsclosed);
|
||||
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsopen);
|
||||
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsclosed);
|
||||
let children = [];
|
||||
while (wrapper.childElementCount) {
|
||||
children.push(wrapper.firstChild);
|
||||
wrapper.firstChild.remove();
|
||||
}
|
||||
let closebutton = BDFDB.htmlToElement(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" 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"></path></g></svg></div>`);
|
||||
let closebutton = BDFDB.DOMUtils.create(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" 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"></path></g></svg></div>`);
|
||||
wrapper.appendChild(closebutton);
|
||||
closebutton.addEventListener("click", () => {
|
||||
BDFDB.removeClass(wrapper, BDFDB.disCN._reposettingsopen);
|
||||
BDFDB.addClass(wrapper, BDFDB.disCN._reposettingsclosed);
|
||||
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsopen);
|
||||
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsclosed);
|
||||
while (wrapper.childElementCount) wrapper.firstChild.remove();
|
||||
while (children.length) wrapper.appendChild(children.shift());
|
||||
})
|
||||
|
@ -115,12 +115,12 @@ class ThemeSettings {
|
|||
|
||||
createThemeSettings (wrapper, theme, vars) {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
var settingshtml = `<div class="theme-settings" id="theme-settings-${theme.name}"><div class="${theme.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${BDFDB.encodeToHTML(theme.name)}</div><div class="BDFDB-settings-inner"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Update all variables</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorgreen + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} update-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Update</div></button></div></div></div>`;
|
||||
var settingshtml = `<div class="theme-settings" id="theme-settings-${theme.name}"><div class="${theme.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${BDFDB.StringUtils.htmlEscape(theme.name)}</div><div class="BDFDB-settings-inner"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Update all variables</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorgreen + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} update-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Update</div></button></div></div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
var settingspanelinner = settingspanel.querySelector(".BDFDB-settings-inner");
|
||||
|
||||
var maxwidth = BDFDB.getRects(wrapper).width - 80;
|
||||
var maxwidth = BDFDB.DOMUtils.getRects(wrapper).width - 80;
|
||||
|
||||
for (let varstr of vars) {
|
||||
varstr = varstr.split(":");
|
||||
|
@ -130,7 +130,7 @@ class ThemeSettings {
|
|||
if (varvalue) {
|
||||
let vardescription = varstr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim();
|
||||
vardescription = vardescription && vardescription.indexOf("*") == 0 ? vardescription.slice(1) : vardescription;
|
||||
let varcontainer = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} varcontainer" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild} BDFDB-textscrollwrapper" style="flex: 0 0 30%;"><div class="BDFDB-textscroll">${varname[0].toUpperCase() + varname.slice(1)}</div></h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${varname}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16} varinput"></div><button type="button" class="${BDFDB.disCN.colorpickerswatch} single-swatch" style="background-color: black;"></button><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}"></div><input type="file" accept="image/*" style="display:none!important;"></button></div>${vardescription ? `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.note + BDFDB.disCN.primary} BDFDB-textscrollwrapper" style="flex: 1 1 auto; max-width: ${maxwidth}px !important;"><div class="BDFDB-textscroll">${BDFDB.encodeToHTML(vardescription)}</div></div>` : ""}${vars[vars.length-1] == varstr ? '' : `<div class="${BDFDB.disCNS.divider + BDFDB.disCN.dividerdefault}"></div>`}</div>`);
|
||||
let varcontainer = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directioncolumn + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20} varcontainer" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild} BDFDB-textscrollwrapper" style="flex: 0 0 30%;"><div class="BDFDB-textscroll">${varname[0].toUpperCase() + varname.slice(1)}</div></h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${varname}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16} varinput"></div><button type="button" class="${BDFDB.disCN.colorpickerswatch} single-swatch" style="background-color: black;"></button><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}"></div><input type="file" accept="image/*" style="display:none!important;"></button></div>${vardescription ? `<div class="${BDFDB.disCNS.description + BDFDB.disCNS.note + BDFDB.disCN.primary} BDFDB-textscrollwrapper" style="flex: 1 1 auto; max-width: ${maxwidth}px !important;"><div class="BDFDB-textscroll">${BDFDB.StringUtils.htmlEscape(vardescription)}</div></div>` : ""}${vars[vars.length-1] == varstr ? '' : `<div class="${BDFDB.disCNS.divider + BDFDB.disCN.dividerdefault}"></div>`}</div>`);
|
||||
let varinput = varcontainer.querySelector(BDFDB.dotCN.input);
|
||||
varinput.value = varvalue;
|
||||
varinput.setAttribute("placeholder", varvalue);
|
||||
|
@ -146,10 +146,10 @@ class ThemeSettings {
|
|||
let color = iscomp ? BDFDB.ColorUtils.convert(varvalue.split(","), "RGB") : varvalue;
|
||||
swatch.style.setProperty("background-color", color, "important");
|
||||
swatch.addEventListener("click", e => {
|
||||
BDFDB.openColorPicker(varcontainer, e.currentTarget, color, {gradient:false, comp:iscomp, alpha:iscolor});
|
||||
BDFDB.ColorUtils.openPicker(varcontainer, e.currentTarget, color, {gradient:false, comp:iscomp, alpha:iscolor});
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(swatch);
|
||||
else BDFDB.DOMUtils.remove(swatch);
|
||||
if (isurlfile || isfile) {
|
||||
navigator.addEventListener("change", e => {
|
||||
let file = navigator.querySelector("input").files[0];
|
||||
|
@ -157,7 +157,7 @@ class ThemeSettings {
|
|||
else varinput.value = varvalue;
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(navigator);
|
||||
else BDFDB.DOMUtils.remove(navigator);
|
||||
|
||||
settingspanelinner.appendChild(varcontainer);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class ThemeSettings {
|
|||
let newvalue = input.value;
|
||||
if (newvalue && newvalue.trim() && newvalue != oldvalue) {
|
||||
let varname = input.getAttribute("option");
|
||||
css = css.replace(new RegExp(`--${BDFDB.regEscape(varname)}(\\s*):(\\s*)${BDFDB.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varname)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class TimedLightDarkMode {
|
|||
|
||||
clearInterval(this.checkInterval);
|
||||
|
||||
BDFDB.removeEles(".TLDM-settingsbox");
|
||||
BDFDB.DOMUtils.remove(".TLDM-settingsbox");
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class TimedLightDarkMode {
|
|||
if (instance.props && Array.isArray(instance.props.options) && instance.props.options[0] && instance.props.options[0].value == "light" && instance.props.options[1] && instance.props.options[1].value == "dark" && wrapper.parentElement.firstElementChild.innerText && wrapper.parentElement.firstElementChild.innerText.toUpperCase() == BDFDB.LanguageUtils.LanguageStrings.THEME.toUpperCase()) {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var values = BDFDB.DataUtils.get(this, "values");
|
||||
var settingsbox = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.margintop8} TLDM-settingsbox"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCN.h5}">${BDFDB.LanguageUtils.LanguageStrings.THEME} Timer</h5><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 running" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings.running ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.slider + BDFDB.disCN.margintop20}${!settings.running ? (" " + BDFDB.disCN.sliderdisabled): ""}"><input type="number" key="timer1" class="${BDFDB.disCN.sliderinput}" value="${values.timer1}" readonly=""><input type="number" key="timer2" class="${BDFDB.disCN.sliderinput}" value="${values.timer2}" readonly=""><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidermark}" style="left: 0%;"><div class="${BDFDB.disCN.slidermarkvalue}">00:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 12.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">03:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 25%;"><div class="${BDFDB.disCN.slidermarkvalue}">06:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 37.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">09:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 50%;"><div class="${BDFDB.disCN.slidermarkvalue}">12:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 62.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">15:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 75%;"><div class="${BDFDB.disCN.slidermarkvalue}">18:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 87.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">21:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 100%;"><div class="${BDFDB.disCN.slidermarkvalue}">24:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div></div><div class="${BDFDB.disCN.sliderbar}"><div class="${BDFDB.disCN.sliderbarfill}"></div></div><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer1" style="left: ${values.timer1}%;"></div><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer2" style="left: ${values.timer2}%;"></div><div class="${BDFDB.disCN.slidergrabber} date-grabber" key="current" style="left: ${this.getPercent(new Date())}%; cursor: help !important; height: 12px; margin-top: -7px;"></div></div></div></div>`);
|
||||
var settingsbox = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN.margintop8} TLDM-settingsbox"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCN.nowrap}" style="flex: 1 1 auto;"><h5 class="${BDFDB.disCN.h5}">${BDFDB.LanguageUtils.LanguageStrings.THEME} Timer</h5><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 running" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings.running ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.slider + BDFDB.disCN.margintop20}${!settings.running ? (" " + BDFDB.disCN.sliderdisabled): ""}"><input type="number" key="timer1" class="${BDFDB.disCN.sliderinput}" value="${values.timer1}" readonly=""><input type="number" key="timer2" class="${BDFDB.disCN.sliderinput}" value="${values.timer2}" readonly=""><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidermark}" style="left: 0%;"><div class="${BDFDB.disCN.slidermarkvalue}">00:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 12.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">03:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 25%;"><div class="${BDFDB.disCN.slidermarkvalue}">06:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 37.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">09:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 50%;"><div class="${BDFDB.disCN.slidermarkvalue}">12:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 62.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">15:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 75%;"><div class="${BDFDB.disCN.slidermarkvalue}">18:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 87.5%;"><div class="${BDFDB.disCN.slidermarkvalue}">21:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div><div class="${BDFDB.disCN.slidermark}" style="left: 100%;"><div class="${BDFDB.disCN.slidermarkvalue}">24:00</div><div class="${BDFDB.disCN.slidermarkdash}"></div></div></div><div class="${BDFDB.disCN.sliderbar}"><div class="${BDFDB.disCN.sliderbarfill}"></div></div><div class="${BDFDB.disCN.slidertrack}"><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer1" style="left: ${values.timer1}%;"></div><div class="${BDFDB.disCN.slidergrabber} timer-grabber" key="timer2" style="left: ${values.timer2}%;"></div><div class="${BDFDB.disCN.slidergrabber} date-grabber" key="current" style="left: ${this.getPercent(new Date())}%; cursor: help !important; height: 12px; margin-top: -7px;"></div></div></div></div>`);
|
||||
wrapper.parentElement.appendChild(settingsbox);
|
||||
var slider = settingsbox.querySelector(BDFDB.dotCN.slider);
|
||||
|
||||
|
@ -93,7 +93,7 @@ class TimedLightDarkMode {
|
|||
BDFDB.ListenerUtils.addToChildren(settingsbox, "mouseenter", BDFDB.dotCN.slidergrabber + ".date-grabber", e => {this.showCurrentTime(e.currentTarget);});
|
||||
BDFDB.ListenerUtils.addToChildren(settingsbox, "click", ".settings-switch", e => {
|
||||
this.startInterval();
|
||||
BDFDB.toggleClass(slider, BDFDB.disCN.sliderdisabled, !e.currentTarget.checked);
|
||||
BDFDB.DOMUtils.toggleClass(slider, BDFDB.disCN.sliderdisabled, !e.currentTarget.checked);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -131,11 +131,11 @@ class TimedLightDarkMode {
|
|||
var currenttime = new Date();
|
||||
var currenthours = currenttime.getHours();
|
||||
var currentminutes = currenttime.getMinutes();
|
||||
var bubble = BDFDB.htmlToElement(`<span class="${BDFDB.disCN.sliderbubble}">${(currenthours > 9 ? currenthours : ("0" + currenthours)) + ":" + (currentminutes > 9 ? currentminutes : ("0" + currentminutes))}</span>`);
|
||||
var bubble = BDFDB.DOMUtils.create(`<span class="${BDFDB.disCN.sliderbubble}">${(currenthours > 9 ? currenthours : ("0" + currenthours)) + ":" + (currentminutes > 9 ? currentminutes : ("0" + currentminutes))}</span>`);
|
||||
grabber.appendChild(bubble);
|
||||
grabber.style.setProperty("left", `${this.getPercent(currenttime)}%`);
|
||||
var mouseleave = () => {
|
||||
BDFDB.removeEles(bubble);
|
||||
BDFDB.DOMUtils.remove(bubble);
|
||||
grabber.removeEventListener("mouseleave", mouseleave);
|
||||
};
|
||||
grabber.addEventListener("mouseleave", mouseleave);
|
||||
|
@ -143,32 +143,32 @@ class TimedLightDarkMode {
|
|||
|
||||
dragSlider (grabber) {
|
||||
var track = grabber.parentNode;
|
||||
if (BDFDB.containsClass(track.parentNode, BDFDB.disCN.sliderdisabled)) return;
|
||||
if (BDFDB.DOMUtils.containsClass(track.parentNode, BDFDB.disCN.sliderdisabled)) return;
|
||||
var type = grabber.getAttribute("key");
|
||||
var input = track.parentNode.querySelector(`${BDFDB.dotCN.sliderinput}[key="${type}"]`);
|
||||
var values = BDFDB.DataUtils.get(this, "values");
|
||||
|
||||
BDFDB.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
|
||||
BDFDB.DOMUtils.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
|
||||
|
||||
var value = values[type];
|
||||
var othervalue = type == "timer1" ? values.timer2 : values.timer1;
|
||||
var sY = 0;
|
||||
var sHalfW = BDFDB.getRects(grabber).width/2;
|
||||
var sMinX = BDFDB.getRects(track).left;
|
||||
var sMaxX = sMinX + BDFDB.getRects(track).width;
|
||||
var bubble = BDFDB.htmlToElement(`<span class="${BDFDB.disCN.sliderbubble}">${this.getTime(value, true)}</span>`);
|
||||
var sHalfW = BDFDB.DOMUtils.getRects(grabber).width/2;
|
||||
var sMinX = BDFDB.DOMUtils.getRects(track).left;
|
||||
var sMaxX = sMinX + BDFDB.DOMUtils.getRects(track).width;
|
||||
var bubble = BDFDB.DOMUtils.create(`<span class="${BDFDB.disCN.sliderbubble}">${this.getTime(value, true)}</span>`);
|
||||
grabber.appendChild(bubble);
|
||||
var mouseup = () => {
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
document.removeEventListener("mousemove", mousemove);
|
||||
BDFDB.removeEles(bubble);
|
||||
BDFDB.removeLocalStyle("disableTextSelection");
|
||||
BDFDB.DOMUtils.remove(bubble);
|
||||
BDFDB.DOMUtils.removeLocalStyle("disableTextSelection");
|
||||
BDFDB.DataUtils.save(value, this, "values", type);
|
||||
this.startInterval();
|
||||
};
|
||||
var mousemove = e => {
|
||||
sY = e.clientX > sMaxX ? sMaxX - sHalfW : (e.clientX < sMinX ? sMinX - sHalfW : e.clientX - sHalfW);
|
||||
value = BDFDB.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
|
||||
value = BDFDB.NumberUtils.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
|
||||
input.value = value;
|
||||
grabber.style.setProperty("left", value + "%");
|
||||
bubble.innerText = this.getTime(value, true);
|
||||
|
@ -190,7 +190,7 @@ class TimedLightDarkMode {
|
|||
}
|
||||
|
||||
getTime (percent, stringify) {
|
||||
var time = BDFDB.mapRange([0, 100], [0, 1440], percent)/60;
|
||||
var time = BDFDB.NumberUtils.mapRange([0, 100], [0, 1440], percent)/60;
|
||||
var hours = Math.floor(time);
|
||||
var minutes = Math.floor((time - hours) * 60);
|
||||
return stringify ? (hours > 9 ? hours : ("0" + hours)) + ":" + (minutes > 9 ? minutes : ("0" + minutes)) : [hours,minutes];
|
||||
|
@ -200,7 +200,7 @@ class TimedLightDarkMode {
|
|||
if (!time) return 0;
|
||||
var hours = Array.isArray(time) ? time[0] : (typeof time == "object" && typeof time.getHours == "function" ? time.getHours() : 0);
|
||||
var minutes = Array.isArray(time) ? time[1] : (typeof time == "object" && typeof time.getMinutes == "function" ? time.getMinutes() : 0);
|
||||
return BDFDB.mapRange([0, 1440], [0, 100], (hours * 60) + minutes);
|
||||
return BDFDB.NumberUtils.mapRange([0, 1440], [0, 100], (hours * 60) + minutes);
|
||||
}
|
||||
|
||||
getHighTime (timer) {
|
||||
|
|
|
@ -58,7 +58,7 @@ class TopRoleEverywhere {
|
|||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -100,7 +100,7 @@ class TopRoleEverywhere {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.removeEles(".TRE-tag");
|
||||
BDFDB.DOMUtils.remove(".TRE-tag");
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ class TopRoleEverywhere {
|
|||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
if (username && BDFDB.DataUtils.get(this, "settings", "showInChat")) {
|
||||
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addRoleTag(message.author, username, "chat", BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
|
||||
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addRoleTag(message.author, username, "chat", BDFDB.DOMUtils.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,14 +128,14 @@ class TopRoleEverywhere {
|
|||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".TRE-tag");
|
||||
BDFDB.DOMUtils.remove(".TRE-tag");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
}
|
||||
|
||||
addRoleTag (info, username, type, selector) {
|
||||
if (!info || !username) return;
|
||||
BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
|
||||
BDFDB.DOMUtils.remove(username.parentElement.querySelectorAll(".TRE-tag"));
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (!guild || info.bot && settings.disableForBots) return;
|
||||
|
@ -144,8 +144,8 @@ class TopRoleEverywhere {
|
|||
let roleColor = role && role.colorString ? BDFDB.ColorUtils.convert(role.colorString, "RGBCOMP") : [255,255,255];
|
||||
let roleName = role ? role.name : "";
|
||||
let oldwidth;
|
||||
if (type == "list") oldwidth = BDFDB.getRects(username).width;
|
||||
let tag = BDFDB.htmlToElement(`<span class="TRE-tag ${BDFDB.disCN.bottagregular + (selector ? (" " + selector) : "")}"><span class="role-inner"></span></span>`);
|
||||
if (type == "list") oldwidth = BDFDB.DOMUtils.getRects(username).width;
|
||||
let tag = BDFDB.DOMUtils.create(`<span class="TRE-tag ${BDFDB.disCN.bottagregular + (selector ? (" " + selector) : "")}"><span class="role-inner"></span></span>`);
|
||||
username.parentElement.insertBefore(tag, username.parentElement.querySelector("svg[name=MobileDevice]"));
|
||||
|
||||
let borderColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.5)";
|
||||
|
@ -171,7 +171,7 @@ class TopRoleEverywhere {
|
|||
}
|
||||
}
|
||||
else if (settings.showOwnerRole && info.id == guild.ownerId) roleText = "Owner";
|
||||
BDFDB.addClass(tag, type + "-tag");
|
||||
BDFDB.DOMUtils.addClass(tag, type + "-tag");
|
||||
if (!settings.useOtherStyle) tag.style.setProperty("border", "1px solid " + borderColor, "important");
|
||||
tag.style.setProperty("background", bgColor, "important");
|
||||
tag.style.setProperty("order", 11, "important");
|
||||
|
@ -181,12 +181,12 @@ class TopRoleEverywhere {
|
|||
inner.style.setProperty("-webkit-background-clip", "text", "important");
|
||||
inner.textContent = roleText;
|
||||
|
||||
if (oldwidth && oldwidth < 100 && BDFDB.getRects(username).width < 100) {
|
||||
tag.style.setProperty("max-width", (BDFDB.getRects(BDFDB.getParentEle(BDFDB.dotCN.namecontainerlayout, username)).width - oldwidth - 15) + "px");
|
||||
if (oldwidth && oldwidth < 100 && BDFDB.DOMUtils.getRects(username).width < 100) {
|
||||
tag.style.setProperty("max-width", (BDFDB.DOMUtils.getRects(BDFDB.DOMUtils.getParent(BDFDB.dotCN.namecontainerlayout, username)).width - oldwidth - 15) + "px");
|
||||
}
|
||||
}
|
||||
if (type == "chat" && settings.addUserID) {
|
||||
let idtag = BDFDB.htmlToElement(this.tagMarkup);
|
||||
let idtag = BDFDB.DOMUtils.create(this.tagMarkup);
|
||||
username.parentElement.insertBefore(idtag, username.parentElement.querySelector("svg[name=MobileDevice]"));
|
||||
let idColor = settings.darkIdTag ? [33,33,33] : [222,222,222];
|
||||
let idBorderColor = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.5)";
|
||||
|
@ -198,7 +198,7 @@ class TopRoleEverywhere {
|
|||
idBgColor = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
|
||||
idTextColor = settings.darkIdTag ? "white" : "black";
|
||||
}
|
||||
BDFDB.addClass(idtag, "id-tag");
|
||||
BDFDB.DOMUtils.addClass(idtag, "id-tag");
|
||||
idtag.style.setProperty("border", "1px solid " + idBorderColor, "important");
|
||||
idtag.style.setProperty("background", idBgColor, "important");
|
||||
idtag.style.setProperty("order", 12, "important");
|
||||
|
|
|
@ -70,7 +70,7 @@ class UserNotes {
|
|||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Remove all User Notes.</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorred + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} remove-button" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Remove</div></button></div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
|
@ -147,7 +147,7 @@ class UserNotes {
|
|||
openNotesModal (info) {
|
||||
let note = BDFDB.DataUtils.load(this, "notes", info.id) || "";
|
||||
|
||||
let userNotesModal = BDFDB.htmlToElement(this.userNotesModalMarkup);
|
||||
let userNotesModal = BDFDB.DOMUtils.create(this.userNotesModalMarkup);
|
||||
let noteinput = userNotesModal.querySelector("#modal-inputtext");
|
||||
userNotesModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.username || "";
|
||||
noteinput.value = note;
|
||||
|
|
Loading…
Reference in New Issue