From 9ac7d20df3916acf9f9d0042180601d51fe59857 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 3 Jun 2019 08:31:43 -0400 Subject: [PATCH] [frio] Add .add-to-modal delegated event on anchors - Improve hovercard button accessibility --- view/templates/hovercard.tpl | 4 ++-- view/theme/frio/js/modal.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index a688f57b20..017e096afc 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -21,8 +21,8 @@ {{* here are the differnt actions like privat message, poke, delete and so on *}} {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
- {{if $profile.actions.pm}}{{/if}} - {{if $profile.actions.poke}}{{/if}} + {{if $profile.actions.pm}}{{$profile.actions.pm.0}}{{/if}} + {{if $profile.actions.poke}}{{$profile.actions.poke.0}}{{/if}}
{{if $profile.actions.network}}{{/if}} diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index ab263bc2ab..9bca427779 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -93,6 +93,21 @@ $(document).ready(function(){ input.val(img); }); + + // Generic delegated event to open an anchor URL in a modal. + // Used in the hovercard. + document.getElementsByTagName('body')[0].addEventListener('click', function(e) { + var target = e.target; + while (target) { + if (target.matches && target.matches('a.add-to-modal')) { + addToModal(target.href); + e.preventDefault(); + return false; + } + + target = target.parentNode || null; + } + }); }); // Overwrite Dialog.show from main js to load the filebrowser into a bs modal. -- 2.39.5