all fixes
This commit is contained in:
parent
a9596fae0e
commit
dd8a854c67
File diff suppressed because one or more lines are too long
|
@ -1370,6 +1370,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
ChannelMember: 'member',
|
||||
EmojiPicker: 'emojipicker',
|
||||
FriendRow: 'friendsrow',
|
||||
Guild: 'guildouter',
|
||||
InstantInviteModal: 'invitemodalwrapper',
|
||||
InvitationCard: 'invitemodalinviterow',
|
||||
InviteCard: 'guildsettingsinvitecard',
|
||||
|
@ -2770,7 +2771,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
|
||||
BDFDB.initElements = function (container, plugin) {
|
||||
if (!Node.prototype.isPrototypeOf(container)) return;
|
||||
if (BDFDB.containsClass(container, 'DevilBro-settings')) BDFDB.addClass(container, 'BDFDB-settings');
|
||||
var islighttheme = BDFDB.getDiscordTheme() == BDFDB.disCN.themelight;
|
||||
var languagestrings = BDFDB.getLibraryStrings();
|
||||
container.querySelectorAll(".BDFDB-containertext").forEach(ele => {
|
||||
|
@ -3107,7 +3107,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
|
||||
BDFDB.appendModal = function (modalwrapper) {
|
||||
if (!Node.prototype.isPrototypeOf(modalwrapper)) return;
|
||||
if (BDFDB.containsClass(modalwrapper, 'DevilBro-modal')) BDFDB.addClass(modalwrapper, 'BDFDB-modal');
|
||||
if (!BDFDB.appendModal.modals || !document.contains(BDFDB.appendModal.modals)) BDFDB.appendModal.modals = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:document.querySelector(BDFDB.dotCN.app), name:"Modals", depth:99999999, time:99999999}));
|
||||
if (!BDFDB.appendModal.modals) return;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class BadgesEverywhere {
|
||||
getName () {return "BadgesEverywhere";}
|
||||
|
||||
getVersion () {return "1.4.3";}
|
||||
getVersion () {return "1.4.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class BadgesEverywhere {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["DM Groups","Now works properly in DM Groups"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -110,16 +110,15 @@ class BadgesEverywhere {
|
|||
}
|
||||
};
|
||||
|
||||
var UserFlags = BDFDB.WebModules.findByProperties("UserFlags").UserFlags;
|
||||
for (let flagname in UserFlags) if (this.defaults.badges[flagname]) {
|
||||
for (let flagname in BDFDB.DiscordConstants.UserFlags) if (this.defaults.badges[flagname]) {
|
||||
if (BDFDB.LanguageStringsCheck[this.defaults.badges[flagname].name]) this.defaults.badges[flagname].name = BDFDB.LanguageStrings[this.defaults.badges[flagname].name];
|
||||
this.defaults.badges[UserFlags[flagname]] = this.defaults.badges[flagname];
|
||||
this.defaults.badges[BDFDB.DiscordConstants.UserFlags[flagname]] = this.defaults.badges[flagname];
|
||||
delete this.defaults.badges[flagname];
|
||||
}
|
||||
this.nitroflag = Math.pow(2, Object.keys(UserFlags).length);
|
||||
this.nitroflag = Math.pow(2, Object.keys(BDFDB.DiscordConstants.UserFlags).length);
|
||||
this.defaults.badges[this.nitroflag] = this.defaults.badges.NITRO;
|
||||
delete this.defaults.badges.NITRO;
|
||||
this.boostflag = Math.pow(2, Object.keys(UserFlags).length + 1);
|
||||
this.boostflag = Math.pow(2, Object.keys(BDFDB.DiscordConstants.UserFlags).length + 1);
|
||||
this.defaults.badges[this.boostflag] = this.defaults.badges.GUILD_BOOST;
|
||||
delete this.defaults.badges.GUILD_BOOST;
|
||||
for (let flag in this.defaults.badges) if (!this.defaults.badges[flag].selector || isNaN(parseInt(flag))) delete this.defaults.badges[flag];
|
||||
|
@ -177,7 +176,7 @@ class BadgesEverywhere {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -199,12 +198,7 @@ class BadgesEverywhere {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers", "getMember");
|
||||
this.GuildBoostUtils = BDFDB.WebModules.findByProperties("getTierName", "getUserLevel");
|
||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.APIModule = BDFDB.WebModules.findByProperties("getAPIBaseURL");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
this.BadgeClasses = BDFDB.WebModules.findByProperties("profileBadgeStaff","profileBadgePremium");
|
||||
this.BadgeClasses = BDFDB.WebModules.findByProperties("profileBadgeStaff", "profileBadgePremium");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
|
@ -223,11 +217,11 @@ class BadgesEverywhere {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processMemberListItem (instance, wrapper) {
|
||||
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.nametag), "list");
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.namecontainername), "list");
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper) {
|
||||
processMessageUsername (instance, wrapper, returnvalue) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
|
@ -235,11 +229,11 @@ class BadgesEverywhere {
|
|||
}
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("showInPopout", this, "settings")) this.addBadges(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), "popout");
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -250,7 +244,7 @@ class BadgesEverywhere {
|
|||
if (!info || info.bot || !wrapper) return;
|
||||
if (!this.requestedusers[info.id]) {
|
||||
this.requestedusers[info.id] = [[wrapper,type]];
|
||||
this.APIModule.get(this.DiscordConstants.Endpoints.USER_PROFILE(info.id)).then(result => {
|
||||
BDFDB.LibraryModules.APIUtils.get(BDFDB.DiscordConstants.Endpoints.USER_PROFILE(info.id)).then(result => {
|
||||
let usercopy = Object.assign({},result.body.user);
|
||||
if (result.body.premium_since) usercopy.flags += this.nitroflag;
|
||||
usercopy.premium_since = result.body.premium_since;
|
||||
|
@ -277,7 +271,7 @@ class BadgesEverywhere {
|
|||
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>`);
|
||||
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(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].id} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector + (flag == this.boostflag ? this.GuildBoostUtils.getUserLevel(this.loadedusers[info.id].premium_guild_since) : "")]} BE-size-${this.defaults.badges[flag].size}"></div>`);
|
||||
let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].id} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector + (flag == this.boostflag ? BDFDB.LibraryModules.GuildBoostUtils.getUserLevel(this.loadedusers[info.id].premium_guild_since) : "")]} BE-size-${this.defaults.badges[flag].size}"></div>`);
|
||||
badgewrapper.appendChild(badge);
|
||||
badge.addEventListener("mouseenter", () => {
|
||||
let text = this.defaults.badges[flag].name;
|
||||
|
@ -287,7 +281,7 @@ class BadgesEverywhere {
|
|||
});
|
||||
}
|
||||
}
|
||||
let member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id);
|
||||
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.defaults.indicators.CURRENT_GUILD_BOOST.markup);
|
||||
BDFDB.addClass(badge, `BE-badge-${type}`);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class BetterFriendCount {
|
||||
getName () {return "BetterFriendCount";}
|
||||
|
||||
getVersion () {return "1.1.6";}
|
||||
getVersion () {return "1.1.7";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class BetterFriendCount {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["New Structure","Fixed issues that will occur once the avatar/name changes from canary will hit stable/ptb"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -31,6 +31,7 @@ class BetterFriendCount {
|
|||
`;
|
||||
|
||||
this.relationshipTypes = {};
|
||||
for (let type in BDFDB.DiscordConstants.RelationshipTypes) this.relationshipTypes[BDFDB.DiscordConstants.RelationshipTypes[type]] = type;
|
||||
}
|
||||
|
||||
//legacy
|
||||
|
@ -51,7 +52,7 @@ class BetterFriendCount {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -73,11 +74,6 @@ class BetterFriendCount {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.FriendUtils = BDFDB.WebModules.findByProperties("getFriendIDs", "getRelationships");
|
||||
this.UserMetaStore = BDFDB.WebModules.findByProperties("getStatus", "getOnlineFriendCount");
|
||||
let RelationshipTypes = BDFDB.WebModules.findByProperties("RelationshipTypes").RelationshipTypes;
|
||||
for (let type in RelationshipTypes) this.relationshipTypes[RelationshipTypes[type]] = type;
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -95,21 +91,21 @@ class BetterFriendCount {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processTabBar (instance, wrapper) {
|
||||
processTabBar (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.children) for (let child of instance.props.children) if ((child.key || (child.props && child.props.id)) == "ADD_FRIEND") this.addCountNumbers(wrapper);
|
||||
}
|
||||
|
||||
processFriendRow (instance, wrapper) {
|
||||
processFriendRow (instance, wrapper, returnvalue) {
|
||||
this.addCountNumbers();
|
||||
}
|
||||
|
||||
addCountNumbers (wrapper = document.querySelector(BDFDB.dotCNS.friends + BDFDB.dotCN.settingstabbar)) {
|
||||
if (!wrapper) return;
|
||||
let tabitems = wrapper.querySelectorAll(BDFDB.dotCN.settingsitem + BDFDB.notCN.settingstabbarprimary);
|
||||
let tabitems = wrapper.querySelectorAll(BDFDB.dotCN.settingsitem + BDFDB.dotCN.settingsitemthemed);
|
||||
if (!tabitems || tabitems.length < 4) return;
|
||||
BDFDB.removeEles(".betterfriendcount-badge");
|
||||
|
||||
let relationships = this.FriendUtils.getRelationships(), relationshipCount = {};
|
||||
let relationships = BDFDB.LibraryModules.FriendUtils.getRelationships(), relationshipCount = {};
|
||||
for (let type in this.relationshipTypes) relationshipCount[this.relationshipTypes[type]] = 0;
|
||||
for (let id in relationships) relationshipCount[this.relationshipTypes[relationships[id]]]++;
|
||||
for (let item of tabitems) switch (BDFDB.getReactValue(item, "return.memoizedProps.id") || BDFDB.getReactValue(item, "return.return.memoizedProps.id")) {
|
||||
|
@ -117,7 +113,7 @@ class BetterFriendCount {
|
|||
item.appendChild(this.createBadge(relationshipCount.FRIEND, "friendcount"));
|
||||
break;
|
||||
case "ONLINE":
|
||||
item.appendChild(this.createBadge(this.UserMetaStore.getOnlineFriendCount(), "onlinefriendcount"));
|
||||
item.appendChild(this.createBadge(BDFDB.LibraryModules.StatusMetaUtils.getOnlineFriendCount(), "onlinefriendcount"));
|
||||
break;
|
||||
case "PENDING":
|
||||
item.appendChild(this.createBadge(relationshipCount.PENDING_INCOMING, "requestincount"));
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
class BetterNsfwTag {
|
||||
getName () {return "BetterNsfwTag";}
|
||||
|
||||
getVersion () {return "1.2.0";}
|
||||
getVersion () {return "1.2.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Adds a more noticeable tag to NSFW channels.";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"ChannelItem":"componentDidMount"
|
||||
};
|
||||
|
@ -33,7 +37,7 @@ class BetterNsfwTag {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -72,7 +76,7 @@ class BetterNsfwTag {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannelItem (instance, wrapper) {
|
||||
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); color: white; top: 0px; min-width: 28px;">NSFW</span>`), channelname.nextElementSibling);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class BetterSearchPage {
|
||||
getName () {return "BetterSearchPage";}
|
||||
|
||||
getVersion () {return "1.0.7";}
|
||||
getVersion () {return "1.0.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class BetterSearchPage {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Canary/PTB","Fixed the plugin for canary and ptb"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -100,7 +100,7 @@ class BetterSearchPage {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -122,8 +122,6 @@ class BetterSearchPage {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.SearchNavigation = BDFDB.WebModules.findByProperties("searchNextPage","searchPreviousPage");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -141,11 +139,11 @@ class BetterSearchPage {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processSearchResults (instance, wrapper) {
|
||||
processSearchResults (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.searchId) this.addNewControls(wrapper.querySelector(BDFDB.dotCN.searchresultspagination), instance.props.searchId);
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".BSP-pagination",".BSP-pagination-button",".BSP-pagination-jumpinput");
|
||||
|
@ -194,12 +192,12 @@ class BetterSearchPage {
|
|||
}
|
||||
else if (value < currentpage) {
|
||||
for (; currentpage - value > 0; value++) {
|
||||
this.SearchNavigation.searchPreviousPage(searchId);
|
||||
BDFDB.LibraryModules.SearchPageUtils.searchPreviousPage(searchId);
|
||||
}
|
||||
}
|
||||
else if (value > currentpage) {
|
||||
for (; value - currentpage > 0; value--) {
|
||||
this.SearchNavigation.searchNextPage(searchId);
|
||||
BDFDB.LibraryModules.SearchPageUtils.searchNextPage(searchId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -207,16 +205,16 @@ class BetterSearchPage {
|
|||
BDFDB.stopEvent(e);
|
||||
});
|
||||
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination ${BDFDB.dotCN.searchresultspaginationprevious + BDFDB.notCN.searchresultspaginationdisabled}`, () => {
|
||||
this.SearchNavigation.searchPreviousPage(searchId);
|
||||
BDFDB.LibraryModules.SearchPageUtils.searchPreviousPage(searchId);
|
||||
});
|
||||
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination ${BDFDB.dotCN.searchresultspaginationnext + BDFDB.notCN.searchresultspaginationdisabled}`, () => {
|
||||
this.SearchNavigation.searchNextPage(searchId);
|
||||
BDFDB.LibraryModules.SearchPageUtils.searchNextPage(searchId);
|
||||
});
|
||||
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-first${BDFDB.notCN.searchresultspaginationdisabled}`, () => {
|
||||
for (let i = 0; currentpage - 1 - i > 0; i++) this.SearchNavigation.searchPreviousPage(searchId);
|
||||
for (let i = 0; currentpage - 1 - i > 0; i++) BDFDB.LibraryModules.SearchPageUtils.searchPreviousPage(searchId);
|
||||
});
|
||||
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-last${BDFDB.notCN.searchresultspaginationdisabled}`, () => {
|
||||
for (let i = 0; maxpage - currentpage - i > 0; i++) this.SearchNavigation.searchNextPage(searchId);
|
||||
for (let i = 0; maxpage - currentpage - i > 0; i++) BDFDB.LibraryModules.SearchPageUtils.searchNextPage(searchId);
|
||||
});
|
||||
BDFDB.addEventListener(this, searchResultsWrapper, "click", `.BSP-pagination-jump${BDFDB.notCN.searchresultspaginationdisabled}`, e => {
|
||||
doJump(e.currentTarget.parentElement.querySelector(`.BSP-pagination-jumpinput ${BDFDB.dotCN.inputmini}`));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class CharCounter {
|
||||
getName () {return "CharCounter";}
|
||||
|
||||
getVersion () {return "1.3.5";}
|
||||
getVersion () {return "1.3.6";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,12 +11,13 @@ class CharCounter {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Nickname Modal","Fixed for the nickname modal"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"ChannelTextArea":"componentDidMount",
|
||||
"Note":"componentDidMount",
|
||||
"UserPopout":"componentDidMount",
|
||||
"UserProfile":"componentDidMount",
|
||||
"ChangeNickname":"componentDidMount"
|
||||
};
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ class CharCounter {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -143,15 +144,24 @@ class CharCounter {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.type && this.maxLenghts[instance.props.type]) this.appendCounter(wrapper.querySelector("textarea"), instance.props.type, true);
|
||||
}
|
||||
|
||||
processNote (instance, wrapper) {
|
||||
processNote (instance, wrapper, returnvalue) {
|
||||
console.log(wrapper);
|
||||
this.appendCounter(wrapper.firstElementChild, BDFDB.containsClass(wrapper, BDFDB.disCN.usernotepopout) ? "popout" : (BDFDB.containsClass(wrapper, BDFDB.disCN.usernoteprofile) ? "profile" : null), false);
|
||||
}
|
||||
|
||||
processChangeNickname (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
this.appendCounter(wrapper.querySelector(BDFDB.dotCN.usernote).firstElementChild, "popout", false);
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
this.appendCounter(wrapper.querySelector(BDFDB.dotCN.usernote).firstElementChild, "profile", false);
|
||||
}
|
||||
|
||||
processChangeNickname (instance, wrapper, returnvalue) {
|
||||
let reset = wrapper.querySelector(BDFDB.dotCN.reset);
|
||||
if (reset && BDFDB.getInnerText(reset.firstElementChild) == BDFDB.LanguageStrings.RESET_NICKNAME) this.appendCounter(wrapper.querySelector(BDFDB.dotCN.inputdefault), "nickname", false);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ChatAliases {
|
||||
getName () {return "ChatAliases";}
|
||||
|
||||
getVersion () {return "2.0.0";}
|
||||
getVersion () {return "2.0.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ChatAliases {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["File Aliases","Fixed the crash occuring when trying to send a file via an alias"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -25,27 +25,19 @@ class ChatAliases {
|
|||
configs: {
|
||||
case: {value:false, description:"Handle the wordvalue case sensitive"},
|
||||
exact: {value:true, description:"Handle the wordvalue as an exact word and not as part of a word"},
|
||||
autoc: {value:true, description:"Add this alias in the autocomplete menu (not for Regex)"},
|
||||
regex: {value:false, description:"Handle the wordvalue as a regex string"},
|
||||
autoc: {value:true, description:"Add this alias in the autocomplete menu (not for RegExp)"},
|
||||
regex: {value:false, description:"Handle the wordvalue as a RegExp string"},
|
||||
file: {value:false, description:"Handle the replacevalue as a filepath"}
|
||||
},
|
||||
settings: {
|
||||
addContextMenu: {value:true, description:"Add a ContextMenu entry to faster add new Aliases:"},
|
||||
addAutoComplete: {value:true, description:"Add an Autocomplete-Menu for Non-Regex Aliases:"}
|
||||
addAutoComplete: {value:true, description:"Add an Autocomplete-Menu for Non-RegExp Aliases:"}
|
||||
},
|
||||
amounts: {
|
||||
minAliasLength: {value:2, min:1, description:"Minimal Character Length to open Autocomplete-Menu:"}
|
||||
}
|
||||
};
|
||||
|
||||
this.chataliasesContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable} chataliases-item">
|
||||
<div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">Add to ChatAliases</div></div>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.chataliasesAddModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -310,38 +302,46 @@ class ChatAliases {
|
|||
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(".chataliases-item")) {
|
||||
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, instance.props.value.trim());
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim());
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".chataliases-item")) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let text = document.getSelection().toString().trim();
|
||||
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, text);
|
||||
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, text);
|
||||
}
|
||||
}
|
||||
|
||||
appendItem (menu, text) {
|
||||
let chataliasesContextEntry = BDFDB.htmlToElement(this.chataliasesContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(chataliasesContextEntry, devgroup);
|
||||
else menu.appendChild(chataliasesContextEntry, menu);
|
||||
chataliasesContextEntry.querySelector(".chataliases-item").addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.openAddModal(text);
|
||||
appendItem (menu, returnvalue, text) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Add to ChatAliases",
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addalias-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.openAddModal(text);
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel && instance.props.type) {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
if (!textarea) return;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ChatFilter {
|
||||
getName () {return "ChatFilter";}
|
||||
|
||||
getVersion () {return "3.3.4";}
|
||||
getVersion () {return "3.3.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ChatFilter {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["ContextMenu","Added an contextmenu entry when right clicking a highlighted/selected word to allow you to faster add new aliases"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -45,14 +45,6 @@ class ChatFilter {
|
|||
}
|
||||
};
|
||||
|
||||
this.chatfilterContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} chatfilter-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">Add to ChatFilter</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.chatfilterAddModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -61,7 +53,7 @@ class ChatFilter {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">Add to ChatFilter</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">Add to ChatFilter</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -178,7 +170,7 @@ class ChatFilter {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -302,35 +294,43 @@ class ChatFilter {
|
|||
BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(".chatfilter-item")) {
|
||||
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, instance.props.value.trim());
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.value && instance.props.value.trim() && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, instance.props.value.trim());
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".chatfilter-item")) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let text = document.getSelection().toString().trim();
|
||||
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, text);
|
||||
if (text && BDFDB.getData("addContextMenu", this, "settings")) this.appendItem(menu, returnvalue, text);
|
||||
}
|
||||
}
|
||||
|
||||
appendItem (menu, text) {
|
||||
let chatfilterContextEntry = BDFDB.htmlToElement(this.chatfilterContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(chatfilterContextEntry, devgroup);
|
||||
else menu.appendChild(chatfilterContextEntry, menu);
|
||||
chatfilterContextEntry.querySelector(".chatfilter-item").addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.openAddModal(text);
|
||||
appendItem (menu, returnvalue, text) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Add to ChatFilter",
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addalias-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.openAddModal(text);
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
|
||||
processMessage (instance, wrapper) {
|
||||
processMessage (instance, wrapper, returnvalue) {
|
||||
wrapper.querySelectorAll(`${BDFDB.dotCNC.messagemarkup + BDFDB.dotCN.messageaccessory}`).forEach(message => {this.hideMessage(message);});
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class CompleteTimestamps {
|
||||
getName () {return "CompleteTimestamps";}
|
||||
|
||||
getVersion () {return "1.3.3";}
|
||||
getVersion () {return "1.3.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class CompleteTimestamps {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -22,6 +22,8 @@ class CompleteTimestamps {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
this.languages = {};
|
||||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
|
||||
|
@ -96,7 +98,7 @@ class CompleteTimestamps {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -118,9 +120,9 @@ class CompleteTimestamps {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}}, BDFDB.languages);
|
||||
|
||||
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messagecontent, e => {
|
||||
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messagecontent, e => {
|
||||
if (BDFDB.getData("showOnHover", this, "settings")) {
|
||||
let message = e.currentTarget;
|
||||
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, message);
|
||||
|
@ -131,7 +133,7 @@ class CompleteTimestamps {
|
|||
BDFDB.createTooltip(this.getTimestamp(this.languages[choice].id, info.timestamp._i), message, {type:"left",selector:"completetimestamp-tooltip"});
|
||||
}
|
||||
});
|
||||
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messageedited, e => {
|
||||
BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.messagegroup + BDFDB.dotCN.messageedited, e => {
|
||||
if (BDFDB.getData("changeForEdit", this, "settings")) {
|
||||
let marker = e.currentTarget;
|
||||
let time = marker.getAttribute("datetime");
|
||||
|
@ -195,14 +197,14 @@ class CompleteTimestamps {
|
|||
}
|
||||
|
||||
createSelectChoice (choice) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightlight + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
}
|
||||
|
||||
processMessageGroup (instance, wrapper) {
|
||||
processMessageGroup (instance, wrapper, returnvalue) {
|
||||
if (BDFDB.getData("showInChat", this, "settings")) for (let stamp of wrapper.querySelectorAll("time[datetime]")) this.changeTimestamp(stamp);
|
||||
}
|
||||
|
||||
processEmbed (instance, wrapper) {
|
||||
processEmbed (instance, wrapper, returnvalue) {
|
||||
let embed = BDFDB.getReactValue(instance, "props.embed");
|
||||
let footer = wrapper.querySelector(BDFDB.dotCN.embedfootertext);
|
||||
if (footer && embed && embed.timestamp && BDFDB.getData("showInEmbed", this, "settings")) {
|
||||
|
@ -210,7 +212,7 @@ class CompleteTimestamps {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class CopyRawMessage {
|
||||
getName () {return "CopyRawMessage";}
|
||||
|
||||
getVersion () {return "1.0.1";}
|
||||
getVersion () {return "1.0.2";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,30 +11,14 @@ class CopyRawMessage {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Message 3-dot entry","Added the copy entry to the message 3-dot menu"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"Message":"componentDidMount",
|
||||
"MessageOptionPopout":"componentDidMount"
|
||||
"Message":"componentDidMount"
|
||||
};
|
||||
}
|
||||
|
||||
initConstructor () {
|
||||
this.messageCopyRawEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} copyrawmessage-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">Copy Raw Message</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.popoutCopyRawEntryMarkup =
|
||||
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} copyrawmessage-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">Copy raw</div>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
//legacy
|
||||
load () {}
|
||||
|
||||
|
@ -53,7 +37,7 @@ class CopyRawMessage {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -89,39 +73,50 @@ class CopyRawMessage {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.message.content && instance.props.target && !menu.querySelector(".copyrawmessage-item")) {
|
||||
let messageCopyRawEntry = BDFDB.htmlToElement(this.messageCopyRawEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(messageCopyRawEntry, devgroup);
|
||||
else menu.appendChild(messageCopyRawEntry, menu);
|
||||
let copyrawmessageitem = messageCopyRawEntry.querySelector(".copyrawmessage-item");
|
||||
copyrawmessageitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
require("electron").clipboard.write({text:instance.props.message.content});
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.message.content && instance.props.target && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: BDFDB.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-copyraw-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text:instance.props.message.content});
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
processMessage (instance, wrapper) {
|
||||
onMessageOptionPopout (instance, popout, returnvalue) {
|
||||
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !popout.querySelector(".copyrawmessage-itembtn")) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, BDFDB.LanguageStrings.DELETE);
|
||||
const copyItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: BDFDB.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text:instance.props.message.content});
|
||||
instance.props.onClose();
|
||||
}
|
||||
});
|
||||
children.splice(index, 0, copyItem);
|
||||
}
|
||||
}
|
||||
|
||||
processMessage (instance, wrapper, returnvalue) {
|
||||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.getReactValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.optionpopoutbutton}"></div>`);
|
||||
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>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processMessageOptionPopout (instance, wrapper) {
|
||||
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".copyrawmessage-itembtn")) {
|
||||
let popoutCopyRawEntry = BDFDB.htmlToElement(this.popoutCopyRawEntryMarkup);
|
||||
wrapper.appendChild(popoutCopyRawEntry);
|
||||
popoutCopyRawEntry.addEventListener("click", () => {
|
||||
require("electron").clipboard.write({text:instance.props.message.content});
|
||||
instance.props.onClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
class CreationDate {
|
||||
getName () {return "CreationDate";}
|
||||
|
||||
getVersion () {return "1.2.9";}
|
||||
getVersion () {return "1.3.0";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class CreationDate {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -117,7 +117,7 @@ class CreationDate {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -139,7 +139,7 @@ class CreationDate {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}}, BDFDB.languages);
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
|
@ -190,16 +190,16 @@ class CreationDate {
|
|||
}
|
||||
|
||||
createSelectChoice (choice) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightlight + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
|
||||
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
|
||||
}
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper) {
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
|
||||
this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class EditChannels {
|
||||
getName () {return "EditChannels";}
|
||||
|
||||
getVersion () {return "4.0.0";}
|
||||
getVersion () {return "4.0.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class EditChannels {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["EditUsers bug","Fixed a bug that occured when EditUsers is enabled"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -30,28 +30,6 @@ class EditChannels {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
this.channelContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} localchannelsettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_localchannelsettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.channelContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} editchannels-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} channelsettings-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_channelsettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} resetsettings-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_resetsettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.channelSettingsModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -60,7 +38,7 @@ class EditChannels {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -101,7 +79,7 @@ class EditChannels {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -179,7 +157,7 @@ class EditChannels {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -201,12 +179,6 @@ class EditChannels {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||
this.GuildChannels = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
|
||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
|
||||
var observer = new MutationObserver(() => {this.changeAppTitle();});
|
||||
BDFDB.addObserver(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
|
||||
this.changeAppTitle();
|
||||
|
@ -235,44 +207,50 @@ class EditChannels {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.channelContextEntryMarkup = this.channelContextEntryMarkup.replace("REPLACE_context_localchannelsettings_text", this.labels.context_localchannelsettings_text);
|
||||
|
||||
this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_channelsettings_text", this.labels.submenu_channelsettings_text);
|
||||
this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
|
||||
|
||||
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_channelname_text", this.labels.modal_channelname_text);
|
||||
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
|
||||
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_inheritcolor_text", this.labels.modal_inheritcolor_text);
|
||||
this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
|
||||
}
|
||||
|
||||
onChannelContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.channel && !menu.querySelector(".localchannelsettings-item")) {
|
||||
let channelContextEntry = BDFDB.htmlToElement(this.channelContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(channelContextEntry, devgroup);
|
||||
else menu.appendChild(channelContextEntry, menu);
|
||||
let settingsitem = channelContextEntry.querySelector(".localchannelsettings-item");
|
||||
settingsitem.addEventListener("mouseenter", () => {
|
||||
let channelContextSubMenu = BDFDB.htmlToElement(this.channelContextSubMenuMarkup);
|
||||
let channelitem = channelContextSubMenu.querySelector(".channelsettings-item");
|
||||
channelitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showChannelSettings(instance.props.channel);
|
||||
});
|
||||
if (BDFDB.loadData(instance.props.channel.id, this, "channels")) {
|
||||
let resetitem = channelContextSubMenu.querySelector(".resetsettings-item");
|
||||
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
resetitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.channel.id, this, "channels");
|
||||
this.changeAppTitle();
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(settingsitem, channelContextSubMenu);
|
||||
onChannelContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.channel && !BDFDB.getParentEle(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_localchannelsettings_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-channelsettings-contextMenuSubItem`,
|
||||
render: [BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_channelsettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-channelsettings-ContextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showChannelSettings(instance.props.channel);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_resetsettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
|
||||
disabled: !BDFDB.loadData(instance.props.channel.id, this, "channels"),
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.channel.id, this, "channels");
|
||||
this.changeAppTitle();
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
})
|
||||
]
|
||||
})]
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +290,7 @@ class EditChannels {
|
|||
channelnameinput.focus();
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
let channel = BDFDB.getReactValue(instance, "props.channel");
|
||||
if (channel) {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
|
@ -360,7 +338,7 @@ class EditChannels {
|
|||
}
|
||||
}
|
||||
|
||||
processAuditLog (instance, wrapper) {
|
||||
processAuditLog (instance, wrapper, returnvalue) {
|
||||
let channel = BDFDB.getReactValue(instance, "props.log.options.channel");
|
||||
if (channel) {
|
||||
let hooks = wrapper.querySelectorAll(`${BDFDB.dotCN.flexchild} > span${BDFDB.notCN.auditloguserhook}`);
|
||||
|
@ -368,7 +346,7 @@ class EditChannels {
|
|||
}
|
||||
}
|
||||
|
||||
processInviteCard (instance, wrapper) {
|
||||
processInviteCard (instance, wrapper, returnvalue) {
|
||||
let invite = BDFDB.getReactValue(instance, "props.invite");
|
||||
if (invite && invite.inviter && invite.channel) {
|
||||
let channelname = wrapper.querySelector(BDFDB.dotCN.guildsettingsinvitechannelname);
|
||||
|
@ -376,32 +354,32 @@ class EditChannels {
|
|||
}
|
||||
}
|
||||
|
||||
processChannelCategoryItem (instance, wrapper) {
|
||||
processChannelCategoryItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel) {
|
||||
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.categoryname), true);
|
||||
}
|
||||
}
|
||||
|
||||
processChannelItem (instance, wrapper) {
|
||||
processChannelItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel) {
|
||||
this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.channelname), true);
|
||||
}
|
||||
}
|
||||
|
||||
processHeaderBarContainer (instance, wrapper) {
|
||||
processHeaderBarContainer (instance, wrapper, returnvalue) {
|
||||
this.processHeaderBar(instance, wrapper);
|
||||
}
|
||||
|
||||
processHeaderBar (instance, wrapper) {
|
||||
processHeaderBar (instance, wrapper, returnvalue) {
|
||||
let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
|
||||
if (channel_id) {
|
||||
let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle);
|
||||
if (channelname) {
|
||||
let channel = this.ChannelUtils.getChannel(channel_id);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channel_id);
|
||||
if (channel) {
|
||||
if (channel.type == 0 || channel.type == 2) this.changeChannel(channel, channelname);
|
||||
else {
|
||||
if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel;
|
||||
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.isPluginEnabled("EditUsers")) bdplugins.EditUsers.plugin.changeName(channel, channelname);
|
||||
else {
|
||||
|
@ -415,18 +393,18 @@ class EditChannels {
|
|||
}
|
||||
}
|
||||
|
||||
processClickable (instance, wrapper) {
|
||||
processClickable (instance, wrapper, returnvalue) {
|
||||
if (!instance.props || !instance.props.className) return;
|
||||
else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mentionwrapper) > -1 && instance.props.className.indexOf(BDFDB.disCN.mention) == -1) {
|
||||
let children = BDFDB.getReactValue(instance, "_reactInternalFiber.memoizedProps.children");
|
||||
if (children && typeof children[0] == "string") {
|
||||
let channelname = children[0].slice(1);
|
||||
let categoryname = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.type.displayName") == "Tooltip" ? BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.text") : null
|
||||
let channelid = this.LastGuildStore.getGuildId();
|
||||
let channels = channelid ? (this.GuildChannels.getChannels(channelid)[0] || this.GuildChannels.getChannels(channelid).SELECTABLE) : null;
|
||||
let channelid = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
let channels = channelid ? (BDFDB.LibraryModules.GuildChannelStore.getChannels(channelid)[0] || BDFDB.LibraryModules.GuildChannelStore.getChannels(channelid).SELECTABLE) : null;
|
||||
if (Array.isArray(channels)) for (let channel of channels) {
|
||||
if (channelname == channel.channel.name) {
|
||||
let category = categoryname ? this.ChannelUtils.getChannel(channel.channel.parent_id) : null;
|
||||
let category = categoryname ? BDFDB.LibraryModules.ChannelStore.getChannel(channel.channel.parent_id) : null;
|
||||
if (!category || category && categoryname == category.name) {
|
||||
this.changeMention(channel.channel, wrapper, category || {});
|
||||
break;
|
||||
|
@ -439,7 +417,7 @@ class EditChannels {
|
|||
let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.channel");
|
||||
if (channel) {
|
||||
this.changeChannel(channel, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
|
||||
if (channel.parent_id) this.changeChannel(this.ChannelUtils.getChannel(channel.parent_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultnote));
|
||||
if (channel.parent_id) this.changeChannel(BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultnote));
|
||||
}
|
||||
}
|
||||
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
|
||||
|
@ -456,7 +434,7 @@ class EditChannels {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.changeAppTitle();
|
||||
|
@ -465,7 +443,7 @@ class EditChannels {
|
|||
}
|
||||
|
||||
changeAppTitle () {
|
||||
let channel = this.ChannelUtils.getChannel(this.LastChannelStore.getChannelId());
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title && channel && channel.type != 1) {
|
||||
let data = this.getChannelData(channel.id, channel.parent_id, title);
|
||||
|
@ -672,8 +650,8 @@ class EditChannels {
|
|||
if (!channels) return;
|
||||
let channelarray = [];
|
||||
for (let id in channels) if (channels[id].name) {
|
||||
let channel = this.ChannelUtils.getChannel(id);
|
||||
let category = channel && channel.parent_id ? this.ChannelUtils.getChannel(channel.parent_id) : null;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
let category = channel && channel.parent_id ? BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id) : null;
|
||||
let catdata = (category ? channels[category.id] : null) || {};
|
||||
if (channel && channel.type == 0) channelarray.push(Object.assign({lowercasename:channels[id].name.toLowerCase(),lowercasecatname:(catdata && catdata.name ? catdata.name.toLowerCase() : null),channel,category,catdata},channels[id]));
|
||||
}
|
||||
|
@ -751,9 +729,7 @@ class EditChannels {
|
|||
modal_header_text: "Postavke lokalnih kanala",
|
||||
modal_channelname_text: "Naziv lokalnog kanala",
|
||||
modal_colorpicker1_text: "Boja lokalnog kanala",
|
||||
modal_inheritcolor_text: "Naslijedi boju u potkanale",
|
||||
btn_cancel_text: "Prekid",
|
||||
btn_save_text: "Uštedjeti"
|
||||
modal_inheritcolor_text: "Naslijedi boju u potkanale"
|
||||
};
|
||||
case "da": //danish
|
||||
return {
|
||||
|
@ -763,9 +739,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokal kanalindstillinger",
|
||||
modal_channelname_text: "Lokalt kanalnavn",
|
||||
modal_colorpicker1_text: "Lokal kanalfarve",
|
||||
modal_inheritcolor_text: "Arve farve til subkanaler",
|
||||
btn_cancel_text: "Afbryde",
|
||||
btn_save_text: "Spare"
|
||||
modal_inheritcolor_text: "Arve farve til subkanaler"
|
||||
};
|
||||
case "de": //german
|
||||
return {
|
||||
|
@ -775,9 +749,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokale Kanaleinstellungen",
|
||||
modal_channelname_text: "Lokaler Kanalname",
|
||||
modal_colorpicker1_text: "Lokale Kanalfarbe",
|
||||
modal_inheritcolor_text: "Farbe an Unterkanäle vererben",
|
||||
btn_cancel_text: "Abbrechen",
|
||||
btn_save_text: "Speichern"
|
||||
modal_inheritcolor_text: "Farbe an Unterkanäle vererben"
|
||||
};
|
||||
case "es": //spanish
|
||||
return {
|
||||
|
@ -787,9 +759,7 @@ class EditChannels {
|
|||
modal_header_text: "Ajustes local de canal",
|
||||
modal_channelname_text: "Nombre local del canal",
|
||||
modal_colorpicker1_text: "Color local del canal",
|
||||
modal_inheritcolor_text: "Heredar color a sub-canales",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Guardar"
|
||||
modal_inheritcolor_text: "Heredar color a sub-canales"
|
||||
};
|
||||
case "fr": //french
|
||||
return {
|
||||
|
@ -799,9 +769,7 @@ class EditChannels {
|
|||
modal_header_text: "Paramètres locale du canal",
|
||||
modal_channelname_text: "Nom local du canal",
|
||||
modal_colorpicker1_text: "Couleur locale de la chaîne",
|
||||
modal_inheritcolor_text: "Hériter de la couleur sur les sous-canaux",
|
||||
btn_cancel_text: "Abandonner",
|
||||
btn_save_text: "Enregistrer"
|
||||
modal_inheritcolor_text: "Hériter de la couleur sur les sous-canaux"
|
||||
};
|
||||
case "it": //italian
|
||||
return {
|
||||
|
@ -811,9 +779,7 @@ class EditChannels {
|
|||
modal_header_text: "Impostazioni locale canale",
|
||||
modal_channelname_text: "Nome locale canale",
|
||||
modal_colorpicker1_text: "Colore locale canale",
|
||||
modal_inheritcolor_text: "Eredita colore per sub-canali",
|
||||
btn_cancel_text: "Cancellare",
|
||||
btn_save_text: "Salvare"
|
||||
modal_inheritcolor_text: "Eredita colore per sub-canali"
|
||||
};
|
||||
case "nl": //dutch
|
||||
return {
|
||||
|
@ -823,9 +789,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokale kanaalinstellingen",
|
||||
modal_channelname_text: "Lokale kanaalnaam",
|
||||
modal_colorpicker1_text: "Lokale kanaalkleur",
|
||||
modal_inheritcolor_text: "Overerving van kleuren naar subkanalen",
|
||||
btn_cancel_text: "Afbreken",
|
||||
btn_save_text: "Opslaan"
|
||||
modal_inheritcolor_text: "Overerving van kleuren naar subkanalen"
|
||||
};
|
||||
case "no": //norwegian
|
||||
return {
|
||||
|
@ -835,9 +799,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokal kanalinnstillinger",
|
||||
modal_channelname_text: "Lokalt kanalnavn",
|
||||
modal_colorpicker1_text: "Lokal kanalfarge",
|
||||
modal_inheritcolor_text: "Arve farge til underkanaler",
|
||||
btn_cancel_text: "Avbryte",
|
||||
btn_save_text: "Lagre"
|
||||
modal_inheritcolor_text: "Arve farge til underkanaler"
|
||||
};
|
||||
case "pl": //polish
|
||||
return {
|
||||
|
@ -847,9 +809,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokalne ustawienia kanału",
|
||||
modal_channelname_text: "Lokalna nazwa kanału",
|
||||
modal_colorpicker1_text: "Lokalny kolor kanału",
|
||||
modal_inheritcolor_text: "Dziedzicz kolor do podkanałów",
|
||||
btn_cancel_text: "Anuluj",
|
||||
btn_save_text: "Zapisz"
|
||||
modal_inheritcolor_text: "Dziedzicz kolor do podkanałów"
|
||||
};
|
||||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
|
@ -859,9 +819,7 @@ class EditChannels {
|
|||
modal_header_text: "Configurações local do canal",
|
||||
modal_channelname_text: "Nome local do canal",
|
||||
modal_colorpicker1_text: "Cor local do canal",
|
||||
modal_inheritcolor_text: "Herdar cor aos sub-canais",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Salvar"
|
||||
modal_inheritcolor_text: "Herdar cor aos sub-canais"
|
||||
};
|
||||
case "fi": //finnish
|
||||
return {
|
||||
|
@ -871,9 +829,7 @@ class EditChannels {
|
|||
modal_header_text: "Paikallinen kanavan asetukset",
|
||||
modal_channelname_text: "Paikallinen kanavanimi",
|
||||
modal_colorpicker1_text: "Paikallinen kanavanväri",
|
||||
modal_inheritcolor_text: "Hävitä väri alikanaville",
|
||||
btn_cancel_text: "Peruuttaa",
|
||||
btn_save_text: "Tallentaa"
|
||||
modal_inheritcolor_text: "Hävitä väri alikanaville"
|
||||
};
|
||||
case "sv": //swedish
|
||||
return {
|
||||
|
@ -883,9 +839,7 @@ class EditChannels {
|
|||
modal_header_text: "Lokal kanalinställningar",
|
||||
modal_channelname_text: "Lokalt kanalnamn",
|
||||
modal_colorpicker1_text: "Lokal kanalfärg",
|
||||
modal_inheritcolor_text: "Inherit färg till subkanaler",
|
||||
btn_cancel_text: "Avbryta",
|
||||
btn_save_text: "Spara"
|
||||
modal_inheritcolor_text: "Inherit färg till subkanaler"
|
||||
};
|
||||
case "tr": //turkish
|
||||
return {
|
||||
|
@ -895,9 +849,7 @@ class EditChannels {
|
|||
modal_header_text: "Yerel Kanal Ayarları",
|
||||
modal_channelname_text: "Yerel Kanal Adı",
|
||||
modal_colorpicker1_text: "Yerel Kanal Rengi",
|
||||
modal_inheritcolor_text: "Renkleri alt kanallara miras alma",
|
||||
btn_cancel_text: "Iptal",
|
||||
btn_save_text: "Kayıt"
|
||||
modal_inheritcolor_text: "Renkleri alt kanallara miras alma"
|
||||
};
|
||||
case "cs": //czech
|
||||
return {
|
||||
|
@ -907,9 +859,7 @@ class EditChannels {
|
|||
modal_header_text: "Místní nastavení kanálu",
|
||||
modal_channelname_text: "Místní název kanálu",
|
||||
modal_colorpicker1_text: "Místní barvy kanálu",
|
||||
modal_inheritcolor_text: "Zdědit barvu na subkanály",
|
||||
btn_cancel_text: "Zrušení",
|
||||
btn_save_text: "Uložit"
|
||||
modal_inheritcolor_text: "Zdědit barvu na subkanály"
|
||||
};
|
||||
case "bg": //bulgarian
|
||||
return {
|
||||
|
@ -919,9 +869,7 @@ class EditChannels {
|
|||
modal_header_text: "Настройки за локални канали",
|
||||
modal_channelname_text: "Локално име на канал",
|
||||
modal_colorpicker1_text: "Локален цветен канал",
|
||||
modal_inheritcolor_text: "Наследи цвета до подканали",
|
||||
btn_cancel_text: "Зъбести",
|
||||
btn_save_text: "Cпасяване"
|
||||
modal_inheritcolor_text: "Наследи цвета до подканали"
|
||||
};
|
||||
case "ru": //russian
|
||||
return {
|
||||
|
@ -931,9 +879,7 @@ class EditChannels {
|
|||
modal_header_text: "Настройки локального канала",
|
||||
modal_channelname_text: "Имя локального канала",
|
||||
modal_colorpicker1_text: "Цвет локального канала",
|
||||
modal_inheritcolor_text: "Наследовать цвет на подканалы",
|
||||
btn_cancel_text: "Отмена",
|
||||
btn_save_text: "Cпасти"
|
||||
modal_inheritcolor_text: "Наследовать цвет на подканалы"
|
||||
};
|
||||
case "uk": //ukrainian
|
||||
return {
|
||||
|
@ -943,9 +889,7 @@ class EditChannels {
|
|||
modal_header_text: "Налаштування локального каналу",
|
||||
modal_channelname_text: "Локальне ім'я каналу",
|
||||
modal_colorpicker1_text: "Колір місцевого каналу",
|
||||
modal_inheritcolor_text: "Успадковують колір до підканалів",
|
||||
btn_cancel_text: "Скасувати",
|
||||
btn_save_text: "Зберегти"
|
||||
modal_inheritcolor_text: "Успадковують колір до підканалів"
|
||||
};
|
||||
case "ja": //japanese
|
||||
return {
|
||||
|
@ -955,9 +899,7 @@ class EditChannels {
|
|||
modal_header_text: "ローカルチャネル設定",
|
||||
modal_channelname_text: "ローカルチャネル名",
|
||||
modal_colorpicker1_text: "ローカルチャネルの色",
|
||||
modal_inheritcolor_text: "サブチャンネルに色を継承",
|
||||
btn_cancel_text: "キャンセル",
|
||||
btn_save_text: "セーブ"
|
||||
modal_inheritcolor_text: "サブチャンネルに色を継承"
|
||||
};
|
||||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
|
@ -967,9 +909,7 @@ class EditChannels {
|
|||
modal_header_text: "本地頻道設置",
|
||||
modal_channelname_text: "本地頻道名稱",
|
||||
modal_colorpicker1_text: "本地頻道顏色",
|
||||
modal_inheritcolor_text: "繼承子通道的顏色",
|
||||
btn_cancel_text: "取消",
|
||||
btn_save_text: "保存"
|
||||
modal_inheritcolor_text: "繼承子通道的顏色"
|
||||
};
|
||||
case "ko": //korean
|
||||
return {
|
||||
|
@ -979,9 +919,7 @@ class EditChannels {
|
|||
modal_header_text: "로컬 채널 설정",
|
||||
modal_channelname_text: "로컬 채널 이름",
|
||||
modal_colorpicker1_text: "지역 채널 색깔",
|
||||
modal_inheritcolor_text: "하위 채널에 색상 상속",
|
||||
btn_cancel_text: "취소",
|
||||
btn_save_text: "저장"
|
||||
modal_inheritcolor_text: "하위 채널에 색상 상속"
|
||||
};
|
||||
default: //default: english
|
||||
return {
|
||||
|
@ -991,9 +929,7 @@ class EditChannels {
|
|||
modal_header_text: "Local Channelsettings",
|
||||
modal_channelname_text: "Local Channelname",
|
||||
modal_colorpicker1_text: "Local Channelcolor",
|
||||
modal_inheritcolor_text: "Inherit color to Sub-Channels",
|
||||
btn_cancel_text: "Cancel",
|
||||
btn_save_text: "Save"
|
||||
modal_inheritcolor_text: "Inherit color to Sub-Channels"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class EditServers {
|
||||
getName () {return "EditServers";}
|
||||
|
||||
getVersion () {return "2.0.4";}
|
||||
getVersion () {return "2.0.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class EditServers {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["<span style='-webkit-background-clip: text; color: transparent; background-image: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'>Color Gradients</span>","You can now use color gradients to edit servers"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -25,28 +25,6 @@ class EditServers {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
this.serverContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} localserversettings-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_localserversettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} editservers-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} serversettings-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_serversettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} resetsettings-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_resetsettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverSettingsModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -55,7 +33,7 @@ class EditServers {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto; padding-bottom: 10px;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -140,7 +118,7 @@ class EditServers {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -206,7 +184,7 @@ class EditServers {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -228,11 +206,8 @@ class EditServers {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
|
||||
this.CurrentGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
|
||||
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties('getGuildBannerURL'), 'getGuildBannerURL', this, {instead:e => {
|
||||
let guild = this.GuildUtils.getGuild(e.methodArguments[0].id);
|
||||
BDFDB.WebModules.patch(BDFDB.LibraryModules.IconUtils, 'getGuildBannerURL', this, {instead:e => {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
|
||||
if (guild) {
|
||||
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
|
||||
let data = BDFDB.loadData(guild.id, this, "servers");
|
||||
|
@ -271,7 +246,7 @@ class EditServers {
|
|||
onSwitch () {
|
||||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
BDFDB.removeClass(document.querySelector(".fake-guildacronym" + BDFDB.dotCN.guildiconselected), BDFDB.disCN.guildiconselected);
|
||||
let guilddiv = BDFDB.getServerDiv(this.CurrentGuildStore.getGuildId());
|
||||
let guilddiv = BDFDB.getServerDiv(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
if (guilddiv) BDFDB.addClass(guilddiv.querySelector(".fake-guildacronym"), BDFDB.disCN.guildiconselected);
|
||||
}
|
||||
}
|
||||
|
@ -279,11 +254,6 @@ class EditServers {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_localserversettings_text", this.labels.context_localserversettings_text);
|
||||
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_serversettings_text", this.labels.submenu_serversettings_text);
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
|
||||
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servername_text", this.labels.modal_servername_text);
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servershortname_text", this.labels.modal_servershortname_text);
|
||||
|
@ -298,40 +268,51 @@ class EditServers {
|
|||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
|
||||
this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
|
||||
}
|
||||
|
||||
onGuildContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.target && instance.props.guild && !menu.querySelector(".localserversettings-item")) {
|
||||
let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(serverContextEntry, devgroup);
|
||||
else menu.appendChild(serverContextEntry, menu);
|
||||
let settingsitem = serverContextEntry.querySelector(".localserversettings-item");
|
||||
settingsitem.addEventListener("mouseenter", () => {
|
||||
let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
|
||||
let serveritem = serverContextSubMenu.querySelector(".serversettings-item");
|
||||
serveritem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showServerSettings(instance.props.guild);
|
||||
});
|
||||
if (BDFDB.loadData(instance.props.guild.id, this, "servers")) {
|
||||
let resetitem = serverContextSubMenu.querySelector(".resetsettings-item");
|
||||
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
resetitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.guild.id, this, "servers");
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
this.updateGuildSidebar();
|
||||
this.onSwitch();
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(settingsitem, serverContextSubMenu);
|
||||
|
||||
onGuildContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.guild && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_localserversettings_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-serversettings-contextMenuSubItem`,
|
||||
render: [BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_serversettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-serversettings-ContextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showServerSettings(instance.props.guild);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_resetsettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
|
||||
disabled: !BDFDB.loadData(instance.props.guild.id, this, "servers"),
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.guild.id, this, "servers");
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
this.updateGuildSidebar();
|
||||
this.onSwitch();
|
||||
}
|
||||
})
|
||||
]
|
||||
})]
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
processGuild (instance, wrapper) {
|
||||
processGuild (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
let icon = wrapper.querySelector(BDFDB.dotCN.guildicon + ":not(.fake-guildicon), " + BDFDB.dotCN.guildiconacronym + ":not(.fake-guildacronym)");
|
||||
if (!icon) return;
|
||||
|
@ -340,7 +321,7 @@ class EditServers {
|
|||
}
|
||||
}
|
||||
|
||||
processGuildIconWrapper (instance, wrapper) {
|
||||
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);
|
||||
if (!icon) return;
|
||||
|
@ -349,13 +330,13 @@ class EditServers {
|
|||
}
|
||||
}
|
||||
|
||||
processGuildHeader (instance, wrapper) {
|
||||
processGuildHeader (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
this.changeGuildName(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildheadername));
|
||||
}
|
||||
}
|
||||
|
||||
processClickable (instance, wrapper) {
|
||||
processClickable (instance, wrapper, returnvalue) {
|
||||
if (!wrapper || !instance.props || !instance.props.className) return;
|
||||
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.userprofilelistrow) > -1) {
|
||||
let guild = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.guild");
|
||||
|
@ -368,7 +349,7 @@ class EditServers {
|
|||
if (guild) this.changeGuildName(guild, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
|
||||
else {
|
||||
let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.channel");
|
||||
if (channel && channel.guild_id) this.changeGuildName(this.GuildUtils.getGuild(channel.guild_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultmisccontainer));
|
||||
if (channel && channel.guild_id) this.changeGuildName(BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultmisccontainer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +403,7 @@ class EditServers {
|
|||
});
|
||||
urlinput.addEventListener("mouseleave", () => {
|
||||
BDFDB.removeClass(urlinput, "hovering");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.itemlayerconainer + ".notice-tooltip");
|
||||
});
|
||||
}
|
||||
if (info.id == "410787888507256842") {
|
||||
|
@ -465,13 +446,13 @@ class EditServers {
|
|||
}
|
||||
|
||||
checkUrl (input) {
|
||||
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.itemlayerconainer + ".notice-tooltip");
|
||||
if (!input.value) {
|
||||
BDFDB.removeClass(input, "valid");
|
||||
BDFDB.removeClass(input, "invalid");
|
||||
}
|
||||
else {
|
||||
require("request")(input.value, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(input.value, (error, response, result) => {
|
||||
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
|
||||
BDFDB.addClass(input, "valid");
|
||||
BDFDB.removeClass(input, "invalid");
|
||||
|
@ -658,7 +639,7 @@ class EditServers {
|
|||
|
||||
setBanner (id, data) {
|
||||
data = data || {};
|
||||
let guild = this.GuildUtils.getGuild(id);
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
|
||||
if (!guild) return;
|
||||
if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
|
||||
guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
|
||||
|
@ -694,9 +675,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Boja fonta",
|
||||
modal_ignoreurl_text: "URL ignorirati",
|
||||
modal_validurl_text: "Vrijedi URL",
|
||||
modal_invalidurl_text: "Nevažeći URL",
|
||||
btn_cancel_text: "Prekid",
|
||||
btn_save_text: "Uštedjeti"
|
||||
modal_invalidurl_text: "Nevažeći URL"
|
||||
};
|
||||
case "da": //danish
|
||||
return {
|
||||
|
@ -719,9 +698,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Skriftfarve",
|
||||
modal_ignoreurl_text: "Ignorer URL",
|
||||
modal_validurl_text: "Gyldig URL",
|
||||
modal_invalidurl_text: "Ugyldig URL",
|
||||
btn_cancel_text: "Afbryde",
|
||||
btn_save_text: "Spare"
|
||||
modal_invalidurl_text: "Ugyldig URL"
|
||||
};
|
||||
case "de": //german
|
||||
return {
|
||||
|
@ -744,9 +721,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Schriftfarbe",
|
||||
modal_ignoreurl_text: "URL ignorieren",
|
||||
modal_validurl_text: "Gültige URL",
|
||||
modal_invalidurl_text: "Ungültige URL",
|
||||
btn_cancel_text: "Abbrechen",
|
||||
btn_save_text: "Speichern"
|
||||
modal_invalidurl_text: "Ungültige URL"
|
||||
};
|
||||
case "es": //spanish
|
||||
return {
|
||||
|
@ -769,9 +744,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Color de fuente",
|
||||
modal_ignoreurl_text: "Ignorar URL",
|
||||
modal_validurl_text: "URL válida",
|
||||
modal_invalidurl_text: "URL inválida",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Guardar"
|
||||
modal_invalidurl_text: "URL inválida"
|
||||
};
|
||||
case "fr": //french
|
||||
return {
|
||||
|
@ -794,9 +767,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Couleur de la police",
|
||||
modal_ignoreurl_text: "Ignorer l'URL",
|
||||
modal_validurl_text: "URL valide",
|
||||
modal_invalidurl_text: "URL invalide",
|
||||
btn_cancel_text: "Abandonner",
|
||||
btn_save_text: "Enregistrer"
|
||||
modal_invalidurl_text: "URL invalide"
|
||||
};
|
||||
case "it": //italian
|
||||
return {
|
||||
|
@ -819,9 +790,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Colore del carattere",
|
||||
modal_ignoreurl_text: "Ignora l'URL",
|
||||
modal_validurl_text: "URL valido",
|
||||
modal_invalidurl_text: "URL non valido",
|
||||
btn_cancel_text: "Cancellare",
|
||||
btn_save_text: "Salvare"
|
||||
modal_invalidurl_text: "URL non valido"
|
||||
};
|
||||
case "nl": //dutch
|
||||
return {
|
||||
|
@ -844,9 +813,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Doopvontkleur",
|
||||
modal_ignoreurl_text: "URL negeren",
|
||||
modal_validurl_text: "Geldige URL",
|
||||
modal_invalidurl_text: "Ongeldige URL",
|
||||
btn_cancel_text: "Afbreken",
|
||||
btn_save_text: "Opslaan"
|
||||
modal_invalidurl_text: "Ongeldige URL"
|
||||
};
|
||||
case "no": //norwegian
|
||||
return {
|
||||
|
@ -869,9 +836,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Skriftfarge",
|
||||
modal_ignoreurl_text: "Ignorer URL",
|
||||
modal_validurl_text: "Gyldig URL",
|
||||
modal_invalidurl_text: "Ugyldig URL",
|
||||
btn_cancel_text: "Avbryte",
|
||||
btn_save_text: "Lagre"
|
||||
modal_invalidurl_text: "Ugyldig URL"
|
||||
};
|
||||
case "pl": //polish
|
||||
return {
|
||||
|
@ -894,9 +859,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Kolor czcionki",
|
||||
modal_ignoreurl_text: "Ignoruj URL",
|
||||
modal_validurl_text: "Prawidłowe URL",
|
||||
modal_invalidurl_text: "Nieprawidłowe URL",
|
||||
btn_cancel_text: "Anuluj",
|
||||
btn_save_text: "Zapisz"
|
||||
modal_invalidurl_text: "Nieprawidłowe URL"
|
||||
};
|
||||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
|
@ -919,9 +882,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Cor da fonte",
|
||||
modal_ignoreurl_text: "Ignorar URL",
|
||||
modal_validurl_text: "URL válido",
|
||||
modal_invalidurl_text: "URL inválida",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Salvar"
|
||||
modal_invalidurl_text: "URL inválida"
|
||||
};
|
||||
case "fi": //finnish
|
||||
return {
|
||||
|
@ -944,9 +905,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Fontinväri",
|
||||
modal_ignoreurl_text: "Ohita URL",
|
||||
modal_validurl_text: "Voimassa URL",
|
||||
modal_invalidurl_text: "Virheellinen URL",
|
||||
btn_cancel_text: "Peruuttaa",
|
||||
btn_save_text: "Tallentaa"
|
||||
modal_invalidurl_text: "Virheellinen URL"
|
||||
};
|
||||
case "sv": //swedish
|
||||
return {
|
||||
|
@ -969,9 +928,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Fontfärg",
|
||||
modal_ignoreurl_text: "Ignorera URL",
|
||||
modal_validurl_text: "Giltig URL",
|
||||
modal_invalidurl_text: "Ogiltig URL",
|
||||
btn_cancel_text: "Avbryta",
|
||||
btn_save_text: "Spara"
|
||||
modal_invalidurl_text: "Ogiltig URL"
|
||||
};
|
||||
case "tr": //turkish
|
||||
return {
|
||||
|
@ -994,9 +951,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Yazı rengi",
|
||||
modal_ignoreurl_text: "URL yoksay",
|
||||
modal_validurl_text: "Geçerli URL",
|
||||
modal_invalidurl_text: "Geçersiz URL",
|
||||
btn_cancel_text: "Iptal",
|
||||
btn_save_text: "Kayıt"
|
||||
modal_invalidurl_text: "Geçersiz URL"
|
||||
};
|
||||
case "cs": //czech
|
||||
return {
|
||||
|
@ -1019,9 +974,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Barva fontu",
|
||||
modal_ignoreurl_text: "Ignorovat URL",
|
||||
modal_validurl_text: "Platná URL",
|
||||
modal_invalidurl_text: "Neplatná URL",
|
||||
btn_cancel_text: "Zrušení",
|
||||
btn_save_text: "Uložit"
|
||||
modal_invalidurl_text: "Neplatná URL"
|
||||
};
|
||||
case "bg": //bulgarian
|
||||
return {
|
||||
|
@ -1044,9 +997,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Цвят на шрифта",
|
||||
modal_ignoreurl_text: "Игнориране на URL",
|
||||
modal_validurl_text: "Валиден URL",
|
||||
modal_invalidurl_text: "Невалиден URL",
|
||||
btn_cancel_text: "Зъбести",
|
||||
btn_save_text: "Cпасяване"
|
||||
modal_invalidurl_text: "Невалиден URL"
|
||||
};
|
||||
case "ru": //russian
|
||||
return {
|
||||
|
@ -1069,9 +1020,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Цвет шрифта",
|
||||
modal_ignoreurl_text: "Игнорировать URL",
|
||||
modal_validurl_text: "Действительный URL",
|
||||
modal_invalidurl_text: "Неверная URL",
|
||||
btn_cancel_text: "Отмена",
|
||||
btn_save_text: "Cпасти"
|
||||
modal_invalidurl_text: "Неверная URL"
|
||||
};
|
||||
case "uk": //ukrainian
|
||||
return {
|
||||
|
@ -1094,9 +1043,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Колір шрифту",
|
||||
modal_ignoreurl_text: "Ігнорувати URL",
|
||||
modal_validurl_text: "Дійсна URL",
|
||||
modal_invalidurl_text: "Недійсна URL",
|
||||
btn_cancel_text: "Скасувати",
|
||||
btn_save_text: "Зберегти"
|
||||
modal_invalidurl_text: "Недійсна URL"
|
||||
};
|
||||
case "ja": //japanese
|
||||
return {
|
||||
|
@ -1119,9 +1066,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "フォントの色",
|
||||
modal_ignoreurl_text: "URL を無視する",
|
||||
modal_validurl_text: "有効な URL",
|
||||
modal_invalidurl_text: "無効な URL",
|
||||
btn_cancel_text: "キャンセル",
|
||||
btn_save_text: "セーブ"
|
||||
modal_invalidurl_text: "無効な URL"
|
||||
};
|
||||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
|
@ -1144,9 +1089,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "字體顏色",
|
||||
modal_ignoreurl_text: "忽略 URL",
|
||||
modal_validurl_text: "有效的 URL",
|
||||
modal_invalidurl_text: "無效的 URL",
|
||||
btn_cancel_text: "取消",
|
||||
btn_save_text: "保存"
|
||||
modal_invalidurl_text: "無效的 URL"
|
||||
};
|
||||
case "ko": //korean
|
||||
return {
|
||||
|
@ -1169,9 +1112,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "글꼴 색깔",
|
||||
modal_ignoreurl_text: "URL 무시",
|
||||
modal_validurl_text: "유효한 URL",
|
||||
modal_invalidurl_text: "잘못된 URL",
|
||||
btn_cancel_text: "취소",
|
||||
btn_save_text: "저장"
|
||||
modal_invalidurl_text: "잘못된 URL"
|
||||
};
|
||||
default: //default: english
|
||||
return {
|
||||
|
@ -1194,9 +1135,7 @@ class EditServers {
|
|||
modal_colorpicker4_text: "Fontcolor",
|
||||
modal_ignoreurl_text: "Ignore URL",
|
||||
modal_validurl_text: "Valid URL",
|
||||
modal_invalidurl_text: "Invalid URL",
|
||||
btn_cancel_text: "Cancel",
|
||||
btn_save_text: "Save"
|
||||
modal_invalidurl_text: "Invalid URL"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class EditUsers {
|
||||
getName () {return "EditUsers";}
|
||||
|
||||
getVersion () {return "3.5.4";}
|
||||
getVersion () {return "3.5.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class EditUsers {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["BotTags","No longer forces bottag color to be the same as the role color unless BetterRoleColors is enabled and the bottag option in BRC is enabled"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -72,28 +72,6 @@ class EditUsers {
|
|||
bottom: 3px;
|
||||
}`;
|
||||
|
||||
this.userContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitemsubmenu} localusersettings-item">
|
||||
<div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_localusersettings_text</div></div>
|
||||
<svg class="${BDFDB.disCN.contextmenuitemsubmenucaret}" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z"></path></svg>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.userContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} editusers-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable} usersettings-item">
|
||||
<div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_usersettings_text</div></div>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCNS.contextmenuitemclickable + BDFDB.disCN.contextmenuitemdisabled} resetsettings-item">
|
||||
<div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_resetsettings_text</div></div>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.userSettingsModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -181,7 +159,7 @@ class EditUsers {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -314,11 +292,6 @@ class EditUsers {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.userContextEntryMarkup = this.userContextEntryMarkup.replace("REPLACE_context_localusersettings_text", this.labels.context_localusersettings_text);
|
||||
|
||||
this.userContextSubMenuMarkup = this.userContextSubMenuMarkup.replace("REPLACE_submenu_usersettings_text", this.labels.submenu_usersettings_text);
|
||||
this.userContextSubMenuMarkup = this.userContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
|
||||
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_username_text", this.labels.modal_username_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_usertag_text", this.labels.modal_usertag_text);
|
||||
|
@ -332,36 +305,46 @@ class EditUsers {
|
|||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_btn_cancel_text", this.labels.btn_cancel_text);
|
||||
this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
|
||||
}
|
||||
|
||||
onUserContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(".localusersettings-item")) {
|
||||
let userContextEntry = BDFDB.htmlToElement(this.userContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(userContextEntry, devgroup);
|
||||
else menu.appendChild(userContextEntry, menu);
|
||||
let settingsitem = userContextEntry.querySelector(".localusersettings-item");
|
||||
settingsitem.addEventListener("mouseenter", () => {
|
||||
let userContextSubMenu = BDFDB.htmlToElement(this.userContextSubMenuMarkup);
|
||||
let useritem = userContextSubMenu.querySelector(".usersettings-item");
|
||||
useritem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showUserSettings(instance.props.user);
|
||||
});
|
||||
if (BDFDB.loadData(instance.props.user.id, this, "users")) {
|
||||
let resetitem = userContextSubMenu.querySelector(".resetsettings-item");
|
||||
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
resetitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.user.id, this, "users");
|
||||
this.changeAppTitle();
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(settingsitem, userContextSubMenu);
|
||||
|
||||
onUserContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_localusersettings_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-usersettings-contextMenuSubItem`,
|
||||
render: [BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_usersettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-usersettings-ContextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showUserSettings(instance.props.user);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_resetsettings_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
|
||||
disabled: !BDFDB.loadData(instance.props.user.id, this, "users"),
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
BDFDB.removeData(instance.props.user.id, this, "users");
|
||||
this.changeAppTitle();
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
})
|
||||
]
|
||||
})]
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,7 +396,7 @@ class EditUsers {
|
|||
});
|
||||
userurlinput.addEventListener("mouseleave", () => {
|
||||
BDFDB.removeClass(userurlinput, "hovering");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.itemlayerconainer + ".notice-tooltip");
|
||||
});
|
||||
BDFDB.addChildEventListener(userSettingsModal, "click", ".btn-save", e => {
|
||||
name = usernameinput.value.trim();
|
||||
|
@ -447,7 +430,7 @@ class EditUsers {
|
|||
}
|
||||
|
||||
checkUrl (input) {
|
||||
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
|
||||
BDFDB.removeEles(BDFDB.dotCNS.itemlayerconainer + ".notice-tooltip");
|
||||
if (!input.value) {
|
||||
BDFDB.removeClass(input, "valid");
|
||||
BDFDB.removeClass(input, "invalid");
|
||||
|
@ -476,7 +459,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
let channel = BDFDB.getReactValue(instance, "props.channel");
|
||||
if (channel) {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
|
@ -527,7 +510,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processMemberListItem (instance, wrapper) {
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.memberusername);
|
||||
if (username) {
|
||||
this.changeName(instance.props.user, username);
|
||||
|
@ -536,7 +519,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCNC.userpopoutheadertagusernamenonickname + BDFDB.dotCN.userpopoutheadernickname);
|
||||
if (username) {
|
||||
this.changeName(instance.props.user, username);
|
||||
|
@ -545,7 +528,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper) {
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.userprofileusername);
|
||||
if (username) {
|
||||
this.changeName(instance.props.user, username);
|
||||
|
@ -554,7 +537,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processFriendRow (instance, wrapper) {
|
||||
processFriendRow (instance, wrapper, returnvalue) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.friendsusername);
|
||||
if (username) {
|
||||
this.changeName(instance.props.user, username);
|
||||
|
@ -562,7 +545,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processVoiceUser (instance, wrapper) {
|
||||
processVoiceUser (instance, wrapper, returnvalue) {
|
||||
let user = instance.props.user;
|
||||
if (user && wrapper.className) {
|
||||
this.changeVoiceUser(user, wrapper.querySelector(BDFDB.dotCN.voicename), instance.props.speaking);
|
||||
|
@ -570,7 +553,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processAccount (instance, wrapper) {
|
||||
processAccount (instance, wrapper, returnvalue) {
|
||||
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.child.stateNode.props.currentUser");
|
||||
if (user) {
|
||||
this.changeName(user, wrapper.querySelector(BDFDB.dotCN.accountinfodetails).firstElementChild);
|
||||
|
@ -578,7 +561,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper) {
|
||||
processMessageUsername (instance, wrapper, returnvalue) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
|
@ -592,7 +575,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processAuditLog (instance, wrapper) {
|
||||
processAuditLog (instance, wrapper, returnvalue) {
|
||||
let log = BDFDB.getReactValue(instance, "props.log");
|
||||
if (log && log.user) {
|
||||
let hooks = wrapper.querySelectorAll(BDFDB.dotCN.auditloguserhook);
|
||||
|
@ -602,7 +585,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processBannedCard (instance, wrapper) {
|
||||
processBannedCard (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && instance.props.guild) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsbannedusername);
|
||||
if (username) {
|
||||
|
@ -612,7 +595,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processInviteCard (instance, wrapper) {
|
||||
processInviteCard (instance, wrapper, returnvalue) {
|
||||
let invite = BDFDB.getReactValue(instance, "props.invite");
|
||||
if (invite && invite.inviter && invite.guild) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsinviteusername);
|
||||
|
@ -623,7 +606,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processMemberCard (instance, wrapper) {
|
||||
processMemberCard (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && instance.props.guild) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsmembername);
|
||||
if (username) {
|
||||
|
@ -633,7 +616,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processInvitationCard (instance, wrapper) {
|
||||
processInvitationCard (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.invitemodalinviterowname);
|
||||
if (username) {
|
||||
|
@ -643,14 +626,14 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processTypingUsers (instance, wrapper) {
|
||||
processTypingUsers (instance, wrapper, returnvalue) {
|
||||
let users = !instance.props.typingUsers ? [] : Object.keys(instance.props.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(id => id != null);
|
||||
wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
|
||||
if (users[i] && username) this.changeName2(users[i], username);
|
||||
});
|
||||
}
|
||||
|
||||
processDirectMessage (instance, wrapper) {
|
||||
processDirectMessage (instance, wrapper, returnvalue) {
|
||||
let channel = BDFDB.getReactValue(instance, "props.channel");
|
||||
if (channel && channel.type == 1) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
|
@ -664,7 +647,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processCallAvatar (instance, wrapper) {
|
||||
processCallAvatar (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.id) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.id);
|
||||
if (!user) {
|
||||
|
@ -680,30 +663,30 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processVideoTile (instance, wrapper) {
|
||||
processVideoTile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user) this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
|
||||
}
|
||||
|
||||
processPictureInPictureVideo (instance, wrapper) {
|
||||
processPictureInPictureVideo (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.backgroundKey) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.backgroundKey);
|
||||
if (user) this.changeAvatar(user, this.getAvatarDiv(wrapper));
|
||||
}
|
||||
}
|
||||
|
||||
processPrivateChannel (instance, wrapper) {
|
||||
processPrivateChannel (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.dmchannelname);
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.namecontainername);
|
||||
this.changePrivateChannel(instance.props.user, username && username.firstElementChild ? username.firstElementChild : username);
|
||||
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
|
||||
}
|
||||
}
|
||||
|
||||
processHeaderBarContainer (instance, wrapper) {
|
||||
processHeaderBarContainer (instance, wrapper, returnvalue) {
|
||||
this.processHeaderBar(instance, wrapper);
|
||||
}
|
||||
|
||||
processHeaderBar (instance, wrapper) {
|
||||
processHeaderBar (instance, wrapper, returnvalue) {
|
||||
let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
|
||||
if (channel_id) {
|
||||
let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle);
|
||||
|
@ -725,7 +708,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processClickable (instance, wrapper) {
|
||||
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) {
|
||||
|
@ -767,7 +750,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processMessageContent (instance, wrapper) {
|
||||
processMessageContent (instance, wrapper, returnvalue) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message && message.author) {
|
||||
let markup = wrapper.querySelector(BDFDB.dotCN.messagemarkup);
|
||||
|
@ -780,7 +763,7 @@ class EditUsers {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.changeAppTitle();
|
||||
|
@ -972,7 +955,7 @@ class EditUsers {
|
|||
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.dmchannelselected)) colorHover();
|
||||
if (username.EditUsersHovered || BDFDB.containsClass(dmchannel, BDFDB.disCN.namecontainerselected)) colorHover();
|
||||
else colorDefault();
|
||||
|
||||
if (data.name || data.color1 || data.color2) {
|
||||
|
@ -1280,9 +1263,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL ignorirati",
|
||||
modal_ignoretagcolor_text: "Upotrijebite boju uloga",
|
||||
modal_validurl_text: "Vrijedi URL",
|
||||
modal_invalidurl_text: "Nevažeći URL",
|
||||
btn_cancel_text: "Prekid",
|
||||
btn_save_text: "Uštedjeti"
|
||||
modal_invalidurl_text: "Nevažeći URL"
|
||||
};
|
||||
case "da": //danish
|
||||
return {
|
||||
|
@ -1304,9 +1285,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorer URL",
|
||||
modal_ignoretagcolor_text: "Brug rollefarve",
|
||||
modal_validurl_text: "Gyldig URL",
|
||||
modal_invalidurl_text: "Ugyldig URL",
|
||||
btn_cancel_text: "Afbryde",
|
||||
btn_save_text: "Spare"
|
||||
modal_invalidurl_text: "Ugyldig URL"
|
||||
};
|
||||
case "de": //german
|
||||
return {
|
||||
|
@ -1328,9 +1307,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL ignorieren",
|
||||
modal_ignoretagcolor_text: "Benutze Rollenfarbe",
|
||||
modal_validurl_text: "Gültige URL",
|
||||
modal_invalidurl_text: "Ungültige URL",
|
||||
btn_cancel_text: "Abbrechen",
|
||||
btn_save_text: "Speichern"
|
||||
modal_invalidurl_text: "Ungültige URL"
|
||||
};
|
||||
case "es": //spanish
|
||||
return {
|
||||
|
@ -1352,9 +1329,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorar URL",
|
||||
modal_ignoretagcolor_text: "Usar color de rol",
|
||||
modal_validurl_text: "URL válida",
|
||||
modal_invalidurl_text: "URL inválida",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Guardar"
|
||||
modal_invalidurl_text: "URL inválida"
|
||||
};
|
||||
case "fr": //french
|
||||
return {
|
||||
|
@ -1376,9 +1351,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorer l'URL",
|
||||
modal_ignoretagcolor_text: "Utiliser la couleur de rôle",
|
||||
modal_validurl_text: "URL valide",
|
||||
modal_invalidurl_text: "URL invalide",
|
||||
btn_cancel_text: "Abandonner",
|
||||
btn_save_text: "Enregistrer"
|
||||
modal_invalidurl_text: "URL invalide"
|
||||
};
|
||||
case "it": //italian
|
||||
return {
|
||||
|
@ -1400,9 +1373,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignora l'URL",
|
||||
modal_ignoretagcolor_text: "Usa il colore del ruolo",
|
||||
modal_validurl_text: "URL valido",
|
||||
modal_invalidurl_text: "URL non valido",
|
||||
btn_cancel_text: "Cancellare",
|
||||
btn_save_text: "Salvare"
|
||||
modal_invalidurl_text: "URL non valido"
|
||||
};
|
||||
case "nl": //dutch
|
||||
return {
|
||||
|
@ -1424,9 +1395,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL negeren",
|
||||
modal_ignoretagcolor_text: "Gebruik rolkleur",
|
||||
modal_validurl_text: "Geldige URL",
|
||||
modal_invalidurl_text: "Ongeldige URL",
|
||||
btn_cancel_text: "Afbreken",
|
||||
btn_save_text: "Opslaan"
|
||||
modal_invalidurl_text: "Ongeldige URL"
|
||||
};
|
||||
case "no": //norwegian
|
||||
return {
|
||||
|
@ -1448,9 +1417,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorer URL",
|
||||
modal_ignoretagcolor_text: "Bruk rollefarge",
|
||||
modal_validurl_text: "Gyldig URL",
|
||||
modal_invalidurl_text: "Ugyldig URL",
|
||||
btn_cancel_text: "Avbryte",
|
||||
btn_save_text: "Lagre"
|
||||
modal_invalidurl_text: "Ugyldig URL"
|
||||
};
|
||||
case "pl": //polish
|
||||
return {
|
||||
|
@ -1472,9 +1439,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignoruj URL",
|
||||
modal_ignoretagcolor_text: "Użyj kolor roli",
|
||||
modal_validurl_text: "Prawidłowe URL",
|
||||
modal_invalidurl_text: "Nieprawidłowe URL",
|
||||
btn_cancel_text: "Anuluj",
|
||||
btn_save_text: "Zapisz"
|
||||
modal_invalidurl_text: "Nieprawidłowe URL"
|
||||
};
|
||||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
|
@ -1496,9 +1461,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorar URL",
|
||||
modal_ignoretagcolor_text: "Use a cor do papel",
|
||||
modal_validurl_text: "URL válido",
|
||||
modal_invalidurl_text: "URL inválida",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_save_text: "Salvar"
|
||||
modal_invalidurl_text: "URL inválida"
|
||||
};
|
||||
case "fi": //finnish
|
||||
return {
|
||||
|
@ -1520,9 +1483,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ohita URL",
|
||||
modal_ignoretagcolor_text: "Käytä rooliväriä",
|
||||
modal_validurl_text: "Voimassa URL",
|
||||
modal_invalidurl_text: "Virheellinen URL",
|
||||
btn_cancel_text: "Peruuttaa",
|
||||
btn_save_text: "Tallentaa"
|
||||
modal_invalidurl_text: "Virheellinen URL"
|
||||
};
|
||||
case "sv": //swedish
|
||||
return {
|
||||
|
@ -1544,9 +1505,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorera URL",
|
||||
modal_ignoretagcolor_text: "Använd rollfärg",
|
||||
modal_validurl_text: "Giltig URL",
|
||||
modal_invalidurl_text: "Ogiltig URL",
|
||||
btn_cancel_text: "Avbryta",
|
||||
btn_save_text: "Spara"
|
||||
modal_invalidurl_text: "Ogiltig URL"
|
||||
};
|
||||
case "tr": //turkish
|
||||
return {
|
||||
|
@ -1568,9 +1527,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL yoksay",
|
||||
modal_ignoretagcolor_text: "Rol rengini kullan",
|
||||
modal_validurl_text: "Geçerli URL",
|
||||
modal_invalidurl_text: "Geçersiz URL",
|
||||
btn_cancel_text: "Iptal",
|
||||
btn_save_text: "Kayıt"
|
||||
modal_invalidurl_text: "Geçersiz URL"
|
||||
};
|
||||
case "cs": //czech
|
||||
return {
|
||||
|
@ -1592,9 +1549,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignorovat URL",
|
||||
modal_ignoretagcolor_text: "Použijte barva role",
|
||||
modal_validurl_text: "Platná URL",
|
||||
modal_invalidurl_text: "Neplatná URL",
|
||||
btn_cancel_text: "Zrušení",
|
||||
btn_save_text: "Uložit"
|
||||
modal_invalidurl_text: "Neplatná URL"
|
||||
};
|
||||
case "bg": //bulgarian
|
||||
return {
|
||||
|
@ -1616,9 +1571,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Игнориране на URL",
|
||||
modal_ignoretagcolor_text: "Използвайте цвят на ролите",
|
||||
modal_validurl_text: "Валиден URL",
|
||||
modal_invalidurl_text: "Невалиден URL",
|
||||
btn_cancel_text: "Зъбести",
|
||||
btn_save_text: "Cпасяване"
|
||||
modal_invalidurl_text: "Невалиден URL"
|
||||
};
|
||||
case "ru": //russian
|
||||
return {
|
||||
|
@ -1640,9 +1593,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Игнорировать URL",
|
||||
modal_ignoretagcolor_text: "Использовать цвет ролей",
|
||||
modal_validurl_text: "Действительный URL",
|
||||
modal_invalidurl_text: "Неверная URL",
|
||||
btn_cancel_text: "Отмена",
|
||||
btn_save_text: "Cпасти"
|
||||
modal_invalidurl_text: "Неверная URL"
|
||||
};
|
||||
case "uk": //ukrainian
|
||||
return {
|
||||
|
@ -1664,9 +1615,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ігнорувати URL",
|
||||
modal_ignoretagcolor_text: "Використовуйте рольовий колір",
|
||||
modal_validurl_text: "Дійсна URL",
|
||||
modal_invalidurl_text: "Недійсна URL",
|
||||
btn_cancel_text: "Скасувати",
|
||||
btn_save_text: "Зберегти"
|
||||
modal_invalidurl_text: "Недійсна URL"
|
||||
};
|
||||
case "ja": //japanese
|
||||
return {
|
||||
|
@ -1688,9 +1637,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL を無視する",
|
||||
modal_ignoretagcolor_text: "ロールカラーを使用する",
|
||||
modal_validurl_text: "有効な URL",
|
||||
modal_invalidurl_text: "無効な URL",
|
||||
btn_cancel_text: "キャンセル",
|
||||
btn_save_text: "セーブ"
|
||||
modal_invalidurl_text: "無効な URL"
|
||||
};
|
||||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
|
@ -1712,9 +1659,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "忽略 URL",
|
||||
modal_ignoretagcolor_text: "使用角色",
|
||||
modal_validurl_text: "有效的 URL",
|
||||
modal_invalidurl_text: "無效的 URL",
|
||||
btn_cancel_text: "取消",
|
||||
btn_save_text: "保存"
|
||||
modal_invalidurl_text: "無效的 URL"
|
||||
};
|
||||
case "ko": //korean
|
||||
return {
|
||||
|
@ -1736,9 +1681,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "URL 무시",
|
||||
modal_ignoretagcolor_text: "역할 색상 사용",
|
||||
modal_validurl_text: "유효한 URL",
|
||||
modal_invalidurl_text: "잘못된 URL",
|
||||
btn_cancel_text: "취소",
|
||||
btn_save_text: "저장"
|
||||
modal_invalidurl_text: "잘못된 URL"
|
||||
};
|
||||
default: //default: english
|
||||
return {
|
||||
|
@ -1760,9 +1703,7 @@ class EditUsers {
|
|||
modal_ignoreurl_text: "Ignore URL",
|
||||
modal_ignoretagcolor_text: "Use Rolecolor",
|
||||
modal_validurl_text: "Valid URL",
|
||||
modal_invalidurl_text: "Invalid URL",
|
||||
btn_cancel_text: "Cancel",
|
||||
btn_save_text: "Save"
|
||||
modal_invalidurl_text: "Invalid URL"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class EmojiStatistics {
|
||||
getName () {return "EmojiStatistics";}
|
||||
|
||||
getVersion () {return "2.8.4";}
|
||||
getVersion () {return "2.8.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class EmojiStatistics {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Context Menu & Tooltips","fixed"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -105,7 +105,7 @@ class EmojiStatistics {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -125,7 +125,7 @@ class EmojiStatistics {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-ok ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_ok_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -202,7 +202,7 @@ class EmojiStatistics {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -224,8 +224,6 @@ class EmojiStatistics {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.GuildEmojis = BDFDB.WebModules.findByProperties("getGuildEmoji", "getDisambiguatedEmojiContext");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -245,8 +243,6 @@ class EmojiStatistics {
|
|||
|
||||
changeLanguageStrings () {
|
||||
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
|
||||
this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
|
||||
|
||||
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesicon-label", this.labels.modal_titlesicon_text);
|
||||
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesname_text", this.labels.modal_titlesname_text);
|
||||
|
@ -256,7 +252,7 @@ class EmojiStatistics {
|
|||
this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlescopies_text", this.labels.modal_titlescopies_text);
|
||||
}
|
||||
|
||||
processEmojiPicker (instance, wrapper) {
|
||||
processEmojiPicker (instance, wrapper, returnvalue) {
|
||||
if (!wrapper.querySelector(".emojistatistics-button")) {
|
||||
let emojipickerdiversityselector = document.querySelector(BDFDB.dotCN.emojipickerdiversityselector);
|
||||
if (!emojipickerdiversityselector) return;
|
||||
|
@ -287,7 +283,7 @@ class EmojiStatistics {
|
|||
this.emojiReplicaList = {};
|
||||
this.emojiToServerList = {};
|
||||
for (let serverObj of BDFDB.readServerList()) {
|
||||
for (let emoji of this.GuildEmojis.getGuildEmoji(serverObj.id)) {
|
||||
for (let emoji of BDFDB.LibraryModules.GuildEmojiStore.getGuildEmoji(serverObj.id)) {
|
||||
this.emojiToServerList[emoji.url] = {emoji:emoji.allNamesString, server:serverObj.name};
|
||||
if (emoji.managed) this.emojiReplicaList[emoji.name] = this.emojiReplicaList[emoji.name] != undefined;
|
||||
}
|
||||
|
@ -324,7 +320,7 @@ class EmojiStatistics {
|
|||
|
||||
for (let info of BDFDB.readServerList()) {
|
||||
let amountGlobal = 0, amountLocal = 0, amountCopies = 0;
|
||||
for (let emoji of this.GuildEmojis.getGuildEmoji(info.id)) {
|
||||
for (let emoji of BDFDB.LibraryModules.GuildEmojiStore.getGuildEmoji(info.id)) {
|
||||
if (emoji.managed) {
|
||||
amountGlobal++;
|
||||
if (this.emojiReplicaList[emoji.name]) amountCopies++;
|
||||
|
@ -379,8 +375,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Cjelokupni:",
|
||||
modal_titlesglobal_text: "Globalno:",
|
||||
modal_titleslocal_text: "Kokalne:",
|
||||
modal_titlescopies_text: "Kopije:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopije:"
|
||||
};
|
||||
case "da": //danish
|
||||
return {
|
||||
|
@ -390,8 +385,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Lokal:",
|
||||
modal_titlescopies_text: "Copies:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Copies:"
|
||||
};
|
||||
case "de": //german
|
||||
return {
|
||||
|
@ -401,8 +395,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Gesamt:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Lokal:",
|
||||
modal_titlescopies_text: "Kopien:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopien:"
|
||||
};
|
||||
case "es": //spanish
|
||||
return {
|
||||
|
@ -412,8 +405,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Local:",
|
||||
modal_titlescopies_text: "Copias:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Copias:"
|
||||
};
|
||||
case "fr": //french
|
||||
return {
|
||||
|
@ -423,8 +415,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Local:",
|
||||
modal_titlescopies_text: "Copies:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Copies:"
|
||||
};
|
||||
case "it": //italian
|
||||
return {
|
||||
|
@ -434,8 +425,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Totale:",
|
||||
modal_titlesglobal_text: "Globale:",
|
||||
modal_titleslocal_text: "Locale:",
|
||||
modal_titlescopies_text: "Copie:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Copie:"
|
||||
};
|
||||
case "nl": //dutch
|
||||
return {
|
||||
|
@ -445,8 +435,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Totaal:",
|
||||
modal_titlesglobal_text: "Globaal:",
|
||||
modal_titleslocal_text: "Lokaal:",
|
||||
modal_titlescopies_text: "Kopieën:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopieën:"
|
||||
};
|
||||
case "no": //norwegian
|
||||
return {
|
||||
|
@ -456,8 +445,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Lokal:",
|
||||
modal_titlescopies_text: "Kopier:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopier:"
|
||||
};
|
||||
case "pl": //polish
|
||||
return {
|
||||
|
@ -467,8 +455,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Całkowity:",
|
||||
modal_titlesglobal_text: "Światowy:",
|
||||
modal_titleslocal_text: "Lokalny:",
|
||||
modal_titlescopies_text: "Kopie:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopie:"
|
||||
};
|
||||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
|
@ -478,8 +465,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Local:",
|
||||
modal_titlescopies_text: "Cópias:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Cópias:"
|
||||
};
|
||||
case "fi": //finnish
|
||||
return {
|
||||
|
@ -489,8 +475,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Koko:",
|
||||
modal_titlesglobal_text: "Globaali:",
|
||||
modal_titleslocal_text: "Paikallinen:",
|
||||
modal_titlescopies_text: "Kopiot:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopiot:"
|
||||
};
|
||||
case "sv": //swedish
|
||||
return {
|
||||
|
@ -500,8 +485,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Lokal:",
|
||||
modal_titlescopies_text: "Kopior:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopior:"
|
||||
};
|
||||
case "tr": //turkish
|
||||
return {
|
||||
|
@ -511,8 +495,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Toplam:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Yerel:",
|
||||
modal_titlescopies_text: "Kopya:",
|
||||
btn_ok_text: "Okey"
|
||||
modal_titlescopies_text: "Kopya:"
|
||||
};
|
||||
case "cs": //czech
|
||||
return {
|
||||
|
@ -522,8 +505,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Celkový:",
|
||||
modal_titlesglobal_text: "Globální:",
|
||||
modal_titleslocal_text: "Místní:",
|
||||
modal_titlescopies_text: "Kopie:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Kopie:"
|
||||
};
|
||||
case "bg": //bulgarian
|
||||
return {
|
||||
|
@ -533,8 +515,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Oбщо:",
|
||||
modal_titlesglobal_text: "Cветовен:",
|
||||
modal_titleslocal_text: "Mестен:",
|
||||
modal_titlescopies_text: "Копия:",
|
||||
btn_ok_text: "Добре"
|
||||
modal_titlescopies_text: "Копия:"
|
||||
};
|
||||
case "ru": //russian
|
||||
return {
|
||||
|
@ -544,8 +525,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Всего:",
|
||||
modal_titlesglobal_text: "Mировой:",
|
||||
modal_titleslocal_text: "Местный:",
|
||||
modal_titlescopies_text: "Копии:",
|
||||
btn_ok_text: "ОК"
|
||||
modal_titlescopies_text: "Копии:"
|
||||
};
|
||||
case "uk": //ukrainian
|
||||
return {
|
||||
|
@ -555,8 +535,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Всього:",
|
||||
modal_titlesglobal_text: "Cвітовий:",
|
||||
modal_titleslocal_text: "Місцевий:",
|
||||
modal_titlescopies_text: "Копії:",
|
||||
btn_ok_text: "Добре"
|
||||
modal_titlescopies_text: "Копії:"
|
||||
};
|
||||
case "ja": //japanese
|
||||
return {
|
||||
|
@ -566,8 +545,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "合計:",
|
||||
modal_titlesglobal_text: "グローバル:",
|
||||
modal_titleslocal_text: "地元:",
|
||||
modal_titlescopies_text: "コピー:",
|
||||
btn_ok_text: "はい"
|
||||
modal_titlescopies_text: "コピー:"
|
||||
};
|
||||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
|
@ -577,8 +555,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "總:",
|
||||
modal_titlesglobal_text: "全球:",
|
||||
modal_titleslocal_text: "本地:",
|
||||
modal_titlescopies_text: "副本:",
|
||||
btn_ok_text: "好"
|
||||
modal_titlescopies_text: "副本:"
|
||||
};
|
||||
case "ko": //korean
|
||||
return {
|
||||
|
@ -588,8 +565,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "합계:",
|
||||
modal_titlesglobal_text: "글로벌:",
|
||||
modal_titleslocal_text: "지방의:",
|
||||
modal_titlescopies_text: "사본:",
|
||||
btn_ok_text: "승인"
|
||||
modal_titlescopies_text: "사본:"
|
||||
};
|
||||
default: //default: english
|
||||
return {
|
||||
|
@ -599,8 +575,7 @@ class EmojiStatistics {
|
|||
modal_titlestotal_text: "Total:",
|
||||
modal_titlesglobal_text: "Global:",
|
||||
modal_titleslocal_text: "Local:",
|
||||
modal_titlescopies_text: "Copies:",
|
||||
btn_ok_text: "OK"
|
||||
modal_titlescopies_text: "Copies:"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ForceImagePreviews {
|
||||
getName () {return "ForceImagePreviews";}
|
||||
|
||||
getVersion () {return "1.1.2";}
|
||||
getVersion () {return "1.1.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ForceImagePreviews {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["GIFs","Fixed the issue where gifs would be forced as a preview even tho the native preview was rendered"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -37,7 +37,7 @@ class ForceImagePreviews {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -76,7 +76,7 @@ class ForceImagePreviews {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processMessage (instance, wrapper) {
|
||||
processMessage (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.message) {
|
||||
let accessory = wrapper.querySelector(BDFDB.dotCN.messageaccessory);
|
||||
if (accessory) {
|
||||
|
@ -101,7 +101,7 @@ class ForceImagePreviews {
|
|||
else if (item.embedded) this.addItemToAccessory(item, links, accessory);
|
||||
else {
|
||||
let itemsrc = this.parseSrc(item.src);
|
||||
require("request")(itemsrc, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(itemsrc, (error, response, result) => {
|
||||
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") > -1) {
|
||||
let imagethrowaway = document.createElement("img");
|
||||
imagethrowaway.src = itemsrc;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class FriendNotifications {
|
||||
getName () {return "FriendNotifications";}
|
||||
|
||||
getVersion () {return "1.2.7";}
|
||||
getVersion () {return "1.2.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,9 +11,9 @@ class FriendNotifications {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Canary/PTB","Fixed bugs for complete new look in canary/ptb"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
|
||||
this.patchModules = {
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ class FriendNotifications {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">Friends LogIn/-Out Timelog</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">Friends LogIn/-Out Timelog</h4>
|
||||
</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}">
|
||||
|
@ -155,7 +155,7 @@ class FriendNotifications {
|
|||
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
|
||||
let amounts = BDFDB.getAllData(this, "amounts");
|
||||
|
||||
let friendIDs = this.FriendUtils.getFriendIDs();
|
||||
let friendIDs = BDFDB.LibraryModules.FriendUtils.getFriendIDs();
|
||||
let friends = BDFDB.loadAllData(this, "friends");
|
||||
let nonfriends = BDFDB.loadAllData(this, "nonfriends");
|
||||
|
||||
|
@ -172,7 +172,7 @@ class FriendNotifications {
|
|||
for (let config in this.defaults.notificationstrings) settingshtml += `<div class="${BDFDB.disCNS.margintop8 + BDFDB.disCNS.tableheadersize + BDFDB.disCNS.size10 + BDFDB.disCNS.primary + BDFDB.disCNS.weightbold + BDFDB.disCN.cursorpointer} BDFDB-tableheadercolumn" config="${config}" group="friends">${config.toUpperCase()}</div>`;
|
||||
settingshtml += `</div></div><div class="BDFDB-settings-inner-list friend-list ${BDFDB.disCN.marginbottom8}">`;
|
||||
for (let id of friendIDs) {
|
||||
let user = this.UserUtils.getUser(id);
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
if (user) {
|
||||
let friend = friends[id] || (friends[id] = nonfriends[id] || this.createDefaultConfig());
|
||||
settingshtml += this.createHoverCard(user, friend, "friends");
|
||||
|
@ -189,7 +189,7 @@ class FriendNotifications {
|
|||
for (let config in this.defaults.notificationstrings) settingshtml += `<div class="${BDFDB.disCNS.margintop8 + BDFDB.disCNS.tableheadersize + BDFDB.disCNS.size10 + BDFDB.disCNS.primary + BDFDB.disCNS.weightbold + BDFDB.disCN.cursorpointer} BDFDB-tableheadercolumn" config="${config}" group="nonfriends">${config.toUpperCase()}</div>`;
|
||||
settingshtml += `</div></div><div class="BDFDB-settings-inner-list nonfriend-list ${BDFDB.disCN.marginbottom8}">`;
|
||||
for (let id in nonfriends) if (!friendIDs.includes(id)) {
|
||||
let user = this.UserUtils.getUser(id);
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
if (user) {
|
||||
let nonfriend = nonfriends[id] || (nonfriends[id] = this.createDefaultConfig());
|
||||
settingshtml += this.createHoverCard(user, nonfriend, "nonfriends");
|
||||
|
@ -266,7 +266,7 @@ class FriendNotifications {
|
|||
if (friendIDs.includes(id)) BDFDB.showToast("User is already a friend of yours. Please use the 'Friends' area to configure him/her.", {type:"error"});
|
||||
else if (BDFDB.loadData(id, this, "nonfriends")) BDFDB.showToast("User is already being observed as a 'Non-Friend'.", {type:"error"});
|
||||
else {
|
||||
let user = this.UserUtils.getUser(id);
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
if (user) {
|
||||
let data = this.createDefaultConfig();
|
||||
BDFDB.saveData(user.id, data, this, "nonfriends");
|
||||
|
@ -302,7 +302,7 @@ class FriendNotifications {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -324,15 +324,6 @@ class FriendNotifications {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.FriendUtils = BDFDB.WebModules.findByProperties("getFriendIDs", "getRelationships");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getDMFromUserId");
|
||||
this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
|
||||
this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("openPrivateChannel");
|
||||
this.MobileUtils = BDFDB.WebModules.findByProperties("isMobileOnline");
|
||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUsers");
|
||||
this.APIUtils = BDFDB.WebModules.findByProperties("getAPIBaseURL");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
|
||||
/* REMOVE AFTER SOME TIME - 22.08.2019 */
|
||||
let oldFriendDataDesktop = BDFDB.loadAllData("FriendNotifications", "desktop");
|
||||
let oldFriendDataDisabled = BDFDB.loadAllData("FriendNotifications", "disabled");
|
||||
|
@ -349,7 +340,7 @@ class FriendNotifications {
|
|||
let nonfriends = BDFDB.loadAllData(this, "nonfriends")
|
||||
for (let id in oldStalkerData) nonfriends[id] = Object.assign(this.createDefaultConfig(), oldStalkerData[id]);
|
||||
BDFDB.saveAllData(nonfriends, this, "nonfriends");
|
||||
require("fs").unlinkSync(require("path").join(BDFDB.getPluginsFolder(), "StalkerNotifications.config.json"));
|
||||
BDFDB.LibraryRequires.fs.unlinkSync(BDFDB.LibraryRequires.path.join(BDFDB.getPluginsFolder(), "StalkerNotifications.config.json"));
|
||||
}
|
||||
|
||||
this.startInterval();
|
||||
|
@ -468,7 +459,7 @@ class FriendNotifications {
|
|||
successSavedAudio(url, url);
|
||||
}
|
||||
else if (url.indexOf("http") == 0) {
|
||||
require("request")(url, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(url, (error, response, result) => {
|
||||
if (response) {
|
||||
let type = response.headers["content-type"];
|
||||
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) {
|
||||
|
@ -480,7 +471,7 @@ class FriendNotifications {
|
|||
});
|
||||
}
|
||||
else {
|
||||
require("fs").readFile(url, (error, response) => {
|
||||
BDFDB.LibraryRequires.fs.readFile(url, (error, response) => {
|
||||
if (error) BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
|
||||
else successSavedAudio(url, `data:audio/mpeg;base64,${response.toString("base64")}`);
|
||||
});
|
||||
|
@ -488,7 +479,7 @@ class FriendNotifications {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.startInterval();
|
||||
|
@ -497,7 +488,7 @@ class FriendNotifications {
|
|||
|
||||
getStatusWithMobile (id) {
|
||||
let status = BDFDB.getUserStatus(id);
|
||||
return status == "online" && this.MobileUtils.isMobileOnline(id) ? "mobile" : status;
|
||||
return status == "online" && BDFDB.LibraryModules.StatusMetaUtils.isMobileOnline(id) ? "mobile" : status;
|
||||
}
|
||||
|
||||
startInterval () {
|
||||
|
@ -509,7 +500,7 @@ class FriendNotifications {
|
|||
for (let id in users) this.userStatusStore[id] = this.getStatusWithMobile(id);
|
||||
this.checkInterval = setInterval(() => {
|
||||
for (let id in users) if (!users[id].disabled) {
|
||||
let user = this.UserUtils.getUser(id);
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let status = this.getStatusWithMobile(id);
|
||||
if (user && this.userStatusStore[id] != status && users[id][status]) {
|
||||
let EUdata = BDFDB.loadData(user.id, "EditUsers", "users") || {};
|
||||
|
@ -521,10 +512,10 @@ class FriendNotifications {
|
|||
if (!(settings.muteOnDND && BDFDB.getUserStatus() == "dnd")) {
|
||||
let openChannel = () => {
|
||||
if (settings.openOnClick) {
|
||||
let DMid = this.ChannelUtils.getDMFromUserId(user.id)
|
||||
if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid);
|
||||
else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id);
|
||||
require("electron").remote.getCurrentWindow().maximize();
|
||||
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
||||
if (DMid) BDFDB.LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
|
||||
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.myData.id, user.id);
|
||||
BDFDB.LibraryRequires.electron.remote.getCurrentWindow().maximize();
|
||||
}
|
||||
};
|
||||
if (!users[id].desktop) {
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
class GoogleSearchReplace {
|
||||
getName () {return "GoogleSearchReplace";}
|
||||
|
||||
getVersion () {return "1.1.8";}
|
||||
getVersion () {return "1.1.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Replaces the default Google Text Search with a selection menu of several search engines.";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
}
|
||||
|
||||
|
@ -35,23 +39,6 @@ class GoogleSearchReplace {
|
|||
YouTube: {value:true, name:"YouTube", url:"https://www.youtube.com/results?q=" + this.textUrlReplaceString}
|
||||
}
|
||||
};
|
||||
|
||||
this.messageContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitem} googlereplacesearch-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_googlesearchreplace_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>`;
|
||||
|
||||
this.messageContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} googlereplacesearch-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} alldisabled-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_disabled_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
${Object.keys(this.defaults.engines).map((key, i) => `<div engine="${key}" class="${BDFDB.disCN.contextmenuitem} GRS-item"><span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${this.defaults.engines[key].name}</div></span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`).join("")}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
getSettingsPanel () {
|
||||
|
@ -90,7 +77,7 @@ class GoogleSearchReplace {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -126,48 +113,46 @@ class GoogleSearchReplace {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.messageContextEntryMarkup = this.messageContextEntryMarkup.replace("REPLACE_context_googlesearchreplace_text", this.labels.context_googlesearchreplace_text);
|
||||
|
||||
this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.type == "NATIVE_TEXT" && instance.props.value && !menu.querySelector(".reverseimagesearch-item")) {
|
||||
let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
|
||||
if (searchentry) this.appendItem(searchentry, instance.props.value);
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.type == "NATIVE_TEXT" && instance.props.value && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
this.appendItem(menu, returnvalue, instance.props.value);
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".googlereplacesearch-item")) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let text = document.getSelection().toString();
|
||||
if (text) {
|
||||
let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
|
||||
if (searchentry) this.appendItem(searchentry, text);
|
||||
}
|
||||
if (text) this.appendItem(menu, returnvalue, text);
|
||||
}
|
||||
}
|
||||
|
||||
appendItem (target, text) {
|
||||
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
|
||||
target.parentElement.insertBefore(messageContextEntry, target.nextElementSibling);
|
||||
messageContextEntry.addEventListener("mouseenter", () => {
|
||||
let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
|
||||
let engines = BDFDB.getAllData(this, "engines");
|
||||
for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
|
||||
if (messageContextSubMenu.querySelector(".GRS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
|
||||
BDFDB.addChildEventListener(messageContextSubMenu, "click", ".GRS-item", e => {
|
||||
BDFDB.closeContextMenu(target);
|
||||
let engine = e.currentTarget.getAttribute("engine");
|
||||
if (engine == "_all") {
|
||||
for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
|
||||
appendItem (menu, returnvalue, text) {
|
||||
let engines = BDFDB.getAllData(this, "engines");
|
||||
let items = [];
|
||||
for (let key in engines) if (engines[key]) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.defaults.engines[key].name,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-engine-contextMenuItem`,
|
||||
action: e => {
|
||||
if (!e.shiftKey) BDFDB.closeContextMenu(menu);
|
||||
if (key == "_all") {
|
||||
for (let key2 in engines) if (key2 != "_all" && engines[key2]) window.open(this.defaults.engines[key2].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
|
||||
}
|
||||
else window.open(this.defaults.engines[engine].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
|
||||
});
|
||||
BDFDB.appendSubMenu(messageContextEntry, messageContextSubMenu);
|
||||
else window.open(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
|
||||
}
|
||||
}));
|
||||
if (!items.length) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_disabled_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-disabled-contextMenuItem`,
|
||||
disabled: true
|
||||
}));
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, "SearchWithGoogle");
|
||||
const item = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_googlesearchreplace_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-search-contextMenuSubItem`,
|
||||
render: items
|
||||
});
|
||||
BDFDB.toggleEles(target, false);
|
||||
if (index > -1) children.splice(index, 1, item);
|
||||
else children.push(item);
|
||||
}
|
||||
|
||||
setLabelsByLanguage () {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class GoogleTranslateOption {
|
||||
getName () {return "GoogleTranslateOption";}
|
||||
|
||||
getVersion () {return "1.7.3";}
|
||||
getVersion () {return "1.7.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class GoogleTranslateOption {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Embeds","Fixed the bug where some parts of an embed would vanish if the message above is translated"],["Translating/Untranslating Bug","Translating/Untranslating no longer breaks the features of native discord elements (clicking the username, spoilers, etc.)"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -19,7 +19,7 @@ class GoogleTranslateOption {
|
|||
this.patchModules = {
|
||||
"ChannelTextArea":"componentDidMount",
|
||||
"Message":"componentDidMount",
|
||||
"MessageOptionPopout":"componentDidMount",
|
||||
"MessageContent":"componentDidMount",
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
};
|
||||
}
|
||||
|
@ -51,43 +51,9 @@ class GoogleTranslateOption {
|
|||
}
|
||||
};
|
||||
|
||||
this.messageTranslateContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} googletranslateoption-item googletranslateoption-translate-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_messagetranslateoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.messageUntranslateContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} googletranslateoption-item googletranslateoption-untranslate-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_messageuntranslateoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.messageSearchContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} googletranslateoption-item googletranslateoption-search-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_googletranslateoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.popoutTranslateEntryMarkup =
|
||||
`<button type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} googletranslateoption-itembtn googletranslateoption-translate-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_translateoption_text</div>
|
||||
</button>`;
|
||||
|
||||
this.popoutUntranslateEntryMarkup =
|
||||
`<button type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} googletranslateoption-itembtn googletranslateoption-untranslate-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_untranslateoption_text</div>
|
||||
</button>`;
|
||||
|
||||
this.translateButtonMarkup =
|
||||
`<button type="button" class="${BDFDB.disCNS.textareabuttonwrapper + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} translate-button-wrapper">
|
||||
<div class="${BDFDB.disCNS.buttoncontents + BDFDB.disCNS.textareabutton + BDFDB.disCN.textareapickerbutton} translate-button-inner">
|
||||
`<button type="button" class="${BDFDB.disCNS.textareabuttonwrapper + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} translate-button">
|
||||
<div class="${BDFDB.disCNS.buttoncontents + BDFDB.disCNS.textareabutton + BDFDB.disCN.textareapickerbutton}">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="${BDFDB.disCN.textareaicon}" viewBox="0 0 22 22" fill="currentColor">
|
||||
<path d="M 19.794, 3.299 H 9.765 L 8.797, 0 h -6.598 C 0.99, 0, 0, 0.99, 0, 2.199 V 16.495 c 0, 1.21, 0.99, 2.199, 2.199, 2.199 H 9.897 l 1.1, 3.299 H 19.794 c 1.21, 0, 2.199 -0.99, 2.199 -2.199 V 5.498 C 21.993, 4.289, 21.003, 3.299, 19.794, 3.299 z M 5.68, 13.839 c -2.48, 0 -4.492 -2.018 -4.492 -4.492 s 2.018 -4.492, 4.492 -4.492 c 1.144, 0, 2.183, 0.407, 3.008, 1.171 l 0.071, 0.071 l -1.342, 1.298 l -0.066 -0.06 c -0.313 -0.297 -0.858 -0.643 -1.671 -0.643 c -1.441, 0 -2.612, 1.193 -2.612, 2.661 c 0, 1.468, 1.171, 2.661, 2.612, 2.661 c 1.507, 0, 2.161 -0.962, 2.337 -1.606 h -2.43 v -1.704 h 4.344 l 0.016, 0.077 c 0.044, 0.231, 0.06, 0.434, 0.06, 0.665 C 10.001, 12.036, 8.225, 13.839, 5.68, 13.839 z M 11.739, 9.979 h 4.393 c 0, 0 -0.374, 1.446 -1.715, 3.008 c -0.588 -0.676 -0.995 -1.336 -1.254 -1.864 h -1.089 L 11.739, 9.979 z M 13.625, 13.839 l -0.588, 0.583 l -0.72 -2.452 C 12.685, 12.63, 13.13, 13.262, 13.625, 13.839 z M 20.893, 19.794 c 0, 0.605 -0.495, 1.1 -1.1, 1.1 H 12.096 l 2.199 -2.199 l -0.896 -3.041 l 1.012 -1.012 l 2.953, 2.953 l 0.803 -0.803 l -2.975 -2.953 c 0.99 -1.138, 1.759 -2.474, 2.106 -3.854 h 1.397 V 8.841 H 14.697 v -1.144 h -1.144 v 1.144 H 11.398 l -1.309 -4.443 H 19.794 c 0.605, 0, 1.1, 0.495, 1.1, 1.1 V 19.794 z"/>
|
||||
</svg>
|
||||
|
@ -110,7 +76,7 @@ class GoogleTranslateOption {
|
|||
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.choices[key].description}</h3>
|
||||
${this.defaults.choices[key].direction == "Output" ? this.reverseButtonMarkup.replace("REPLACETYPE",key) : ""}
|
||||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">${BDFDB.createSelectMenu(`<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;"></div>`, this.defaults.choices[key].value, key)}</div>`).join("")}
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">${BDFDB.createSelectMenu(`<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;"></div>`, this.defaults.choices[key].value, key)}</div>`).join("")}
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">
|
||||
<h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Translate:</h3>
|
||||
<div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCNS.switchthemedefault + BDFDB.disCN.switchvalueunchecked}" style="flex: 0 0 auto;">
|
||||
|
@ -129,19 +95,9 @@ class GoogleTranslateOption {
|
|||
bottom: 0;
|
||||
right: 9px;
|
||||
}
|
||||
${BDFDB.dotCN.textareabuttonwrapper}.popout-open ${BDFDB.dotCN.textareabutton}.translate-button-inner {
|
||||
opacity: 1;
|
||||
}
|
||||
${BDFDB.dotCN.textareabuttonwrapper + BDFDB.dotCNS.textareabuttonactive + BDFDB.dotCN.textareabutton}.translate-button-inner {
|
||||
${BDFDB.dotCN.textareabuttonwrapper}.translate-button.translating-active ${BDFDB.dotCN.textareaicon} {
|
||||
color: #F04747 !important;
|
||||
}
|
||||
${BDFDB.dotCNS.textareabuttonwrapper + BDFDB.dotCN.textareabutton}.translate-button-inner ${BDFDB.dotCN.textareaicon} {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
${BDFDB.dotCN.textareabuttonwrapper}.popout-open ${BDFDB.dotCN.textareabutton}.translate-button-inner ${BDFDB.dotCN.textareaicon} {
|
||||
transform: none;
|
||||
}
|
||||
.reverse-button {
|
||||
margin-top: -5px;
|
||||
opacity: 0.2;
|
||||
|
@ -167,13 +123,13 @@ class GoogleTranslateOption {
|
|||
border-radius: 3px 3px 0 0 !important;
|
||||
margin-top: 1px !important;
|
||||
}
|
||||
${BDFDB.dotCN.message}.GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} {
|
||||
${BDFDB.dotCN.messagegroup} .GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} {
|
||||
font-size: 0 !important;
|
||||
}
|
||||
${BDFDB.dotCN.message}.GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} > .GTO-translation {
|
||||
font-size: 0.9375rem !important;
|
||||
${BDFDB.dotCN.messagegroup} .GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} > .GTO-translation {
|
||||
font-size: 1rem !important;
|
||||
}
|
||||
${BDFDB.dotCN.message}.GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} > :not(.GTO-translation)${BDFDB.notCN.messageheadercompact + BDFDB.notCN.messageedited} {
|
||||
${BDFDB.dotCN.messagegroup} .GTO-translated-message ${BDFDB.dotCNS.messagebody + BDFDB.dotCN.messagemarkup} > :not(.GTO-translation)${BDFDB.notCN.messageheadercompact + BDFDB.notCN.messageedited} {
|
||||
display: none !important;
|
||||
}`;
|
||||
}
|
||||
|
@ -223,7 +179,7 @@ class GoogleTranslateOption {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -245,11 +201,6 @@ class GoogleTranslateOption {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
|
||||
this.setLanguage();
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -261,11 +212,11 @@ class GoogleTranslateOption {
|
|||
|
||||
stop () {
|
||||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
document.querySelectorAll(BDFDB.dotCN.message + ".GTO-translated-message").forEach(message => {
|
||||
document.querySelectorAll(BDFDB.dotCN.messagegroup + " .GTO-translated-message").forEach(message => {
|
||||
this.resetMessage(message);
|
||||
});
|
||||
|
||||
BDFDB.removeEles(".translate-button-wrapper", ".popout-googletranslate");
|
||||
BDFDB.removeEles(".translate-button", ".popout-googletranslate");
|
||||
|
||||
BDFDB.unloadMessage(this);
|
||||
}
|
||||
|
@ -274,57 +225,77 @@ class GoogleTranslateOption {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.messageTranslateContextEntryMarkup = this.messageTranslateContextEntryMarkup.replace("REPLACE_context_messagetranslateoption_text", this.labels.context_messagetranslateoption_text);
|
||||
this.messageUntranslateContextEntryMarkup = this.messageUntranslateContextEntryMarkup.replace("REPLACE_context_messageuntranslateoption_text", this.labels.context_messageuntranslateoption_text);
|
||||
this.messageSearchContextEntryMarkup = this.messageSearchContextEntryMarkup.replace("REPLACE_context_googletranslateoption_text", this.labels.context_googletranslateoption_text);
|
||||
|
||||
this.popoutTranslateEntryMarkup = this.popoutTranslateEntryMarkup.replace("REPLACE_popout_translateoption_text", this.labels.popout_translateoption_text);
|
||||
this.popoutUntranslateEntryMarkup = this.popoutUntranslateEntryMarkup.replace("REPLACE_popout_untranslateoption_text", this.labels.popout_untranslateoption_text);
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".googletranslateoption-item")) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
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 pinentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"MessagePinItem"}));
|
||||
let messageTranslateContextEntry = BDFDB.htmlToElement(BDFDB.containsClass(messagediv, "GTO-translated-message") ? this.messageUntranslateContextEntryMarkup : this.messageTranslateContextEntryMarkup);
|
||||
if (pinentry) pinentry.parentElement.insertBefore(messageTranslateContextEntry, pinentry.nextElementSibling);
|
||||
else menu.insertBefore(messageTranslateContextEntry, menu.firstElementChild);
|
||||
let translateitem = messageTranslateContextEntry.querySelector(".googletranslateoption-item");
|
||||
translateitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
|
||||
let translated = BDFDB.containsClass(messagediv, "GTO-translated-message");
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, "MessagePinItem");
|
||||
const translateUntranslateItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
|
||||
hint: BDFDB.isPluginEnabled("MessageUtilities") ? window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Translate_Message") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${translated ? "untranslate" : "translate"}-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
|
||||
}
|
||||
});
|
||||
if (BDFDB.isPluginEnabled("MessageUtilities")) {
|
||||
BDFDB.setContextHint(translateitem, window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Translate_Message"));
|
||||
}
|
||||
if (index > -1) children.splice(index, 0, translateUntranslateItem);
|
||||
else children.push(translateUntranslateItem);
|
||||
let text = document.getSelection().toString();
|
||||
if (text) {
|
||||
let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
|
||||
if (searchentry) {
|
||||
let messageSearchContextEntry = BDFDB.htmlToElement(this.messageSearchContextEntryMarkup);
|
||||
searchentry.parentElement.appendChild(messageSearchContextEntry);
|
||||
let searchitem = messageSearchContextEntry.querySelector(".googletranslateoption-search-item");
|
||||
searchitem.addEventListener("mouseenter", e => {
|
||||
this.translateText(text, "context", (translation, input, output) => {
|
||||
if (translation) {
|
||||
var openGoogleSearch = () => {
|
||||
let GSRstring = BDFDB.getReactValue(bdplugins, "GoogleSearchReplace.plugin.labels.context_googlesearchreplace_text");
|
||||
let [children2, index2] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, GSRstring ? ["SearchWithGoogle", GSRstring] : "SearchWithGoogle");
|
||||
var foundtranslation, foundinput, foundoutput;
|
||||
const searchTranslationItem = BDFDB.React.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);
|
||||
if (item) {
|
||||
var createTooltip = () => {
|
||||
BDFDB.createTooltip(`From ${foundinput.name}:\n${text}\n\nTo ${foundoutput.name}:\n${foundtranslation}`, item, {type:"right", selector:"googletranslate-tooltip"});
|
||||
};
|
||||
if (foundtranslation && foundinput && foundoutput) {
|
||||
if (document.querySelector(".googletranslate-tooltip")) {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
window.open(this.getGoogleTranslatePageURL(input.id, output.id, text), "_blank");
|
||||
};
|
||||
searchitem.removeEventListener("click", openGoogleSearch);
|
||||
searchitem.addEventListener("click", openGoogleSearch);
|
||||
let rects = BDFDB.getRects(searchitem);
|
||||
BDFDB.createTooltip(`From ${input.name}:\n${text}\n\nTo ${output.name}:\n${translation}`, searchitem, {type: "right",selector:"googletranslate-tooltip",style:`max-width: ${window.outerWidth - rects.left - rects.width}px !important;`});
|
||||
window.open(this.getGoogleTranslatePageURL(foundinput.id, foundoutput.id, text), "_blank");
|
||||
}
|
||||
else createTooltip();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else this.translateText(text, "context", (translation, input, output) => {
|
||||
if (translation) {
|
||||
foundtranslation = translation, foundinput = input, foundoutput = output;
|
||||
createTooltip();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (index2 > -1) children2.splice(index2, 0, searchTranslationItem);
|
||||
else children2.push(searchTranslationItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMessageOptionPopout (instance, popout, returnvalue) {
|
||||
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 [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, [BDFDB.LanguageStrings.PIN, BDFDB.LanguageStrings.UNPIN]);
|
||||
const translateUntranslateItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[translated ? "popout_untranslateoption_text" : "popout_translateoption_text"],
|
||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-${translated ? "untranslate" : "translate"}-popoutMenuItem`,
|
||||
action: e => {
|
||||
this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
|
||||
instance.props.onClose();
|
||||
}
|
||||
});
|
||||
children.splice(index + 1, 0, translateUntranslateItem);
|
||||
}
|
||||
}
|
||||
|
||||
setLanguage () {
|
||||
this.languages = Object.assign({},
|
||||
{"auto": {name:"Auto", id:"auto", integrated:false, dic:false}},
|
||||
|
@ -344,17 +315,17 @@ class GoogleTranslateOption {
|
|||
return choice;
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.setLanguage();
|
||||
BDFDB.removeEles(".translate-button-wrapper");
|
||||
BDFDB.removeEles(".translate-button");
|
||||
BDFDB.WebModules.forceAllUpdates(this, "ChannelTextArea");
|
||||
}
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
if (instance.props && instance.props.type && instance.props.type == "normal" && !instance.props.disabled && !wrapper.querySelector(".translate-button-wrapper") && BDFDB.getData("addTranslateButton", this, "settings")) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.type && instance.props.type == "normal" && !instance.props.disabled && !wrapper.querySelector(".translate-button") && BDFDB.getData("addTranslateButton", this, "settings")) {
|
||||
let textarea = wrapper.querySelector("textarea");
|
||||
if (textarea) {
|
||||
var buttoncontainer = wrapper.querySelector(BDFDB.dotCN.textareapickerbuttons);
|
||||
|
@ -365,11 +336,11 @@ class GoogleTranslateOption {
|
|||
});
|
||||
translateButton.addEventListener("contextmenu", () => {
|
||||
this.translating = !this.translating;
|
||||
BDFDB.toggleClass(document.querySelectorAll(BDFDB.dotCNS.textareawrapchat + ".translate-button-wrapper"), BDFDB.disCN.textareabuttonactive, this.translating);
|
||||
BDFDB.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, BDFDB.disCN.textareabuttonactive, this.translating);
|
||||
BDFDB.toggleClass(translateButton, "translating-active", this.translating);
|
||||
BDFDB.addEventListener(this, textarea, "input", () => {
|
||||
if (this.doTranslate) {
|
||||
this.doTranslate = false;
|
||||
|
@ -398,33 +369,27 @@ class GoogleTranslateOption {
|
|||
}
|
||||
}
|
||||
|
||||
processMessage (instance, wrapper) {
|
||||
processMessage (instance, wrapper, returnvalue) {
|
||||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.getReactValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.optionpopoutbutton}"></div>`);
|
||||
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>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processMessageOptionPopout (instance, wrapper) {
|
||||
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".googletranslateoption-itembtn")) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.memoizedProps.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let popoutTranslateEntry = BDFDB.htmlToElement(BDFDB.containsClass(messagediv, "GTO-translated-message") ? this.popoutUntranslateEntryMarkup : this.popoutTranslateEntryMarkup);
|
||||
wrapper.appendChild(popoutTranslateEntry);
|
||||
popoutTranslateEntry.addEventListener("click", () => {
|
||||
this.translateMessage(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
|
||||
instance.props.onClose();
|
||||
});
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
getMessageAndPos (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
|
||||
let messagediv = BDFDB.getParentEle(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};
|
||||
}
|
||||
|
||||
|
@ -432,7 +397,7 @@ class GoogleTranslateOption {
|
|||
if (!message || !target) return;
|
||||
let {messagediv, pos} = this.getMessageAndPos(target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
|
||||
channel = channel ? channel : BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (!messagediv.querySelector(BDFDB.dotCN.messageedited + ".GTO-translated")) {
|
||||
var markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup);
|
||||
var fakemarkup = markup.cloneNode(true);
|
||||
|
@ -497,7 +462,7 @@ class GoogleTranslateOption {
|
|||
finishTranslation(newtext, exceptions, input, output, toast);
|
||||
}
|
||||
else {
|
||||
require("request")(this.getGoogleTranslateApiURL(input.id, output.id, newtext), (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(this.getGoogleTranslateApiURL(input.id, output.id, newtext), (error, response, result) => {
|
||||
if (!error && result) {
|
||||
try {
|
||||
result = JSON.parse(result);
|
||||
|
@ -632,8 +597,8 @@ class GoogleTranslateOption {
|
|||
|
||||
openTranslatePopout (button) {
|
||||
let container = document.querySelector(BDFDB.dotCN.popouts);
|
||||
if (!container || BDFDB.containsClass(button, "popout-open")) return;
|
||||
BDFDB.addClass(button, "popout-open");
|
||||
if (!container || BDFDB.containsClass(button, BDFDB.disCN.textareabuttonactive)) return;
|
||||
BDFDB.addClass(button, BDFDB.disCN.textareabuttonactive);
|
||||
let translatepopout = BDFDB.htmlToElement(this.translatePopoutMarkup);
|
||||
container.appendChild(translatepopout);
|
||||
let buttonrects = BDFDB.getRects(button);
|
||||
|
@ -669,7 +634,7 @@ class GoogleTranslateOption {
|
|||
var translatecheckbox = translatepopout.querySelector("#translating-checkbox");
|
||||
translatecheckbox.checked = this.translating;
|
||||
translatecheckbox.addEventListener("click", () => {
|
||||
BDFDB.toggleClass(button, BDFDB.disCN.textareabuttonactive, translatecheckbox.checked);
|
||||
BDFDB.toggleClass(button, "translating-active", translatecheckbox.checked);
|
||||
this.translating = translatecheckbox.checked;
|
||||
});
|
||||
|
||||
|
@ -677,7 +642,7 @@ class GoogleTranslateOption {
|
|||
if (!translatepopout.contains(e.target)) {
|
||||
document.removeEventListener("mousedown", removePopout);
|
||||
translatepopout.remove();
|
||||
setTimeout(() => {BDFDB.removeClass(button, "popout-open");},300);
|
||||
setTimeout(() => {BDFDB.removeClass(button, BDFDB.disCN.textareabuttonactive);},300);
|
||||
}
|
||||
};
|
||||
document.addEventListener("mousedown", removePopout);
|
||||
|
@ -693,7 +658,7 @@ class GoogleTranslateOption {
|
|||
}
|
||||
|
||||
createSelectChoice (key) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;">${this.languages[key].name}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="flex: 1 1 auto;">${this.languages[key].name}</div>`;
|
||||
}
|
||||
|
||||
getGoogleTranslateApiURL (input, output, text) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ImageGallery {
|
||||
getName () {return "ImageGallery";}
|
||||
|
||||
getVersion () {return "1.5.8";}
|
||||
getVersion () {return "1.5.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ImageGallery {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Prev/Next Image","Fixed bug where the previou/next image would sometimes be doubled with the current image on the first/last image"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -57,7 +57,7 @@ class ImageGallery {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -104,7 +104,7 @@ class ImageGallery {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processImageModal (instance, wrapper, methodnames) {
|
||||
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);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class JoinedAtDate {
|
||||
getName () {return "JoinedAtDate";}
|
||||
|
||||
getVersion () {return "1.1.2";}
|
||||
getVersion () {return "1.1.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class JoinedAtDate {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -47,7 +47,6 @@ class JoinedAtDate {
|
|||
color: hsla(0,0%,100%,.6);
|
||||
}`;
|
||||
|
||||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
addInUserPopout: {value:true, description:"Add in User Popouts:"},
|
||||
|
@ -119,7 +118,7 @@ class JoinedAtDate {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -141,10 +140,6 @@ class JoinedAtDate {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.CurrentGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.APIModule = BDFDB.WebModules.findByProperties("getAPIBaseURL");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -196,16 +191,16 @@ class JoinedAtDate {
|
|||
}
|
||||
|
||||
createSelectChoice (choice) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightlight + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
|
||||
this.addJoinedAtDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
|
||||
}
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper) {
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
|
||||
this.addJoinedAtDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
|
||||
}
|
||||
|
@ -213,7 +208,7 @@ class JoinedAtDate {
|
|||
|
||||
addJoinedAtDate (info, container, popout) {
|
||||
if (!info || info.discriminator == "0000" || !container || container.querySelector(".joinedAtDate")) return;
|
||||
let guildid = this.CurrentGuildStore.getGuildId();
|
||||
let guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
if (guildid) {
|
||||
if (!this.loadedusers[guildid]) this.loadedusers[guildid] = {};
|
||||
let addTimestamp = (timestamp) => {
|
||||
|
@ -235,7 +230,7 @@ class JoinedAtDate {
|
|||
}
|
||||
};
|
||||
if (this.loadedusers[guildid][info.id]) addTimestamp(this.loadedusers[guildid][info.id]);
|
||||
else this.APIModule.get(this.DiscordConstants.Endpoints.GUILD_MEMBER(guildid,info.id)).then(result => {
|
||||
else BDFDB.LibraryModules.APIUtils.get(BDFDB.DiscordConstants.Endpoints.GUILD_MEMBER(guildid,info.id)).then(result => {
|
||||
if (result && result.body) {
|
||||
let joineddate = new Date(result.body.joined_at);
|
||||
this.loadedusers[guildid][info.id] = joineddate;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class LastMessageDate {
|
||||
getName () {return "LastMessageDate";}
|
||||
|
||||
getVersion () {return "1.0.6";}
|
||||
getVersion () {return "1.0.7";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class LastMessageDate {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Showing at top","Fixed issue where dates would be listed at the top in the profile the first time a profile was opened or when a custom status is set"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -119,7 +119,7 @@ class LastMessageDate {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -141,14 +141,9 @@ class LastMessageDate {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.CurrentGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.CurrentChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
this.APIModule = BDFDB.WebModules.findByProperties("getAPIBaseURL");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}}, BDFDB.languages);
|
||||
|
||||
this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
|
||||
|
||||
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("receiveMessage"), "receiveMessage", this, {after: e => {
|
||||
BDFDB.WebModules.patch(BDFDB.LibraryModules.MessageUtils, "receiveMessage", this, {after: e => {
|
||||
let message = e.methodArguments[1];
|
||||
let guildid = message.guild_id || message.channel_id;
|
||||
if (guildid && this.loadedusers[guildid] && this.loadedusers[guildid][message.author.id]) this.loadedusers[guildid][message.author.id] = new Date(message.timestamp);
|
||||
|
@ -203,16 +198,16 @@ class LastMessageDate {
|
|||
}
|
||||
|
||||
createSelectChoice (choice) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer} languageName" style="flex: 1 1 42%; padding: 0;">${this.languages[choice].name}</div><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightlight + BDFDB.disCN.cursorpointer} languageTimestamp" style="flex: 1 1 58%; padding: 0;">${this.getTimestamp(this.languages[choice].id)}</div>`;
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
|
||||
this.addLastMessageDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
|
||||
}
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper) {
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
|
||||
this.addLastMessageDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
|
||||
}
|
||||
|
@ -220,9 +215,9 @@ class LastMessageDate {
|
|||
|
||||
addLastMessageDate (info, container, popout) {
|
||||
if (!info || info.discriminator == "0000" || !container || container.querySelector(".lastMessageDate")) return;
|
||||
let guildid = this.CurrentGuildStore.getGuildId();
|
||||
let guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
let isguild = !!guildid;
|
||||
guildid = guildid || this.CurrentChannelStore.getChannelId();
|
||||
guildid = guildid || BDFDB.LibraryModules.LastChannelStore.getChannelId();
|
||||
if (guildid) {
|
||||
if (!this.loadedusers[guildid]) this.loadedusers[guildid] = {};
|
||||
let addTimestamp = (timestamp) => {
|
||||
|
@ -244,7 +239,7 @@ class LastMessageDate {
|
|||
}
|
||||
};
|
||||
if (this.loadedusers[guildid][info.id]) addTimestamp(this.loadedusers[guildid][info.id]);
|
||||
else this.APIModule.get((isguild ? this.DiscordConstants.Endpoints.SEARCH_GUILD(guildid) : this.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildid)) + "?author_id=" + info.id).then(result => {
|
||||
else BDFDB.LibraryModules.APIUtils.get((isguild ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(guildid) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildid)) + "?author_id=" + info.id).then(result => {
|
||||
if (result && result.body && result.body.messages && Array.isArray(result.body.messages[0])) {
|
||||
for (let message of result.body.messages[0]) if (message.hit && message.author.id == info.id) {
|
||||
let lastmessagedate = new Date(message.timestamp);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class MessageUtilities {
|
||||
getName () {return "MessageUtilities";}
|
||||
|
||||
getVersion () {return "1.5.1";}
|
||||
getVersion () {return "1.5.2";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class MessageUtilities {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class MessageUtilities {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -132,14 +132,10 @@ class MessageUtilities {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||
this.MessageActions = BDFDB.WebModules.findByProperties("startEditMessage", "endEditMessage");
|
||||
this.PinActions = BDFDB.WebModules.findByProperties("pinMessage", "unpinMessage");
|
||||
|
||||
BDFDB.addEventListener(this, document, "click", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
|
||||
BDFDB.addEventListener(this, document, "click", BDFDB.dotCN.messagegroup + "> [aria-disabled]," + BDFDB.dotCN.messagesystem, e => {
|
||||
this.onClick(e, 0, "onSglClick");
|
||||
})
|
||||
BDFDB.addEventListener(this, document, "dblclick", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
|
||||
BDFDB.addEventListener(this, document, "dblclick", BDFDB.dotCN.messagegroup + "> [aria-disabled]," + BDFDB.dotCN.messagesystem, e => {
|
||||
this.onClick(e, 1, "onDblClick");
|
||||
});
|
||||
BDFDB.addEventListener(this, document, "keydown", BDFDB.dotCN.textareawrapchat, e => {
|
||||
|
@ -190,7 +186,7 @@ class MessageUtilities {
|
|||
}
|
||||
|
||||
createSelectChoice (key) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${this.clickMap[key]}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${this.clickMap[key]}</div>`;
|
||||
}
|
||||
|
||||
startRecording (settingspanel, e) {
|
||||
|
@ -272,16 +268,16 @@ class MessageUtilities {
|
|||
let deletelink = messagediv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotmessage + BDFDB.dotCN.anchor);
|
||||
if (deletelink) deletelink.click();
|
||||
else {
|
||||
let channel = this.ChannelUtils.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if ((channel && BDFDB.isUserAllowedTo("MANAGE_MESSAGES")) || message.author.id == BDFDB.myData.id && message.type != 1 && message.type != 2 && message.type != 3) {
|
||||
this.MessageActions.deleteMessage(message.channel_id, message.id, message.state != "SENT");
|
||||
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != "SENT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doEdit ({messagediv, pos, message}) {
|
||||
if (message.author.id == BDFDB.myData.id && !messagediv.querySelector("textarea")) {
|
||||
this.MessageActions.startEditMessage(message.channel_id, message.id, message.content);
|
||||
BDFDB.LibraryModules.MessageUtils.startEditMessage(message.channel_id, message.id, message.content);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,24 +288,24 @@ class MessageUtilities {
|
|||
|
||||
doPinUnPin ({messagediv, pos, message}) {
|
||||
if (message.state == "SENT") {
|
||||
let channel = this.ChannelUtils.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && (channel.type == 1 || channel.type == 3 || BDFDB.isUserAllowedTo("MANAGE_MESSAGES")) && message.type == 0) {
|
||||
if (message.pinned) this.PinActions.unpinMessage(channel, message.id);
|
||||
else this.PinActions.pinMessage(channel, message.id);
|
||||
if (message.pinned) BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
|
||||
else BDFDB.LibraryModules.MessagePinUtils.pinMessage(channel, message.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doNote ({messagediv, pos, message}) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
|
||||
let channel = this.ChannelUtils.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) window.bdplugins[this.defaults.bindings.__Note_Message.plugin].plugin.addMessageToNotes(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doTranslate ({messagediv, pos, message}) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
|
||||
let channel = this.ChannelUtils.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) window.bdplugins[this.defaults.bindings.__Translate_Message.plugin].plugin.translateMessage(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
@ -358,8 +354,8 @@ class MessageUtilities {
|
|||
}
|
||||
|
||||
getMessageData (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target) || BDFDB.getParentEle(BDFDB.dotCN.messagesystem, target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem)).indexOf(messagediv) : -1;
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target) || BDFDB.getParentEle(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.getReactInstance(messagediv);
|
||||
let message = instance ? BDFDB.getKeyInformation({instance, key:"message", up:true}) : null;
|
||||
return {messagediv, pos, message};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class NotificationSounds {
|
||||
getName () {return "NotificationSounds";}
|
||||
|
||||
getVersion () {return "3.3.4";}
|
||||
getVersion () {return "3.3.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class NotificationSounds {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Go Live","Maybe fix the Go Live Bug, maybe not"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -210,7 +210,7 @@ class NotificationSounds {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -232,18 +232,15 @@ class NotificationSounds {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.ChannelSettingsUtils = BDFDB.WebModules.findByProperties("isGuildOrCategoryOrChannelMuted");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
|
||||
BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("receiveMessage"), "receiveMessage", this, {before: e => {
|
||||
BDFDB.WebModules.patch(BDFDB.LibraryModules.MessageUtils, "receiveMessage", this, {before: e => {
|
||||
let message = e.methodArguments[1];
|
||||
let guildid = message.guild_id ? message.guild_id : null;
|
||||
if (!this.ChannelSettingsUtils.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) {
|
||||
if (!guildid && !(this.choices.dm.focus && document.hasFocus() && this.LastChannelStore.getChannelId() == message.channel_id)) {
|
||||
if (!BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) {
|
||||
if (!guildid && !(this.choices.dm.focus && document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == message.channel_id)) {
|
||||
this.fireEvent("dm");
|
||||
this.playAudio("dm");
|
||||
}
|
||||
else if (message.mentions && !(this.choices.mentioned.focus && document.hasFocus() && this.LastChannelStore.getChannelId() == message.channel_id)) {
|
||||
else if (message.mentions && !(this.choices.mentioned.focus && document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == message.channel_id)) {
|
||||
for (let mention of message.mentions) if (mention.id == BDFDB.myData.id) {
|
||||
this.fireEvent("mentioned");
|
||||
this.playAudio("mentioned");
|
||||
|
@ -253,8 +250,7 @@ class NotificationSounds {
|
|||
}
|
||||
}});
|
||||
|
||||
var SoundUtils = BDFDB.WebModules.findByProperties("playSound", "createSound");
|
||||
BDFDB.WebModules.patch(SoundUtils, "playSound", this, {instead: e => {
|
||||
BDFDB.WebModules.patch(BDFDB.LibraryModules.SoundUtils, "playSound", this, {instead: e => {
|
||||
let type = e.methodArguments[0];
|
||||
if (this.choices[type]) setImmediate(() => {
|
||||
if (type == "message1") {
|
||||
|
@ -266,7 +262,7 @@ class NotificationSounds {
|
|||
});
|
||||
else e.callOriginalMethod();
|
||||
}});
|
||||
BDFDB.WebModules.patch(SoundUtils, "createSound", this, {after: e => {
|
||||
BDFDB.WebModules.patch(BDFDB.LibraryModules.SoundUtils, "createSound", this, {after: e => {
|
||||
let type = e.methodArguments[0];
|
||||
let audio = new Audio();
|
||||
audio.src = this.choices[type].src;
|
||||
|
@ -332,7 +328,7 @@ class NotificationSounds {
|
|||
this.choices[type][option] = selection;
|
||||
if (option == "category") {
|
||||
this.choices[type].song = Object.keys(this.audios[selection])[0];
|
||||
songSelect.outerHTML = `<div type="${type}" option="song" value="${this.choices[type].song}" class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="padding:0;">${this.choices[type].song}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div>`;
|
||||
songSelect.outerHTML = `<div type="${type}" option="song" value="${this.choices[type].song}" class="${BDFDB.disCNS.select + BDFDB.disCNS.selectsingle + BDFDB.disCN.selecthasvalue}"><div class="${BDFDB.disCN.selectcontrol}"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.selectvalue}" style="flex: 1 1 auto;"><div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}" style="padding:0;">${this.choices[type].song}</div></div><span class="${BDFDB.disCN.selectarrowzone}"><span class="${BDFDB.disCN.selectarrow}"></span></span></div></div>`;
|
||||
}
|
||||
this.choices[type].src = this.audios[this.choices[type].category][this.choices[type].song];
|
||||
this.choices[type].src = this.choices[type].src ? this.choices[type].src : this.types[type].src;
|
||||
|
@ -354,7 +350,7 @@ class NotificationSounds {
|
|||
var menuhtml = `<div class="${BDFDB.disCN.selectmenuouter}"><div class="${BDFDB.disCN.selectmenu}">`;
|
||||
for (var ele in eles) {
|
||||
var isSelected = this.choices[type][option] == ele ? ` ${BDFDB.disCN.selectselected}` : ``;
|
||||
menuhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + 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.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCN.weightnormal}">${ele}</div></div>`
|
||||
menuhtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + 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);
|
||||
|
@ -378,7 +374,7 @@ class NotificationSounds {
|
|||
}
|
||||
|
||||
createSelectChoice (key) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${key}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding: 0;">${key}</div>`;
|
||||
}
|
||||
|
||||
dragSlider (settingspanel, e) {
|
||||
|
@ -436,7 +432,7 @@ class NotificationSounds {
|
|||
var song = settingspanel.querySelector("#input-song").value;
|
||||
var url = settingspanel.querySelector("#input-url").value;
|
||||
if (url.indexOf("http") == 0) {
|
||||
require("request")(url, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(url, (error, response, result) => {
|
||||
if (response) {
|
||||
var type = response.headers["content-type"];
|
||||
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) {
|
||||
|
@ -448,7 +444,7 @@ class NotificationSounds {
|
|||
});
|
||||
}
|
||||
else {
|
||||
require("fs").readFile(url, (error, response) => {
|
||||
BDFDB.LibraryRequires.fs.readFile(url, (error, response) => {
|
||||
if (error) {
|
||||
BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
|
||||
}
|
||||
|
@ -518,7 +514,7 @@ class NotificationSounds {
|
|||
setTimeout(() => {this.firedEvents[type] = false;},3000);
|
||||
}
|
||||
|
||||
processIncomingCalls (instance, wrapper) {
|
||||
processIncomingCalls (instance, wrapper, returnvalue) {
|
||||
let audio = new Audio();
|
||||
let play = () => {
|
||||
if (!audio.paused || this.dontPlayAudio("call_ringing")) return;
|
||||
|
@ -534,7 +530,7 @@ class NotificationSounds {
|
|||
BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "stopRinging", this, {instead: stop});
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.settingsaudio.pause();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class OldTitleBar {
|
||||
getName () {return "OldTitleBar";}
|
||||
|
||||
getVersion () {return "1.5.7";}
|
||||
getVersion () {return "1.5.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class OldTitleBar {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Mac OSX","Fixed the plugin for Mac OSX"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -35,7 +35,7 @@ class OldTitleBar {
|
|||
margin-top: 0;
|
||||
}
|
||||
|
||||
.hidden-by-OTB .platform-osx ${BDFDB.dotCN.guilds} {
|
||||
.hidden-by-OTB .platform-osx ${BDFDB.dotCN.guildsscroller} {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,8 @@ class OldTitleBar {
|
|||
if (this.patched) {
|
||||
notifybar = BDFDB.createNotificationsBar("Changed nativebar settings, relaunch to see changes:", {type:"danger",btn:"Relaunch",id:"OldTitleBarNotifyBar"});
|
||||
notifybar.querySelector(BDFDB.dotCN.noticebutton).addEventListener("click", () => {
|
||||
let app = require("electron").remote.app;
|
||||
app.relaunch();
|
||||
app.quit();
|
||||
BDFDB.LibraryRequires.electron.remote.app.relaunch();
|
||||
BDFDB.LibraryRequires.electron.remote.app.quit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +144,7 @@ class OldTitleBar {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -171,7 +170,7 @@ class OldTitleBar {
|
|||
this.changeMaximizeButtons();
|
||||
});
|
||||
|
||||
this.window = require("electron").remote.getCurrentWindow();
|
||||
this.window = BDFDB.LibraryRequires.electron.remote.getCurrentWindow();
|
||||
|
||||
this.patchMainScreen(BDFDB.getData("displayNative", this, "settings"));
|
||||
|
||||
|
@ -198,19 +197,19 @@ class OldTitleBar {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processHeaderBar (instance, wrapper) {
|
||||
processHeaderBar (instance, wrapper, returnvalue) {
|
||||
this.addTitleBar();
|
||||
}
|
||||
|
||||
processHeaderBarContainer (instance, wrapper) {
|
||||
processHeaderBarContainer (instance, wrapper, returnvalue) {
|
||||
this.addTitleBar();
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper, methodnames) {
|
||||
this.processAuthWrapper(instance, wrapper, methodnames);
|
||||
processStandardSidebarView (instance, wrapper, returnvalue, methodnames) {
|
||||
this.processAuthWrapper(instance, wrapper, returnvalue, methodnames);
|
||||
}
|
||||
|
||||
processAuthWrapper (instance, wrapper, methodnames) {
|
||||
processAuthWrapper (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentDidMount")) {
|
||||
this.addSettingsTitleBar(wrapper);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class OwnerTag {
|
||||
getName () {return "OwnerTag";}
|
||||
|
||||
getVersion () {return "1.1.6";}
|
||||
getVersion () {return "1.1.7";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class OwnerTag {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["DM Groups","Now works properly in DM Groups"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -88,7 +88,7 @@ class OwnerTag {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -110,11 +110,6 @@ class OwnerTag {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers", "getMember");
|
||||
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
||||
this.addHideCSS();
|
||||
|
@ -146,19 +141,19 @@ class OwnerTag {
|
|||
this.SettingsUpdated = true;
|
||||
}
|
||||
|
||||
processMemberListItem (instance, wrapper) {
|
||||
if (instance.props && BDFDB.getData("addInMemberList", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "list", BDFDB.disCN.bottagnametag, null);
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("addInMemberList", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list", BDFDB.disCN.bottagnametag, null);
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper) {
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("addInUserPopout", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "popout", BDFDB.disCN.bottagnametag, wrapper);
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper) {
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("addInUserProfil", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCNS.bottagnametag + BDFDB.disCN.userprofilebottag, wrapper);
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper, methodnames) {
|
||||
processMessageUsername (instance, wrapper, returnvalue, methodnames) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message && BDFDB.getData("addInChatWindow", this, "settings")) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
|
@ -169,7 +164,7 @@ class OwnerTag {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".owner-tag, .owner-tag-crown");
|
||||
|
@ -181,18 +176,18 @@ class OwnerTag {
|
|||
addOwnerTag (info, channelid, wrapper, type, selector = "", container) {
|
||||
if (!info || !wrapper || !wrapper.parentElement) return;
|
||||
BDFDB.removeEles(wrapper.querySelectorAll(".owner-tag, .owner-tag-crown"));
|
||||
let channel = this.ChannelUtils.getChannel(channelid || this.LastChannelStore.getChannelId());
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelid || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
if (!channel) return;
|
||||
let guild = this.GuildUtils.getGuild(channel.guild_id);
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
let settings = BDFDB.getAllData(this, "settings");
|
||||
let isowner = channel.ownerId == info.id || guild && guild.ownerId == info.id;
|
||||
if (!(isowner || (settings.addForAdmins && BDFDB.isUserAllowedTo("ADMINISTRATOR", info.id)))) return;
|
||||
let member = settings.useRoleColor ? (this.MemberUtils.getMember(channel.guild_id, info.id) || {}) : {};
|
||||
let EditUsersData = BDFDB.isPluginEnabled("EditUsers") ? window.bdplugins.EditUsers.plugin.getUserData(info.id, wrapper) : {};
|
||||
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.getData(isowner ? "ownTagName" : "ownAdminTagName", this, "inputs")}</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.isPluginEnabled("EditUsers") ? window.bdplugins.EditUsers.plugin.getUserData(info.id, wrapper) : {};
|
||||
let tagcolor = BDFDB.colorCONVERT(EditUsersData.color1 || member.colorString, "RGB");
|
||||
let isbright = BDFDB.colorISBRIGHT(tagcolor);
|
||||
tagcolor = isbright ? (settings.useBlackFont ? tagcolor : BDFDB.colorCHANGE(tagcolor, -0.3)) : tagcolor;
|
||||
|
|
|
@ -5,13 +5,13 @@ class PersonalPins {
|
|||
|
||||
getDescription () {return "Similar to normal pins. Lets you save messages as notes for yourself.";}
|
||||
|
||||
getVersion () {return "1.8.1";}
|
||||
getVersion () {return "1.8.2";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Update Option","Rightclicking/Using the 3-dot menu, will show an option to update a note in the notebook in case the original message changed"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -19,8 +19,7 @@ class PersonalPins {
|
|||
this.patchModules = {
|
||||
"HeaderBar":["componentDidMount","componentDidUpdate"],
|
||||
"HeaderBarContainer":["componentDidMount","componentDidUpdate"],
|
||||
"Message":"componentDidMount",
|
||||
"MessageOptionPopout":"componentDidMount"
|
||||
"Message":"componentDidMount"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -69,65 +68,26 @@ class PersonalPins {
|
|||
this.sortPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} personalpins-sort-popout" style="z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div option="timestamp" class="${BDFDB.disCN.contextmenuitem}">REPLACE_popout_messagesort_text</div>
|
||||
<div option="addedat" class="${BDFDB.disCN.contextmenuitem}">REPLACE_popout_datesort_text</div>
|
||||
<div option="timestamp" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">REPLACE_popout_messagesort_text</div>
|
||||
<div option="addedat" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">REPLACE_popout_datesort_text</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.messagePinContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} personalpins-item personalpins-pin-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_pinoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.messageUpdateContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} personalpins-item personalpins-update-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_updateoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.messageUnpinContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} personalpins-item personalpins-unpin-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_unpinoption_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.popoutPinEntryMarkup =
|
||||
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} personalpins-itembtn personalpins-pin-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_pinoption_text</div>
|
||||
</button>`;
|
||||
|
||||
this.popoutUpdateEntryMarkup =
|
||||
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} personalpins-itembtn personalpins-update-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_updateoption_text</div>
|
||||
</button>`;
|
||||
|
||||
this.popoutUnpinEntryMarkup =
|
||||
`<button role="menuitem" type="button" class="${BDFDB.disCNS.optionpopoutitem + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookblank + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCN.buttongrow} personalpins-itembtn personalpins-unpin-itembtn">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_popout_unpinoption_text</div>
|
||||
</button>`;
|
||||
|
||||
this.messageDividerMarkup =
|
||||
`<div class="${BDFDB.disCN.messagespopoutchannelseparator}">
|
||||
<span tabindex="0" class="${BDFDB.disCN.messagespopoutchannelname}" role="button"></span>
|
||||
<span class=${BDFDB.disCN.messagespopoutguildname}></span>
|
||||
<span class="${BDFDB.disCN.messagespopoutguildname}"></span>
|
||||
</div>`;
|
||||
|
||||
this.messageMarkup =
|
||||
`<div class="${BDFDB.disCN.messagespopoutmessagegroupwrapper}">
|
||||
<div class="${BDFDB.disCN.messagespopoutmessagegroupwrapperoffsetcorrection}">
|
||||
<div class="${BDFDB.disCNS.messagespopoutcontainercozybounded + BDFDB.disCNS.messagegroup + BDFDB.disCN.messagegroupcozy}">
|
||||
<div class="${BDFDB.disCNS.messagespopoutmessagegroupcozy + BDFDB.disCNS.messagecozy + BDFDB.disCN.message}" aria-disabled="true">
|
||||
<div class="${BDFDB.disCN.messagespopoutmessagegroupcozy}" aria-disabled="true">
|
||||
<div class="${BDFDB.disCN.messageheadercozy}">
|
||||
<div class="${BDFDB.disCN.messageavatar}" aria-hidden="true">
|
||||
<div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-hidden="true" style="width: 40px; height: 40px;">
|
||||
|
@ -208,7 +168,7 @@ class PersonalPins {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -230,16 +190,6 @@ class PersonalPins {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.SelectChannelUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel","selectChannel");
|
||||
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
|
||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
|
||||
this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers","getMember");
|
||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
this.HistoryUtils = BDFDB.WebModules.findByProperties("transitionTo", "replaceWith", "getHistory");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -259,14 +209,6 @@ class PersonalPins {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.messagePinContextEntryMarkup = this.messagePinContextEntryMarkup.replace("REPLACE_context_pinoption_text", this.labels.context_pinoption_text);
|
||||
this.messageUpdateContextEntryMarkup = this.messageUpdateContextEntryMarkup.replace("REPLACE_context_updateoption_text", this.labels.context_updateoption_text);
|
||||
this.messageUnpinContextEntryMarkup = this.messageUnpinContextEntryMarkup.replace("REPLACE_context_unpinoption_text", this.labels.context_unpinoption_text);
|
||||
|
||||
this.popoutPinEntryMarkup = this.popoutPinEntryMarkup.replace("REPLACE_popout_pinoption_text", this.labels.popout_pinoption_text);
|
||||
this.popoutUpdateEntryMarkup = this.popoutUpdateEntryMarkup.replace("REPLACE_popout_updateoption_text", this.labels.context_updateoption_text);
|
||||
this.popoutUnpinEntryMarkup = this.popoutUnpinEntryMarkup.replace("REPLACE_popout_unpinoption_text", this.labels.context_unpinoption_text);
|
||||
|
||||
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_note_text", this.labels.popout_note_text);
|
||||
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_channel_text", this.labels.popout_channel_text);
|
||||
this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_server_text", this.labels.popout_server_text);
|
||||
|
@ -281,43 +223,80 @@ class PersonalPins {
|
|||
this.sortPopoutMarkup = this.sortPopoutMarkup.replace("REPLACE_popout_datesort_text", this.labels.popout_datesort_text);
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".personalpins-item")) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
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 pinentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"MessagePinItem"}));
|
||||
let note = this.getNoteData(instance.props.message, instance.props.target, instance.props.channel);
|
||||
let messagePinUnpinContextEntry = BDFDB.htmlToElement(note ? this.messageUnpinContextEntryMarkup : this.messagePinContextEntryMarkup);
|
||||
if (pinentry) pinentry.parentElement.insertBefore(messagePinUnpinContextEntry, pinentry.nextElementSibling);
|
||||
else menu.insertBefore(messagePinUnpinContextEntry, menu.firstElementChild);
|
||||
messagePinUnpinContextEntry.firstElementChild.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addMessageToNotes(instance.props.message, instance.props.target, instance.props.channel);
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, "MessagePinItem");
|
||||
const pinUnpinItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[note ? "context_unpinoption_text" : "context_pinoption_text"],
|
||||
hint: BDFDB.isPluginEnabled("MessageUtilities") ? window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Note_Message") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${note ? "unpin" : "pin"}-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addMessageToNotes(instance.props.message, instance.props.target, instance.props.channel);
|
||||
}
|
||||
});
|
||||
if (BDFDB.isPluginEnabled("MessageUtilities")) {
|
||||
BDFDB.setContextHint(messagePinUnpinContextEntry.firstElementChild, window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Note_Message"));
|
||||
}
|
||||
if (index > -1) children.splice(index, 0, pinUnpinItem);
|
||||
else children.push(pinUnpinItem);
|
||||
if (note) {
|
||||
let newmarkup = this.getMarkup(messagediv).innerHTML;
|
||||
let newaccessory = messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML;
|
||||
if (note.markup != newmarkup || note.accessory != newaccessory) {
|
||||
let messageUpdateContextEntry = BDFDB.htmlToElement(this.messageUpdateContextEntryMarkup);
|
||||
if (pinentry) pinentry.parentElement.insertBefore(messageUpdateContextEntry, pinentry.nextElementSibling);
|
||||
else menu.insertBefore(messageUpdateContextEntry, menu.firstElementChild);
|
||||
messageUpdateContextEntry.firstElementChild.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.updateNoteData(note, newmarkup, newaccessory);
|
||||
const updateItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_updateoption_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-update-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.updateNoteData(note, newmarkup, newaccessory);
|
||||
}
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, updateItem);
|
||||
else children.push(updateItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processHeaderBarContainer (instance, wrapper) {
|
||||
onMessageOptionPopout (instance, popout, returnvalue) {
|
||||
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 note = this.getNoteData(instance.props.message, instance.props.target, instance.props.channel);
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, [BDFDB.LanguageStrings.PIN, BDFDB.LanguageStrings.UNPIN]);
|
||||
const pinUnpinItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[note ? "context_unpinoption_text" : "popout_pinoption_text"],
|
||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-${note ? "unpin" : "pin"}-popoutMenuItem`,
|
||||
action: e => {
|
||||
this.addMessageToNotes(instance.props.message, instance.props.target, instance.props.channel);
|
||||
instance.props.onClose();
|
||||
}
|
||||
});
|
||||
children.splice(index + 1, 0, pinUnpinItem);
|
||||
if (note) {
|
||||
let newmarkup = this.getMarkup(messagediv).innerHTML;
|
||||
let newaccessory = messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML;
|
||||
if (note.markup != newmarkup || note.accessory != newaccessory) {
|
||||
const updateItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_updateoption_text,
|
||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-update-popoutMenuItem`,
|
||||
action: e => {
|
||||
this.updateNoteData(note, newmarkup, newaccessory);
|
||||
instance.props.onClose();
|
||||
}
|
||||
});
|
||||
children.splice(index + 1, 0, updateItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processHeaderBarContainer (instance, wrapper, returnvalue) {
|
||||
this.processHeaderBar(instance, wrapper);
|
||||
}
|
||||
|
||||
processHeaderBar (instance, wrapper) {
|
||||
processHeaderBar (instance, wrapper, returnvalue) {
|
||||
if (wrapper.querySelector(".notes-button")) return;
|
||||
let search = wrapper.querySelector(BDFDB.dotCN.channelheadersearch);
|
||||
if (!search) return;
|
||||
|
@ -332,41 +311,15 @@ class PersonalPins {
|
|||
});
|
||||
}
|
||||
|
||||
processMessage (instance, wrapper) {
|
||||
processMessage (instance, wrapper, returnvalue) {
|
||||
if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton) && BDFDB.getReactValue(instance, "props.message.author.id") != 1) {
|
||||
let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
|
||||
if (buttonwrap) {
|
||||
let optionPopoutButton = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.optionpopoutbutton}"></div>`);
|
||||
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>`);
|
||||
optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
|
||||
buttonwrap.appendChild(optionPopoutButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processMessageOptionPopout (instance, wrapper) {
|
||||
if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".personalpins-itembtn")) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.memoizedProps.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let note = this.getNoteData(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
|
||||
if (note) {
|
||||
let newmarkup = this.getMarkup(messagediv).innerHTML;
|
||||
let newaccessory = messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML;
|
||||
if (note.markup != newmarkup || note.accessory != newaccessory) {
|
||||
let popoutUpdateEntry = BDFDB.htmlToElement(this.popoutUpdateEntryMarkup);
|
||||
wrapper.appendChild(popoutUpdateEntry);
|
||||
popoutUpdateEntry.addEventListener("click", () => {
|
||||
this.updateNoteData(note, newmarkup, newaccessory);
|
||||
instance.props.onClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
let popoutPinUnpinEntry = BDFDB.htmlToElement(note ? this.popoutUnpinEntryMarkup : this.popoutPinEntryMarkup);
|
||||
wrapper.appendChild(popoutPinUnpinEntry);
|
||||
popoutPinUnpinEntry.addEventListener("click", () => {
|
||||
this.addMessageToNotes(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
|
||||
instance.props.onClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
openNotesPopout (button) {
|
||||
|
@ -449,10 +402,10 @@ class PersonalPins {
|
|||
|
||||
appendNote (notespopout, container, noteData, placeholder) {
|
||||
if (!container || !noteData) return;
|
||||
let server = this.GuildUtils.getGuild(noteData.guild_id) || {};
|
||||
let channel = this.ChannelUtils.getChannel(noteData.channel_id) || {};
|
||||
let user = this.UserUtils.getUser(noteData.author_id) || {};
|
||||
let member = this.MemberUtils.getMember(noteData.guild_id, noteData.author_id) || {};
|
||||
let server = BDFDB.LibraryModules.GuildStore.getGuild(noteData.guild_id) || {};
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(noteData.channel_id) || {};
|
||||
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);
|
||||
|
@ -497,7 +450,7 @@ class PersonalPins {
|
|||
let ytlink = ytvideo.parentElement.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
|
||||
let wrapper = ytvideo.parentElement;
|
||||
ytvideo.remove();
|
||||
require("request")(ytlink, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(ytlink, (error, response, result) => {
|
||||
if (result) {
|
||||
wrapper.innerHTML = `<div class="${BDFDB.disCNS.imagewrapper + BDFDB.disCNS.imageclickable + BDFDB.disCN.embedvideoimagecomponent}" style="width: 400px; height: 225px;"><img alt="" src="${result.split('<link itemprop="thumbnailUrl" href="')[1].split('"')[0]}" style="width: 400px; height: 225px;"></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="${ytlink}" 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>`;
|
||||
wrapper.querySelector(BDFDB.dotCN.iconplay).addEventListener("click", e => {this.startYoutubeVideo(e.currentTarget);});
|
||||
|
@ -508,7 +461,7 @@ class PersonalPins {
|
|||
messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname).addEventListener("click", e => {
|
||||
if (!BDFDB.isObjectEmpty(channel)) {
|
||||
notespopout.remove();
|
||||
this.SelectChannelUtils.selectChannel(server.id, channel.id);
|
||||
BDFDB.LibraryModules.SelectChannelUtils.selectChannel(server.id, channel.id);
|
||||
}
|
||||
else BDFDB.shake();
|
||||
});
|
||||
|
@ -518,28 +471,26 @@ class PersonalPins {
|
|||
BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
|
||||
});
|
||||
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".jump").addEventListener("click", e => {
|
||||
this.HistoryUtils.transitionTo(this.DiscordConstants.Routes.CHANNEL(noteData.guild_id, noteData.channel_id, noteData.id));
|
||||
BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(noteData.guild_id, noteData.channel_id, noteData.id));
|
||||
});
|
||||
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".copy").addEventListener("click", e => {
|
||||
let clipboard = require("electron").clipboard;
|
||||
if (noteData.content) {
|
||||
let text = noteData.content;
|
||||
for (let file of message.querySelectorAll(BDFDB.dotCN.filenamelink)) text += ("\n" + file.href);
|
||||
clipboard.write({text});
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text});
|
||||
}
|
||||
else {
|
||||
let image = message.querySelector(BDFDB.dotCNS.imagewrapper + "img");
|
||||
if (image) require("request")({url: image.src, encoding: null}, (error, response, buffer) => {
|
||||
if (image) BDFDB.LibraryRequires.request({url: image.src, encoding: null}, (error, response, buffer) => {
|
||||
if (buffer) {
|
||||
let platform = require("process").platform;
|
||||
if (platform === "win32" || platform === "darwin") {
|
||||
clipboard.write({image: require("electron").nativeImage.createFromBuffer(buffer)});
|
||||
if (BDFDB.LibraryRequires.process.platform === "win32" || BDFDB.LibraryRequires.process.platform === "darwin") {
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({image: BDFDB.LibraryRequires.electron.nativeImage.createFromBuffer(buffer)});
|
||||
}
|
||||
else {
|
||||
let file = require("path").join(require("process").env["HOME"], "personalpinstemp.png");
|
||||
require("fs").writeFileSync(file, buffer, {encoding: null});
|
||||
clipboard.write({image: file});
|
||||
require("fs").unlinkSync(file);
|
||||
let file = BDFDB.LibraryRequires.path.join(BDFDB.LibraryRequires.process.env["HOME"], "personalpinstemp.png");
|
||||
BDFDB.LibraryRequires.fs.writeFileSync(file, buffer, {encoding: null});
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({image: file});
|
||||
BDFDB.LibraryRequires.fs.unlinkSync(file);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -550,7 +501,7 @@ class PersonalPins {
|
|||
startYoutubeVideo (button) {
|
||||
let embedwrapper = BDFDB.getParentEle(BDFDB.dotCN.embedvideo, button);
|
||||
let ytlink = embedwrapper.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
|
||||
require("request")(ytlink, (error, response, result) => {
|
||||
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;
|
||||
|
@ -565,9 +516,9 @@ class PersonalPins {
|
|||
let {messagediv, pos} = this.getMessageAndPos(target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let pins = BDFDB.loadAllData(this, "pins");
|
||||
let guild = this.GuildUtils.getGuild(channel.guild_id) || {};
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {};
|
||||
let guild_id = guild.id ? guild.id : "@me";
|
||||
channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
|
||||
channel = channel ? channel : BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
pins[guild_id] = pins[guild_id] || {}
|
||||
pins[guild_id][channel.id] = pins[guild_id][channel.id] || {}
|
||||
if (!pins[guild_id][channel.id][message.id + "_" + pos]) {
|
||||
|
@ -576,7 +527,7 @@ class PersonalPins {
|
|||
if (!channelname && channel.recipients.length > 0) {
|
||||
for (let dmuser_id of channel.recipients) {
|
||||
channelname = channelname ? channelname + ", @" : channelname;
|
||||
channelname = channelname + this.UserUtils.getUser(dmuser_id).username;
|
||||
channelname = channelname + BDFDB.LibraryModules.UserStore.getUser(dmuser_id).username;
|
||||
}
|
||||
}
|
||||
pins[guild_id][channel.id][message.id + "_" + pos] = BDFDB.sortObject({
|
||||
|
@ -622,7 +573,7 @@ class PersonalPins {
|
|||
if (!message || !target) return;
|
||||
let {messagediv, pos} = this.getMessageAndPos(target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
|
||||
channel = channel ? channel : BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let pins = BDFDB.loadAllData(this, "pins");
|
||||
let guildid = channel.guild_id ? channel.guild_id : "@me";
|
||||
return pins[guildid] && pins[guildid][channel.id] && pins[guildid][channel.id][message.id + "_" + pos] ? pins[guildid][channel.id][message.id + "_" + pos] : null;
|
||||
|
@ -638,10 +589,10 @@ class PersonalPins {
|
|||
BDFDB.saveAllData(pins, this, "pins");
|
||||
BDFDB.showToast(this.labels.toast_noteremove_text, {type:"danger"});
|
||||
}
|
||||
|
||||
|
||||
getMessageAndPos (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
|
||||
let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
|
||||
let messagediv = BDFDB.getParentEle(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};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class PinDMs {
|
||||
getName () {return "PinDMs";}
|
||||
|
||||
getVersion () {return "1.4.5";}
|
||||
getVersion () {return "1.4.6";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class PinDMs {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Pinned DMs","Changed to new DM classes"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -24,56 +24,6 @@ class PinDMs {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
this.dmContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} pindms-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_pindm_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.dmContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} pindms-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} pindm-channel-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_pinchannel_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} unpindm-channel-item ${BDFDB.disCN.contextmenuitemdanger}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_unpinchannel_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} pindm-guild-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_pinguild_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} unpindm-guild-item ${BDFDB.disCN.contextmenuitemdanger}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_unpinguild_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.dmPinContextMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} pinneddm-contextmenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} pindm-guild-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_pinguild_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.dmUnpinContextMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} pinneddm-contextmenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} unpindm-guild-item ${BDFDB.disCN.contextmenuitemdanger}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_unpinguild_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.recentDMMarkup =
|
||||
`<div class="pinned-dm" style="opacity: 1; height: 56px; transform: scale(1);">
|
||||
<div class="${BDFDB.disCN.guildouter}">
|
||||
|
@ -149,6 +99,9 @@ class PinDMs {
|
|||
.pinned-dm.pindms-dragpreview ${BDFDB.dotCN.guildupperbadge},
|
||||
.pinned-dm.pindms-dragpreview ${BDFDB.dotCN.guildlowerbadge} {
|
||||
display: none !important;
|
||||
}
|
||||
${BDFDB.dotCN.dmchannel}.dmchannelplaceholder {
|
||||
border: 1px dashed var(--channels-default);
|
||||
}`;
|
||||
|
||||
this.defaults = {
|
||||
|
@ -199,7 +152,7 @@ class PinDMs {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -221,15 +174,6 @@ class PinDMs {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUser");
|
||||
this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels", "getChannel");
|
||||
this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("ensurePrivateChannel");
|
||||
this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
|
||||
this.CurrentChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
this.UnreadUtils = BDFDB.WebModules.findByProperties("getUnreadCount");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
this.Animations = BDFDB.WebModules.findByProperties("spring");
|
||||
|
||||
this.forceAdding = true;
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
delete this.forceAdding;
|
||||
|
@ -251,7 +195,7 @@ class PinDMs {
|
|||
if (ele && ele.pinned) {
|
||||
delete ele.pinned;
|
||||
if (ele.props.ispin) {
|
||||
if (ele.type == "header") insertpoint = i;
|
||||
if (ele && ele.type == "header" || BDFDB.getReactValue(ele, "type.displayName") == "ListSectionItem") insertpoint = i;
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
|
@ -277,105 +221,86 @@ class PinDMs {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.dmContextEntryMarkup = this.dmContextEntryMarkup.replace("REPLACE_context_pindm_text", this.labels.context_pindm_text);
|
||||
|
||||
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinchannel_text", this.labels.context_pinchannel_text);
|
||||
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinchannel_text", this.labels.context_unpinchannel_text);
|
||||
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
|
||||
this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
|
||||
|
||||
this.dmPinContextMarkup = this.dmPinContextMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
|
||||
|
||||
this.dmUnpinContextMarkup = this.dmUnpinContextMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
|
||||
}
|
||||
|
||||
onUserContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(".pindms-item")) {
|
||||
let closeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleClose"]}));
|
||||
if (closeentry) {
|
||||
let id = this.ChannelUtils.getDMFromUserId(instance.props.user.id);
|
||||
if (id) this.appendItem(id, closeentry);
|
||||
else this.PrivateChannelUtils.ensurePrivateChannel(BDFDB.myData.id, instance.props.user.id).then(id => {this.appendItem(id, closeentry);});
|
||||
onUserContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, "UserCloseChatItem");
|
||||
if (index > -1) {
|
||||
let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(instance.props.user.id);
|
||||
if (id) this.appendItem(menu, id, children, index);
|
||||
else BDFDB.LibraryModules.DirectMessageUtils.ensurePrivateChannel(BDFDB.myData.id, instance.props.user.id).then(id => {this.appendItem(menu, id, children, index);});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onGroupDMContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.channelId && !menu.querySelector(".pindms-item")) {
|
||||
let changeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleChangeIcon"]}));
|
||||
if (changeentry) {
|
||||
this.appendItem(instance.props.channelId, changeentry);
|
||||
}
|
||||
onGroupDMContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.channelId && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, "ChangeIcon");
|
||||
if (index > -1) this.appendItem(menu, instance.props.channelId, children, index);
|
||||
}
|
||||
}
|
||||
|
||||
appendItem (id, target) {
|
||||
let dmContextEntry = BDFDB.htmlToElement(this.dmContextEntryMarkup);
|
||||
target.parentElement.insertBefore(dmContextEntry, target);
|
||||
let pindmsitem = dmContextEntry.querySelector(".pindms-item");
|
||||
pindmsitem.addEventListener("mouseenter", () => {
|
||||
let dmContextSubMenu = BDFDB.htmlToElement(this.dmContextSubMenuMarkup);
|
||||
let pinchannelitem = dmContextSubMenu.querySelector(".pindm-channel-item");
|
||||
let unpinchannelitem = dmContextSubMenu.querySelector(".unpindm-channel-item");
|
||||
let pinguilditem = dmContextSubMenu.querySelector(".pindm-guild-item");
|
||||
let unpinguilditem = dmContextSubMenu.querySelector(".unpindm-guild-item");
|
||||
let pinnedDMs = BDFDB.loadAllData(this, "pinnedDMs");
|
||||
if (pinnedDMs[id] == undefined) {
|
||||
BDFDB.removeEles(unpinchannelitem);
|
||||
pinchannelitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(target);
|
||||
appendItem (menu, id, children, index) {
|
||||
let pinnedInChannel = BDFDB.loadAllData(this, "pinnedDMs")[id] != undefined;
|
||||
let pinnedInGuild = BDFDB.loadAllData(this, "pinnedRecents")[id] != undefined;
|
||||
let items = [];
|
||||
items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[pinnedInChannel ? "context_unpinchannel_text" : "context_pinchannel_text"],
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${pinnedInChannel ? "unpin" : "pin"}channel-contextMenuItem`,
|
||||
danger: pinnedInChannel,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
if (!pinnedInChannel) {
|
||||
let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
|
||||
if (dmsscrollerinstance) {
|
||||
let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
|
||||
let dms = dmsscrollerinstance.return.return.return.stateNode.props.children;
|
||||
let insertpoint = this.getInsertPoint(dms);
|
||||
this.addPinnedDM(id, dms, insertpoint);
|
||||
this.forceUpdateScroller(dmsscrollerinstance.stateNode);
|
||||
}
|
||||
this.updatePinnedPositions("pinnedDMs");
|
||||
});
|
||||
}
|
||||
else {
|
||||
BDFDB.removeEles(pinchannelitem);
|
||||
unpinchannelitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(target);
|
||||
}
|
||||
else {
|
||||
this.removePinnedDM(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
|
||||
if (pinnedRecents[id] == undefined) {
|
||||
BDFDB.removeEles(unpinguilditem);
|
||||
pinguilditem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(target);
|
||||
}));
|
||||
items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"],
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-${pinnedInGuild ? "unpin" : "pin"}guild-contextMenuItem`,
|
||||
danger: pinnedInGuild,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
if (!pinnedInGuild) {
|
||||
this.addPinnedRecent(id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
});
|
||||
}
|
||||
else {
|
||||
BDFDB.removeEles(pinguilditem);
|
||||
unpinguilditem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(target);
|
||||
}
|
||||
else {
|
||||
BDFDB.removeEles(document.querySelector(`.pinned-dm[channelid="${id}"]`));
|
||||
this.unhideNativeDM(id);
|
||||
BDFDB.removeData(id, this, "pinnedRecents");
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
});
|
||||
}
|
||||
}
|
||||
BDFDB.appendSubMenu(pindmsitem, dmContextSubMenu);
|
||||
}));
|
||||
const subitem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_pindm_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-pindm-contextMenuSubItem`,
|
||||
render: items
|
||||
});
|
||||
children.splice(index, 0, subitem);
|
||||
}
|
||||
|
||||
processGuilds (instance, wrapper) {
|
||||
processGuilds (instance, wrapper, returnvalue) {
|
||||
for (let id of this.sortAndUpdate("pinnedRecents")) this.addPinnedRecent(id);
|
||||
}
|
||||
|
||||
processPrivateChannel (instance, wrapper) {
|
||||
processPrivateChannel (instance, wrapper, returnvalue) {
|
||||
if (instance && instance.props && instance.props.ispin) {
|
||||
let id = BDFDB.getReactValue(instance, "props.channel.id");
|
||||
wrapper.setAttribute("channelid", id);
|
||||
BDFDB.addClass(wrapper, "pinned");
|
||||
BDFDB.removeClass(BDFDB.getChannelDiv(id), BDFDB.disCN.dmchannelselected);
|
||||
wrapper.querySelector("a").setAttribute("draggable", false);
|
||||
BDFDB.removeClass(BDFDB.getChannelDiv(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);
|
||||
if (dmsscroller) {
|
||||
|
@ -396,7 +321,7 @@ class PinDMs {
|
|||
let dmchannelswrap = document.querySelector(`${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller}`);
|
||||
if (!dmchannelswrap) return;
|
||||
let hovele = null;
|
||||
let placeholder = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.dmchannel} dmchannelplaceholder" style="height: 42px; opacity: 1;"><a style="border: 1px dashed #535559 !important;"></a></div>`);
|
||||
let placeholder = BDFDB.htmlToElement(`<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);
|
||||
|
@ -429,20 +354,27 @@ class PinDMs {
|
|||
}
|
||||
}
|
||||
|
||||
processDirectMessage (instance, wrapper, methodnames) {
|
||||
processDirectMessage (instance, wrapper, returnvalue, methodnames) {
|
||||
if (instance.props && instance.props.channel) {
|
||||
if (methodnames.includes("componentDidMount")) {
|
||||
wrapper.removeEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
|
||||
wrapper.PinDMsContextMenuListener = e => {
|
||||
let freshPinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
|
||||
if (freshPinnedRecents[instance.props.channel.id] == undefined) {
|
||||
let dmContext = BDFDB.htmlToElement(this.dmPinContextMarkup);
|
||||
dmContext.querySelector(".pindm-guild-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(dmContext);
|
||||
this.addPinnedRecent(instance.props.channel.id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
if (BDFDB.loadAllData(this, "pinnedRecents")[instance.props.channel.id] == undefined) {
|
||||
const itemGroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
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));
|
||||
this.addPinnedRecent(instance.props.channel.id);
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
BDFDB.appendContextMenu(dmContext, e);
|
||||
BDFDB.openContextMenu(this, e, itemGroup);
|
||||
}
|
||||
};
|
||||
wrapper.addEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
|
||||
|
@ -458,7 +390,7 @@ class PinDMs {
|
|||
}
|
||||
}
|
||||
|
||||
processLazyScroller (instance, wrapper) {
|
||||
processLazyScroller (instance, wrapper, returnvalue) {
|
||||
let privateChannelIds = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.privateChannelIds");
|
||||
if (privateChannelIds) {
|
||||
if (this.forceAdding || !instance.props.PinDMsPatched) {
|
||||
|
@ -477,7 +409,7 @@ class PinDMs {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
for (let id of this.sortAndUpdate("pinnedRecents")) this.updatePinnedRecent(id);
|
||||
|
@ -488,13 +420,13 @@ class PinDMs {
|
|||
let insertpoint = null;
|
||||
for (let i in dms) {
|
||||
let ele = dms[i];
|
||||
if (ele && ele.type == "header") {
|
||||
if (ele && ele.type == "header" || BDFDB.getReactValue(ele, "type.displayName") == "ListSectionItem") {
|
||||
insertpoint = parseInt(i);
|
||||
if (!ele.pinned && !ele.props.ispin) {
|
||||
ele.pinned = true;
|
||||
let headerpin = Object.assign({},ele);
|
||||
headerpin.key = "pin" + headerpin.key;
|
||||
headerpin.props = {children:this.labels.header_pinneddms_text,ispin:true};
|
||||
headerpin.props = {className:ele.props.className,children:this.labels.header_pinneddms_text,ispin:true};
|
||||
dms.splice(insertpoint, 0, headerpin);
|
||||
}
|
||||
insertpoint++;
|
||||
|
@ -554,7 +486,7 @@ class PinDMs {
|
|||
};
|
||||
for (let id in pinnedDMs) sortDM(id, pinnedDMs[id]);
|
||||
sortedDMs = sortedDMs.filter(n => n);
|
||||
for (let pos in sortedDMs) if (this.ChannelUtils.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
|
||||
for (let pos in sortedDMs) if (BDFDB.LibraryModules.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
|
||||
this.updatePinnedPositions(type);
|
||||
return existingDMs;
|
||||
}
|
||||
|
@ -562,7 +494,7 @@ class PinDMs {
|
|||
forceUpdateScroller (scroller) {
|
||||
if (this.updatingScroller) return;
|
||||
var stateNode = BDFDB.getReactValue(scroller, "return.return.return.stateNode");
|
||||
if (stateNode) {
|
||||
if (stateNode && stateNode.updater) {
|
||||
this.updatingScroller = true;
|
||||
stateNode.updater.enqueueForceUpdate(stateNode);
|
||||
setTimeout(() => {stateNode.updater.enqueueForceUpdate(stateNode);},500);
|
||||
|
@ -571,18 +503,18 @@ class PinDMs {
|
|||
}
|
||||
|
||||
addPinnedRecent (id) {
|
||||
let anker = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
let anker = document.querySelector("#bd-pub-li") || BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCN.homebuttonicon));
|
||||
if (anker && !document.querySelector(`.pinned-dm[channelid="${id}"]`)) {
|
||||
let info = this.ChannelUtils.getChannel(id);
|
||||
let info = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
if (info) {
|
||||
let dmdiv = BDFDB.htmlToElement(this.recentDMMarkup);
|
||||
let dmdivinner = dmdiv.querySelector(BDFDB.dotCN.guildinnerwrapper);
|
||||
let dmiconwrapper = dmdiv.querySelector(BDFDB.dotCN.guildiconwrapper);
|
||||
dmiconwrapper.style.setProperty("border-radius", this.CurrentChannelStore.getChannelId() == id ? "30%" : "50%");
|
||||
dmiconwrapper.style.setProperty("border-radius", BDFDB.LibraryModules.LastChannelStore.getChannelId() == id ? "30%" : "50%");
|
||||
dmiconwrapper.style.setProperty("overflow", "hidden");
|
||||
dmdiv.querySelector("mask").setAttribute("id", "PINDMS" + id);
|
||||
dmdiv.querySelector("foreignObject").setAttribute("mask", "url(#PINDMS" + id + ")");
|
||||
let user = info.type == 1 ? this.UserUtils.getUser(info.recipients[0]) : null;
|
||||
let user = info.type == 1 ? BDFDB.LibraryModules.UserStore.getUser(info.recipients[0]) : null;
|
||||
dmdiv.setAttribute("channelid", id);
|
||||
anker.parentElement.insertBefore(dmdiv, anker.nextSibling);
|
||||
let avatar = dmdiv.querySelector(BDFDB.dotCN.guildicon);
|
||||
|
@ -590,7 +522,7 @@ class PinDMs {
|
|||
if (!dmname && info.recipients.length > 0) {
|
||||
for (let dmuser_id of info.recipients) {
|
||||
dmname = dmname ? dmname + ", " : dmname;
|
||||
dmname = dmname + this.UserUtils.getUser(dmuser_id).username;
|
||||
dmname = dmname + BDFDB.LibraryModules.UserStore.getUser(dmuser_id).username;
|
||||
}
|
||||
}
|
||||
let EditUsersData = user && BDFDB.isPluginEnabled("EditUsers") ? window.bdplugins.EditUsers.plugin.getUserData(user.id, dmdiv) : {};
|
||||
|
@ -603,22 +535,32 @@ class PinDMs {
|
|||
});
|
||||
avatar.parentElement.addEventListener("click", e => {
|
||||
if (user) {
|
||||
let DMid = this.ChannelUtils.getDMFromUserId(user.id)
|
||||
if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid);
|
||||
else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id);
|
||||
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
||||
if (DMid) BDFDB.LibraryModules.SelectChannelUtils.selectPrivateChannel(DMid);
|
||||
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(BDFDB.myData.id, user.id);
|
||||
}
|
||||
else this.ChannelSwitchUtils.selectPrivateChannel(id);
|
||||
else BDFDB.LibraryModules.SelectChannelUtils.selectPrivateChannel(id);
|
||||
BDFDB.stopEvent(e);
|
||||
});
|
||||
avatar.parentElement.addEventListener("contextmenu", e => {
|
||||
let dmContext = BDFDB.htmlToElement(this.dmUnpinContextMarkup);
|
||||
dmContext.querySelector(".unpindm-guild-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(dmdiv, dmContext);
|
||||
this.unhideNativeDM(id);
|
||||
BDFDB.removeData(id, this, "pinnedRecents");
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
const itemGroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_unpinguild_text,
|
||||
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);
|
||||
this.unhideNativeDM(id);
|
||||
BDFDB.removeData(id, this, "pinnedRecents");
|
||||
this.updatePinnedPositions("pinnedRecents");
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
BDFDB.appendContextMenu(dmContext, e);
|
||||
BDFDB.openContextMenu(this, e, itemGroup);
|
||||
});
|
||||
dmdiv.addEventListener("mousedown", e => {
|
||||
let x = e.pageX, y = e.pageY;
|
||||
|
@ -686,17 +628,19 @@ class PinDMs {
|
|||
}
|
||||
|
||||
updatePinnedPositions (type) {
|
||||
let newPinned = {}, oldPinned = BDFDB.loadAllData(this, type);
|
||||
let pins = Array.from(document.querySelectorAll(type == "pinnedRecents" ? `.pinned-dm` : `${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned`)).map(div => {return div.getAttribute("channelid");}).reverse();
|
||||
for (let i in pins) if (pins[i]) newPinned[pins[i]] = parseInt(i);
|
||||
for (let id in oldPinned) if (newPinned[id] == undefined) newPinned[id] = Object.keys(newPinned).length;
|
||||
BDFDB.saveAllData(newPinned, this, type);
|
||||
setImmediate(() => {
|
||||
let newPinned = {}, oldPinned = BDFDB.loadAllData(this, type);
|
||||
let pins = Array.from(document.querySelectorAll(type == "pinnedRecents" ? `.pinned-dm` : `${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned`)).map(div => {return div.getAttribute("channelid");}).reverse();
|
||||
for (let i in pins) if (pins[i]) newPinned[pins[i]] = parseInt(i);
|
||||
for (let id in oldPinned) if (newPinned[id] == undefined) newPinned[id] = Object.keys(newPinned).length;
|
||||
BDFDB.saveAllData(newPinned, this, type);
|
||||
});
|
||||
}
|
||||
|
||||
updatePinnedRecent (id) {
|
||||
let pinneddmdiv = document.querySelector(`.pinned-dm[channelid="${id}"]`);
|
||||
if (Node.prototype.isPrototypeOf(pinneddmdiv)) {
|
||||
let count = this.UnreadUtils.getUnreadCount(id);
|
||||
let count = BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(id);
|
||||
let showpin = BDFDB.getData("showPinIcon", this, "settings");
|
||||
|
||||
let dmdiv = BDFDB.getDmDiv(id);
|
||||
|
@ -706,7 +650,7 @@ class PinDMs {
|
|||
let notificationbadge = pinneddmdiv.querySelector(BDFDB.dotCN.guildlowerbadge);
|
||||
|
||||
BDFDB.toggleClass(pinneddmdiv, "has-new-messages", count > 0);
|
||||
let selected = this.CurrentChannelStore.getChannelId() == id;
|
||||
let selected = BDFDB.LibraryModules.LastChannelStore.getChannelId() == id;
|
||||
pinneddmiconwrapper.style.setProperty("border-radius", selected ? "30%" : "50%");
|
||||
pinneddmdivpill.style.setProperty("opacity", selected ? 1 : (count ? 0.7 : 0));
|
||||
pinneddmdivpill.style.setProperty("height", selected ? "40px" : "8px");
|
||||
|
@ -749,58 +693,58 @@ class PinDMs {
|
|||
|
||||
let pillvisible = divpillitem.style.getPropertyValue("opacity") != 0;
|
||||
|
||||
let borderRadius = new this.Animations.Value(0);
|
||||
let borderRadius = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
borderRadius
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [50, 30]
|
||||
})
|
||||
.addListener((value) => {
|
||||
diviconwrapper.style.setProperty("border-radius", `${this.CurrentChannelStore.getChannelId() == id ? 30 : value.value}%`);
|
||||
diviconwrapper.style.setProperty("border-radius", `${BDFDB.LibraryModules.LastChannelStore.getChannelId() == id ? 30 : value.value}%`);
|
||||
});
|
||||
|
||||
let pillHeight = new this.Animations.Value(0);
|
||||
let pillHeight = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
pillHeight
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [8, 20]
|
||||
})
|
||||
.addListener((value) => {
|
||||
divpillitem.style.setProperty("height", `${this.CurrentChannelStore.getChannelId() == id ? 40 : value.value}px`);
|
||||
divpillitem.style.setProperty("height", `${BDFDB.LibraryModules.LastChannelStore.getChannelId() == id ? 40 : value.value}px`);
|
||||
});
|
||||
|
||||
let pillOpacity = new this.Animations.Value(0);
|
||||
let pillOpacity = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
pillOpacity
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [0, 0.7]
|
||||
})
|
||||
.addListener((value) => {
|
||||
divpillitem.style.setProperty("opacity", `${this.CurrentChannelStore.getChannelId() == id ? 1 : value.value}`);
|
||||
divpillitem.style.setProperty("opacity", `${BDFDB.LibraryModules.LastChannelStore.getChannelId() == id ? 1 : value.value}`);
|
||||
});
|
||||
|
||||
let animate = (v) => {
|
||||
this.Animations.parallel([
|
||||
this.Animations.timing(borderRadius, {toValue: v, duration: 200}),
|
||||
this.Animations.spring(pillHeight, {toValue: v, friction: 5})
|
||||
BDFDB.LibraryModules.AnimationUtils.parallel([
|
||||
BDFDB.LibraryModules.AnimationUtils.timing(borderRadius, {toValue: v, duration: 200}),
|
||||
BDFDB.LibraryModules.AnimationUtils.spring(pillHeight, {toValue: v, friction: 5})
|
||||
]).start();
|
||||
};
|
||||
|
||||
let animate2 = (v) => {
|
||||
this.Animations.parallel([
|
||||
this.Animations.timing(pillOpacity, {toValue: v, duration: 200}),
|
||||
BDFDB.LibraryModules.AnimationUtils.parallel([
|
||||
BDFDB.LibraryModules.AnimationUtils.timing(pillOpacity, {toValue: v, duration: 200}),
|
||||
]).start();
|
||||
};
|
||||
|
||||
divinner.addEventListener("mouseenter", () => {
|
||||
pillvisible = divpillitem.style.getPropertyValue("opacity") != 0;
|
||||
if (this.CurrentChannelStore.getChannelId() != id) {
|
||||
if (BDFDB.LibraryModules.LastChannelStore.getChannelId() != id) {
|
||||
animate(1);
|
||||
if (!pillvisible) animate2(1);
|
||||
}
|
||||
})
|
||||
divinner.addEventListener("mouseleave", () => {
|
||||
if (this.CurrentChannelStore.getChannelId() != id) {
|
||||
if (BDFDB.LibraryModules.LastChannelStore.getChannelId() != id) {
|
||||
animate(0);
|
||||
if (!pillvisible) animate2(0);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class PluginRepo {
|
||||
getName () {return "PluginRepo";}
|
||||
|
||||
getVersion () {return "1.8.3";}
|
||||
getVersion () {return "1.8.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class PluginRepo {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Repo Modal","Fixed an issue that prevented the repo modal from opening"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -45,12 +45,6 @@ class PluginRepo {
|
|||
|
||||
this.updateInterval;
|
||||
|
||||
this.settingsContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitem} pluginrepo-item">
|
||||
<span>Plugin Repo</span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>`;
|
||||
|
||||
this.pluginRepoIconMarkup =
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="34" height="31" viewBox="0 0 400 382">
|
||||
<path d="M0.000 183.023 L 0.000 366.046 46.377 366.046 L 92.754 366.046 92.754 312.629 L 92.754 259.213 127.223 259.213 C 174.433 259.213,187.432 257.146,210.766 245.926 C 311.105 197.681,301.344 41.358,195.859 7.193 C 173.603 -0.015,173.838 0.000,80.846 0.000 L 0.000 0.000 0.000 183.023 M157.615 88.195 C 193.007 97.413,198.827 152.678,166.407 171.674 C 158.993 176.019,155.494 176.398,122.807 176.398 L 92.754 176.398 92.754 131.677 L 92.754 86.957 122.807 86.957 C 146.807 86.957,153.819 87.206,157.615 88.195" stroke="none" fill="#7289da" fill-rule="evenodd"></path>
|
||||
|
@ -103,7 +97,7 @@ class PluginRepo {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto; padding-bottom: 10px;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset} pluginAmount">Plugin Repository</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin} pluginAmount">Plugin Repository</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -179,9 +173,9 @@ class PluginRepo {
|
|||
this.sortPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} pluginrepo-sort-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.sort[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">${this.sortings.sort[key]}</div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -190,9 +184,9 @@ class PluginRepo {
|
|||
this.orderPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} pluginrepo-order-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.order[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">${this.sortings.order[key]}</div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -299,7 +293,7 @@ class PluginRepo {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -353,26 +347,19 @@ class PluginRepo {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onUserSettingsCogContextMenu (instance, menu) {
|
||||
let observer = new MutationObserver(changes => {
|
||||
changes.forEach(change => {
|
||||
if (change.addedNodes) change.addedNodes.forEach(node => {
|
||||
if (node.tagName && BDFDB.containsClass(node, BDFDB.disCN.contextmenu) && BDFDB.getReactValue(node, "return.return.return.memoizedProps.label") == "BandagedBD" && !node.querySelector(".pluginrepo-item")) {
|
||||
let item = node.querySelectorAll(BDFDB.dotCN.contextmenuitem);
|
||||
item = item[item.length-1];
|
||||
var settingsContextEntry = BDFDB.htmlToElement(this.settingsContextEntryMarkup);
|
||||
settingsContextEntry.addEventListener("click", () => {
|
||||
if (!this.loading.is) BDFDB.closeContextMenu(menu);
|
||||
this.openPluginRepoModal();
|
||||
});
|
||||
item.parentElement.insertBefore(settingsContextEntry, item.nextElementSibling);
|
||||
var menurects = BDFDB.getRects(menu);
|
||||
node.style.setProperty("top", (menurects.top - BDFDB.getRects(node).height + menurects.height) + "px");
|
||||
}
|
||||
});
|
||||
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
|
||||
setImmediate(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
|
||||
const repoItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Plugin Repo",
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-repo-contextMenuItem`,
|
||||
action: e => {
|
||||
if (!this.loading.is) BDFDB.closeContextMenu(menu);
|
||||
this.openPluginRepoModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(menu, {childList: true, subtree:true});
|
||||
child.props.render.push(repoItem);
|
||||
break;
|
||||
}});
|
||||
}
|
||||
|
||||
processV2CList (instance, wrapper) {
|
||||
|
@ -623,8 +610,7 @@ class PluginRepo {
|
|||
var seps = ["\"", "\'", "\`"];
|
||||
var newentriesdata = BDFDB.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
|
||||
this.cachedPlugins = (newentriesdata.urlbase64 ? atob(newentriesdata.urlbase64).split("\n") : []).concat(ownlist);
|
||||
let request = require("request");
|
||||
request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/PluginRepo/res/PluginList.txt", (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/PluginRepo/res/PluginList.txt", (error, response, result) => {
|
||||
if (!error && result) {
|
||||
result = result.replace(/[\r\t]/g, "");
|
||||
BDFDB.saveData("urlbase64", btoa(result), this, "newentriesdata");
|
||||
|
@ -710,7 +696,7 @@ class PluginRepo {
|
|||
return;
|
||||
}
|
||||
let url = this.foundPlugins[i];
|
||||
request(url, (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request(url, (error, response, body) => {
|
||||
if (!response) {
|
||||
if (url && BDFDB.getAllIndexes(this.foundPlugins, url).length < 2) this.foundPlugins.push(url);
|
||||
}
|
||||
|
@ -867,7 +853,7 @@ class PluginRepo {
|
|||
}
|
||||
|
||||
checkForNewPlugins () {
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/PluginRepo/res/PluginList.txt", (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/PluginRepo/res/PluginList.txt", (error, response, result) => {
|
||||
if (response && !BDFDB.equals(result.replace(/\t|\r/g, "").split("\n").filter(n => n), this.grabbedPlugins)) {
|
||||
this.loading = {is:false, timeout:null, amount:0};
|
||||
this.loadPlugins();
|
||||
|
@ -876,14 +862,14 @@ class PluginRepo {
|
|||
}
|
||||
|
||||
downloadPlugin (data) {
|
||||
require("request")(data.url, (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request(data.url, (error, response, body) => {
|
||||
if (error) BDFDB.showToast(`Unable to download Plugin "${plugin.getName}".`, {type:"danger"});
|
||||
else this.createPluginFile(data.url.split("/").pop(), body);
|
||||
});
|
||||
}
|
||||
|
||||
createPluginFile (filename, content) {
|
||||
require("fs").writeFile(require("path").join(BDFDB.getPluginsFolder(), filename), content, (error) => {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.getPluginsFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to save Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully saved Plugin "${filename}".`, {type:"success"});
|
||||
});
|
||||
|
@ -900,7 +886,7 @@ class PluginRepo {
|
|||
|
||||
deletePluginFile (data) {
|
||||
let filename = data.url.split("/").pop();
|
||||
require("fs").unlink(require("path").join(BDFDB.getPluginsFolder(), filename), (error) => {
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.getPluginsFolder(), filename), (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to delete Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully deleted Plugin "${filename}".`);
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ReadAllNotificationsButton {
|
||||
getName () {return "ReadAllNotificationsButton";}
|
||||
|
||||
getVersion () {return "1.4.9";}
|
||||
getVersion () {return "1.5.0";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ReadAllNotificationsButton {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Muted Servers","Added an extra contextmenu option to only read muted servers and also relabeled the other options"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -22,31 +22,11 @@ class ReadAllNotificationsButton {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
this.RANcontextMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} RANbutton-contextmenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} readunreadguilds-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_unreadguilds_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} readmutedguilds-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_mutedguilds_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} readguilds-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_guilds_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} readdms-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_dms_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.RANbuttonMarkup =
|
||||
`<div class="${BDFDB.disCN.guildouter} RANbutton-frame" style="height: 20px;">
|
||||
<div class="${BDFDB.disCN.guildiconacronym} RANbutton" style="height: 20px;">read all</div>
|
||||
`<div class="${BDFDB.disCNS.guildouter} RANbutton-frame" style="height: 20px;">
|
||||
<div class="${BDFDB.disCN.guildiconwrapper} RANbutton-inner" style="height: 20px;">
|
||||
<div class="${BDFDB.disCNS.guildiconchildwrapper + BDFDB.disCN.guildiconacronym} RANbutton" style="height: 20px;">read all</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.RAMbuttonMarkup =
|
||||
|
@ -122,7 +102,7 @@ class ReadAllNotificationsButton {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -162,14 +142,7 @@ class ReadAllNotificationsButton {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.RANcontextMenuMarkup = this.RANcontextMenuMarkup.replace("REPLACE_context_unreadguilds_text", this.labels.context_unreadguilds_text);
|
||||
this.RANcontextMenuMarkup = this.RANcontextMenuMarkup.replace("REPLACE_context_mutedguilds_text", this.labels.context_mutedguilds_text);
|
||||
this.RANcontextMenuMarkup = this.RANcontextMenuMarkup.replace("REPLACE_context_guilds_text", this.labels.context_guilds_text);
|
||||
this.RANcontextMenuMarkup = this.RANcontextMenuMarkup.replace("REPLACE_context_dms_text", this.labels.context_dms_text);
|
||||
}
|
||||
|
||||
processGuilds (instance, wrapper, methodnames) {
|
||||
processGuilds (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentDidMount") || (methodnames.includes("componentDidUpdate") && document.querySelector(".bd-guild ~ .RANbutton-frame"))) {
|
||||
BDFDB.removeEles(".RANbutton-frame");
|
||||
let insertnode = this.getInsertNode();
|
||||
|
@ -182,37 +155,58 @@ class ReadAllNotificationsButton {
|
|||
if (settings.includeDMs) BDFDB.markChannelAsRead(BDFDB.readDmList());
|
||||
});
|
||||
ranbutton.addEventListener("contextmenu", e => {
|
||||
let RANcontextMenu = BDFDB.htmlToElement(this.RANcontextMenuMarkup);
|
||||
RANcontextMenu.querySelector(".readunreadguilds-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(RANcontextMenu);
|
||||
BDFDB.markGuildAsRead(BDFDB.readUnreadServerList());
|
||||
const itemGroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
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.markGuildAsRead(BDFDB.readUnreadServerList());
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
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.markGuildAsRead(BDFDB.readMutedServerList());
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
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));
|
||||
this.addPinnedRecent(instance.props.channel.id);
|
||||
BDFDB.markGuildAsRead(BDFDB.readServerList());
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
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.markChannelAsRead(BDFDB.readDmList());
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
RANcontextMenu.querySelector(".readmutedguilds-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(RANcontextMenu);
|
||||
BDFDB.markGuildAsRead(BDFDB.readMutedServerList());
|
||||
});
|
||||
RANcontextMenu.querySelector(".readguilds-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(RANcontextMenu);
|
||||
BDFDB.markGuildAsRead(BDFDB.readServerList());
|
||||
});
|
||||
RANcontextMenu.querySelector(".readdms-item").addEventListener("click", () => {
|
||||
BDFDB.removeEles(RANcontextMenu);
|
||||
BDFDB.markChannelAsRead(BDFDB.readDmList());
|
||||
});
|
||||
BDFDB.appendContextMenu(RANcontextMenu, e);
|
||||
BDFDB.openContextMenu(this, e, itemGroup);
|
||||
});
|
||||
BDFDB.addClass(wrapper, "RAN-added");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processDirectMessage (instance, wrapper, methodnames) {
|
||||
processDirectMessage (instance, wrapper, returnvalue, methodnames) {
|
||||
let ranbutton = document.querySelector(".RANbutton-frame");
|
||||
let insertnode = this.getInsertNode();
|
||||
if (ranbutton && insertnode) insertnode.parentElement.insertBefore(ranbutton, insertnode);
|
||||
}
|
||||
|
||||
processRecentMentions (instance, wrapper) {
|
||||
processRecentMentions (instance, wrapper, returnvalue) {
|
||||
BDFDB.removeEles(".RAMbutton");
|
||||
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT" && BDFDB.getData("addClearButton", this, "settings")) {
|
||||
let recentmentionstitle = wrapper.querySelector(BDFDB.dotCN.messagespopouttitle);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class RemoveNicknames {
|
||||
getName () {return "RemoveNicknames";}
|
||||
|
||||
getVersion () {return "1.2.5";}
|
||||
getVersion () {return "1.2.6";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class RemoveNicknames {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Bot Nicknames","Added an option that allows you to keep the nicknames of bots"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -68,7 +68,7 @@ class RemoveNicknames {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -91,13 +91,6 @@ class RemoveNicknames {
|
|||
BDFDB.loadMessage(this);
|
||||
|
||||
this.reseting = false;
|
||||
|
||||
this.RelationshipUtils = BDFDB.WebModules.findByProperties("isBlocked", "isFriend");
|
||||
this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUser");
|
||||
this.MemberUtils = BDFDB.WebModules.findByProperties("getNicknames", "getNick");
|
||||
this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -119,7 +112,7 @@ class RemoveNicknames {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processMemberListItem (instance, wrapper) {
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
let user = BDFDB.getReactValue(instance, "props.user");
|
||||
if (user) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.memberusername);
|
||||
|
@ -127,7 +120,7 @@ class RemoveNicknames {
|
|||
}
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper) {
|
||||
processMessageUsername (instance, wrapper, returnvalue) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
|
@ -135,14 +128,14 @@ class RemoveNicknames {
|
|||
}
|
||||
}
|
||||
|
||||
processTypingUsers (instance, wrapper) {
|
||||
let users = !instance.props.typingUsers ? [] : Object.keys(instance.props.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
|
||||
processTypingUsers (instance, wrapper, returnvalue) {
|
||||
let users = !instance.props.typingUsers ? [] : Object.keys(instance.props.typingUsers).filter(id => id != BDFDB.myData.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]));
|
||||
});
|
||||
}
|
||||
|
||||
processClickable (instance, wrapper) {
|
||||
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) {
|
||||
|
@ -150,7 +143,7 @@ class RemoveNicknames {
|
|||
if (message) {
|
||||
BDFDB.setInnerText(wrapper, this.getNewName(message.author));
|
||||
if (message.mentions.length == 1) {
|
||||
let seconduser = this.UserUtils.getUser(message.mentions[0]);
|
||||
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));
|
||||
}
|
||||
|
@ -163,7 +156,7 @@ class RemoveNicknames {
|
|||
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(this.UserUtils.getUser(props.userId), wrapper));
|
||||
else if (props && props.userId) BDFDB.setInnerText(wrapper, "@" + this.getNewName(BDFDB.LibraryModules.UserStore.getUser(props.userId), wrapper));
|
||||
}
|
||||
}
|
||||
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
|
||||
|
@ -182,7 +175,7 @@ class RemoveNicknames {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -192,7 +185,7 @@ class RemoveNicknames {
|
|||
getNewName (info) {
|
||||
if (!info) return null;
|
||||
let settings = BDFDB.getAllData(this, "settings");
|
||||
let member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {};
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
|
||||
let EditUsersData = (BDFDB.isPluginEnabled("EditUsers") ? BDFDB.loadData(info.id, "EditUsers", "users") : null) || {};
|
||||
if (this.reseting || !member.nick || info.id == BDFDB.myData.id && !settings.replaceOwn || info.bot && !settings.replaceBots) return EditUsersData.name || member.nick || info.username;
|
||||
var username = EditUsersData.name || info.username;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class RepoControls {
|
||||
getName () {return "RepoControls";}
|
||||
|
||||
getVersion () {return "1.2.9";}
|
||||
getVersion () {return "1.3.0";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class RepoControls {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Searchbug","Fixed an issue with the changelog button"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -67,9 +67,9 @@ class RepoControls {
|
|||
this.sortPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} repocontrols-sort-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.sort[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">${this.sortings.sort[key]}</div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -78,9 +78,9 @@ class RepoControls {
|
|||
this.orderPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} repocontrols-order-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.order[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}">${this.sortings.order[key]}</div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -165,7 +165,7 @@ class RepoControls {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -186,9 +186,7 @@ class RepoControls {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.fs = require("fs");
|
||||
this.path = require("path");
|
||||
|
||||
this.dirs = {theme: BDFDB.getThemesFolder(), plugin: BDFDB.getPluginsFolder()};
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -249,11 +247,11 @@ class RepoControls {
|
|||
let name = wrapper.getAttribute("data-name");
|
||||
let controls = wrapper.querySelector(BDFDB.dotCN._repocontrols);
|
||||
if (!name || !controls) return;
|
||||
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? this.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
|
||||
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);
|
||||
button.addEventListener("click", () => {
|
||||
if (!require("electron").shell.openItem(path)) BDFDB.showToast(`Unable to open ${type} "${name}".`, {type:"danger"});;
|
||||
if (!BDFDB.LibraryRequires.electron.shell.openItem(path)) BDFDB.showToast(`Unable to open ${type} "${name}".`, {type:"danger"});;
|
||||
});
|
||||
button.addEventListener("mouseenter", e => {
|
||||
BDFDB.createTooltip(`Edit ${type[0].toUpperCase() + type.slice(1)}`, e.currentTarget, {type:"top",selector:"repocontrols-editicon-tooltip"});
|
||||
|
@ -266,12 +264,12 @@ class RepoControls {
|
|||
let name = wrapper.getAttribute("data-name");
|
||||
let controls = wrapper.querySelector(BDFDB.dotCN._repocontrols);
|
||||
if (!name || !controls) return;
|
||||
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? this.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
|
||||
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);
|
||||
button.addEventListener("click", () => {
|
||||
let deleteFile = () => {
|
||||
this.fs.unlink(path, (error) => {
|
||||
BDFDB.LibraryRequires.fs.unlink(path, (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to delete ${type} "${name}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully deleted ${type} "${name}".`, {type:"success"});
|
||||
});
|
||||
|
@ -344,8 +342,8 @@ class RepoControls {
|
|||
let author = li.querySelector(BDFDB.dotCN._repoauthor).textContent;
|
||||
let description = li.querySelector(BDFDB.dotCN._repodescription).textContent;
|
||||
let enabled = li.querySelector(BDFDB.dotCN._repocheckbox).checked;
|
||||
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? this.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
|
||||
let stats = path ? this.fs.statSync(path) : null;
|
||||
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;
|
||||
let stats = path ? BDFDB.LibraryRequires.fs.statSync(path) : null;
|
||||
container.entries[name] = {
|
||||
search: (name + " " + author + " " + description).toUpperCase(),
|
||||
origName: name,
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
class RevealAllSpoilersOption {
|
||||
getName () {return "RevealAllSpoilersOption";}
|
||||
|
||||
getVersion () {return "1.0.0";}
|
||||
getVersion () {return "1.0.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Adds an entry to the message contextmenu to reveal all spoilers within a messageblock.";}
|
||||
|
||||
initConstructor () {
|
||||
this.messageContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} revealspoilers-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">Reveal all Spoilers</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ class RevealAllSpoilersOption {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -74,27 +74,32 @@ class RevealAllSpoilersOption {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.message && instance.props.target && !menu.querySelector(".revealspoilers-item")) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, instance.props.target);
|
||||
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);
|
||||
if (!messagediv || !messagediv.querySelector(BDFDB.dotCN.spoilerhidden)) return;
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(messageContextEntry, devgroup);
|
||||
else menu.appendChild(messageContextEntry, menu);
|
||||
let revealitem = messageContextEntry.querySelector(".revealspoilers-item");
|
||||
revealitem.addEventListener("click", () => {
|
||||
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
|
||||
this.revealAllSpoilers(messagediv);
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Reveal all Spoilers",
|
||||
hint: BDFDB.isPluginEnabled("MessageUtilities") ? window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Reveal_Spoilers") : null,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-reveal-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.revealAllSpoilers(messagediv);
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
if (BDFDB.isPluginEnabled("MessageUtilities")) {
|
||||
BDFDB.setContextHint(revealitem, window.bdplugins.MessageUtilities.plugin.getActiveShortcutString("__Reveal_Spoilers"));
|
||||
}
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
revealAllSpoilers (target) {
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
|
||||
let messagediv = BDFDB.getParentEle(BDFDB.dotCN.messagegroup + "> [aria-disabled]", target);
|
||||
if (!messagediv) return;
|
||||
for (let spoiler of messagediv.querySelectorAll(BDFDB.dotCN.spoilerhidden)) spoiler.click();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ReverseImageSearch {
|
||||
getName () {return "ReverseImageSearch";}
|
||||
|
||||
getVersion () {return "3.4.2";}
|
||||
getVersion () {return "3.4.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ReverseImageSearch {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Image Modal","Option is now also added to a contextmenu when you right click the image in the image modal"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -33,26 +33,6 @@ class ReverseImageSearch {
|
|||
Yandex: {value:true, name:"Yandex", url:"https://yandex.com/images/search?url=" + this.imgUrlReplaceString + "&rpt=imageview"}
|
||||
}
|
||||
};
|
||||
|
||||
this.messageContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} reverseimagesearch-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span>Reverse Image Search</span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
this.messageContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} reverseimagesearch-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} alldisabled-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_disabled_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
${Object.keys(this.defaults.engines).map((key, i) => `<div engine="${key}" class="${BDFDB.disCN.contextmenuitem} RIS-item"><span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${this.defaults.engines[key].name}</div></span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`).join("")}
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
getSettingsPanel () {
|
||||
|
@ -91,7 +71,7 @@ class ReverseImageSearch {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -127,52 +107,60 @@ class ReverseImageSearch {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.type == "NATIVE_IMAGE" && (instance.props.href || instance.props.src) && !menu.querySelector(".reverseimagesearch-item")) {
|
||||
this.appendItem(menu, instance.props.href || instance.props.src);
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.type == "NATIVE_IMAGE" && (instance.props.href || instance.props.src) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
this.appendItem(menu, returnvalue, instance.props.href || instance.props.src);
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu) {
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".reverseimagesearch-item")) {
|
||||
if (instance.props.attachment) {
|
||||
this.appendItem(menu, instance.props.attachment.url);
|
||||
this.appendItem(menu, returnvalue, instance.props.attachment.url);
|
||||
}
|
||||
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, instance.props.target.href);
|
||||
BDFDB.updateContextPosition(menu);
|
||||
this.appendItem(menu, returnvalue, instance.props.target.href);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appendItem (menu, url) {
|
||||
appendItem (menu, returnvalue, url) {
|
||||
if (url && url.indexOf("discordapp.com/assets/") == -1 && !url.endsWith(".mp4")) {
|
||||
if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1) {
|
||||
if (url.split("/https/").length != 1) url = "https://" + url.split("/https/")[url.split("/https/").length-1];
|
||||
else if (url.split("/http/").length != 1) url = "http://" + url.split("/http/")[url.split("/http/").length-1];
|
||||
}
|
||||
let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
|
||||
menu.appendChild(messageContextEntry);
|
||||
let searchitem = messageContextEntry.querySelector(".reverseimagesearch-item");
|
||||
searchitem.addEventListener("mouseenter", () => {
|
||||
let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
|
||||
let engines = BDFDB.getAllData(this, "engines");
|
||||
for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
|
||||
if (messageContextSubMenu.querySelector(".RIS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
|
||||
BDFDB.addChildEventListener(messageContextSubMenu, "click", ".RIS-item", e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
let engine = e.currentTarget.getAttribute("engine");
|
||||
if (engine == "_all") {
|
||||
for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
|
||||
let engines = BDFDB.getAllData(this, "engines");
|
||||
let items = [];
|
||||
for (let key in engines) if (engines[key]) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.defaults.engines[key].name,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-engine-contextMenuItem`,
|
||||
action: e => {
|
||||
if (!e.shiftKey) BDFDB.closeContextMenu(menu);
|
||||
if (key == "_all") {
|
||||
for (let key2 in engines) if (key2 != "_all" && engines[key2]) window.open(this.defaults.engines[key2].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
|
||||
}
|
||||
else window.open(this.defaults.engines[engine].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
|
||||
});
|
||||
BDFDB.appendSubMenu(searchitem, messageContextSubMenu);
|
||||
else window.open(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
|
||||
}
|
||||
}));
|
||||
if (!items.length) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_disabled_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-disabled-contextMenuItem`,
|
||||
disabled: true
|
||||
}));
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: "Reverse Image Search",
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-search-contextMenuSubItem`,
|
||||
render: items
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class SendLargeMessages {
|
||||
getName () {return "SendLargeMessages";}
|
||||
|
||||
getVersion () {return "1.5.3";}
|
||||
getVersion () {return "1.5.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SendLargeMessages {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Sending","Fixed the issue where Messages are not being sent"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -49,7 +49,7 @@ class SendLargeMessages {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -72,7 +72,7 @@ class SendLargeMessages {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-send ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_send_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -99,7 +99,7 @@ class SendLargeMessages {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -121,8 +121,6 @@ class SendLargeMessages {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.clipboard = require("electron").clipboard;
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -142,11 +140,9 @@ class SendLargeMessages {
|
|||
|
||||
changeLanguageStrings () {
|
||||
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_cancel_text", this.labels.btn_cancel_text);
|
||||
this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_send_text", this.labels.btn_send_text);
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.type && instance.props.type == "normal") {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
if (!textarea) return;
|
||||
|
@ -166,7 +162,7 @@ class SendLargeMessages {
|
|||
},100);
|
||||
});
|
||||
BDFDB.addEventListener(this, textarea, "paste", e => {
|
||||
modaltext = textarea.value.slice(0, textarea.selectionStart) + this.clipboard.readText() + textarea.value.slice(textarea.selectionEnd);
|
||||
modaltext = textarea.value.slice(0, textarea.selectionStart) + BDFDB.LibraryRequires.electron.clipboard.readText() + textarea.value.slice(textarea.selectionEnd);
|
||||
setImmediate(() => {checkTextarea(textarea);});
|
||||
});
|
||||
}
|
||||
|
@ -280,189 +276,147 @@ class SendLargeMessages {
|
|||
toast_allsent_text: "Sve veliku poslane.",
|
||||
modal_messages_translation: "Vijesti",
|
||||
modal_messages_warning: "Nemojte slati previše veliku!",
|
||||
modal_header_text: "Pošalji veliku poruku:",
|
||||
btn_cancel_text: "Prekid",
|
||||
btn_send_text: "Poslati"
|
||||
modal_header_text: "Pošalji veliku poruku:"
|
||||
};
|
||||
case "da": //danish
|
||||
return {
|
||||
toast_allsent_text: "Alle beskeder sendes.",
|
||||
modal_messages_translation: "Beskeder",
|
||||
modal_messages_warning: "Send ikke for mange beskeder!",
|
||||
modal_header_text: "Send stor besked:",
|
||||
btn_cancel_text: "Afbryde",
|
||||
btn_send_text: "Sende"
|
||||
modal_header_text: "Send stor besked:"
|
||||
};
|
||||
case "de": //german
|
||||
return {
|
||||
toast_allsent_text: "Alle Nachrichten versendet.",
|
||||
modal_messages_translation: "Nachrichten",
|
||||
modal_messages_warning: "Schicke nicht zu viele Nachrichten!",
|
||||
modal_header_text: "Große Nachricht senden:",
|
||||
btn_cancel_text: "Abbrechen",
|
||||
btn_send_text: "Senden"
|
||||
modal_header_text: "Große Nachricht senden:"
|
||||
};
|
||||
case "es": //spanish
|
||||
return {
|
||||
toast_allsent_text: "Todos los mensajes enviados.",
|
||||
modal_messages_translation: "Mensajes",
|
||||
modal_messages_warning: "¡No envíe demasiados mensajes!",
|
||||
modal_header_text: "Enviar mensaje grande:",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_send_text: "Enviar"
|
||||
modal_header_text: "Enviar mensaje grande:"
|
||||
};
|
||||
case "fr": //french
|
||||
return {
|
||||
toast_allsent_text: "Tous les messages envoyés",
|
||||
modal_messages_translation: "Messages",
|
||||
modal_messages_warning: "N'envoyez pas trop de messages!",
|
||||
modal_header_text: "Envoyer un gros message:",
|
||||
btn_cancel_text: "Abandonner",
|
||||
btn_send_text: "Envoyer"
|
||||
modal_header_text: "Envoyer un gros message:"
|
||||
};
|
||||
case "it": //italian
|
||||
return {
|
||||
toast_allsent_text: "Tutti i messaggi inviati.",
|
||||
modal_messages_translation: "Messaggi",
|
||||
modal_messages_warning: "Non inviare troppi messaggi!",
|
||||
modal_header_text: "Invia grande messaggio:",
|
||||
btn_cancel_text: "Cancellare",
|
||||
btn_send_text: "Inviare"
|
||||
modal_header_text: "Invia grande messaggio:"
|
||||
};
|
||||
case "nl": //dutch
|
||||
return {
|
||||
toast_allsent_text: "Alle berichten verzonden.",
|
||||
modal_messages_translation: "Berichten",
|
||||
modal_messages_warning: "Stuur niet te veel berichten!",
|
||||
modal_header_text: "Stuur een groot bericht:",
|
||||
btn_cancel_text: "Afbreken",
|
||||
btn_send_text: "Sturen"
|
||||
modal_header_text: "Stuur een groot bericht:"
|
||||
};
|
||||
case "no": //norwegian
|
||||
return {
|
||||
toast_allsent_text: "Alle meldinger sendt.",
|
||||
modal_messages_translation: "Meldinger",
|
||||
modal_messages_warning: "Ikke send for mange meldinger!",
|
||||
modal_header_text: "Send stor melding:",
|
||||
btn_cancel_text: "Avbryte",
|
||||
btn_send_text: "Sende"
|
||||
modal_header_text: "Send stor melding:"
|
||||
};
|
||||
case "pl": //polish
|
||||
return {
|
||||
toast_allsent_text: "Wszystkie wiadomości zostały wysłane.",
|
||||
modal_messages_translation: "Wiadomości",
|
||||
modal_messages_warning: "Nie wysyłaj zbyt wielu wiadomości!",
|
||||
modal_header_text: "Wyślij dużą wiadomość:",
|
||||
btn_cancel_text: "Anuluj",
|
||||
btn_send_text: "Wyślij"
|
||||
modal_header_text: "Wyślij dużą wiadomość:"
|
||||
};
|
||||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
toast_allsent_text: "Todas as mensagens enviadas.",
|
||||
modal_messages_translation: "Mensagens",
|
||||
modal_messages_warning: "Não envie muitas mensagens!",
|
||||
modal_header_text: "Enviar mensagem grande:",
|
||||
btn_cancel_text: "Cancelar",
|
||||
btn_send_text: "Enviar"
|
||||
modal_header_text: "Enviar mensagem grande:"
|
||||
};
|
||||
case "fi": //finnish
|
||||
return {
|
||||
toast_allsent_text: "Kaikki lähetetyt viestit.",
|
||||
modal_messages_translation: "Viestien",
|
||||
modal_messages_warning: "Älä lähetä liian monta viestiä!",
|
||||
modal_header_text: "Lähetä suuri viesti:",
|
||||
btn_cancel_text: "Peruuttaa",
|
||||
btn_send_text: "Lähettää"
|
||||
modal_header_text: "Lähetä suuri viesti:"
|
||||
};
|
||||
case "sv": //swedish
|
||||
return {
|
||||
toast_allsent_text: "Alla meddelanden skickade.",
|
||||
modal_messages_translation: "Meddelanden",
|
||||
modal_messages_warning: "Skicka inte för många meddelanden!",
|
||||
modal_header_text: "Skicka stort meddelande:",
|
||||
btn_cancel_text: "Avbryta",
|
||||
btn_send_text: "Skicka"
|
||||
modal_header_text: "Skicka stort meddelande:"
|
||||
};
|
||||
case "tr": //turkish
|
||||
return {
|
||||
toast_allsent_text: "Tüm mesajlar gönderildi.",
|
||||
modal_messages_translation: "Mesajları",
|
||||
modal_messages_warning: "Çok fazla mesaj göndermeyin!",
|
||||
modal_header_text: "Büyük mesaj gönder:",
|
||||
btn_cancel_text: "Iptal",
|
||||
btn_send_text: "Göndermek"
|
||||
modal_header_text: "Büyük mesaj gönder:"
|
||||
};
|
||||
case "cs": //czech
|
||||
return {
|
||||
toast_allsent_text: "Všechny zprávy byly odeslány.",
|
||||
modal_messages_translation: "Zpráv",
|
||||
modal_messages_warning: "Neposílejte příliš mnoho zpráv!",
|
||||
modal_header_text: "Odeslat velkou zprávu:",
|
||||
btn_cancel_text: "Zrušení",
|
||||
btn_send_text: "Poslat"
|
||||
modal_header_text: "Odeslat velkou zprávu:"
|
||||
};
|
||||
case "bg": //bulgarian
|
||||
return {
|
||||
toast_allsent_text: "Всички изпратени съобщения.",
|
||||
modal_messages_translation: "Съобщения",
|
||||
modal_messages_warning: "Не изпращайте твърде много съобщения!",
|
||||
modal_header_text: "Изпратете голямо съобщение:",
|
||||
btn_cancel_text: "Зъбести",
|
||||
btn_send_text: "изпращам"
|
||||
modal_header_text: "Изпратете голямо съобщение:"
|
||||
};
|
||||
case "ru": //russian
|
||||
return {
|
||||
toast_allsent_text: "Все отправленные сообщения.",
|
||||
modal_messages_translation: "Сообщения",
|
||||
modal_messages_warning: "Не отправляйте слишком много сообщений!",
|
||||
modal_header_text: "Отправить сообщение:",
|
||||
btn_cancel_text: "Отмена",
|
||||
btn_send_text: "Послать"
|
||||
modal_header_text: "Отправить сообщение:"
|
||||
};
|
||||
case "uk": //ukrainian
|
||||
return {
|
||||
toast_allsent_text: "Всі повідомлення надіслано.",
|
||||
modal_messages_translation: "Повідомлення",
|
||||
modal_messages_warning: "Не надсилайте надто багато повідомлень!",
|
||||
modal_header_text: "Надіслати велике повідомлення:",
|
||||
btn_cancel_text: "Скасувати",
|
||||
btn_send_text: "Відправити"
|
||||
modal_header_text: "Надіслати велике повідомлення:"
|
||||
};
|
||||
case "ja": //japanese
|
||||
return {
|
||||
toast_allsent_text: "すべてのメッセージが送信されました。",
|
||||
modal_messages_translation: "メッセージ",
|
||||
modal_messages_warning: "あまりにも多くのメッセージを送信しないでください!",
|
||||
modal_header_text: "大きなメッセージを送信する:",
|
||||
btn_cancel_text: "キャンセル",
|
||||
btn_send_text: "送信"
|
||||
modal_header_text: "大きなメッセージを送信する:"
|
||||
};
|
||||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
toast_allsent_text: "發送的所有消息。",
|
||||
modal_messages_translation: "消息",
|
||||
modal_messages_warning: "不要發送太多信息!",
|
||||
modal_header_text: "發送大信息:",
|
||||
btn_cancel_text: "取消",
|
||||
btn_send_text: "發送"
|
||||
modal_header_text: "發送大信息:"
|
||||
};
|
||||
case "ko": //korean
|
||||
return {
|
||||
toast_allsent_text: "모든 메시지가 전송되었습니다.",
|
||||
modal_messages_translation: "메시지",
|
||||
modal_messages_warning: "너무 많은 메시지를 보내지 마십시오!",
|
||||
modal_header_text: "큰 메시지 보내기:",
|
||||
btn_cancel_text: "취소",
|
||||
btn_send_text: "보내다"
|
||||
modal_header_text: "큰 메시지 보내기:"
|
||||
};
|
||||
default: //default: english
|
||||
return {
|
||||
toast_allsent_text: "All messages sent.",
|
||||
modal_messages_translation: "Messages",
|
||||
modal_messages_warning: "Do not send too many messages!",
|
||||
modal_header_text: "Send large message:",
|
||||
btn_cancel_text: "Cancel",
|
||||
btn_send_text: "Send"
|
||||
modal_header_text: "Send large message:"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ServerFolders {
|
||||
getName () {return "ServerFolders";}
|
||||
|
||||
getVersion () {return "6.3.5";}
|
||||
getVersion () {return "6.3.6";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ServerFolders {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["<span style='-webkit-background-clip: text; color: transparent; background-image: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'>Color Gradients</span>","You can now use color gradients to create folders"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -91,83 +91,31 @@ class ServerFolders {
|
|||
}
|
||||
${BDFDB.dotCN.guildswrapper}.foldercontent {
|
||||
transition: width .3s linear !important;
|
||||
left: 72px;
|
||||
}
|
||||
${BDFDB.dotCN.guildswrapper}.foldercontent .folderseparatorouter {
|
||||
margin-top: 10px;
|
||||
}
|
||||
${BDFDB.dotCN.guildswrapper}.foldercontent.foldercontentclosed {
|
||||
width: 0px !important;
|
||||
}
|
||||
${BDFDB.dotCN.appcontainer} {
|
||||
display: flex !important;
|
||||
}
|
||||
${BDFDB.dotCN.guildswrapper} {
|
||||
position: static !important;
|
||||
contain: unset !important;
|
||||
}
|
||||
${BDFDB.dotCN.chatbase} {
|
||||
position: static !important;
|
||||
contain: unset !important;
|
||||
width: 100% !important;
|
||||
}`;
|
||||
|
||||
this.serverContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} serverfolders-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_servercontext_serverfolders_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} serverfolders-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} createfolder-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_serversubmenu_createfolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} addtofolder-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_serversubmenu_addtofolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} removefromfolder-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_serversubmenu_removefromfolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverContextSubFolderMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} serverfolders-foldersubmenu">
|
||||
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
|
||||
<div class="${BDFDB.disCNS.scroller + BDFDB.disCN.contextmenuscroller}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.folderContextMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} serverfolder-contextmenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} unreadfolder-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_foldercontext_unreadfolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} autounreadfolder-item ${BDFDB.disCN.contextmenuitemtoggle}">
|
||||
<div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_foldercontext_autounreadfolder_text</div></div>
|
||||
<div class="${BDFDB.disCNS.contextmenucheckbox + BDFDB.disCN.contextmenucheckbox2}">
|
||||
<div class="${BDFDB.disCN.contextmenucheckboxinner}">
|
||||
<input class="${BDFDB.disCN.contextmenucheckboxelement}" type="checkbox">
|
||||
<span></span>
|
||||
</div>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} foldersettings-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_foldercontext_foldersettings_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} createfolder-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_foldercontext_createfolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} removefolder-item ${BDFDB.disCN.contextmenuitemdanger}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_foldercontext_removefolder_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.folderContentMarkup =
|
||||
`<div class="${BDFDB.disCN.guildswrapper} foldercontent foldercontentclosed">
|
||||
`<div class="${BDFDB.disCNS.guildswrapper + BDFDB.disCN.guilds} foldercontent foldercontentclosed">
|
||||
<div class="${BDFDB.disCNS.scrollerwrap + BDFDB.disCNS.firefoxfixscrollflex + BDFDB.disCNS.guildsscrollerwrap + BDFDB.disCNS.scrollerthemed + BDFDB.disCN.themeghosthairline}">
|
||||
<div class="${BDFDB.disCNS.guilds + BDFDB.disCN.scroller}"></div>
|
||||
<div class="${BDFDB.disCNS.guildsscroller + BDFDB.disCN.scroller}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
@ -231,7 +179,7 @@ class ServerFolders {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto; padding-bottom: 10px;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -342,7 +290,7 @@ class ServerFolders {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-save ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_save_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -426,7 +374,7 @@ class ServerFolders {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -448,11 +396,6 @@ class ServerFolders {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
|
||||
this.CurrentGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
|
||||
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
|
||||
this.Animations = BDFDB.WebModules.findByProperties("spring");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this, "Guilds");
|
||||
}
|
||||
else {
|
||||
|
@ -483,18 +426,6 @@ class ServerFolders {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_servercontext_serverfolders_text", this.labels.servercontext_serverfolders_text);
|
||||
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_serversubmenu_createfolder_text", this.labels.serversubmenu_createfolder_text);
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_serversubmenu_addtofolder_text", this.labels.serversubmenu_addtofolder_text);
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_serversubmenu_removefromfolder_text", this.labels.serversubmenu_removefromfolder_text);
|
||||
|
||||
this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_unreadfolder_text", this.labels.foldercontext_unreadfolder_text);
|
||||
this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_autounreadfolder_text", this.labels.foldercontext_autounreadfolder_text);
|
||||
this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_foldersettings_text", this.labels.foldercontext_foldersettings_text);
|
||||
this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_createfolder_text", this.labels.serversubmenu_createfolder_text);
|
||||
this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_removefolder_text", this.labels.foldercontext_removefolder_text);
|
||||
|
||||
this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_foldername_text", this.labels.modal_foldername_text);
|
||||
this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text);
|
||||
|
@ -512,59 +443,60 @@ class ServerFolders {
|
|||
this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_custompreview_text", this.labels.modal_custompreview_text);
|
||||
}
|
||||
|
||||
onGuildContextMenu (instance, menu) {
|
||||
onGuildContextMenu (instance, menu, returnvalue) {
|
||||
if (document.querySelector(".BDFDB-modal")) return;
|
||||
if (instance.props && instance.props.target && instance.props.guild && instance.props.type == "GUILD_ICON_BAR" && !menu.querySelector(".serverfolders-item")) {
|
||||
let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(serverContextEntry, devgroup);
|
||||
else menu.appendChild(serverContextEntry, menu);
|
||||
let folderitem = serverContextEntry.querySelector(".serverfolders-item");
|
||||
folderitem.addEventListener("mouseenter", () => {
|
||||
let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
|
||||
let createitem = serverContextSubMenu.querySelector(".createfolder-item");
|
||||
let additem = serverContextSubMenu.querySelector(".addtofolder-item");
|
||||
let removeitem = serverContextSubMenu.querySelector(".removefromfolder-item");
|
||||
createitem.addEventListener("click", () => {
|
||||
let folders = document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder");
|
||||
let folderdiv = this.getFolderOfServer(instance.props.guild);
|
||||
let addtofolderitems = [];
|
||||
for (let i = 0; i < folders.length; i++) addtofolderitems.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: folders[i].getAttribute("foldername") || (this.labels.modal_tabheader1_text + " #" + parseInt(i+1)),
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addtofolder-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.createNewFolder(instance.props.target);
|
||||
});
|
||||
let folderdiv = this.getFolderOfServer(instance.props.guild);
|
||||
if (!folderdiv) {
|
||||
BDFDB.removeEles(removeitem);
|
||||
let folders = document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder");
|
||||
if (folders) {
|
||||
BDFDB.removeClass(additem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
additem.addEventListener("mouseenter", () => {
|
||||
let serverContextSubFolderMenu = BDFDB.htmlToElement(this.serverContextSubFolderMenuMarkup);
|
||||
for (let i = 0; i < folders.length; i++) {
|
||||
let foundfolderdiv = folders[i];
|
||||
let name = foundfolderdiv.getAttribute("foldername");
|
||||
let folderentry = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.contextmenuitem} addtospecificfolder-item"><span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${name ? BDFDB.encodeToHTML(name) : (this.labels.modal_tabheader1_text + " #" + (i+1))}</div></span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`);
|
||||
folderentry.addEventListener("click", () => {
|
||||
this.addServerToFolder(instance.props.guild, folders[i]);
|
||||
}
|
||||
}));
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.servercontext_serverfolders_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-guild-contextMenuSubItem`,
|
||||
render: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.serversubmenu_createfolder_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-createfolder-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addServerToFolder(instance.props.guild, foundfolderdiv);
|
||||
});
|
||||
serverContextSubFolderMenu.firstElementChild.firstElementChild.appendChild(folderentry);
|
||||
}
|
||||
BDFDB.appendSubMenu(additem, serverContextSubFolderMenu);
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(additem);
|
||||
}
|
||||
else {
|
||||
BDFDB.removeEles(additem);
|
||||
removeitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.removeServerFromFolder(instance.props.guild, folderdiv);
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(folderitem, serverContextSubMenu);
|
||||
this.createNewFolder(instance.props.target);
|
||||
}
|
||||
}),
|
||||
folderdiv ? BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.serversubmenu_removefromfolder_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-repo-contextMenuItem`,
|
||||
danger: true,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.removeServerFromFolder(instance.props.guild, folderdiv);
|
||||
}
|
||||
}) : BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.serversubmenu_addtofolder_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-addtofolder-contextMenuSubItem`,
|
||||
disabled: !addtofolderitems.length,
|
||||
render: addtofolderitems
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
processGuilds (instance, wrapper, methodnames) {
|
||||
processGuilds (instance, wrapper, returnvalue, methodnames) {
|
||||
if (methodnames.includes("componentWillUnmount")) {
|
||||
BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent", ".serverfolder-contextmenu", BDFDB.dotCN.guildouter + ".folder");
|
||||
this.foldercontent = null;
|
||||
|
@ -574,7 +506,7 @@ class ServerFolders {
|
|||
if (!wrapper.parentElement.querySelector(BDFDB.dotCN.guildswrapper + ".foldercontent")) {
|
||||
this.foldercontent = BDFDB.htmlToElement(this.folderContentMarkup);
|
||||
wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling);
|
||||
this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guilds);
|
||||
this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guildsscroller);
|
||||
}
|
||||
let folders = BDFDB.sortObject(BDFDB.loadAllData(this, "folders"), "position");
|
||||
for (let folderID in folders) if (folderID && !wrapper.querySelector(BDFDB.dotCN.guildouter + ".folder#" + folderID)) {
|
||||
|
@ -596,7 +528,7 @@ class ServerFolders {
|
|||
}
|
||||
}
|
||||
|
||||
processGuild (instance, wrapper, methodnames) {
|
||||
processGuild (instance, wrapper, returnvalue, methodnames) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
if (methodnames.includes("componentDidMount")) {
|
||||
this.cachedGuildState[instance.props.guild.id] = this.getGuildState(instance);
|
||||
|
@ -609,7 +541,7 @@ class ServerFolders {
|
|||
BDFDB.addEventListener(this, wrapper, "click", () => {setImmediate(() => {
|
||||
var newsettings = BDFDB.getAllData(this, "settings")
|
||||
if (newsettings.closeAllFolders) document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder.open").forEach(openFolder => {
|
||||
if (!newsettings.forceOpenFolder || !this.foldercontent.querySelector(`${BDFDB.dotCN.guildouter}[folder="${openFolder.id}"][guild="${this.CurrentGuildStore.getGuildId()}"]`)) this.openCloseFolder(openFolder);
|
||||
if (!newsettings.forceOpenFolder || !this.foldercontent.querySelector(`${BDFDB.dotCN.guildouter}[folder="${openFolder.id}"][guild="${BDFDB.LibraryModules.LastGuildStore.getGuildId()}"]`)) this.openCloseFolder(openFolder);
|
||||
});
|
||||
})});
|
||||
BDFDB.addEventListener(this, wrapper, "mousedown", e => {
|
||||
|
@ -663,7 +595,7 @@ class ServerFolders {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated && this.foldercontent) {
|
||||
delete this.SettingsUpdated;
|
||||
this.foldercontent.querySelectorAll(BDFDB.dotCN.guildouter + ".folder").forEach(folderdiv => {this.updateFolderNotifications(folderdiv);});
|
||||
|
@ -678,7 +610,7 @@ class ServerFolders {
|
|||
|
||||
showFolderSettings (folderdiv) {
|
||||
if (!folderdiv) return;
|
||||
let {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers,isOpen} = BDFDB.loadData(folderdiv.id, this, "folders") || {};
|
||||
let {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers,isOpen,autounread} = BDFDB.loadData(folderdiv.id, this, "folders") || {};
|
||||
if (!folderID) return;
|
||||
|
||||
let folderSettingsModal = BDFDB.htmlToElement(this.folderSettingsModalMarkup);
|
||||
|
@ -820,8 +752,7 @@ class ServerFolders {
|
|||
let successFetchIcon;
|
||||
let url = modal.querySelector("input[type='text'][option='" + type + "']").value;
|
||||
if (url.indexOf("http") == 0) {
|
||||
let request = require("request");
|
||||
request(url, (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request(url, (error, response, result) => {
|
||||
if (response) {
|
||||
let type = response.headers["content-type"];
|
||||
if (type && type.indexOf("image") > -1) {
|
||||
|
@ -833,9 +764,8 @@ class ServerFolders {
|
|||
});
|
||||
}
|
||||
else {
|
||||
let fs = require("fs")
|
||||
if (fs.existsSync(url)) {
|
||||
fs.readFile(url, (error, response) => {
|
||||
if (BDFDB.LibraryRequires.fs.existsSync(url)) {
|
||||
BDFDB.LibraryRequires.fs.readFile(url, (error, response) => {
|
||||
if (!error) {
|
||||
url = `data:image/png;base64,${response.toString("base64")}`;
|
||||
successFetchIcon();
|
||||
|
@ -912,20 +842,22 @@ class ServerFolders {
|
|||
if (!Node.prototype.isPrototypeOf(ankerdiv)) return;
|
||||
let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter, ankerdiv);
|
||||
if (!guilddiv) return;
|
||||
let folderID = this.generateID("folder");
|
||||
let folderName = "";
|
||||
let position = this.getAllServersAndFolders().indexOf(guilddiv);
|
||||
let iconID = 0;
|
||||
let icons = {openicon: this.createBase64SVG(this.folderIcons[0].openicon), closedicon: this.createBase64SVG(this.folderIcons[0].closedicon)};
|
||||
let autounread = false;
|
||||
let isOpen = false;
|
||||
let color1 = ["0","0","0"];
|
||||
let color2 = ["255","255","255"];
|
||||
let color3 = null;
|
||||
let color4 = null;
|
||||
let servers = [];
|
||||
|
||||
this.showFolderSettings(this.createFolderDiv({folderID,folderName,position,iconID,icons,autounread,color1,color2,color3,color4,servers}));
|
||||
this.showFolderSettings(this.createFolderDiv({
|
||||
folderID: this.generateID("folder"),
|
||||
folderName: "",
|
||||
position: this.getAllServersAndFolders().indexOf(guilddiv),
|
||||
iconID: 0,
|
||||
icons: {openicon: this.createBase64SVG(this.folderIcons[0].openicon), closedicon: this.createBase64SVG(this.folderIcons[0].closedicon)},
|
||||
autounread: false,
|
||||
copyTooltipColor: false,
|
||||
isOpen: false,
|
||||
color1: ["0","0","0"],
|
||||
color2: ["255","255","255"],
|
||||
color3: null,
|
||||
color4: null,
|
||||
servers: []
|
||||
}));
|
||||
|
||||
this.updateFolderPositions();
|
||||
}
|
||||
|
@ -963,37 +895,56 @@ class ServerFolders {
|
|||
folderdiv.addEventListener("contextmenu", e => {
|
||||
let newdata = BDFDB.loadData(folderdiv.id, this, "folders");
|
||||
if (!newdata) return;
|
||||
let folderContext = BDFDB.htmlToElement(this.folderContextMarkup);
|
||||
let autounreadinput = folderContext.querySelector(".autounreadfolder-item input");
|
||||
autounreadinput.checked = newdata.autounread;
|
||||
folderContext.querySelector(".autounreadfolder-item").addEventListener("click", () => {
|
||||
autounreadinput.checked = !autounreadinput.checked;
|
||||
newdata.autounread = autounreadinput.checked;
|
||||
BDFDB.saveData(newdata.folderID, newdata, this, "folders");
|
||||
});
|
||||
folderContext.querySelector(".foldersettings-item").addEventListener("click", () => {
|
||||
folderContext.remove();
|
||||
this.showFolderSettings(folderdiv);
|
||||
});
|
||||
folderContext.querySelector(".createfolder-item").addEventListener("click", () => {
|
||||
folderContext.remove();
|
||||
this.createNewFolder(folderdiv);
|
||||
});
|
||||
folderContext.querySelector(".removefolder-item").addEventListener("click", () => {
|
||||
folderContext.remove();
|
||||
this.removeFolder(folderdiv);
|
||||
});
|
||||
|
||||
let unreadServers = BDFDB.readUnreadServerList(this.readIncludedServerList(folderdiv));
|
||||
if (unreadServers.length > 0) {
|
||||
let unreaditem = folderContext.querySelector(".unreadfolder-item");
|
||||
BDFDB.removeClass(unreaditem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
unreaditem.addEventListener("click", () => {
|
||||
folderContext.remove();
|
||||
BDFDB.markGuildAsRead(unreadServers);
|
||||
});
|
||||
}
|
||||
BDFDB.appendContextMenu(folderContext, e);
|
||||
const itemGroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.foldercontext_unreadfolder_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-unreadfolder-contextMenuItem`,
|
||||
disabled: !unreadServers.length,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
BDFDB.markGuildAsRead(unreadServers);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuToggleItem, {
|
||||
label: this.labels.foldercontext_autounreadfolder_text,
|
||||
className: `BDFDB-contextMenuToggleItem ${this.name}-contextMenuToggleItem ${this.name}-autounreadfolder-contextMenuToggleItem`,
|
||||
active: newdata.autounread,
|
||||
action: state => {
|
||||
newdata.autounread = state;
|
||||
BDFDB.saveData(newdata.folderID, newdata, this, "folders");
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.foldercontext_foldersettings_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-foldersettings-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
this.showFolderSettings(folderdiv);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.serversubmenu_createfolder_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-createfolder-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
this.createNewFolder(folderdiv);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.foldercontext_removefolder_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-removefolder-contextMenuItem`,
|
||||
danger: true,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target));
|
||||
this.removeFolder(folderdiv);
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
BDFDB.openContextMenu(this, e, itemGroup);
|
||||
});
|
||||
folderdiv.addEventListener("mousedown", e => {
|
||||
let x = e.pageX, y = e.pageY;
|
||||
|
@ -1001,7 +952,7 @@ class ServerFolders {
|
|||
if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) {
|
||||
document.removeEventListener("mousemove", mousemove);
|
||||
document.removeEventListener("mouseup", mouseup);
|
||||
let guildswrap = document.querySelector(`${BDFDB.dotCN.guildswrapper}:not(.foldercontent) ${BDFDB.dotCN.guilds}`);
|
||||
let guildswrap = document.querySelector(`${BDFDB.dotCN.guildswrapper}:not(.foldercontent) ${BDFDB.dotCN.guildsscroller}`);
|
||||
if (!guildswrap) return;
|
||||
let hovele = null;
|
||||
let placeholder = BDFDB.htmlToElement(this.dragPlaceholderMarkup);
|
||||
|
@ -1011,11 +962,13 @@ class ServerFolders {
|
|||
BDFDB.toggleEles(folderdiv, false);
|
||||
this.updateDragPreview(dragpreview, e3);
|
||||
hovele = BDFDB.getParentEle(BDFDB.dotCN.guildouter + ".folder", e3.target);
|
||||
if (hovele) guildswrap.insertBefore(placeholder, hovele.nextSibling);
|
||||
if (hovele) {
|
||||
if (hovele.parentElement == guildswrap) guildswrap.insertBefore(placeholder, hovele.nextSibling);
|
||||
}
|
||||
else {
|
||||
hovele = BDFDB.getParentEle(BDFDB.dotCN.guildouter, e3.target);
|
||||
if (hovele && BDFDB.getReactValue(hovele, "return.memoizedProps.guild") && guildswrap.contains(hovele)) {
|
||||
guildswrap.insertBefore(placeholder, hovele.nextSibling);
|
||||
if (hovele.parentElement == guildswrap) guildswrap.insertBefore(placeholder, hovele.nextSibling);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1058,7 +1011,7 @@ class ServerFolders {
|
|||
let insertnode = serversandfolders[data.position == -1 || data.position > serversandfolders.length - 1 ? serversandfolders.length - 1 : data.position];
|
||||
if (insertnode) insertnode.parentElement.insertBefore(folderdiv, insertnode);
|
||||
else {
|
||||
insertnode = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCNS.guilds + BDFDB.dotCN.guildbuttoncontainer));
|
||||
insertnode = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCNS.guildsscroller + BDFDB.dotCN.guildbuttoncontainer));
|
||||
if (insertnode) insertnode.parentElement.parentElement.insertBefore(folderdiv, insertnode.parentElement);
|
||||
}
|
||||
}
|
||||
|
@ -1199,7 +1152,7 @@ class ServerFolders {
|
|||
updateCopyInFolderContent (guilddiv, folderdiv) {
|
||||
if (!guilddiv || !folderdiv || !this.foldercontent) return;
|
||||
if (BDFDB.containsClass(folderdiv, "open")) {
|
||||
let info = this.GuildUtils.getGuild(BDFDB.getServerID(guilddiv));
|
||||
let info = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.getServerID(guilddiv));
|
||||
if (!info) return;
|
||||
let oldCopy = this.foldercontent.querySelector(`[guild="${info.id}"]`);
|
||||
if (oldCopy) {
|
||||
|
@ -1216,7 +1169,7 @@ class ServerFolders {
|
|||
|
||||
createCopyOfServer (guilddiv, folderdiv) {
|
||||
if (!guilddiv || !folderdiv || !this.foldercontent) return;
|
||||
let info = this.GuildUtils.getGuild(BDFDB.getServerID(guilddiv));
|
||||
let info = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.getServerID(guilddiv));
|
||||
if (!info) return;
|
||||
let props = BDFDB.getReactValue(guilddiv, "return.stateNode.props");
|
||||
let guildcopy = guilddiv.cloneNode(true);
|
||||
|
@ -1390,11 +1343,13 @@ class ServerFolders {
|
|||
|
||||
includedServers.forEach(div => {
|
||||
let props = BDFDB.getReactValue(div, "return.stateNode.props");
|
||||
mentions += parseInt(props.badge);
|
||||
if (props.selected) selected = true;
|
||||
if (props.unread) unread = true;
|
||||
if (props.audio) audioenabled = true;
|
||||
if (props.video) videoenabled = true;
|
||||
if (props) {
|
||||
mentions += parseInt(props.badge);
|
||||
if (props.selected) selected = true;
|
||||
if (props.unread) unread = true;
|
||||
if (props.audio) audioenabled = true;
|
||||
if (props.video) videoenabled = true;
|
||||
}
|
||||
});
|
||||
|
||||
BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildunread, unread);
|
||||
|
@ -1453,7 +1408,7 @@ class ServerFolders {
|
|||
|
||||
let guild = div.getAttribute("guild");
|
||||
|
||||
let borderRadius = new this.Animations.Value(0);
|
||||
let borderRadius = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
borderRadius
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
|
@ -1463,7 +1418,7 @@ class ServerFolders {
|
|||
diviconwrapper.style.setProperty("border-radius", `${value.value}%`);
|
||||
});
|
||||
|
||||
let pillHeight = new this.Animations.Value(0);
|
||||
let pillHeight = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
pillHeight
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
|
@ -1473,7 +1428,7 @@ class ServerFolders {
|
|||
divpillitem.style.setProperty("height", `${value.value}px`);
|
||||
});
|
||||
|
||||
let pillOpacity = new this.Animations.Value(0);
|
||||
let pillOpacity = new BDFDB.LibraryModules.AnimationUtils.Value(0);
|
||||
pillOpacity
|
||||
.interpolate({
|
||||
inputRange: [0, 1],
|
||||
|
@ -1484,27 +1439,27 @@ class ServerFolders {
|
|||
});
|
||||
|
||||
let animate = (v) => {
|
||||
this.Animations.parallel([
|
||||
this.Animations.timing(borderRadius, {toValue: v, duration: 200}),
|
||||
this.Animations.spring(pillHeight, {toValue: v, friction: 5})
|
||||
BDFDB.LibraryModules.AnimationUtils.parallel([
|
||||
BDFDB.LibraryModules.AnimationUtils.timing(borderRadius, {toValue: v, duration: 200}),
|
||||
BDFDB.LibraryModules.AnimationUtils.spring(pillHeight, {toValue: v, friction: 5})
|
||||
]).start();
|
||||
};
|
||||
|
||||
let animate2 = (v) => {
|
||||
this.Animations.parallel([
|
||||
this.Animations.timing(pillOpacity, {toValue: v, duration: 200}),
|
||||
BDFDB.LibraryModules.AnimationUtils.parallel([
|
||||
BDFDB.LibraryModules.AnimationUtils.timing(pillOpacity, {toValue: v, duration: 200}),
|
||||
]).start();
|
||||
};
|
||||
|
||||
divinner.addEventListener("mouseenter", () => {
|
||||
pillvisible = divpillitem.style.getPropertyValue("opacity") != 0;
|
||||
if (!guild || (this.CurrentGuildStore.getGuildId() != guild)) {
|
||||
if (!guild || (BDFDB.LibraryModules.LastGuildStore.getGuildId() != guild)) {
|
||||
animate(1);
|
||||
if (!pillvisible) animate2(1);
|
||||
}
|
||||
})
|
||||
divinner.addEventListener("mouseleave", () => {
|
||||
if (!guild || (this.CurrentGuildStore.getGuildId() != guild)) {
|
||||
if (!guild || (BDFDB.LibraryModules.LastGuildStore.getGuildId() != guild)) {
|
||||
animate(0);
|
||||
if (!pillvisible) animate2(0);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ServerHider {
|
||||
getName () {return "ServerHider";}
|
||||
|
||||
getVersion () {return "6.0.8";}
|
||||
getVersion () {return "6.0.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ServerHider {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Server Object","Changes in the Server Object broke the plugin"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.labels = {};
|
||||
|
@ -30,7 +30,7 @@ class ServerHider {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">REPLACE_modal_header_text</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">REPLACE_modal_header_text</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -49,10 +49,10 @@ class ServerHider {
|
|||
</div>
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontalreverse + BDFDB.disCNS.horizontalreverse2 + BDFDB.disCNS.directionrowreverse + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignstretch + BDFDB.disCNS.nowrap + BDFDB.disCN.modalfooter}">
|
||||
<button type="button" class="btn-ok ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_ok_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
<button type="button" class="btn-all ${BDFDB.disCNS.button + BDFDB.disCNS.buttonlooklink + BDFDB.disCNS.buttoncolortransparent + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow}">
|
||||
<div class="${BDFDB.disCN.buttoncontents}">REPLACE_btn_all_text</div>
|
||||
<div class="${BDFDB.disCN.buttoncontents}"></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,28 +68,6 @@ class ServerHider {
|
|||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} serverhider-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_serverhider_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.serverContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} serverhider-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} hideserver-item ${BDFDB.disCN.contextmenuitemdisabled}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_hideserver_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} openhidemenu-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_submenu_openhidemenu_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
clearNotifications: {value:false, description:"Automatically clear any kind of notification of all hidden servers."},
|
||||
|
@ -138,7 +116,7 @@ class ServerHider {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -183,47 +161,52 @@ class ServerHider {
|
|||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_serverhider_text", this.labels.context_serverhider_text);
|
||||
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_hideserver_text", this.labels.submenu_hideserver_text);
|
||||
this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_openhidemenu_text", this.labels.submenu_openhidemenu_text);
|
||||
|
||||
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
|
||||
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
|
||||
this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
|
||||
|
||||
this.serverEntryMarkup = this.serverEntryMarkup.replace("REPLACE_btn_visible_text", this.labels.btn_visible_text);
|
||||
}
|
||||
|
||||
onGuildContextMenu (instance, menu) {
|
||||
onGuildContextMenu (instance, menu, returnvalue) {
|
||||
if (document.querySelector(".BDFDB-modal")) return;
|
||||
if (instance.props && instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(".serverhider-item")) {
|
||||
let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
|
||||
let devgroup = BDFDB.getContextMenuDevGroup(menu);
|
||||
if (devgroup) devgroup.parentElement.insertBefore(serverContextEntry, devgroup);
|
||||
else menu.appendChild(serverContextEntry, menu);
|
||||
let hideritem = serverContextEntry.querySelector(".serverhider-item");
|
||||
hideritem.addEventListener("mouseenter", () => {
|
||||
let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
|
||||
let openitem = serverContextSubMenu.querySelector(".openhidemenu-item");
|
||||
openitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showServerModal();
|
||||
});
|
||||
if (instance.props.guild && !instance.props.target.getAttribute("folder")) {
|
||||
let hideitem = serverContextSubMenu.querySelector(".hideserver-item");
|
||||
BDFDB.removeClass(hideitem, BDFDB.disCN.contextmenuitemdisabled);
|
||||
hideitem.addEventListener("click", () => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.toggleServer(instance.props.guild, instance.props.target, false);
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(hideritem, serverContextSubMenu);
|
||||
if (instance.props && instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_serverhider_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem`,
|
||||
render: [BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_openhidemenu_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-hidemenu-ContextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.showServerModal();
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.submenu_hideserver_text,
|
||||
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-hideserver-ContextMenuItem`,
|
||||
disabled: !(instance.props.guild && !instance.props.target.getAttribute("folder")),
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.toggleServer(instance.props.guild, instance.props.target, false);
|
||||
}
|
||||
})
|
||||
]
|
||||
})]
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
processGuild (instance, wrapper, methodnames) {
|
||||
processGuild (instance, wrapper, returnvalue, methodnames) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
|
||||
if (methodnames.includes("componentDidMount")) this.toggleServer(instance.props.guild, wrapper, !hiddenservers.includes(instance.props.guild.id));
|
||||
|
@ -292,8 +275,6 @@ class ServerHider {
|
|||
case "hr": //croatian
|
||||
return {
|
||||
modal_header_text: "Upravljanje popisom poslužitelja",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Sve",
|
||||
context_serverhider_text: "Vidljivost poslužitelj",
|
||||
submenu_hideserver_text: "Sakrij poslužitelj",
|
||||
submenu_openhidemenu_text: "Upravljanje popisom poslužitelja"
|
||||
|
@ -301,8 +282,6 @@ class ServerHider {
|
|||
case "da": //danish
|
||||
return {
|
||||
modal_header_text: "Styring af Serverliste",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Alle",
|
||||
context_serverhider_text: "Server synlighed",
|
||||
submenu_hideserver_text: "Skjul Server",
|
||||
submenu_openhidemenu_text: "Styre Serverliste"
|
||||
|
@ -310,8 +289,6 @@ class ServerHider {
|
|||
case "de": //german
|
||||
return {
|
||||
modal_header_text: "Verwaltung der Serverliste",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Alle",
|
||||
context_serverhider_text: "Serversichtbarkeit",
|
||||
submenu_hideserver_text: "Server verstecken",
|
||||
submenu_openhidemenu_text: "Serverliste verwalten"
|
||||
|
@ -319,8 +296,6 @@ class ServerHider {
|
|||
case "es": //spanish
|
||||
return {
|
||||
modal_header_text: "Administración de lista de servidores",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Todo",
|
||||
context_serverhider_text: "Visibilidad del servidor",
|
||||
submenu_hideserver_text: "Ocultar servidor",
|
||||
submenu_openhidemenu_text: "Administrar lista de servidores"
|
||||
|
@ -328,8 +303,6 @@ class ServerHider {
|
|||
case "fr": //french
|
||||
return {
|
||||
modal_header_text: "Gestion de la liste des serveurs",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Tout",
|
||||
context_serverhider_text: "Visibilité du serveur",
|
||||
submenu_hideserver_text: "Cacher le serveur",
|
||||
submenu_openhidemenu_text: "Gérer la liste des serveurs"
|
||||
|
@ -337,8 +310,6 @@ class ServerHider {
|
|||
case "it": //italian
|
||||
return {
|
||||
modal_header_text: "Gestione dell'elenco dei server",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Tutto",
|
||||
context_serverhider_text: "Visibilità del server",
|
||||
submenu_hideserver_text: "Nascondi il server",
|
||||
submenu_openhidemenu_text: "Gestione elenco dei server"
|
||||
|
@ -346,8 +317,6 @@ class ServerHider {
|
|||
case "nl": //dutch
|
||||
return {
|
||||
modal_header_text: "Beheer van de Serverlijst",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Alle",
|
||||
context_serverhider_text: "Server zichtbaarheid",
|
||||
submenu_hideserver_text: "Verberg server",
|
||||
submenu_openhidemenu_text: "Beheer serverlijst"
|
||||
|
@ -355,8 +324,6 @@ class ServerHider {
|
|||
case "no": //norwegian
|
||||
return {
|
||||
modal_header_text: "Administrasjon av serverlisten",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Alle",
|
||||
context_serverhider_text: "Server synlighet",
|
||||
submenu_hideserver_text: "Skjul server",
|
||||
submenu_openhidemenu_text: "Administrer serverliste"
|
||||
|
@ -364,8 +331,6 @@ class ServerHider {
|
|||
case "pl": //polish
|
||||
return {
|
||||
modal_header_text: "Zarządzanie listą serwerów",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Wszystkie",
|
||||
context_serverhider_text: "Widoczność serwera",
|
||||
submenu_hideserver_text: "Ukryj serwer",
|
||||
submenu_openhidemenu_text: "Zarządzaj listą serwerów"
|
||||
|
@ -373,8 +338,6 @@ class ServerHider {
|
|||
case "pt-BR": //portuguese (brazil)
|
||||
return {
|
||||
modal_header_text: "Gerenciamento da lista de servidores",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Todo",
|
||||
context_serverhider_text: "Visibilidade do servidor",
|
||||
submenu_hideserver_text: "Ocultar servidor",
|
||||
submenu_openhidemenu_text: "Gerenciar lista de servidores"
|
||||
|
@ -382,8 +345,6 @@ class ServerHider {
|
|||
case "fi": //finnish
|
||||
return {
|
||||
modal_header_text: "Palvelinluettelon hallinta",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Kaikki",
|
||||
context_serverhider_text: "Palvelimen näkyvyys",
|
||||
submenu_hideserver_text: "Piilota palvelin",
|
||||
submenu_openhidemenu_text: "Hallinnoi palvelinluetteloa"
|
||||
|
@ -391,8 +352,6 @@ class ServerHider {
|
|||
case "sv": //swedish
|
||||
return {
|
||||
modal_header_text: "Hantering av serverlistan",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "All",
|
||||
context_serverhider_text: "Server sikt",
|
||||
submenu_hideserver_text: "Dölj server",
|
||||
submenu_openhidemenu_text: "Hantera serverlistan"
|
||||
|
@ -400,8 +359,6 @@ class ServerHider {
|
|||
case "tr": //turkish
|
||||
return {
|
||||
modal_header_text: "Sunucu Listesinin Yönetimi",
|
||||
btn_ok_text: "Okey",
|
||||
btn_all_text: "Her",
|
||||
context_serverhider_text: "Sunucu görünürlüğü",
|
||||
submenu_hideserver_text: "Sunucuyu Gizle",
|
||||
submenu_openhidemenu_text: "Sunucu Listesini Yönet"
|
||||
|
@ -409,8 +366,6 @@ class ServerHider {
|
|||
case "cs": //czech
|
||||
return {
|
||||
modal_header_text: "Správa seznamu serverů",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "Vše",
|
||||
context_serverhider_text: "Viditelnost serveru",
|
||||
submenu_hideserver_text: "Skrýt server",
|
||||
submenu_openhidemenu_text: "Správa seznamu serverů"
|
||||
|
@ -418,8 +373,6 @@ class ServerHider {
|
|||
case "bg": //bulgarian
|
||||
return {
|
||||
modal_header_text: "Управление на списъка със сървъри",
|
||||
btn_ok_text: "Добре",
|
||||
btn_all_text: "Bсичко",
|
||||
context_serverhider_text: "Видимост на сървъра",
|
||||
submenu_hideserver_text: "Скриване на сървър",
|
||||
submenu_openhidemenu_text: "Управление на списъка със сървъри"
|
||||
|
@ -427,8 +380,6 @@ class ServerHider {
|
|||
case "ru": //russian
|
||||
return {
|
||||
modal_header_text: "Управление списком серверов",
|
||||
btn_ok_text: "ОК",
|
||||
btn_all_text: "Все",
|
||||
context_serverhider_text: "Видимость сервера",
|
||||
submenu_hideserver_text: "Скрыть сервер",
|
||||
submenu_openhidemenu_text: "Управление списком серверов"
|
||||
|
@ -436,8 +387,6 @@ class ServerHider {
|
|||
case "uk": //ukrainian
|
||||
return {
|
||||
modal_header_text: "Управління списком серверів",
|
||||
btn_ok_text: "Добре",
|
||||
btn_all_text: "Все",
|
||||
context_serverhider_text: "Видимість сервера",
|
||||
submenu_hideserver_text: "Сховати сервер",
|
||||
submenu_openhidemenu_text: "Управління списком серверів"
|
||||
|
@ -445,8 +394,6 @@ class ServerHider {
|
|||
case "ja": //japanese
|
||||
return {
|
||||
modal_header_text: "サーバリストの管理",
|
||||
btn_ok_text: "はい",
|
||||
btn_all_text: "すべて",
|
||||
context_serverhider_text: "サーバーの可視性",
|
||||
submenu_hideserver_text: "サーバーを隠す",
|
||||
submenu_openhidemenu_text: "サーバーリストを管理する"
|
||||
|
@ -454,8 +401,6 @@ class ServerHider {
|
|||
case "zh-TW": //chinese (traditional)
|
||||
return {
|
||||
modal_header_text: "管理服务器列表",
|
||||
btn_ok_text: "好",
|
||||
btn_all_text: "所有",
|
||||
context_serverhider_text: "服務器可見性",
|
||||
submenu_hideserver_text: "隐藏服务器",
|
||||
submenu_openhidemenu_text: "管理服务器列表"
|
||||
|
@ -463,8 +408,6 @@ class ServerHider {
|
|||
case "ko": //korean
|
||||
return {
|
||||
modal_header_text: "서버 목록 관리",
|
||||
btn_ok_text: "승인",
|
||||
btn_all_text: "모든",
|
||||
context_serverhider_text: "서버 가시성",
|
||||
submenu_hideserver_text: "서버 숨기기",
|
||||
submenu_openhidemenu_text: "서버 목록 관리"
|
||||
|
@ -472,8 +415,6 @@ class ServerHider {
|
|||
default: //default: english
|
||||
return {
|
||||
modal_header_text: "Managing Serverlist",
|
||||
btn_ok_text: "OK",
|
||||
btn_all_text: "All",
|
||||
context_serverhider_text: "Server Visibility",
|
||||
submenu_hideserver_text: "Hide Server",
|
||||
submenu_openhidemenu_text: "Manage Serverlist"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ShowHiddenChannels {
|
||||
getName () {return "ShowHiddenChannels";}
|
||||
|
||||
getVersion () {return "2.5.6";}
|
||||
getVersion () {return "2.5.7";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ShowHiddenChannels {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Voice Channel","Fixes the bug where it doesnt show the connected users of a hidden/locked vocie channel"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -23,7 +23,6 @@ class ShowHiddenChannels {
|
|||
}
|
||||
|
||||
initConstructor () {
|
||||
|
||||
this.categoryMarkup =
|
||||
`<div class="container-hidden">
|
||||
<div class="${BDFDB.disCN.categorycontainerdefault} hidden-category" draggable="false">
|
||||
|
@ -31,7 +30,7 @@ class ShowHiddenChannels {
|
|||
<svg class="${BDFDB.disCN.categoryicon}" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z"></path>
|
||||
</svg>
|
||||
<div class="${BDFDB.disCN.categoryname}">hidden</div>
|
||||
<div class="${BDFDB.disCNS.categoryname + BDFDB.disCN.namecontainernamecontainer}">hidden</div>
|
||||
<div class="${BDFDB.disCN.categorychildren}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -186,22 +185,22 @@ class ShowHiddenChannels {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannels (instance, wrapper, methodnames) {
|
||||
processChannels (instance, wrapper, returnvalue, methodnames) {
|
||||
if (instance.props && instance.props.guild) {
|
||||
if (methodnames.includes("componentDidMount")) this.appendHiddenContainer(instance.props.guild);
|
||||
if (methodnames.includes("componentDidUpdate")) this.reappendHiddenContainer(instance.props.guild);
|
||||
}
|
||||
}
|
||||
|
||||
processChannelItem (instance, wrapper) {
|
||||
processChannelItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
|
||||
}
|
||||
|
||||
processChannelCategoryItem (instance, wrapper) {
|
||||
processChannelCategoryItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.channel) this.reappendHiddenContainer(BDFDB.LibraryModules.GuildStore.getGuild(instance.props.channel.guild_id));
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.WebModules.forceAllUpdates(this, "Channels");
|
||||
|
@ -319,28 +318,7 @@ class ShowHiddenChannels {
|
|||
|
||||
createHiddenObjContextMenu (guild, channel, type, e) {
|
||||
BDFDB.stopEvent(e);
|
||||
let isPermissionsViewerEnabled = BDFDB.isPluginEnabled("PermissionsViewer");
|
||||
var contextMenu = BDFDB.htmlToElement(`<div class="${BDFDB.disCN.contextmenu} showhiddenchannels-contextmenu">${isPermissionsViewerEnabled ? `<div class="${BDFDB.disCN.contextmenuitemgroup}"><div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}" style="display: none !important;"></div></div>` : ``}<div class="${BDFDB.disCN.contextmenuitemgroup}"><div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable} permissionviewer-item"><div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll"></div></div><div class="${BDFDB.disCN.contextmenuhint}"></div></div><div class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable} copyid-item"><div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${BDFDB.LanguageStrings.COPY_ID}</div></div><div class="${BDFDB.disCN.contextmenuhint}"></div></div></div></div>`);
|
||||
var permissionvieweritem = contextMenu.querySelector(".permissionviewer-item");
|
||||
if (isPermissionsViewerEnabled) {
|
||||
permissionvieweritem.querySelector(".BDFDB-textscroll").innerText = window.bdplugins.PermissionsViewer.plugin.strings.contextMenuLabel;
|
||||
permissionvieweritem.addEventListener("click", () => {
|
||||
contextMenu.remove();
|
||||
if (!Object.keys(channel.permissionOverwrites).length) BDFDB.showToast(`#${channel.name} has no permission overrides`, {type: "info"});
|
||||
else window.bdplugins.PermissionsViewer.plugin.showModal(window.bdplugins.PermissionsViewer.plugin.createModalChannel(channel.name, channel, guild));
|
||||
});
|
||||
}
|
||||
else BDFDB.removeEles(permissionvieweritem);
|
||||
var reactInstance = BDFDB.React.createElement(contextMenu);
|
||||
reactInstance.memoizedProps = {displayName:"ChannelDeleteGroup",guild,channel};
|
||||
reactInstance.return = {memoizedProps:{type:("CHANNEL_LIST_" + type),guild,channel}};
|
||||
contextMenu.__reactInternalInstance = reactInstance;
|
||||
BDFDB.addChildEventListener(contextMenu, "click", ".copyid-item", e2 => {
|
||||
contextMenu.remove();
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text: channel.id});
|
||||
});
|
||||
|
||||
BDFDB.appendContextMenu(contextMenu, e);
|
||||
BDFDB.openChannelContextMenu(channel, e);
|
||||
}
|
||||
|
||||
showAccessRoles (guild, channel, e, allowed) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ShowImageDetails {
|
||||
getName () {return "ShowImageDetails";}
|
||||
|
||||
getVersion () {return "1.1.4";}
|
||||
getVersion () {return "1.1.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ShowImageDetails {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Spoilers","Properly works with images that are marked as spoilers now"],["Spoiler Crash","Fixed crash occuring when trying to reveal an inline spoiler"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -81,7 +81,7 @@ class ShowImageDetails {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -131,7 +131,7 @@ class ShowImageDetails {
|
|||
}
|
||||
}
|
||||
|
||||
processLazyImageZoomable (instance, image) {
|
||||
processLazyImageZoomable (instance, image, returnvalue) {
|
||||
let attachment = BDFDB.getReactValue(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;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class SpellCheck {
|
||||
getName () {return "SpellCheck";}
|
||||
|
||||
getVersion () {return "1.3.5";}
|
||||
getVersion () {return "1.3.6";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SpellCheck {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["New Select Classes","The Dropdown-Select element got new classes on canary, this update will prevent stable from breaking once the class change is pushed to stable"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -24,26 +24,6 @@ class SpellCheck {
|
|||
this.langDictionary = [];
|
||||
this.dictionary = [];
|
||||
|
||||
this.spellCheckContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} similarwords-item ${BDFDB.disCN.contextmenuitemsubmenu}">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_similarwords_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
<div class="${BDFDB.disCN.contextmenuitem} spellcheck-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_context_spellcheck_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.similarWordsContextSubMenuMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenu} spellcheck-submenu">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} nosimilars-item">
|
||||
<span class="BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">REPLACE_similarwordssubmenu_none_text</div></span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.spellCheckLayerMarkup =
|
||||
`<div class="spellcheck-overlay" style="position:absolute !important; pointer-events:none !important; background:transparent !important; color:transparent !important; text-shadow:none !important;"></div>`;
|
||||
|
||||
|
@ -126,7 +106,7 @@ class SpellCheck {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -148,8 +128,8 @@ class SpellCheck {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.languages = Object.assign({},BDFDB.languages);
|
||||
this.languages = BDFDB.filterObject(this.languages , (lang) => {return lang.dic == true ? lang : null});
|
||||
this.languages = Object.assign({}, BDFDB.languages);
|
||||
this.languages = BDFDB.filterObject(this.languages, (lang) => {return lang.dic == true ? lang : null});
|
||||
this.setDictionary(BDFDB.getData("dictionaryLanguage", this, "choices"));
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -173,16 +153,9 @@ class SpellCheck {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
changeLanguageStrings () {
|
||||
this.spellCheckContextEntryMarkup = this.spellCheckContextEntryMarkup.replace("REPLACE_context_spellcheck_text", this.labels.context_spellcheck_text);
|
||||
this.spellCheckContextEntryMarkup = this.spellCheckContextEntryMarkup.replace("REPLACE_context_similarwords_text", this.labels.context_similarwords_text);
|
||||
|
||||
this.similarWordsContextSubMenuMarkup = this.similarWordsContextSubMenuMarkup.replace("REPLACE_similarwordssubmenu_none_text", this.labels.similarwordssubmenu_none_text);
|
||||
}
|
||||
|
||||
onNativeContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.target && instance.props.type == "CHANNEL_TEXT_AREA" && !menu.querySelector(".spellcheck-item")) {
|
||||
BDFDB.toggleEles(BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"NativeSpellcheckGroup"})), false);
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.target && instance.props.type == "CHANNEL_TEXT_AREA" && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
BDFDB.toggleEles(BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu, name:"NativeSpellcheckGroup"})), false);
|
||||
var textarea = instance.props.target, word = null, length = 0;
|
||||
if (textarea.value && (textarea.selectionStart || textarea.selectionEnd)) for (let splitword of textarea.value.split(/\s/g)) {
|
||||
length += splitword.length + 1;
|
||||
|
@ -199,44 +172,55 @@ class SpellCheck {
|
|||
}
|
||||
}
|
||||
if (word && this.isWordNotInDictionary(word)) {
|
||||
let pasteentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handlePasteItem"]}));
|
||||
if (pasteentry) {
|
||||
let spellCheckContextEntry = BDFDB.htmlToElement(this.spellCheckContextEntryMarkup);
|
||||
menu.appendChild(spellCheckContextEntry);
|
||||
spellCheckContextEntry.addEventListener("mouseenter", () => {
|
||||
BDFDB.createTooltip(word, spellCheckContextEntry, {type: "left"});
|
||||
});
|
||||
spellCheckContextEntry.querySelector(".spellcheck-item").addEventListener("click", () => {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
let items = [];
|
||||
let similarWords = this.getSimilarWords(word.toLowerCase().trim());
|
||||
for (let suggestion of similarWords.sort()) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: suggestion,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-suggestion-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addToOwnDictionary(word);
|
||||
});
|
||||
let similarwordsitem = spellCheckContextEntry.querySelector(".similarwords-item");
|
||||
similarwordsitem.addEventListener("mouseenter", () => {
|
||||
let similarWordsContextSubMenu = BDFDB.htmlToElement(this.similarWordsContextSubMenuMarkup);
|
||||
let similarWords = this.getSimilarWords(word.toLowerCase().trim());
|
||||
if (similarWords.length > 0) {
|
||||
BDFDB.removeEles(similarWordsContextSubMenu.querySelector(".nosimilars-item"));
|
||||
for (let foundWord of similarWords.sort()) similarWordsContextSubMenu.appendChild(BDFDB.htmlToElement(`<div value="${foundWord}" class="${BDFDB.disCN.contextmenuitem} similarword-item"><span>${foundWord}</span><div class="${BDFDB.disCN.contextmenuhint}"></div></div>`));
|
||||
BDFDB.addChildEventListener(similarWordsContextSubMenu, "click", ".similarword-item", e => {
|
||||
this.replaceWord(textarea, word, suggestion);
|
||||
}
|
||||
}));
|
||||
if (!items.length) items.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.similarwordssubmenu_none_text,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-none-contextMenuItem`,
|
||||
disabled: true
|
||||
}));
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_spellcheck_text,
|
||||
hint: word,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addword-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.replaceWord(textarea, word, e.currentTarget.getAttribute("value"));
|
||||
});
|
||||
}
|
||||
BDFDB.appendSubMenu(similarwordsitem, similarWordsContextSubMenu);
|
||||
});
|
||||
}
|
||||
this.addToOwnDictionary(word);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_similarwords_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-suggestions-contextMenuSubItem`,
|
||||
render: items
|
||||
})
|
||||
]
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.type) {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
if (!textarea) return;
|
||||
|
||||
var updateSpellcheck = () => {
|
||||
var style = Object.assign({},getComputedStyle(textarea));
|
||||
for (let i in style) if (i.indexOf("webkit") == -1) spellcheck.style[i] = style[i];
|
||||
for (let i in style) if (i.indexOf("webkit") == -1 && isNaN(parseInt(i))) spellcheck.style[i] = style[i];
|
||||
spellcheck.style.setProperty("color", "transparent", "important");
|
||||
spellcheck.style.setProperty("background", "none", "important");
|
||||
spellcheck.style.setProperty("mask", "none", "important");
|
||||
|
@ -329,7 +313,7 @@ class SpellCheck {
|
|||
}
|
||||
|
||||
createSelectChoice (choice) {
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding:0;">${this.languages[choice].name}</div>`;
|
||||
return `<div class="${BDFDB.disCNS.title + BDFDB.disCNS.medium + BDFDB.disCNS.primary + BDFDB.disCNS.weightnormal + BDFDB.disCN.cursorpointer}" style="padding:0;">${this.languages[choice].name}</div>`;
|
||||
}
|
||||
|
||||
setDictionary (lang) {
|
||||
|
@ -340,7 +324,7 @@ class SpellCheck {
|
|||
this.languageToast.textContent = this.languageToast.textContent.indexOf(".....") > -1 ? "Grabbing dictionary (" + this.languages[lang].name + "). Please wait" : this.languageToast.textContent + ".";
|
||||
},500);
|
||||
this.languageToast.lang = lang
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/SpellCheck/dic/" + lang + ".dic", (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/SpellCheck/dic/" + lang + ".dic", (error, response, result) => {
|
||||
if (error || (response && result.toLowerCase().indexOf("<!doctype html>") > -1)) {
|
||||
this.killLanguageToast();
|
||||
BDFDB.showToast("Failed to grab dictionary (" + this.languages[lang].name + ").", {type: "error"});
|
||||
|
|
|
@ -33,7 +33,7 @@ class SteamProfileLink {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -78,8 +78,8 @@ class SteamProfileLink {
|
|||
|
||||
openInSteam (e, url) {
|
||||
BDFDB.stopEvent(e);
|
||||
require("request")(url, (error, response, body) => {
|
||||
if (require("electron").shell.openExternal("steam://openurl/" + response.request.href));
|
||||
BDFDB.LibraryRequires.request(url, (error, response, body) => {
|
||||
if (BDFDB.LibraryRequires.electron.shell.openExternal("steam://openurl/" + response.request.href));
|
||||
else window.open(response.request.href, "_blank");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ThemeRepo {
|
||||
getName () {return "ThemeRepo";}
|
||||
|
||||
getVersion () {return "1.8.4";}
|
||||
getVersion () {return "1.8.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ThemeRepo {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Refetch","Fixed refetching occuring every x hours"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -45,17 +45,11 @@ class ThemeRepo {
|
|||
|
||||
this.updateInterval;
|
||||
|
||||
this.themeFixerCSS = `${BDFDB.dotCNC.appmount + BDFDB.dotCNC.appcontainer + BDFDB.dotCNC.channelheaderheaderbar + BDFDB.dotCNC.channelheadertitle + BDFDB.dotCNC.guildchannels + BDFDB.dotCNC.channels + BDFDB.dotCNC.callcurrentcontainer + BDFDB.dotCNC.callcurrentvideo + BDFDB.dotCNC.callcurrentdetails + BDFDB.dotCNC.accountinfo + BDFDB.dotCNC.nochannel + BDFDB.dotCNC.friends + BDFDB.dotCNC.friendstable + BDFDB.dotCNC.friendstableheader + BDFDB.dotCNC.guilds + BDFDB.dotCNC.guildswrapper + BDFDB.dotCNC.channelheadertitle + BDFDB.dotCNC.typing + BDFDB.dotCNS.emojipicker + BDFDB.dotCNS.emojipickerscroller + BDFDB.dotCN.emojipickeremojiitem + BDFDB.dotCNC.emojipickerselected + BDFDB.dotCNC.members + BDFDB.dotCNC.chat + BDFDB.dotCNS.chat + "form," + BDFDB.dotCNC.chatcontent + BDFDB.dotCNC.messageswrapper + BDFDB.dotCNC.searchresultswrap + BDFDB.dotCNC.searchresultschannelname + BDFDB.dotCNC.searchresultssearchheader + BDFDB.dotCNC.activityfeed + BDFDB.dotCNC.lfg + BDFDB.dotCNC.applicationstore + BDFDB.dotCNC.giftinventory + BDFDB.dotCNC.gamelibrary + BDFDB.dotCNC.gamelibrarytableheader + BDFDB.dotCNC.standardsidebarview + BDFDB.dotCNC.sidebarregion + BDFDB.dotCNC.contentregion + BDFDB.dotCN.scroller} {background: transparent !important;} ${BDFDB.dotCNC.layer + BDFDB.dotCNC.layers + BDFDB.dotCN.titlebar} {background: rgba(0,0,0,0.18) !important;} ${BDFDB.dotCN.card}:not([style*="background-color"]) {background: rgba(0,0,0,0.4) !important;}`;
|
||||
this.themeFixerCSS = `${BDFDB.dotCNC.appmount + BDFDB.dotCNC.appcontainer + BDFDB.dotCNC.channelheaderheaderbar + BDFDB.dotCNC.channelheadertitle + BDFDB.dotCNC.guildchannels + BDFDB.dotCNC.channels + BDFDB.dotCNC.callcurrentcontainer + BDFDB.dotCNC.callcurrentvideo + BDFDB.dotCNC.callcurrentdetails + BDFDB.dotCNC.accountinfo + BDFDB.dotCNC.nochannel + BDFDB.dotCNC.friends + BDFDB.dotCNC.friendstable + BDFDB.dotCNC.friendstableheader + BDFDB.dotCNC.guildsscroller + BDFDB.dotCNC.guildswrapper + BDFDB.dotCNC.channelheadertitle + BDFDB.dotCNC.typing + BDFDB.dotCNS.emojipicker + BDFDB.dotCNS.emojipickerscroller + BDFDB.dotCN.emojipickeremojiitem + BDFDB.dotCNC.emojipickerselected + BDFDB.dotCNC.members + BDFDB.dotCNC.chat + BDFDB.dotCNS.chat + "form," + BDFDB.dotCNC.chatcontent + BDFDB.dotCNC.messageswrapper + BDFDB.dotCNC.searchresultswrap + BDFDB.dotCNC.searchresultschannelname + BDFDB.dotCNC.searchresultssearchheader + BDFDB.dotCNC.activityfeed + BDFDB.dotCNC.lfg + BDFDB.dotCNC.applicationstore + BDFDB.dotCNC.giftinventory + BDFDB.dotCNC.gamelibrary + BDFDB.dotCNC.gamelibrarytableheader + BDFDB.dotCNC.standardsidebarview + BDFDB.dotCNC.sidebarregion + BDFDB.dotCNC.contentregion + BDFDB.dotCN.scroller} {background: transparent !important;} ${BDFDB.dotCNC.layer + BDFDB.dotCNC.layers + BDFDB.dotCN.titlebar} {background: rgba(0,0,0,0.18) !important;} ${BDFDB.dotCN.card}:not([style*="background-color"]) {background: rgba(0,0,0,0.4) !important;}`;
|
||||
|
||||
this.themeRepoButtonMarkup =
|
||||
`<button class="bd-pfbtn bd-themerepobutton">Theme Repo</button>`;
|
||||
|
||||
this.settingsContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitem} themerepo-item">
|
||||
<span>Theme Repo</span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>`;
|
||||
|
||||
this.themeRepoIconMarkup =
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="36" height="31" viewBox="20 0 400 332">
|
||||
<path d="M0.000 39.479 L 0.000 78.957 43.575 78.957 L 87.151 78.957 87.151 204.097 L 87.151 329.236 129.609 329.236 L 172.067 329.236 172.067 204.097 L 172.067 78.957 215.642 78.957 L 259.218 78.957 259.218 39.479 L 259.218 0.000 129.609 0.000 L 0.000 0.000 0.000 39.479" stroke="none" fill="#7289da" fill-rule="evenodd"></path>
|
||||
|
@ -112,7 +106,7 @@ class ThemeRepo {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizelarge}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto; padding-bottom: 10px;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset} themeAmount">Theme Repository</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin} themeAmount">Theme Repository</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -218,9 +212,9 @@ class ThemeRepo {
|
|||
this.sortPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} themerepo-sort-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.sort[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.sort).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}"><div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${this.sortings.sort[key]}</div></div></div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -229,9 +223,9 @@ class ThemeRepo {
|
|||
this.orderPopoutMarkup =
|
||||
`<div class="${BDFDB.disCNS.popout + BDFDB.disCNS.popoutbottomright + BDFDB.disCN.popoutnoshadow} themerepo-order-popout" style="position: fixed; z-index: 1100; visibility: visible; transform: translateX(-100%) translateY(0%) translateZ(0px);">
|
||||
<div>
|
||||
<div class="${BDFDB.disCN.contextmenu} quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenu} BDFDB-quickSelectPopout">
|
||||
<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCN.contextmenuitem}">${this.sortings.order[key]}</div>`).join("")}
|
||||
${Object.keys(this.sortings.order).map((key, i) => `<div option="${key}" class="${BDFDB.disCNS.contextmenuitem + BDFDB.disCN.contextmenuitemclickable}"><div class="${BDFDB.disCN.contextmenulabel} BDFDB-textscrollwrapper" speed=3><div class="BDFDB-textscroll">${this.sortings.order[key]}</div></div></div>`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -353,7 +347,7 @@ class ThemeRepo {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -401,26 +395,19 @@ class ThemeRepo {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onUserSettingsCogContextMenu (instance, menu) {
|
||||
let observer = new MutationObserver(changes => {
|
||||
changes.forEach(change => {
|
||||
if (change.addedNodes) change.addedNodes.forEach(node => {
|
||||
if (node.tagName && BDFDB.containsClass(node, BDFDB.disCN.contextmenu) && BDFDB.getReactValue(node, "return.return.return.memoizedProps.label") == "BandagedBD" && !node.querySelector(".themerepo-item")) {
|
||||
let item = node.querySelectorAll(BDFDB.dotCN.contextmenuitem);
|
||||
item = item[item.length-1];
|
||||
var settingsContextEntry = BDFDB.htmlToElement(this.settingsContextEntryMarkup);
|
||||
settingsContextEntry.addEventListener("click", () => {
|
||||
if (!this.loading.is) BDFDB.closeContextMenu(menu);
|
||||
this.openThemeRepoModal();
|
||||
});
|
||||
item.parentElement.insertBefore(settingsContextEntry, item.nextElementSibling);
|
||||
var menurects = BDFDB.getRects(menu);
|
||||
node.style.setProperty("top", (menurects.top - BDFDB.getRects(node).height + menurects.height) + "px");
|
||||
}
|
||||
});
|
||||
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
|
||||
setImmediate(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
|
||||
const repoItem = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: "Theme Repo",
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-repo-contextMenuItem`,
|
||||
action: e => {
|
||||
if (!this.loading.is) BDFDB.closeContextMenu(menu);
|
||||
this.openThemeRepoModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(menu, {childList: true, subtree:true});
|
||||
child.props.render.push(repoItem);
|
||||
break;
|
||||
}});
|
||||
}
|
||||
|
||||
processV2CList (instance, wrapper) {
|
||||
|
@ -752,14 +739,13 @@ class ThemeRepo {
|
|||
var tags = ["name","description","author","version"];
|
||||
var newentriesdata = BDFDB.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
|
||||
this.cachedThemes = (newentriesdata.urlbase64 ? atob(newentriesdata.urlbase64).split("\n") : []).concat(ownlist);
|
||||
var request = require("request");
|
||||
request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/res/ThemeList.txt", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/res/ThemeList.txt", (error, response, body) => {
|
||||
if (!error && body) {
|
||||
body = body.replace(/[\r\t]/g, "");
|
||||
BDFDB.saveData("urlbase64", btoa(body), this, "newentriesdata");
|
||||
this.loadedThemes = {};
|
||||
this.grabbedThemes = body.split("\n").filter(n => n);
|
||||
request("https://github.com/NFLD99/Better-Discord", (error2, response2, body2) => {
|
||||
BDFDB.LibraryRequires.request("https://github.com/NFLD99/Better-Discord", (error2, response2, body2) => {
|
||||
if (!error2 && body2) {
|
||||
NFLDreplace = /\/NFLD99\/Better-Discord\/tree\/master\/Themes_[^"]+">([^<]+)/i.exec(body2);
|
||||
NFLDreplace = NFLDreplace && NFLDreplace.length > 1 ? NFLDreplace[1] : null;
|
||||
|
@ -836,7 +822,7 @@ class ThemeRepo {
|
|||
}
|
||||
let url = this.foundThemes[i];
|
||||
let requesturl = NFLDreplace && url.includes("NFLD99/Better-Discord/master/Themes") ? url.replace("master/Themes", "master/" + NFLDreplace) : url;
|
||||
request(requesturl, (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request(requesturl, (error, response, body) => {
|
||||
if (!response) {
|
||||
if (url && BDFDB.getAllIndexes(this.foundThemes, url).length < 2) this.foundThemes.push(url);
|
||||
}
|
||||
|
@ -892,7 +878,7 @@ class ThemeRepo {
|
|||
}
|
||||
|
||||
checkForNewThemes () {
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/res/ThemeList.txt", (error, response, result) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/res/ThemeList.txt", (error, response, result) => {
|
||||
if (response && !BDFDB.equals(result.replace(/\t|\r/g, "").split("\n").filter(n => n), this.grabbedThemes)) {
|
||||
this.loading = {is:false, timeout:null, amount:0};
|
||||
this.loadThemes();
|
||||
|
@ -901,14 +887,14 @@ class ThemeRepo {
|
|||
}
|
||||
|
||||
downloadTheme (data) {
|
||||
require("request")(data.requesturl, (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request(data.requesturl, (error, response, body) => {
|
||||
if (error) BDFDB.showToast(`Unable to download Theme "${data.name}".`, {type:"danger"});
|
||||
else this.createThemeFile(data.requesturl.split("/").pop(), body);
|
||||
});
|
||||
}
|
||||
|
||||
createThemeFile (filename, content) {
|
||||
require("fs").writeFile(require("path").join(BDFDB.getThemesFolder(), filename), content, (error) => {
|
||||
BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.getThemesFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to save Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully saved Theme "${filename}".`, {type:"success"});
|
||||
});
|
||||
|
@ -926,7 +912,7 @@ class ThemeRepo {
|
|||
|
||||
deleteThemeFile (data) {
|
||||
let filename = data.requesturl.split("/").pop();
|
||||
require("fs").unlink(require("path").join(BDFDB.getThemesFolder(), filename), (error) => {
|
||||
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.getThemesFolder(), filename), (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to delete Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully deleted Theme "${filename}".`);
|
||||
});
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
class ThemeSettings {
|
||||
getName () {return "ThemeSettings";}
|
||||
|
||||
getVersion () {return "1.1.0";}
|
||||
getVersion () {return "1.1.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Allows you to change Theme Variables within BetterDiscord. Adds a Settings button (similar to Plugins) to customizable Themes in your Themes Page.";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"V2C_ThemeCard":"componentDidMount"
|
||||
};
|
||||
|
@ -33,7 +37,7 @@ class ThemeSettings {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -54,9 +58,7 @@ class ThemeSettings {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.fs = require("fs");
|
||||
this.path = require("path");
|
||||
|
||||
this.dir = BDFDB.getThemesFolder();
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
@ -151,8 +153,8 @@ class ThemeSettings {
|
|||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
BDFDB.addEventListener(this, settingspanel, "click", ".update-button", () => {
|
||||
let path = this.path.join(this.dir, theme.filename);
|
||||
let css = this.fs.readFileSync(path).toString();
|
||||
let path = BDFDB.LibraryRequires.path.join(this.dir, theme.filename);
|
||||
let css = BDFDB.LibraryRequires.fs.readFileSync(path).toString();
|
||||
if (css) {
|
||||
let amount = 0;
|
||||
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
|
||||
|
@ -165,7 +167,7 @@ class ThemeSettings {
|
|||
}
|
||||
}
|
||||
if (amount > 0) {
|
||||
this.fs.writeFileSync(path, css);
|
||||
BDFDB.LibraryRequires.fs.writeFileSync(path, css);
|
||||
BDFDB.showToast(`Updated ${amount} variable${amount == 1 ? "" : "s"} in ${theme.filename}`, {type:"success"});
|
||||
}
|
||||
else BDFDB.showToast(`There are no changed variables to be updated in ${theme.filename}`, {type:"warning"});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class TimedLightDarkMode {
|
||||
getName () {return "TimedLightDarkMode";}
|
||||
|
||||
getVersion () {return "1.0.2";}
|
||||
getVersion () {return "1.0.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,8 +11,7 @@ class TimedLightDarkMode {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Current Time","Added a little indicator to show the current time on the slider"]],
|
||||
"improved":[["Start up","Now properly checks the current time on start up and not only after the first check interval"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -50,7 +49,7 @@ class TimedLightDarkMode {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -72,8 +71,6 @@ class TimedLightDarkMode {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.SettingsUtils = BDFDB.WebModules.findByProperties("updateRemoteSettings","updateLocalSettings");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
|
||||
this.startInterval();
|
||||
|
@ -96,7 +93,7 @@ class TimedLightDarkMode {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processRadioGroup (instance, wrapper) {
|
||||
processRadioGroup (instance, wrapper, returnvalue) {
|
||||
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.LanguageStrings.THEME.toUpperCase()) {
|
||||
var settings = BDFDB.getAllData(this, "settings");
|
||||
var values = BDFDB.getAllData(this, "values");
|
||||
|
@ -140,8 +137,8 @@ class TimedLightDarkMode {
|
|||
|
||||
changeTheme (dark) {
|
||||
var theme = BDFDB.getDiscordTheme();
|
||||
if (dark && theme == BDFDB.disCN.themelight) this.SettingsUtils.updateRemoteSettings({theme:"dark"});
|
||||
else if (!dark && theme == BDFDB.disCN.themedark) this.SettingsUtils.updateRemoteSettings({theme:"light"});
|
||||
if (dark && theme == BDFDB.disCN.themelight) BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({theme:"dark"});
|
||||
else if (!dark && theme == BDFDB.disCN.themedark) BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({theme:"light"});
|
||||
}
|
||||
|
||||
showCurrentTime (grabber) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class TopRoleEverywhere {
|
||||
getName () {return "TopRoleEverywhere";}
|
||||
|
||||
getVersion () {return "2.8.6";}
|
||||
getVersion () {return "2.8.7";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class TopRoleEverywhere {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["DM Groups","Now works properly in DM Groups"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -83,7 +83,7 @@ class TopRoleEverywhere {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -105,10 +105,6 @@ class TopRoleEverywhere {
|
|||
if (this.started) return;
|
||||
BDFDB.loadMessage(this);
|
||||
|
||||
this.GuildPerms = BDFDB.WebModules.findByProperties("getHighestRole");
|
||||
this.GuildStore = BDFDB.WebModules.findByProperties("getGuild");
|
||||
this.UserGuildState = BDFDB.WebModules.findByProperties("getGuildId", "getLastSelectedGuildId");
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -126,13 +122,13 @@ class TopRoleEverywhere {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processMemberListItem (instance, wrapper) {
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) {
|
||||
this.addRoleTag(instance.props.user, wrapper.querySelector(BDFDB.dotCN.memberusername), "list", BDFDB.disCN.bottagnametag);
|
||||
}
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper) {
|
||||
processMessageUsername (instance, wrapper, returnvalue) {
|
||||
let message = BDFDB.getReactValue(instance, "props.message");
|
||||
if (message) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
|
@ -143,7 +139,7 @@ class TopRoleEverywhere {
|
|||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.removeEles(".TRE-tag");
|
||||
|
@ -154,10 +150,10 @@ class TopRoleEverywhere {
|
|||
addRoleTag (info, username, type, selector) {
|
||||
if (!info || !username) return;
|
||||
BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
|
||||
let guild = this.GuildStore.getGuild(this.UserGuildState.getGuildId());
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
let settings = BDFDB.getAllData(this, "settings");
|
||||
if (!guild || info.bot && settings.disableForBots) return;
|
||||
let role = this.GuildPerms.getHighestRole(guild, info.id);
|
||||
let role = BDFDB.LibraryModules.PermissionUtils.getHighestRole(guild, info.id);
|
||||
if ((role && (role.colorString || settings.includeColorless)) || info.id == 278543574059057154) {
|
||||
let roleColor = role && role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
|
||||
let roleName = role ? role.name : "";
|
||||
|
|
|
@ -3,11 +3,17 @@
|
|||
class UserNotes {
|
||||
getName () {return "UserNotes";}
|
||||
|
||||
getVersion () {return "1.0.2";}
|
||||
getVersion () {return "1.0.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Allows you to write your own user notes wihtout a character limit.";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
}
|
||||
|
||||
initConstructor () {
|
||||
this.css = `
|
||||
|
@ -18,14 +24,6 @@ class UserNotes {
|
|||
resize: none;
|
||||
}`;
|
||||
|
||||
this.userContextEntryMarkup =
|
||||
`<div class="${BDFDB.disCN.contextmenuitemgroup}">
|
||||
<div class="${BDFDB.disCN.contextmenuitem} localusernotes-item">
|
||||
<span>${BDFDB.LanguageStrings.USERS + " " + BDFDB.LanguageStrings.NOTE}</span>
|
||||
<div class="${BDFDB.disCN.contextmenuhint}"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
this.userNotesModalMarkup =
|
||||
`<span class="${this.name}-modal BDFDB-modal">
|
||||
<div class="${BDFDB.disCN.backdrop}"></div>
|
||||
|
@ -34,7 +32,7 @@ class UserNotes {
|
|||
<div class="${BDFDB.disCNS.modalsub + BDFDB.disCN.modalsizemedium}">
|
||||
<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.modalheader}" style="flex: 0 0 auto;">
|
||||
<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.headertitle + BDFDB.disCNS.size16 + BDFDB.disCNS.height20 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.defaultcolor + BDFDB.disCNS.h4defaultmargin + BDFDB.disCN.marginreset}">${BDFDB.LanguageStrings.USERS + " " + BDFDB.LanguageStrings.NOTE}</h4>
|
||||
<h4 class="${BDFDB.disCNS.h4 + BDFDB.disCNS.defaultcolor + BDFDB.disCN.h4defaultmargin}">${BDFDB.LanguageStrings.USERS + " " + BDFDB.LanguageStrings.NOTE}</h4>
|
||||
<div class="${BDFDB.disCNS.modalguildname + BDFDB.disCNS.small + BDFDB.disCNS.size12 + 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}">
|
||||
|
@ -102,7 +100,7 @@ class UserNotes {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -139,14 +137,24 @@ class UserNotes {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onUserContextMenu (instance, menu) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(".localusernotes-item")) {
|
||||
let userContextEntry = BDFDB.htmlToElement(this.userContextEntryMarkup);
|
||||
userContextEntry.querySelector(".localusernotes-item").addEventListener("click", () => {
|
||||
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
|
||||
this.openNotesModal(instance.props.user);
|
||||
onUserContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.user && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue.props.children, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: BDFDB.LanguageStrings.USERS + " " + BDFDB.LanguageStrings.NOTE,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-usernote-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.openNotesModal(instance.props.user);
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
menu.appendChild(userContextEntry);
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
class WriteUpperCase {
|
||||
getName () {return "WriteUpperCase";}
|
||||
|
||||
getVersion () {return "1.2.0";}
|
||||
getVersion () {return "1.2.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Change input to uppercase.";}
|
||||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"ChannelTextArea":"componentDidMount",
|
||||
};
|
||||
|
@ -32,7 +36,7 @@ class WriteUpperCase {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -70,7 +74,7 @@ class WriteUpperCase {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannelTextArea (instance, wrapper) {
|
||||
processChannelTextArea (instance, wrapper, returnvalue) {
|
||||
if (instance.props && instance.props.type) {
|
||||
var textarea = wrapper.querySelector("textarea");
|
||||
if (!textarea) return;
|
||||
|
|
Loading…
Reference in New Issue