Browse Source

Move registering WebUI magnet handler behind toolbar option

Alert the user if the operation fails due to lack of browser support
adaptive-webui-19844
Thomas Piccirello 5 years ago
parent
commit
324d20d42c
  1. 1
      src/webui/www/private/index.html
  2. 10
      src/webui/www/private/scripts/client.js

1
src/webui/www/private/index.html

@ -77,6 +77,7 @@
<a class="returnFalse">QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]</a> <a class="returnFalse">QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]</a>
<ul> <ul>
<li><a id="preferencesLink"><img class="MyMenuIcon" src="images/qbt-theme/configure.svg" alt="QBT_TR(Options...)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Options...)QBT_TR[CONTEXT=MainWindow]</a></li> <li><a id="preferencesLink"><img class="MyMenuIcon" src="images/qbt-theme/configure.svg" alt="QBT_TR(Options...)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Options...)QBT_TR[CONTEXT=MainWindow]</a></li>
<li><a id="registerMagnetHandlerLink"><img class="MyMenuIcon" src="images/qbt-theme/kt-magnet.svg" alt="QBT_TR(Register to handle magnet links...)QBT_TR[CONTEXT=HttpServer]" width="16" height="16"/>QBT_TR(Register to handle magnet links...)QBT_TR[CONTEXT=HttpServer]</a></li>
</ul> </ul>
</li> </li>
<li> <li>

10
src/webui/www/private/scripts/client.js

@ -590,6 +590,10 @@ window.addEvent('load', function() {
MochaUI.Desktop.setDesktopSize(); MochaUI.Desktop.setDesktopSize();
}); });
$('registerMagnetHandlerLink').addEvent('click', function(e) {
registerMagnetHandler();
});
$('speedInBrowserTitleBarLink').addEvent('click', function(e) { $('speedInBrowserTitleBarLink').addEvent('click', function(e) {
speedInTitle = !speedInTitle; speedInTitle = !speedInTitle;
localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString()); localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString());
@ -801,13 +805,13 @@ window.addEvent('load', function() {
addMainWindowTabsEventListener(); addMainWindowTabsEventListener();
addSearchPanel(); addSearchPanel();
} }
registerMagnetHandler();
}); });
function registerMagnetHandler() { function registerMagnetHandler() {
if (typeof navigator.registerProtocolHandler !== 'function') if (typeof navigator.registerProtocolHandler !== 'function') {
alert("Your browser does not support this feature");
return; return;
}
const hashParams = getHashParamsFromUrl(); const hashParams = getHashParamsFromUrl();
hashParams.download = ''; hashParams.download = '';

Loading…
Cancel
Save