[frontend] Improve reliability of openInHue4 JS
@@ -554,12 +554,20 @@ var HueFileEntry = (function () {
HueFileEntry.prototype.openExternalLink = function (entry, event) {
event.preventDefault();
- location.href = $(event.target).attr('href');
+ var $target = $(event.target);
+ if (!$target.is('a')) {
+ $target = $target.closest('a');
+ }
+ location.href = $target.attr('href');
};
HueFileEntry.prototype.openHue4Link = function (entry, event) {
event.preventDefault();
- huePubSub.publish('open.link', $(event.target).attr('href'));
+ var $target = $(event.target);
+ if (!$target.is('a')) {
+ $target = $target.closest('a');
+ }
+ huePubSub.publish('open.link', $target.attr('href'));
};
HueFileEntry.prototype.showRestoreConfirmation = function () {
