about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-21 18:10:40 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-07-21 18:10:40 +0200
commit7de8c51873b51d8450f7a6597a43d454964d0407 (patch)
tree38d3cbb721e574595cf251fe30441cbd1c107919 /app/javascript/packs
parent043d52f785d8f3d0fa31cde8f5e4c1991888e887 (diff)
Play animated custom emoji on hover (#11348)
* Play animated custom emoji on hover in status

* Play animated custom emoji on hover in display names

* Play animated custom emoji on hover in bios/bio fields

* Add support for animation on hover on public pages emojis too

* Fix tests

* Code style cleanup
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 0c60d828e..b58622a8d 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -44,6 +44,12 @@ function main() {
     }
   };
 
+  const getEmojiAnimationHandler = (swapTo) => {
+    return ({ target }) => {
+      target.src = target.getAttribute(swapTo);
+    };
+  };
+
   ready(() => {
     const locale = document.documentElement.lang;
 
@@ -108,6 +114,9 @@ function main() {
     if (parallaxComponents.length > 0 ) {
       new Rellax('.parallax', { speed: -1 });
     }
+
+    delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
+    delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
   });
 
   delegate(document, '.webapp-btn', 'click', ({ target, button }) => {