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.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.