From 269c35a04a668927d7fe917ba5f175efc92c4db2 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 16 Sep 2016 17:41:17 -0400 Subject: [PATCH] fix #1997 --- src/js/background.js | 1 + src/js/messaging.js | 2 +- src/js/popup.js | 4 +--- src/js/utils.js | 12 ++++++++++++ src/popup.html | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 1a384b588..c63d680b3 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -50,6 +50,7 @@ return { userSettings: { advancedUserEnabled: false, + alwaysDetachLogger: false, autoUpdate: true, cloudStorageEnabled: false, collapseBlocked: true, diff --git a/src/js/messaging.js b/src/js/messaging.js index 5717e4704..4d4487219 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -139,7 +139,7 @@ var onMessage = function(request, sender, callback) { break; case 'gotoURL': - vAPI.tabs.open(request.details); + µb.openNewTab(request.details); break; case 'reloadTab': diff --git a/src/js/popup.js b/src/js/popup.js index c42e9d114..7f16de3d3 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -571,8 +571,6 @@ var gotoURL = function(ev) { ev.preventDefault(); - var rel = this.getAttribute('rel') || ''; - messaging.send( 'popupPanel', { @@ -581,7 +579,7 @@ var gotoURL = function(ev) { url: this.getAttribute('href'), select: true, index: -1, - popup: rel === 'popup' && ev.shiftKey + shiftKey: ev.shiftKey } } ); diff --git a/src/js/utils.js b/src/js/utils.js index 2dde6c95e..44b242e76 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -210,3 +210,15 @@ }; /******************************************************************************/ + +µBlock.openNewTab = function(details) { + if ( details.url.startsWith('logger-ui.html') ) { + if ( details.shiftKey ) { + this.userSettings.alwaysDetachLogger = !this.userSettings.alwaysDetachLogger; + } + details.popup = this.userSettings.alwaysDetachLogger; + } + vAPI.tabs.open(details); +}; + +/******************************************************************************/ diff --git a/src/popup.html b/src/popup.html index 493808009..6da2a6f60 100644 --- a/src/popup.html +++ b/src/popup.html @@ -18,7 +18,7 @@

   - +

?