Specify openerTabId for opened tabs

See https://github.com/arantius/resurrect-pages/pull/44
This commit is contained in:
Albirew 2019-12-12 22:05:41 +01:00
parent 16d1af6868
commit ca7773baf7
4 changed files with 14 additions and 14 deletions

View file

@ -63,21 +63,21 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) {
url = info.linkUrl;
}
if (id.startsWith('resurrect-google-')) {
goToUrl(genGoogleUrl(url), openIn);
goToUrl(genGoogleUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-googletext-')) {
goToUrl(genGoogleTextUrl(url), openIn);
goToUrl(genGoogleTextUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-archive-')) {
goToUrl(genIaUrl(url), openIn);
goToUrl(genIaUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-archivelist-')) {
goToUrl(genIaListUrl(url), openIn);
goToUrl(genIaListUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-archiveis-')) {
goToUrl(genArchiveIsUrl(url), openIn);
goToUrl(genArchiveIsUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-isup-')) {
goToUrl(genIsUpUrl(url), openIn);
goToUrl(genIsUpUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-webcitation-')) {
goToUrl(genWebCiteUrl(url), openIn);
goToUrl(genWebCiteUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-mementoweb-')) {
goToUrl(genMementoUrl(url), openIn);
goToUrl(genMementoUrl(url), openIn, tab.id);
} else if (id.startsWith('resurrect-current-tab-')) {
setOpenIn(openInEnum.CURRENT_TAB);
} else if (id.startsWith('resurrect-new-tab-')) {

View file

@ -37,7 +37,7 @@ function genIaListUrl(url) {
}
function genArchiveIsUrl(url) {
return 'https://archive.md/'+url;
return 'https://archive.ph/'+url;
}
function genWebCiteUrl(url) {
@ -77,16 +77,16 @@ function updateContextRadios() {
});
}
function goToUrl(url, where) {
function goToUrl(url, where, openerTabId) {
switch(Number(where)) {
case openInEnum.CURRENT_TAB:
chrome.tabs.update({'url': url});
break;
case openInEnum.NEW_TAB:
chrome.tabs.create({'url': url});
chrome.tabs.create({'url': url, openerTabId});
break;
case openInEnum.NEW_BGTAB:
chrome.tabs.create({'url': url, 'active': false});
chrome.tabs.create({'url': url, 'active': false, openerTabId});
break;
case openInEnum.NEW_WINDOW:
chrome.windows.create({'url': url});

View file

@ -3,7 +3,7 @@
"name": "__MSG_extensionName__",
"short_name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "6.2",
"version": "6.2.1",
"default_locale": "en",
"homepage_url": "https://github.com/Albirew/resurrect-pages",

View file

@ -23,7 +23,7 @@ function resurrect(gen) {
logLastError();
let url = gen(tabObj[0].url);
console.info('Resurrecting via URL', url);
goToUrl(url, openIn);
goToUrl(url, openIn, tabObj[0].id);
window.close();
});
}