Skip to content

Commit

Permalink
discord: Saving banners
Browse files Browse the repository at this point in the history
  • Loading branch information
Layerex committed Jan 3, 2023
1 parent c265716 commit f07fa0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Chrome extension for saving images from various sites by pressing Ctrl+S lightly
Currently supported sites are:

- vk.com (images, stories, gifs)
- discord.com (images, gifs, avatars, emojis)
- discord.com (images, gifs, avatars, emojis, banners (on Ctrl+Shift+S))
- element.io (images)
- 2ch.hk (images, videos)
- teddit.net (images)
Expand All @@ -27,7 +27,7 @@ Also currently played video can be downloaded on any site with simple html5 vide
На данный момент поддерживаются:

- vk.com (изображения, истории, гифки)
- discord.com (изображения, гифки, аватарки, эмодзи)
- discord.com (изображения, гифки, аватарки, эмодзи, баннеры (на Ctrl+Shift+S))
- element.io (изображения)
- 2ch.hk (изображения, видео)
- teddit.net (изображения)
Expand Down
10 changes: 9 additions & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const getters = {
return getImage(imageDiv).src;
}
},
"discord.com": () => {
"discord.com": (alt) => {
function maxSizeAsset(url) {
return url.split("?")[0] + "?size=4096";
}
Expand All @@ -79,6 +79,14 @@ const getters = {
).parentNode.parentNode.parentNode.click();
} catch {}

if (alt) {
const bannerDiv = getElementByClassNameStart("bannerPremium");
if (bannerDiv) {
const bannerUrl = getBackgroundImage(bannerDiv);
return maxSizeAsset(bannerUrl);
}
}

const backdrop = getElementByClassNameStart("backdrop");
if (backdrop) {
const currentContainer = backdrop.parentNode;
Expand Down

0 comments on commit f07fa0d

Please sign in to comment.