1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

have the logger open in a separate window

This commit is contained in:
gorhill 2015-07-01 12:18:03 -04:00
parent a0607702b1
commit ad827576ce
4 changed files with 37 additions and 5 deletions

View File

@ -286,7 +286,8 @@ vAPI.tabs.get = function(tabId, callback) {
// tabId: 1, // the tab is used if set, instead of creating a new one
// index: -1, // undefined: end of the list, -1: following tab, or after index
// active: false, // opens the tab in background - true and undefined: foreground
// select: true // if a tab is already opened with that url, then select it instead of opening a new one
// select: true, // if a tab is already opened with that url, then select it instead of opening a new one
// popup: true // open in a new window
vAPI.tabs.open = function(details) {
var targetURL = details.url;
@ -338,6 +339,16 @@ vAPI.tabs.open = function(details) {
});
};
// Open in a standalone window
if ( details.popup === true ) {
chrome.windows.create({
url: details.url,
focused: details.active,
type: 'popup'
});
return;
}
if ( details.index !== -1 ) {
subWrapper();
return;

View File

@ -699,7 +699,19 @@ vAPI.tabs.open = function(details) {
details.index = tabBrowser.browsers.indexOf(tabBrowser.selectedBrowser) + 1;
}
tab = tabBrowser.loadOneTab(details.url, {inBackground: !details.active});
// Open in a standalone window
if ( details.popup === true ) {
win = Services.ww.openWindow(
win,
details.url,
null,
'menubar=no,toolbar=no,location=no',
null
);
return;
}
tab = tabBrowser.loadOneTab(details.url, { inBackground: !details.active });
if ( details.index !== undefined ) {
tabBrowser.moveTabTo(tab, details.index);
@ -2683,6 +2695,12 @@ vAPI.contextMenu.unregister = function(doc) {
}
var menuitem = doc.getElementById(this.menuItemId);
// Not guarantee the menu item was actually registered.
if ( menuitem === null ) {
return;
}
var contextMenu = menuitem.parentNode;
menuitem.removeEventListener('command', this.onCommand);
contextMenu.removeEventListener('popupshowing', this.displayMenuItem);

View File

@ -526,12 +526,15 @@ var gotoURL = function(ev) {
ev.preventDefault();
var rel = this.getAttribute('rel') || '';
messager.send({
what: 'gotoURL',
details: {
url: this.getAttribute('href'),
select: true,
index: -1
index: -1,
popup: rel === 'popup'
}
});

View File

@ -18,8 +18,8 @@
<p class="statName">
<span data-i18n="popupBlockedOnThisPagePrompt">&nbsp;</span>&ensp;
<span id="gotoPick" class="fa tool" data-i18n-tip="popupTipPicker">&#xf1fb;</span>&ensp;
<a href="logger-ui.html" target="_blank" id="gotoLog" class="fa tool enabled" data-i18n-tip="popupTipLog">&#xf022;</a>
</p>
<a href="logger-ui.html" rel="popup" class="fa tool enabled" data-i18n-tip="popupTipLog">&#xf022;</a>
</p>
<p class="statValue" id="page-blocked">?</p>
<p class="statName" data-i18n="popupBlockedSinceInstallPrompt">&nbsp;</p>
<p class="statValue" id="total-blocked">?</p>