From 78fa926ed560e6a9738144bec7e152fa42104139 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 18 Aug 2018 03:03:12 +0200 Subject: 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 --- app/javascript/packs/public.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'app/javascript/packs') 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'); -- cgit