about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-07-22 01:16:53 +0000
committerbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-07-22 01:16:53 +0000
commit984d2d4cb626dd3a4da707ecf1e8ad45b476d8fb (patch)
tree9a7ba46c448cca4a4a245224bf421941a33c263d /app/javascript/packs
parent0244019ca17288802a144c84b7e0f319f1685695 (diff)
parent8d6c3cd48ae4f96752ff6b698bc7244d97aa9a27 (diff)
Merge that good fresh upstream shit
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index e34c47fd0..e9bb4a42e 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -90,6 +90,20 @@ function main() {
       noteCounter.textContent = 500 - length(noteWithoutMetadata);
     }
   });
+
+  delegate(document, '#account_avatar', 'change', ({ target }) => {
+    const avatar = document.querySelector('.card.compact .avatar img');
+    const [file] = target.files || [];
+    const url = URL.createObjectURL(file);
+    avatar.src = url;
+  });
+
+  delegate(document, '#account_header', 'change', ({ target }) => {
+    const header = document.querySelector('.card.compact');
+    const [file] = target.files || [];
+    const url = URL.createObjectURL(file);
+    header.style.backgroundImage = `url(${url})`;
+  });
 }
 
 loadPolyfills().then(main).catch(error => {