Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Update ImageEmojis.plugin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusAquino authored Aug 8, 2021
1 parent 1321dc6 commit 33474ed
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ImageEmojis.plugin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* @name ImageEmojis
* @version 0.1.5
* @version 0.2.0
* @source https://raw.githubusercontent.com/MateusAquino/ImageEmojis/master/ImageEmojis.plugin.js
* @updateUrl https://raw.githubusercontent.com/MateusAquino/ImageEmojis/master/ImageEmojis.plugin.js
*/

module.exports = class ImageEmojis {
getName() {return "ImageEmojis"}
getShortName() {return "ie"}
getDescription() {return "Unlock every single Discord emoji as images/gifs. Just Right-Click it."}
getVersion() {return "0.1.5"}
getDescription() {return "Unlock every single Discord emoji or sticker as images/gifs. Just Right-Click it."}
getVersion() {return "0.2.0"}
getAuthor() {return "Mafios"}
load() {
if (window.ZLibrary)
Expand All @@ -22,27 +22,28 @@ module.exports = class ImageEmojis {
start() {
// Global Styling (Removes grayscale filter from emojis + animations for plugin settings)
this.style = document.createElement('style');
this.style.innerHTML = `li[class^='emojiItem'], li[class*=' emojiItem'] { filter: none; -webkit-filter: none; } #ie-svg { -webkit-transition: all 0.1s ease-in-out;-moz-transition: all 0.1s ease-in-out;-ms-transition: all 0.1s ease-in-out;-o-transition: all 0.1s ease-in-out; }`;
this.style.innerHTML = `li[class^='emojiItem'], li[class*=' emojiItem'], div[class^='stickerNode'], div[class*='stickerNode'] { filter: none; -webkit-filter: none; } #ie-svg { -webkit-transition: all 0.1s ease-in-out;-moz-transition: all 0.1s ease-in-out;-ms-transition: all 0.1s ease-in-out;-o-transition: all 0.1s ease-in-out; };`;
document.head.appendChild(this.style);
}
stop() {
if (this.style && this.style.remove)
this.style.remove();
}
observer(o) {
if (o.target.id === "emoji-picker-grid")
const isSticker = o.target.id === "sticker-picker-grid";
if (["sticker-picker-grid", "emoji-picker-grid"].includes(o.target.id))
o.target.addEventListener('contextmenu', e => {
// Get URL of Selected Emoji
e = e || window.event;
e = e.target || e.srcElement;
let url = e.children[0].src;
let url = isSticker ? e.src : e.children[0].src;
if (!url) return;
let size = BdApi.loadData('ImageEmojis', 'fixedSize') | 0;
if (size) url+=`&size=${size}`;
if (size && !isSticker) url+=`&size=${size}`;
// Insert url on chat
let chatInput = this.select('slateTextArea');
let editor = chatInput[Object.keys(chatInput)[0]].memoizedProps.children.props.editor;
editor.insertText(url);
editor.insertText(url)

// Close Emoji Container
let emojiBtn = this.select('emojiButton');
Expand Down

0 comments on commit 33474ed

Please sign in to comment.