From 52cbc5690609b72053965011c43c48730e322750 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 31 Jul 2017 20:39:20 +0300 Subject: [PATCH] Fixed crash on chrome app link middle-click Closes #1471 --- app/js/services.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/js/services.js b/app/js/services.js index 3c3c3e32..8a34e783 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -4737,11 +4737,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) !target.onclick && !target.onmousedown) { var href = $(target).attr('href') || target.href || '' - if (Config.Modes.chrome_packed && - href.length && - $(target).attr('target') == '_blank') { - $(target).attr('rel', '') - } var match = href.match(tgAddrRegExp) if (match) { if (handleTgProtoAddr(match[3], true)) { @@ -4751,6 +4746,19 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } }) + $(document).on('mousedown', function (event) { + var target = event.target + if (target && + target.tagName == 'A') { + var href = $(target).attr('href') || target.href || '' + if (Config.Modes.chrome_packed && + href.length && + $(target).attr('target') == '_blank') { + $(target).attr('rel', '') + } + } + }) + $rootScope.$on('$routeUpdate', checkLocationTgAddr) checkLocationTgAddr() }