diff --git a/view/js/main.js b/view/js/main.js index cd09de0143..a2e2698a82 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1,4 +1,21 @@ // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later + +// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill +if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function(s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; +} + function resizeIframe(obj) { _resizeIframe(obj, 0); } 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.