diff options
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/flavours/glitch/styles/components/emoji.scss | 14 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/util/emoji/index.js | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/styles/components/emoji.scss b/app/javascript/flavours/glitch/styles/components/emoji.scss index dd386d698..2d1395e4f 100644 --- a/app/javascript/flavours/glitch/styles/components/emoji.scss +++ b/app/javascript/flavours/glitch/styles/components/emoji.scss @@ -11,6 +11,20 @@ } } +.hoverplay { + background-position: center; + background-repeat: no-repeat; + background-size: 0 0; +} + +.hoverplay:hover { + background-size: contain; + position: relative; + box-sizing: border-box; + overflow: hidden; + padding-left: 16px; +} + .emoji-picker-dropdown__menu { background: $simple-background-color; position: absolute; diff --git a/app/javascript/flavours/glitch/util/emoji/index.js b/app/javascript/flavours/glitch/util/emoji/index.js index 82a1ef89c..2205cd7a3 100644 --- a/app/javascript/flavours/glitch/util/emoji/index.js +++ b/app/javascript/flavours/glitch/util/emoji/index.js @@ -28,8 +28,11 @@ const emojify = (str, customEmojis = {}) => { // now got a replacee as ':shortname:' // if you want additional emoji handler, add statements below which set replacement and return true. if (shortname in customEmojis) { - const filename = autoPlayGif ? customEmojis[shortname].url : customEmojis[shortname].static_url; - replacement = `<img draggable="false" class="emojione" alt="${shortname}" title="${shortname}" src="${filename}" />`; + if (autoPlayGif) { + replacement = `<img draggable="false" class="emojione" alt="${shortname}" title="${shortname}" src="${customEmojis[shortname].url}" />`; + } else { + replacement = `<img draggable="false" class="emojione hoverplay" alt="${shortname}" title="${shortname}" src="${customEmojis[shortname].static_url}" style="background-image:url(${customEmojis[shortname].url})" />`; + } return true; } return false; |