mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-29 08:24:26 -04:00
ViewIcons: fix viewing animated icons/banners
This commit is contained in:
parent
ba76c43a26
commit
f6bfd18816
1 changed files with 7 additions and 2 deletions
|
@ -71,9 +71,14 @@ const openAvatar = (url: string) => openImage(url, 512, 512);
|
||||||
const openBanner = (url: string) => openImage(url, 1024);
|
const openBanner = (url: string) => openImage(url, 1024);
|
||||||
|
|
||||||
function openImage(url: string, width: number, height?: number) {
|
function openImage(url: string, width: number, height?: number) {
|
||||||
const format = url.startsWith("/") ? "png" : settings.store.format;
|
|
||||||
|
|
||||||
const u = new URL(url, window.location.href);
|
const u = new URL(url, window.location.href);
|
||||||
|
|
||||||
|
const format = url.startsWith("/")
|
||||||
|
? "png"
|
||||||
|
: u.searchParams.get("animated") === "true"
|
||||||
|
? "gif"
|
||||||
|
: settings.store.format;
|
||||||
|
|
||||||
u.searchParams.set("size", settings.store.imgSize);
|
u.searchParams.set("size", settings.store.imgSize);
|
||||||
u.pathname = u.pathname.replace(/\.(png|jpe?g|webp)$/, `.${format}`);
|
u.pathname = u.pathname.replace(/\.(png|jpe?g|webp)$/, `.${format}`);
|
||||||
url = u.toString();
|
url = u.toString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue