open usercss installer tab next to the source tab
This commit is contained in:
parent
95be66cb61
commit
3c08342e98
|
@ -324,7 +324,7 @@ function onRuntimeMessage(request, sender, sendResponse) {
|
|||
return KEEP_CHANNEL_OPEN;
|
||||
|
||||
case 'openUsercssInstallPage':
|
||||
usercssHelper.openInstallPage(sender.tab.id, request).then(sendResponse);
|
||||
usercssHelper.openInstallPage(sender.tab, request).then(sendResponse);
|
||||
return KEEP_CHANNEL_OPEN;
|
||||
|
||||
case 'closeTab':
|
||||
|
|
|
@ -78,11 +78,15 @@ var usercssHelper = (() => {
|
|||
);
|
||||
}
|
||||
|
||||
function openInstallPage(tabId, request) {
|
||||
function openInstallPage(tab, request) {
|
||||
const url = '/install-usercss.html' +
|
||||
'?updateUrl=' + encodeURIComponent(request.updateUrl) +
|
||||
'&tabId=' + tabId;
|
||||
return wrapReject(openURL({url}));
|
||||
'&tabId=' + tab.id;
|
||||
return wrapReject(openURL({
|
||||
url,
|
||||
index: tab.index + 1,
|
||||
openerTabId: tab.id,
|
||||
}));
|
||||
}
|
||||
|
||||
return {build, save, findDup, openInstallPage};
|
||||
|
|
|
@ -180,7 +180,7 @@ function getTabRealURL(tab) {
|
|||
|
||||
// opens a tab or activates the already opened one,
|
||||
// reuses the New Tab page if it's focused now
|
||||
function openURL({url, currentWindow = true}) {
|
||||
function openURL({url, index, openerTabId, currentWindow = true}) {
|
||||
if (!url.includes('://')) {
|
||||
url = chrome.runtime.getURL(url);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ function openURL({url, currentWindow = true}) {
|
|||
chrome.tabs.update({url}, resolve);
|
||||
} else {
|
||||
// create a new tab
|
||||
const options = {url};
|
||||
const options = {url, index};
|
||||
if (tab && (!FIREFOX || FIREFOX >= 57) && !chromeInIncognito) {
|
||||
options.openerTabId = tab.id;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user