Fix avatars not loading correctly
This commit is contained in:
parent
77f17c8dc2
commit
e135a74a9b
@ -66,32 +66,28 @@ function update_select(sel) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let isCreating = sel.closest("div.reminderContent").classList.contains("creator");
|
const avatarInput = sel.closest("div.reminderContent").querySelector("img.avatar");
|
||||||
|
|
||||||
if (!isCreating) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const avatarInput = sel
|
|
||||||
.closest("div.reminderContent")
|
|
||||||
.querySelector("img.discord-avatar");
|
|
||||||
|
|
||||||
|
if (!avatarInput.dataset["set"]) {
|
||||||
if (sel.selectedOptions[0].dataset["webhookAvatar"]) {
|
if (sel.selectedOptions[0].dataset["webhookAvatar"]) {
|
||||||
avatarInput.src = sel.selectedOptions[0].dataset["webhookAvatar"];
|
avatarInput.src = sel.selectedOptions[0].dataset["webhookAvatar"];
|
||||||
} else {
|
} else {
|
||||||
avatarInput.src = "/static/img/icon.png";
|
avatarInput.src = "/static/img/icon.png";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const usernameInput = sel
|
const usernameInput = sel
|
||||||
.closest("div.reminderContent")
|
.closest("div.reminderContent")
|
||||||
.querySelector("input.discord-username");
|
.querySelector("input.discord-username");
|
||||||
|
|
||||||
|
if (usernameInput.value.length === 0) {
|
||||||
if (sel.selectedOptions[0].dataset["webhookName"]) {
|
if (sel.selectedOptions[0].dataset["webhookName"]) {
|
||||||
usernameInput.value = sel.selectedOptions[0].dataset["webhookName"];
|
usernameInput.value = sel.selectedOptions[0].dataset["webhookName"];
|
||||||
} else {
|
} else {
|
||||||
usernameInput.value = "Reminder";
|
usernameInput.value = "Reminder";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function reset_guild_pane() {
|
function reset_guild_pane() {
|
||||||
document
|
document
|
||||||
@ -342,7 +338,7 @@ async function serialize_reminder(node, mode) {
|
|||||||
restartable: false,
|
restartable: false,
|
||||||
attachment: attachment,
|
attachment: attachment,
|
||||||
attachment_name: attachment_name,
|
attachment_name: attachment_name,
|
||||||
avatar: has_source(node.querySelector("img.discord-avatar").src),
|
avatar: has_source(node.querySelector("img.avatar").src),
|
||||||
channel: node.querySelector("select.channel-selector").value,
|
channel: node.querySelector("select.channel-selector").value,
|
||||||
content: content,
|
content: content,
|
||||||
embed_author_url: embed_author_url,
|
embed_author_url: embed_author_url,
|
||||||
@ -387,7 +383,9 @@ function deserialize_reminder(reminder, frame, mode) {
|
|||||||
if ($input !== null) {
|
if ($input !== null) {
|
||||||
$input.value = reminder[prop];
|
$input.value = reminder[prop];
|
||||||
} else if ($image !== null) {
|
} else if ($image !== null) {
|
||||||
|
console.log(`loading img ${prop}`);
|
||||||
$image.src = reminder[prop];
|
$image.src = reminder[prop];
|
||||||
|
$image.dataset["set"] = "1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<figure class="media-left">
|
<figure class="media-left">
|
||||||
<p class="image is-32x32 customizable">
|
<p class="image is-32x32 customizable">
|
||||||
<a>
|
<a>
|
||||||
<img class="is-rounded discord-avatar" src="/static/img/bg.webp" alt="Image for discord avatar">
|
<img class="is-rounded avatar" src="/static/img/bg.webp" alt="Image for discord avatar">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</figure>
|
</figure>
|
||||||
|
Loading…
Reference in New Issue
Block a user