Browse Source

Merge pull request #10926 from Piccirello/webui-protocol-handler

Move registering WebUI magnet handler behind toolbar option
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
a887e1c295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/webui/www/private/index.html
  2. 10
      src/webui/www/private/scripts/client.js

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

@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
<li class="divider"><a id="deleteLink"><img class="MyMenuIcon" src="images/qbt-theme/list-remove.svg" alt="QBT_TR(Delete)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Delete)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="topQueuePosItem" class="divider"><a id="topPrioLink"><img class="MyMenuIcon" src="images/qbt-theme/go-top.svg" alt="QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="increaseQueuePosItem"><a id="increasePrioLink"><img class="MyMenuIcon" src="images/qbt-theme/go-up.svg" alt="QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="decreaseQueuePosItem"><a id="decreasePrioLink"><img class="MyMenuIcon" src="images/qbt-theme/go-down.svg" alt="QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TRMove Down Queue)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="decreaseQueuePosItem"><a id="decreasePrioLink"><img class="MyMenuIcon" src="images/qbt-theme/go-down.svg" alt="QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow]</a></li>
<li id="bottomQueuePosItem"><a id="bottomPrioLink"><img class="MyMenuIcon" src="images/qbt-theme/go-bottom.svg" alt="QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow]" width="16" height="16"/>QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow]</a></li>
<li class="divider"><a id="recheckLink"><img class="MyMenuIcon" src="images/qbt-theme/document-edit-verify.svg" alt="QBT_TR(Force Recheck)QBT_TR[CONTEXT=TransferListWidget]" width="16" height="16"/>QBT_TR(Force recheck)QBT_TR[CONTEXT=TransferListWidget]</a></li>
</ul>
@ -77,6 +77,7 @@ @@ -77,6 +77,7 @@
<a class="returnFalse">QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]</a>
<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="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>
</li>
<li>

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

@ -590,6 +590,10 @@ window.addEvent('load', function() { @@ -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() { @@ -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 = '';

Loading…
Cancel
Save