From: Hypolite Petovan Date: Mon, 3 Jun 2019 12:31:43 +0000 (-0400) Subject: [frio] Add .add-to-modal delegated event on anchors X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9ac7d20df3916acf9f9d0042180601d51fe59857;p=friendica.git [frio] Add .add-to-modal delegated event on anchors - Improve hovercard button accessibility --- 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.