stuff
This commit is contained in:
parent
9918d3b5a8
commit
544303891a
|
@ -3,7 +3,7 @@
|
|||
class GoogleSearchReplace {
|
||||
getName () {return "GoogleSearchReplace";}
|
||||
|
||||
getVersion () {return "1.2.1";}
|
||||
getVersion () {return "1.2.2";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class GoogleSearchReplace {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
"improved":[["Inbuilt Window","Option to use an inbuilt browser instead of the default OS browser"],["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,9 @@ class GoogleSearchReplace {
|
|||
this.textUrlReplaceString = "DEVILBRO_BD_GOOGLESEARCHREPLACE_REPLACE_TEXTURL";
|
||||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
useChromium: {value:false, description:"Use an inbuilt browser window instead of opening your default browser"},
|
||||
},
|
||||
engines: {
|
||||
_all: {value:true, name:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url:null},
|
||||
Ask: {value:true, name:"Ask", url:"https://ask.com/web?q=" + this.textUrlReplaceString},
|
||||
|
@ -41,10 +44,19 @@ class GoogleSearchReplace {
|
|||
|
||||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let engines = BDFDB.DataUtils.get(this, "engines");
|
||||
let settingsitems = [], inneritems = [];
|
||||
let settingsitems = [], engineitems = [];
|
||||
|
||||
for (let key in engines) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
for (let key in engines) engineitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
|
@ -56,7 +68,7 @@ class GoogleSearchReplace {
|
|||
title: "Search Engines:",
|
||||
first: settingsitems.length == 0,
|
||||
last: true,
|
||||
children: inneritems
|
||||
children: engineitems
|
||||
}));
|
||||
|
||||
return BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
|
||||
|
@ -106,7 +118,7 @@ class GoogleSearchReplace {
|
|||
// begin of own functions
|
||||
|
||||
onNativeContextMenu (e) {
|
||||
if (e.instance.props.type == "NATIVE_TEXT" && e.instance.props.value) this.injectItem(e, e.instance.props.value);
|
||||
if (e.instance.props.type == BDFDB.DiscordConstants.ContextMenuTypes.NATIVE_TEXT && e.instance.props.value) this.injectItem(e, e.instance.props.value);
|
||||
}
|
||||
|
||||
onMessageContextMenu (e) {
|
||||
|
@ -123,11 +135,12 @@ class GoogleSearchReplace {
|
|||
label: this.defaults.engines[key].name,
|
||||
danger: key == "_all",
|
||||
action: event => {
|
||||
let useChromium = BDFDB.DataUtils.get(this, "settings", "useChromium");
|
||||
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
|
||||
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");
|
||||
for (let key2 in engines) if (key2 != "_all" && engines[key2]) BDFDB.DiscordUtils.openLink(this.defaults.engines[key2].url.replace(this.textUrlReplaceString, encodeURIComponent(url)), useChromium);
|
||||
}
|
||||
else window.open(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
|
||||
else BDFDB.DiscordUtils.openLink(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(url)), useChromium);
|
||||
}
|
||||
}));
|
||||
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
|
|
|
@ -16,10 +16,9 @@ class GoogleTranslateOption {
|
|||
|
||||
this.patchedModules = {
|
||||
after: {
|
||||
"ChannelTextArea":["componentDidMount","render"],
|
||||
"Message":"componentDidMount",
|
||||
"MessageContent":"componentDidMount",
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
ChannelTextArea: ["componentDidMount","render"],
|
||||
Message: "componentDidMount",
|
||||
MessageContent: "componentDidMount"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -40,8 +39,9 @@ class GoogleTranslateOption {
|
|||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
addTranslateButton: {value:true, description:"Adds an translate button to the chatbar."},
|
||||
sendOriginalMessage: {value:false, description:"Send the original message together with the translation."}
|
||||
useChromium: {value:false, description:"Use an inbuilt browser window instead of opening your default browser"},
|
||||
addTranslateButton: {value:true, description:"Adds an translate button to the chatbar"},
|
||||
sendOriginalMessage: {value:false, description:"Send the original message together with the translation"}
|
||||
},
|
||||
choices: {
|
||||
inputContext: {value:"auto", direction:"input", place:"Context", description:"Input Language in received Messages:"},
|
||||
|
@ -153,19 +153,27 @@ class GoogleTranslateOption {
|
|||
|
||||
|
||||
// begin of own functions
|
||||
|
||||
onSettingsClosed (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.setLanguages();
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, "ChannelTextArea");
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props.message && instance.props.channel && instance.props.target) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(instance.props.target);
|
||||
onMessageContextMenu (e) {
|
||||
if (e.instance.props.message && e.instance.props.channel && e.instance.props.target) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(e.instance.props.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"MessagePinItem"});
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"MessagePinItem"});
|
||||
const translateUntranslateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
|
||||
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Translate_Message") : null,
|
||||
action: _ => {
|
||||
BDFDB.ContextMenuUtils.close(menu);
|
||||
this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
|
||||
BDFDB.ContextMenuUtils.close(e.instance);
|
||||
this.translateMessage(e.instance.props.message, e.instance.props.target, e.instance.props.channel);
|
||||
}
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, translateUntranslateItem);
|
||||
|
@ -173,7 +181,7 @@ class GoogleTranslateOption {
|
|||
let text = document.getSelection().toString();
|
||||
if (text) {
|
||||
let GSRstring = BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("GoogleSearchReplace", true), "labels.context_googlesearchreplace_text");
|
||||
let [children2, index2] = BDFDB.ReactUtils.findChildren(returnvalue, {name:"SearchWithGoogle", props: GSRstring ? [["label", GSRstring]] : null});
|
||||
let [children2, index2] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"SearchWithGoogle", props: GSRstring ? [["label", GSRstring]] : null});
|
||||
var foundtranslation, foundinput, foundoutput;
|
||||
const searchTranslationItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_googletranslateoption_text,
|
||||
|
@ -186,7 +194,7 @@ class GoogleTranslateOption {
|
|||
if (foundtranslation && foundinput && foundoutput) {
|
||||
if (document.querySelector(".googletranslate-tooltip")) {
|
||||
BDFDB.ContextMenuUtils.close(menu);
|
||||
window.open(this.getGoogleTranslatePageURL(foundinput.id, foundoutput.id, text), "_blank");
|
||||
BDFDB.DiscordUtils.openLink(this.getGoogleTranslatePageURL(foundinput.id, foundoutput.id, text), BDFDB.DataUtils.get(this, "settings", "useChromium"));
|
||||
}
|
||||
else createTooltip();
|
||||
}
|
||||
|
@ -205,29 +213,29 @@ class GoogleTranslateOption {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
onMessageOptionPopout (e) {
|
||||
if (e.instance.props.message && e.instance.props.channel && e.instance.props.target) {
|
||||
let {messagediv, pos} = this.getMessageAndPos(e.instance.props.target);
|
||||
if (!messagediv || pos == -1) return;
|
||||
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {props:[["label", [BDFDB.LanguageUtils.LanguageStrings.PIN, BDFDB.LanguageUtils.LanguageStrings.UNPIN]]]});
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", [BDFDB.LanguageUtils.LanguageStrings.PIN, BDFDB.LanguageUtils.LanguageStrings.UNPIN]]]});
|
||||
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[translated ? "popout_untranslateoption_text" : "popout_translateoption_text"],
|
||||
className: BDFDB.disCN.optionpopoutitem,
|
||||
action: _ => {
|
||||
this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
|
||||
instance.props.onClose();
|
||||
this.translateMessage(e.instance.props.message, e.instance.props.target, e.instance.props.channel);
|
||||
e.instance.props.onClose();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
processChannelTextArea (instance, wrapper, returnvalue, methodnames) {
|
||||
if (instance.props.type != "normal" || instance.props.disabled) return;
|
||||
if (methodnames.includes("componentDidMount") && wrapper) {
|
||||
let textarea = wrapper.querySelector(BDFDB.dotCN.textarea);
|
||||
processChannelTextArea (e) {
|
||||
if (e.instance.props.type != "normal" || e.instance.props.disabled) return;
|
||||
if (e.node) {
|
||||
let textarea = e.node.querySelector(BDFDB.dotCN.textarea);
|
||||
if (textarea) {
|
||||
BDFDB.ListenerUtils.add(this, textarea, "input", () => {
|
||||
BDFDB.ListenerUtils.add(this, textarea, "input", _ => {
|
||||
if (this.doTranslate) {
|
||||
this.doTranslate = false;
|
||||
if (document.activeElement == textarea) {
|
||||
|
@ -245,32 +253,24 @@ class GoogleTranslateOption {
|
|||
}
|
||||
}
|
||||
});
|
||||
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
|
||||
if (textarea.value && this.translating && !e.shiftKey && e.which == 13 && !wrapper.querySelector(BDFDB.dotCN.autocomplete)) {
|
||||
BDFDB.ListenerUtils.add(this, textarea, "keydown", event => {
|
||||
if (textarea.value && this.translating && !event.shiftKey && event.which == 13 && !e.node.querySelector(BDFDB.dotCN.autocomplete)) {
|
||||
this.doTranslate = true;
|
||||
textarea.dispatchEvent(new Event("input"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (methodnames.includes("render")) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {props:[["className", BDFDB.disCN.textareapickerbuttons]]});
|
||||
if (e.returnvalue) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["className", BDFDB.disCN.textareapickerbuttons]]});
|
||||
if (index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(this.createTranslateButton());
|
||||
}
|
||||
}
|
||||
|
||||
processMessageContent (instance, wrapper, returnvalue) {
|
||||
if (instance.props.message && instance.props.channel) {
|
||||
let messagediv = BDFDB.DOMUtils.getParent(".GTO-translated-message", wrapper);
|
||||
if (messagediv && !wrapper.querySelector(".GTO-translation")) BDFDB.DOMUtils.removeClass(messagediv, "GTO-translated-message");
|
||||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.setLanguages();
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, "ChannelTextArea");
|
||||
processMessageContent (e) {
|
||||
if (e.instance.props.message && e.instance.props.channel) {
|
||||
let messagediv = BDFDB.DOMUtils.getParent(".GTO-translated-message", e.node);
|
||||
if (messagediv && !e.node.querySelector(".GTO-translation")) BDFDB.DOMUtils.removeClass(messagediv, "GTO-translated-message");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ class PluginRepo {
|
|||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
useChromium: {value:false, description:"Use an inbuilt browser window instead of opening your default browser"},
|
||||
notifyOutdated: {value:true, description:"Notifies you when one of your Plugins is outdated."},
|
||||
notifyNewentries: {value:true, description:"Notifies you when there are new entries in the Repo."}
|
||||
}
|
||||
|
@ -517,7 +518,7 @@ class PluginRepo {
|
|||
else if (data.url.indexOf("https://gist.githubusercontent.com/") == 0) {
|
||||
giturl = data.url.replace("//gist.githubusercontent", "//gist.github").split("/raw/")[0];
|
||||
}
|
||||
if (giturl) window.open(giturl, "_blank");
|
||||
if (giturl) BDFDB.DiscordUtils.openLink(giturl, BDFDB.DataUtils.get(this, "settings", "useChromium"));
|
||||
});
|
||||
gitbutton.addEventListener("mouseenter", e => {
|
||||
BDFDB.TooltipUtils.create(gitbutton, "Go to Git", {type:"top",selector:"pluginrepo-giticon-tooltip"});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class ReverseImageSearch {
|
||||
getName () {return "ReverseImageSearch";}
|
||||
|
||||
getVersion () {return "3.4.8";}
|
||||
getVersion () {return "3.4.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class ReverseImageSearch {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
"improved":[["Inbuilt Window","Option to use an inbuilt browser instead of the default OS browser"],["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,10 @@ class ReverseImageSearch {
|
|||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
addUserAvatarEntry: {value:true, description:"User Avatars"},
|
||||
addGuildIconEntry: {value:true, description:"Server Icons"},
|
||||
addEmojiEntry: {value:true, description:"Custom Emojis/Emotes"}
|
||||
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"},
|
||||
addEmojiEntry: {value:true, inner:true, description:"Custom Emojis/Emotes"}
|
||||
},
|
||||
engines: {
|
||||
_all: {value:true, name:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url:null},
|
||||
|
@ -42,11 +43,11 @@ class ReverseImageSearch {
|
|||
|
||||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "engines");
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let engines = BDFDB.DataUtils.get(this, "engines");
|
||||
let settingsitems = [], inneritems = [];
|
||||
let settingsitems = [], inneritems = [], engineitems = [];
|
||||
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
|
@ -54,7 +55,7 @@ class ReverseImageSearch {
|
|||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
for (let key in engines) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
for (let key in engines) engineitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
|
@ -63,11 +64,17 @@ class ReverseImageSearch {
|
|||
value: engines[key]
|
||||
}));
|
||||
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
|
||||
title: "Search Engines:",
|
||||
title: "Add extra ContextMenu Entry for:",
|
||||
first: settingsitems.length == 0,
|
||||
last: true,
|
||||
children: inneritems
|
||||
}));
|
||||
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
|
||||
title: "Search Engines:",
|
||||
first: settingsitems.length == 0,
|
||||
last: true,
|
||||
children: engineitems
|
||||
}));
|
||||
|
||||
return BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
|
||||
}
|
||||
|
@ -130,7 +137,9 @@ class ReverseImageSearch {
|
|||
}
|
||||
|
||||
onNativeContextMenu (e) {
|
||||
if (e.instance.props.type == "NATIVE_IMAGE" && (e.instance.props.href || e.instance.props.src)) this.injectItem(e, e.instance.props.href || e.instance.props.src);
|
||||
if (e.instance.props.type == BDFDB.DiscordConstants.ContextMenuTypes.NATIVE_IMAGE && (e.instance.props.href || e.instance.props.src)) {
|
||||
this.injectItem(e, e.instance.props.href || e.instance.props.src);
|
||||
}
|
||||
}
|
||||
|
||||
onMessageContextMenu (e) {
|
||||
|
@ -154,11 +163,12 @@ class ReverseImageSearch {
|
|||
label: this.defaults.engines[key].name,
|
||||
danger: key == "_all",
|
||||
action: event => {
|
||||
let useChromium = BDFDB.DataUtils.get(this, "settings", "useChromium");
|
||||
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
|
||||
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");
|
||||
for (let key2 in engines) if (key2 != "_all" && engines[key2]) BDFDB.DiscordUtils.openLink(this.defaults.engines[key2].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), useChromium);
|
||||
}
|
||||
else window.open(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
|
||||
else BDFDB.DiscordUtils.openLink(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), useChromium);
|
||||
}
|
||||
}));
|
||||
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class SteamProfileLink {
|
||||
getName () {return "SteamProfileLink";}
|
||||
|
||||
getVersion () {return "1.0.7";}
|
||||
getVersion () {return "1.0.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,10 +11,37 @@ class SteamProfileLink {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
"improved":[["Inbuilt Window","Option to use an inbuilt browser instead of the default OS browser"],["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
};
|
||||
}
|
||||
|
||||
initConstructor () {
|
||||
this.defaults = {
|
||||
settings: {
|
||||
useChromium: {value:false, description:"Use inbuilt browser instead of default if fails to open Steam"}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let settingsitems = [];
|
||||
|
||||
settingsitems = settingsitems.concat(this.createSelects(false));
|
||||
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
|
||||
return BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
|
||||
}
|
||||
|
||||
//legacy
|
||||
load () {}
|
||||
|
||||
|
@ -67,7 +94,7 @@ class SteamProfileLink {
|
|||
BDFDB.ListenerUtils.stopEvent(e);
|
||||
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");
|
||||
else BDFDB.DiscordUtils.openLink(response.request.href, BDFDB.DataUtils.get(this, "settings", "useChromium"));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -247,6 +247,7 @@ class ThemeRepo {
|
|||
|
||||
this.defaults = {
|
||||
settings: {
|
||||
useChromium: {value:false, description:"Use an inbuilt browser window instead of opening your default browser"},
|
||||
notifyOutdated: {value:true, description:"Notifies you when one of your Themes is outdated."},
|
||||
notifyNewentries: {value:true, description:"Notifies you when there are new entries in the Repo."}
|
||||
}
|
||||
|
@ -798,7 +799,7 @@ class ThemeRepo {
|
|||
else if (data.requesturl.indexOf("https://gist.githubusercontent.com/") == 0) {
|
||||
giturl = data.requesturl.replace("//gist.githubusercontent", "//gist.github").split("/raw/")[0];
|
||||
}
|
||||
if (giturl) window.open(giturl, "_blank");
|
||||
if (giturl) BDFDB.DiscordUtils.openLink(giturl, BDFDB.DataUtils.get(this, "settings", "useChromium"));
|
||||
});
|
||||
gitbutton.addEventListener("mouseenter", e => {
|
||||
BDFDB.TooltipUtils.create(gitbutton, "Go to Git", {type:"top",selector:"themerepo-giticon-tooltip"});
|
||||
|
|
Loading…
Reference in New Issue