This commit is contained in:
Mirco Wittrien 2022-10-24 10:12:01 +02:00
parent 12f51501c6
commit 2a20d9b32e
2 changed files with 22 additions and 15 deletions

View File

@ -2,7 +2,7 @@
* @name OpenSteamLinksInApp
* @author DevilBro
* @authorId 278543574059057154
* @version 1.1.4
* @version 1.1.5
* @description Opens Steam Links in Steam instead of your Browser
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -65,7 +65,7 @@ module.exports = (_ => {
onStart () {
for (let key in urls) BDFDB.ListenerUtils.add(this, document, "click", BDFDB.ArrayUtils.removeCopies(urls[key].map(url => url.indexOf("http") == 0 ? (url.indexOf("https://") == 0 ? [`a[href^="${url}"]`, `a[href^="${url.replace(/https:\/\//i, "http://")}"]`] : `a[href^="${url}"]`) : `a[href*="${url}"][href*="${key}"]`).flat(10).filter(n => n)).join(", "), e => {
if (!(e.currentTarget.className && e.currentTarget.className.indexOf(BDFDB.disCN.imagezoom) > -1)) this.openIn(e, key, e.currentTarget.href);
if (!(e.currentTarget.className && e.currentTarget.className.indexOf(BDFDB.disCN.imagezoom) > -1) && !BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagezoom, e.currentTarget)) this.openIn(e, key, e.currentTarget.href);
});
}
@ -82,10 +82,15 @@ module.exports = (_ => {
}
openInSteam (url) {
BDFDB.LibraryRequires.request(url, (error, response, body) => {
if (BDFDB.LibraryRequires.electron.shell.openExternal("steam://openurl/" + response.request.href));
else BDFDB.DiscordUtils.openLink(response.request.href);
});
const xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
let responseUrl = xhr.responseURL || url;
if (BDFDB.LibraryRequires.electron.shell.openExternal("steam://openurl/" + responseUrl));
else BDFDB.DiscordUtils.openLink(responseUrl);
};
xhr.send(null);
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));

View File

@ -2,7 +2,7 @@
* @name TopRoleEverywhere
* @author DevilBro
* @authorId 278543574059057154
* @version 3.0.9
* @version 3.1.0
* @description Adds the highest Role of a User as a Tag
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -75,12 +75,14 @@ module.exports = (_ => {
}
};
this.patchedModules = {
after: {
MemberListItem: "render",
MessageUsername: "default",
VoiceUser: "render"
}
this.modulePatches = {
before: [
"MessageHeader"
],
after: [
"MemberListItem",
"VoiceUser"
]
};
this.patchPriority = 4;
@ -173,9 +175,9 @@ module.exports = (_ => {
});
}
processMessageUsername (e) {
processMessageHeader (e) {
if (!e.instance.props.message) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "Popout"});
let [children, index] = BDFDB.ReactUtils.findParent(e.instance.props.username, {filter: n => n && n.props && typeof n.props.renderPopout == "function"});
if (index == -1) return;
const author = e.instance.props.userOverride || e.instance.props.message.author;
if (this.settings.places.chat) this.injectRoleTag(children, author, "chat", e.instance.props.compact ? index : (index + 2), {