From 324d20d42c2b7edb8489fd06eac0788e2a77eb2c Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Sun, 14 Jul 2019 17:40:42 -0700 Subject: [PATCH] Move registering WebUI magnet handler behind toolbar option Alert the user if the operation fails due to lack of browser support --- src/webui/www/private/index.html | 1 + src/webui/www/private/scripts/client.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 90dda35d0..f3cc77357 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -77,6 +77,7 @@ QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]
  • diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index c2621af2b..b8bdf323b 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -590,6 +590,10 @@ window.addEvent('load', function() { MochaUI.Desktop.setDesktopSize(); }); + $('registerMagnetHandlerLink').addEvent('click', function(e) { + registerMagnetHandler(); + }); + $('speedInBrowserTitleBarLink').addEvent('click', function(e) { speedInTitle = !speedInTitle; localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString()); @@ -801,13 +805,13 @@ window.addEvent('load', function() { addMainWindowTabsEventListener(); addSearchPanel(); } - - registerMagnetHandler(); }); function registerMagnetHandler() { - if (typeof navigator.registerProtocolHandler !== 'function') + if (typeof navigator.registerProtocolHandler !== 'function') { + alert("Your browser does not support this feature"); return; + } const hashParams = getHashParamsFromUrl(); hashParams.download = '';