This commit is contained in:
Mirco Wittrien 2020-08-31 23:32:22 +02:00
parent 1722f60cdd
commit ed0f13ca6a
6 changed files with 178 additions and 39 deletions

View File

@ -6578,6 +6578,7 @@
last: "Zadnji",
library_settings: "Postavke biblioteke",
order: "Slijed",
server: "Server",
sort_by: "Poredaj po",
toast_plugin_started: "{{var0}} je započeo.",
toast_plugin_stopped: "{{var0}} zaustavljen.",
@ -6595,6 +6596,7 @@
last: "Sidste",
library_settings: "Biblioteksindstillinger",
order: "Sekvens",
server: "Server",
sort_by: "Sorter efter",
toast_plugin_started: "{{var0}} er startet.",
toast_plugin_stopped: "{{var0}} er stoppet.",
@ -6612,6 +6614,7 @@
last: "Letzte",
library_settings: "Bibliothekseinstellungen",
order: "Reihenfolge",
server: "Server",
sort_by: "Sortieren nach",
toast_plugin_started: "{{var0}} wurde gestartet.",
toast_plugin_stopped: "{{var0}} wurde gestoppt.",
@ -6629,6 +6632,7 @@
last: "Último",
library_settings: "Configuraciones de biblioteca",
order: "Secuencia",
server: "Servidor",
sort_by: "Ordenar por",
toast_plugin_started: "{{var0}} se guilddiv iniciado.",
toast_plugin_stopped: "{{var0}} se guilddiv detenido.",
@ -6646,6 +6650,7 @@
last: "Dernier",
library_settings: "Paramètres de la bibliothèque",
order: "Séquence",
server: "Serveur",
sort_by: "Trier par",
toast_plugin_started: "{{var0}} a été démarré.",
toast_plugin_stopped: "{{var0}} a été arrêté.",
@ -6663,6 +6668,7 @@
last: "Ultimo",
library_settings: "Impostazioni della libreria",
order: "Sequenza",
server: "Server",
sort_by: "Ordina per",
toast_plugin_started: "{{var0}} è stato avviato.",
toast_plugin_stopped: "{{var0}} è stato interrotto.",
@ -6680,6 +6686,7 @@
last: "Laatste",
library_settings: "Bibliotheekinstellingen",
order: "Volgorde",
server: "Server",
sort_by: "Sorteer op",
toast_plugin_started: "{{var0}} is gestart.",
toast_plugin_stopped: "{{var0}} is gestopt.",
@ -6697,6 +6704,7 @@
last: "Siste",
library_settings: "Bibliotekinnstillinger",
order: "Sekvens",
server: "Server",
sort_by: "Sorter etter",
toast_plugin_started: "{{var0}} er startet.",
toast_plugin_stopped: "{{var0}} er stoppet.",
@ -6714,6 +6722,7 @@
last: "Ostatni",
library_settings: "Ustawienia biblioteki",
order: "Sekwencja",
server: "Serwer",
sort_by: "Sortuj według",
toast_plugin_started: "{{var0}} został uruchomiony.",
toast_plugin_stopped: "{{var0}} został zatrzymany.",
@ -6731,6 +6740,7 @@
last: "Último",
library_settings: "Configurações da biblioteca",
order: "Seqüência",
server: "Servidor",
sort_by: "Ordenar por",
toast_plugin_started: "{{var0}} foi iniciado.",
toast_plugin_stopped: "{{var0}} foi interrompido.",
@ -6748,6 +6758,7 @@
last: "Viimeinen",
library_settings: "Kirjastoasetukset",
order: "Jakso",
server: "Palvelin",
sort_by: "Järjestä",
toast_plugin_started: "{{var0}} on käynnistetty.",
toast_plugin_stopped: "{{var0}} on pysäytetty.",
@ -6765,6 +6776,7 @@
last: "Sista",
library_settings: "Biblioteksinställningar",
order: "Sekvens",
server: "Server",
sort_by: "Sortera efter",
toast_plugin_started: "{{var0}} har startats.",
toast_plugin_stopped: "{{var0}} har blivit stoppad.",
@ -6782,6 +6794,7 @@
last: "Son",
library_settings: "Kütüphane Ayarları",
order: "Sıra",
server: "Sunucu",
sort_by: "Göre sırala",
toast_plugin_started: "{{var0}} başlatıldı.",
toast_plugin_stopped: "{{var0}} durduruldu.",
@ -6799,6 +6812,7 @@
last: "Poslední",
library_settings: "Nastavení knihovny",
order: "Sekvence",
server: "Server",
sort_by: "Seřazeno podle",
toast_plugin_started: "{{var0}} byl spuštěn.",
toast_plugin_stopped: "{{var0}} byl zastaven.",
@ -6816,6 +6830,7 @@
last: "Последният",
library_settings: "Настройки на библиотеката",
order: "Последователност",
server: "Сървър",
sort_by: "Сортиране по",
toast_plugin_started: "{{var0}} е стартиран.",
toast_plugin_stopped: "{{var0}} е спрян.",
@ -6833,6 +6848,7 @@
last: "Последний",
library_settings: "Настройки библиотеки",
order: "Последовательность",
server: "Сервер",
sort_by: "Сортировать по",
toast_plugin_started: "{{var0}} запущен.",
toast_plugin_stopped: "{{var0}} остановлен.",
@ -6850,6 +6866,7 @@
last: "Останній",
library_settings: "Налаштування бібліотеки",
order: "Послідовність",
server: "Сервер",
sort_by: "Сортувати за",
toast_plugin_started: "{{var0}} було запущено.",
toast_plugin_stopped: "{{var0}} було зупинено.",
@ -6867,6 +6884,7 @@
last: "最後",
library_settings: "ライブラリ設定",
order: "ソート順",
server: "サーバー",
sort_by: "並び替え",
toast_plugin_started: "{{var0}}が開始されました.",
toast_plugin_stopped: "{{var0}}が停止しました.",
@ -6884,6 +6902,7 @@
last: "最後",
library_settings: "庫設置",
order: "排序",
server: "伺服器",
sort_by: "排序方式",
toast_plugin_started: "{{var0}}已經啟動.",
toast_plugin_stopped: "{{var0}}已停止.",
@ -6901,6 +6920,7 @@
last: "마지막",
library_settings: "라이브러리 설정",
order: "정렬 순서",
server: "서버",
sort_by: "정렬 기준",
toast_plugin_started: "{{var0}} 시작되었습니다.",
toast_plugin_stopped: "{{var0}} 중지되었습니다.",
@ -6918,6 +6938,7 @@
last: "Last",
library_settings: "Library Settings",
order: "Order",
server: "Server",
sort_by: "Sort by",
toast_plugin_started: "{{var0}} has been started.",
toast_plugin_stopped: "{{var0}} has been stopped.",
@ -9057,9 +9078,9 @@
}
render() {
if (typeof this.props.type != "string" || !["BUTTON", "SELECT", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
let childcomponent = InternalComponents.LibraryComponents[this.props.type];
if (!childcomponent) return null;
if (this.props.mini && childcomponent.Sizes) this.props.size = childcomponent.Sizes.MINI || childcomponent.Sizes.MIN;
let childComponent = InternalComponents.LibraryComponents[this.props.type];
if (!childComponent) return null;
if (this.props.mini && childComponent.Sizes) this.props.size = childComponent.Sizes.MINI || childComponent.Sizes.MIN;
return BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.Flex, {
className: BDFDB.DOMUtils.formatClassName(this.props.className, this.props.disabled && BDFDB.disCN.disabled),
id: this.props.id,
@ -9091,7 +9112,7 @@
shrink: this.props.basis ? 0 : 1,
basis: this.props.basis,
wrap: true,
children: BDFDB.ReactUtils.createElement(childcomponent, BDFDB.ObjectUtils.exclude(Object.assign(BDFDB.ObjectUtils.exclude(this.props, "className", "id", "type"), this.props.childProps, {onChange: this.handleChange.bind(this)}), "grow", "stretch", "basis", "dividerbottom", "dividertop", "label", "labelClassName", "labelchildren", "tag", "mini", "note", "childProps"))
children: BDFDB.ReactUtils.createElement(childComponent, BDFDB.ObjectUtils.exclude(Object.assign(BDFDB.ObjectUtils.exclude(this.props, "className", "id", "type"), this.props.childProps, {onChange: this.handleChange.bind(this)}), "grow", "stretch", "basis", "dividerbottom", "dividertop", "label", "labelClassName", "labelchildren", "tag", "mini", "note", "childProps"))
})
].flat(10).filter(n => n)
}),
@ -9249,14 +9270,14 @@
let option = keys.shift();
if (BDFDB.ObjectUtils.is(this.props.plugin) && option) {
let data = BDFDB.DataUtils.load(this.props.plugin, option);
let newdata = "";
for (let key of keys) newdata += `{"${key}":`;
let newData = "";
for (let key of keys) newData += `{"${key}":`;
value = value != null && value.value != null ? value.value : value;
let isString = typeof value == "string";
let marker = isString ? `"` : ``;
newdata += (marker + (isString ? value.replace(/\\/g, "\\\\") : value) + marker) + "}".repeat(keys.length);
newdata = JSON.parse(newdata);
BDFDB.DataUtils.save(BDFDB.ObjectUtils.is(newdata) ? BDFDB.ObjectUtils.deepAssign({}, data, newdata) : newdata, this.props.plugin, option);
newData += (marker + (isString ? value.replace(/\\/g, "\\\\") : value) + marker) + "}".repeat(keys.length);
newData = JSON.parse(newData);
BDFDB.DataUtils.save(BDFDB.ObjectUtils.is(newData) ? BDFDB.ObjectUtils.deepAssign({}, data, newData) : newData, this.props.plugin, option);
this.props.plugin.SettingsUpdated = true;
}
if (typeof this.props.onChange == "function") this.props.onChange(value, this);
@ -9265,7 +9286,7 @@
if (typeof this.props.type != "string" || !["SELECT", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
return BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
onChange: this.saveSettings.bind(this)
}), "keys", "plugin"));
}), "keys", "key", "plugin"));
}
};

File diff suppressed because one or more lines are too long

View File

@ -75,12 +75,13 @@ var ImageUtilities = (_ => {
this.defaults = {
settings: {
addDetails: {value:true, inner:false, description:"Add Image details (name, size, amount) in the Image Modal"},
showAsHeader: {value:true, inner:false, description:"Show Image details as a details header above the Image in the chat"},
showOnHover: {value:false, inner:false, description:"Show Image details as Tooltip in the chat"},
enableGallery: {value:true, inner:false, description:"Displays previous/next Images in the same message in the Image Modal"},
enableZoom: {value:true, inner:false, description:"Creates a zoom lense if you press down on an Image in the Image Modal"},
enableCopyImg: {value:true, inner:false, description:"Add a copy Image option in the Image Modal"},
addDetails: {value:true, inner:false, description:"Add image details (name, size, amount) in the image modal"},
showAsHeader: {value:true, inner:false, description:"Show image details as a details header above the image in the chat"},
showOnHover: {value:false, inner:false, description:"Show image details as Tooltip in the chat"},
enableGallery: {value:true, inner:false, description:"Displays previous/next Images in the same message in the image modal"},
enableZoom: {value:true, inner:false, description:"Creates a zoom lense if you press down on an image in the image modal"},
enableCopyImg: {value:true, inner:false, description:"Add a copy image option in the image modal"},
enableSaveImg: {value:true, inner:false, description:"Add a save image as option in the image modal"},
useChromium: {value:false, inner:false, description:"Use an inbuilt browser window instead of opening your default browser"},
addUserAvatarEntry: {value:true, inner:true, description:"User Avatars"},
addGuildIconEntry: {value:true, inner:true, description:"Server Icons"},
@ -431,15 +432,7 @@ var ImageUtilities = (_ => {
label: this.labels.context_saveimageas_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "download-image-as"),
action: _ => {
BDFDB.LibraryRequires.request(url, {encoding: null}, (error, response, body) => {
let fileName = `${url.split("/").pop().split(".").slice(0, -1).join(".")}.${response.headers["content-type"].split("/").pop().split("+")[0]}`;
let hrefURL = window.URL.createObjectURL(new Blob([body]));
let tempLink = document.createElement("a");
tempLink.href = hrefURL;
tempLink.download = fileName;
tempLink.click();
window.URL.revokeObjectURL(hrefURL);
});
this.downloadImage(url);
}
}),
!this.isCopyable(url) ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
@ -520,6 +513,21 @@ var ImageUtilities = (_ => {
className: BDFDB.disCN._imageutilitiesoperations,
children: [
children[index],
settings.enableSaveImg && !isVideo && [
BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.downloadlink,
children: "|",
style: {margin: "0 5px"}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, {
className: BDFDB.disCN.downloadlink,
children: this.labels.context_saveimageas_text,
onClick: event => {
BDFDB.ListenerUtils.stopEvent(event);
this.downloadImage(url);
}
})
],
settings.enableCopyImg && this.isCopyable(url) && !isVideo && [
BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.downloadlink,
@ -760,8 +768,19 @@ var ImageUtilities = (_ => {
return file && (file.endsWith(".jpg") || file.endsWith(".jpeg") || file.endsWith(".png") || file.endsWith(".gif") || file.endsWith(".apng") || file.endsWith(".webp"));
}
copyImage (src) {
BDFDB.LibraryRequires.request(src, {encoding: null}, (error, response, buffer) => {
downloadImage (url) {
BDFDB.LibraryRequires.request(url, {encoding: null}, (error, response, body) => {
let hrefURL = window.URL.createObjectURL(new Blob([body]));
let tempLink = document.createElement("a");
tempLink.href = hrefURL;
tempLink.download = `${url.split("/").pop().split(".").slice(0, -1).join(".")}.${response.headers["content-type"].split("/").pop().split("+")[0]}`;
tempLink.click();
window.URL.revokeObjectURL(hrefURL);
});
}
copyImage (url) {
BDFDB.LibraryRequires.request(url, {encoding: null}, (error, response, buffer) => {
if (error) BDFDB.NotificationUtils.toast(this.labels.toast_copyimage_failed, {type: "error"});
else if (buffer) {
if (BDFDB.LibraryRequires.process.platform === "win32" || BDFDB.LibraryRequires.process.platform === "darwin") {

View File

@ -13,15 +13,16 @@ var OwnerTag = (_ => {
return class OwnerTag {
getName () {return "OwnerTag";}
getVersion () {return "1.3.2";}
getVersion () {return "1.3.3";}
getAuthor () {return "DevilBro";}
getDescription () {return "Adds a Tag like Bottags to the Serverowner.";}
getDescription () {return "Adds a tag or crown to the server owner (or admins/management).";}
constructor () {
this.changelog = {
"added":[["Management Crown/Tag","Added a third tag for people with the server management permission"]]
"added":[["Management Crown/Tag","Added a third tag for people with the server/channel/role management permission"]],
"improved":[["Management Tag","Tag now shows for all kinds of management perms and the type of management is displayed in the tooltip"]]
};
this.patchedModules = {
@ -64,10 +65,10 @@ var OwnerTag = (_ => {
addInUserProfile: {value:true, inner:true, description:"User Profile Modal"},
useRoleColor: {value:true, inner:false, description:"Use the Rolecolor instead of the default blue"},
useBlackFont: {value:false, inner:false, description:"Instead of darkening the Rolecolor on bright colors use black font"},
useCrown: {value:false, inner:false, description:"Use the Crown Icon instead of the OwnerTag"},
useCrown: {value:false, inner:false, description:"Use the Crown Icon instead of the Bot Tag Style"},
hideNativeCrown: {value:true, inner:false, description:"Hide the native Crown Icon (not the Plugin one)"},
addForAdmins: {value:false, inner:false, description:"Also add an Admin Tag for any user with admin permissions"},
addForManagement: {value:false, inner:false, description:"Also add a Management Tag for any user with server manage permissions"},
addForAdmins: {value:false, inner:false, description:"Add an Admin Tag for users with admin permissions"},
addForManagement: {value:false, inner:false, description:"Add a Management Tag for users with management permissions"},
ignoreBotAdmins: {value:false, inner:false, description:"Do not add the Admin/Management tag for bots"}
},
inputs: {
@ -89,9 +90,18 @@ var OwnerTag = (_ => {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
key: key,
disabled: key == "hideNativeCrown" && settings.useCrown,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key]
value: settings[key],
onChange: key == "useCrown" ? (value, instance) => {
let hideNativeCrownInstance = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "hideNativeCrown"});
if (hideNativeCrownInstance) {
hideNativeCrownInstance.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(hideNativeCrownInstance);
}
} : null
}))
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
@ -263,7 +273,7 @@ var OwnerTag = (_ => {
className = BDFDB.disCN._ownertagadminicon;
break;
case userTypes.MANAGEMENT:
label = BDFDB.LanguageUtils.LanguageStrings.MODERATION;
label = `${this.labels.management_text} (${[BDFDB.UserUtils.can("MANAGE_GUILD", user.id) && BDFDB.LanguageUtils.LibraryStrings.server, BDFDB.UserUtils.can("MANAGE_CHANNELS", user.id) && BDFDB.LanguageUtils.LanguageStrings.CHANNELS, BDFDB.UserUtils.can("MANAGE_ROLES", user.id) && BDFDB.LanguageUtils.LanguageStrings.ROLES].filter(n => n).join(", ")})`;
className = BDFDB.disCN._ownertagmanagementicon;
break;
}
@ -314,7 +324,7 @@ var OwnerTag = (_ => {
let isOwner = channel.ownerId == user.id || guild && guild.ownerId == user.id;
if (isOwner) return userTypes.OWNER;
else if (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", user.id) && !(settings.ignoreBotAdmins && user.bot)) return userTypes.ADMIN;
else if (settings.addForManagement && BDFDB.UserUtils.can("MANAGE_GUILD", user.id) && !(settings.ignoreBotAdmins && user.bot)) return userTypes.MANAGEMENT;
else if (settings.addForManagement && (BDFDB.UserUtils.can("MANAGE_GUILD", user.id) || BDFDB.UserUtils.can("MANAGE_CHANNELS", user.id) || BDFDB.UserUtils.can("MANAGE_ROLES", user.id)) && !(settings.ignoreBotAdmins && user.bot)) return userTypes.MANAGEMENT;
return userTypes.NONE;
}
@ -325,6 +335,95 @@ var OwnerTag = (_ => {
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
setLabelsByLanguage () {
switch (BDFDB.LanguageUtils.getLanguage().id) {
case "hr": //croatian
return {
management_text: "Upravljanje"
};
case "da": //danish
return {
management_text: "Ledelse"
};
case "de": //german
return {
management_text: "Verwaltung"
};
case "es": //spanish
return {
management_text: "Administración"
};
case "fr": //french
return {
management_text: "Gestion"
};
case "it": //italian
return {
management_text: "Gestione"
};
case "nl": //dutch
return {
management_text: "Beheer"
};
case "no": //norwegian
return {
management_text: "Ledelse"
};
case "pl": //polish
return {
management_text: "Zarządzanie"
};
case "pt-BR": //portuguese (brazil)
return {
management_text: "Gestão"
};
case "fi": //finnish
return {
management_text: "Johto"
};
case "sv": //swedish
return {
management_text: "Förvaltning"
};
case "tr": //turkish
return {
management_text: "Yönetim"
};
case "cs": //czech
return {
management_text: "Řízení"
};
case "bg": //bulgarian
return {
management_text: "Управление"
};
case "ru": //russian
return {
management_text: "Управление"
};
case "uk": //ukrainian
return {
management_text: "Управління"
};
case "ja": //japanese
return {
management_text: "管理"
};
case "zh-TW": //chinese (traditional)
return {
management_text: "管理"
};
case "ko": //korean
return {
management_text: "관리"
};
default: //default: english
return {
management_text: "Management"
};
}
}
}
})();

View File

@ -9,4 +9,4 @@
[patreon-badge]: https://img.shields.io/badge/Patreon-Support!-%23F96854.svg?logo=patreon&style=flat
[patreon-link]: https://patreon.com/MircoWittrien
Adds a Tag like Bottags to the Serverowner.
Adds a tag or crown to the server owner (or admins/management).

View File

@ -34,7 +34,7 @@
- [Message Utilities](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/MessageUtilities) - Offers a number of useful message options.
- [Notification Sounds](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/NotificationSounds) - Allows you to replace the native sounds of Discord with your own.
- [Old Title Bar](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/OldTitleBar) - Reverts the title bar back to its former self.
- [Owner Tag](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/OwnerTag) - Adds a Tag like Bottags to the Serverowner..
- [Owner Tag](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/OwnerTag) - Adds a tag or crown to the server owner (or admins/management)..
- [Personal Pins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/PersonalPins) - Similar to normal pins. Lets you save messages as notes for yourself.
- [Pin DMs](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/PinDMs) - Allows you to pin DMs, making them appear at the top of your DMs/Guild-list.
- [Plugin Repo](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/PluginRepo) - Allows you to look at all plugins from the plugin repo and download them on the fly.