about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-08-18 03:03:12 +0200
committerGitHub <noreply@github.com>2018-08-18 03:03:12 +0200
commit78fa926ed560e6a9738144bec7e152fa42104139 (patch)
tree77470dc0c731cf32e298a32d618d65f5dc5b3820 /app/javascript/packs
parentbf1bde5d6a8306284a0cce89eb8f492b8c9b7a67 (diff)
Add remote interaction dialog for toots (#8202)
* Add remote interaction dialog for toots

* Change AuthorizeFollow into AuthorizeInteraction, support statuses

* Update brakeman.ignore

* Adjust how interaction buttons are display on public pages

* Fix tests
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 6b47eecf9..dc18da853 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -67,13 +67,6 @@ function main() {
       }, datetime, now, datetime.getFullYear());
     });
 
-    [].forEach.call(document.querySelectorAll('.modal-button'), (content) => {
-      content.addEventListener('click', (e) => {
-        e.preventDefault();
-        window.open(e.target.href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
-      });
-    });
-
     const reactComponents = document.querySelectorAll('[data-component]');
     if (reactComponents.length > 0) {
       import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container')
@@ -119,6 +112,20 @@ function main() {
     return false;
   });
 
+  delegate(document, '.modal-button', 'click', e => {
+    e.preventDefault();
+
+    let href;
+
+    if (e.target.nodeName !== 'A') {
+      href = e.target.parentNode.href;
+    } else {
+      href = e.target.href;
+    }
+
+    window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
+  });
+
   delegate(document, '#account_display_name', 'input', ({ target }) => {
     const nameCounter = document.querySelector('.name-counter');
     const name        = document.querySelector('.card .display-name strong');