diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..d23208f
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/build_dev.xml b/.idea/runConfigurations/build_dev.xml
new file mode 100644
index 0000000..74a7a15
--- /dev/null
+++ b/.idea/runConfigurations/build_dev.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
new file mode 100644
index 0000000..4c417c4
--- /dev/null
+++ b/.idea/watcherTasks.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/coffee/AvatarHover.plugin.coffee b/coffee/AvatarHover.plugin.coffee
index eb1ff37..ff3cc3e 100644
--- a/coffee/AvatarHover.plugin.coffee
+++ b/coffee/AvatarHover.plugin.coffee
@@ -3,8 +3,8 @@
class global.AvatarHover
getName: -> "Avatar Hover"
getDescription: -> "When hovering, resize the avatar. Use Ctrl / Ctrl+Shift."
- getAuthor: -> "noVaLue, MurmursOnSARS, square, Green"
- getVersion: -> "0.7.1"
+ getAuthor: -> "square, noVaLue, MurmursOnSARS, Green"
+ getVersion: -> "0.7.2"
hoverCard = AsyncKeystate = null
@@ -93,7 +93,7 @@ class global.AvatarHover
target.querySelector("img")?.src or
target.src or
getComputedStyle(target).backgroundImage.match(/^url\((["']?)(.+)\1\)$/)[2]
- ).replace /\?size=\d{3,4}\)?$/, "?size=#{size}"
+ ).replace /\?size=\d{2,4}\)?$/, "?size=#{size}"
Object.assign hoverCard.style,
backgroundColor: settings.avatarBackgroundColor
diff --git a/package.json b/package.json
index 2cdf7b1..5d30499 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,12 @@
{
"name": "BetterDiscordStuff",
"description": "square's BD plugins & themes, focused on enhancing user experience",
+ "author": "Inve1951 (square#3880)",
+ "license": "DSL",
+ "private": true,
"scripts": {
- "build": "coffee --no-header -o plugins/ -bct coffee/"
+ "build": "coffee --no-header -o plugins/ -bct coffee/",
+ "build:dev": "coffee --no-header -o plugins/ -bctM coffee/"
},
"repository": {
"type": "git",
@@ -13,8 +17,6 @@
"BD",
"discord"
],
- "author": "Inve1951 (square#3880)",
- "license": "DSL",
"bugs": {
"url": "https://github.com/Inve1951/BetterDiscordStuff/issues"
},
diff --git a/plugins/AvatarHover.plugin.js b/plugins/AvatarHover.plugin.js
index 1e7b732..b299180 100644
--- a/plugins/AvatarHover.plugin.js
+++ b/plugins/AvatarHover.plugin.js
@@ -12,11 +12,11 @@ global.AvatarHover = function () {
}
getAuthor() {
- return "noVaLue, MurmursOnSARS, square, Green";
+ return "square, noVaLue, MurmursOnSARS, Green";
}
getVersion() {
- return "0.7.3";
+ return "0.7.2";
}
load() {
@@ -25,6 +25,7 @@ global.AvatarHover = function () {
if (err || 200 !== (res != null ? res.statusCode : void 0)) {
return r(err != null ? err : res);
}
+
Object.defineProperties(window.SuperSecretSquareStuff, {
libLoaded: {
value: c
@@ -40,7 +41,10 @@ global.AvatarHover = function () {
async start() {
var createElement;
- ({ AsyncKeystate, createElement } = await SuperSecretSquareStuff);
+ ({
+ AsyncKeystate,
+ createElement
+ } = await SuperSecretSquareStuff);
getSettings();
updateQualifier();
BdApi.injectCSS("css-AvatarHover", css);
@@ -67,10 +71,17 @@ global.AvatarHover = function () {
static updateSettings() {
var checked, i, len, name, ref, type, value;
ref = document.querySelectorAll("#settings_AvatarHover input");
+
for (i = 0, len = ref.length; i < len; i++) {
- ({ name, type, value, checked } = ref[i]);
+ ({
+ name,
+ type,
+ value,
+ checked
+ } = ref[i]);
settings[name] = "checkbox" === type ? checked : value || defaultSettings[name];
}
+
BdApi.setData("AvatarHover", "settings", settings);
return updateQualifier();
}
@@ -97,44 +108,42 @@ global.AvatarHover = function () {
isHoverProfile: "Profiles and modals"
};
results = [];
+
for (k in ref) {
v = ref[k];
results.push(makeInput(k, v));
}
+
return results;
}().join("")}`;
}
- };
+ }
+ ;
hoverCard = AsyncKeystate = null;
-
qualifier = null;
updateQualifier = function () {
- return qualifier = [
- // guilds
- settings.isHoverGuilds ? ".wrapper-1BJsBx" : void 0,
- // voip, DM channels
- settings.isHoverChannels ? ".avatarContainer-28iYmV, .channel-2QD9_O .wrapper-3t9DeA" : void 0,
- // friends list
- settings.isHoverFriends ? ".userInfo-2zN2z8 .avatar-3W3CeO" : void 0,
- // messages, embeds
- settings.isHoverChatMessages ? ".contents-2mQqc9 .avatar-1BDn8e, .embedAuthorIcon--1zR3L" : void 0,
- // channel users
- settings.isHoverChatUsers ? ".member-3-YXUe .wrapper-3t9DeA" : void 0,
- // DM call
- settings.isHoverCall ? ".participant-1lOCsd .wrapper-2QE8vf" : void 0,
- // user modal, user popout, mutual servers/friends
- settings.isHoverProfile ? ".header-QKLPzZ .avatar-3EQepX, .wrapper-3t9DeA, .listAvatar-1NlAhb" : void 0].filter(function (s) {
+ return qualifier = [// guilds
+ settings.isHoverGuilds ? ".wrapper-25eVIn" : void 0, // voip, DM channels
+ settings.isHoverChannels ? ".avatarContainer-2inGBK, .channel-2QD9_O .avatar-3uk_u9" : void 0, // friends list
+ settings.isHoverFriends ? ".userInfo-2zN2z8 .avatar-3W3CeO" : void 0, // messages, embeds
+ settings.isHoverChatMessages ? ".contents-2mQqc9 .avatar-1BDn8e, .embedAuthorIcon--1zR3L" : void 0, // channel users
+ settings.isHoverChatUsers ? ".member-3-YXUe .avatar-3uk_u9" : void 0, // DM call
+ settings.isHoverCall ? ".callAvatarWrapper-3Ax_xH" : void 0, // modals, userpopout
+ settings.isHoverProfile ? ".header-QKLPzZ .avatar-3EQepX, .avatarWrapper-3H_478" : void 0].filter(function (s) {
return s != null;
}).join(", ");
};
- handleKeyUpDown = function ({ key }) {
+ handleKeyUpDown = function ({
+ key
+ }) {
if (key !== "Control" && key !== "Shift") {
return;
}
+
return updateHoverCard();
};
@@ -142,10 +151,14 @@ global.AvatarHover = function () {
return updateHoverCard();
};
- handleMouseOverOut = function ({ type, target }) {
+ handleMouseOverOut = function ({
+ type,
+ target
+ }) {
if (!(target.matches(qualifier) || (target = target.closest(qualifier)))) {
return;
}
+
return updateHoverCard("mouseover" === type && target);
};
@@ -156,9 +169,11 @@ global.AvatarHover = function () {
lastTarget = target;
isShown = settings.isShown || AsyncKeystate.key("Control");
isLarge = settings.isLarge || AsyncKeystate.key("Shift");
+
if (!(isShown && target)) {
return hoverCard.remove();
}
+
size = isLarge && 256 || 128;
boundsTarget = target.getBoundingClientRect();
boundsWindow = {
@@ -166,13 +181,17 @@ global.AvatarHover = function () {
height: window.innerHeight
};
left = Math.max(0, boundsTarget.left + (boundsTarget.width - size) / 2);
+
if (left + size > boundsWindow.width) {
left = boundsWindow.width - size;
}
+
top = size > boundsWindow.height ? (boundsWindow.height - size) / 2 : boundsTarget.bottom + size > boundsWindow.height ? boundsTarget.top - size : boundsTarget.bottom;
- if ("none" === (imageUrl = (((ref = target.querySelector("img")) != null ? ref.src : void 0) || target.src || getComputedStyle(target).backgroundImage.match(/^url\((["']?)(.+)\1\)$/)[2]).replace(/\?size=\d{3,4}\)?$/, `?size=${size}`))) {
+
+ if ("none" === (imageUrl = (((ref = target.querySelector("img")) != null ? ref.src : void 0) || target.src || getComputedStyle(target).backgroundImage.match(/^url\((["']?)(.+)\1\)$/)[2]).replace(/\?size=\d{2,4}\)?$/, `?size=${size}`))) {
return hoverCard.remove();
}
+
Object.assign(hoverCard.style, {
backgroundColor: settings.avatarBackgroundColor,
backgroundImage: `url(${imageUrl})`,
@@ -202,28 +221,33 @@ global.AvatarHover = function () {
isHoverCall: true,
isHoverProfile: true
};
-
settings = null;
getSettings = function () {
var k, ref, results, v;
+
if (settings != null) {
return;
}
+
settings = (ref = BdApi.getData("AvatarHover", "settings")) != null ? ref : {};
results = [];
+
for (k in defaultSettings) {
v = defaultSettings[k];
results.push(settings[k] != null ? settings[k] : settings[k] = v);
}
+
return results;
};
makeInput = function (name, label) {
var _default, isCheckbox, type;
+
if (label == null) {
return "
";
}
+
type = Boolean === defaultSettings[name].constructor && (isCheckbox = true) && "checkbox" || "text";
_default = isCheckbox ? settings[name] ? "checked" : "" : `placeholder="${defaultSettings[name]}" value="${settings[name]}\"`;
return `
`;
@@ -240,6 +264,5 @@ global.AvatarHover = function () {
#settings_AvatarHover {
color: #87909C;
}`;
-
return AvatarHover;
-}.call(this);
+}.call(this);
\ No newline at end of file