Re-use an active new tab page for manager/editor

This commit is contained in:
9adefaf01e5bf6426d838cd20eae582d2b6ba647 2015-03-04 05:06:43 +03:00
parent 110c31d495
commit 98a71d2812

View File

@ -125,13 +125,20 @@ function openLinkInTabOrWindow(event) {
if (localStorage['openEditInWindow'] == 'true') {
chrome.windows.create({url: event.target.href});
} else {
chrome.tabs.create({url: event.target.href});
openLink(event);
}
}
function openLink(event) {
event.preventDefault();
chrome.tabs.query({currentWindow: true, active: true}, function (tabs) {
if (tabs && tabs.length && tabs[0].url.match(/^chrome:\/\/newtab\/?$/)) {
chrome.tabs.update({url: event.target.href});
close(); // close the popup
} else {
chrome.tabs.create({url: event.target.href});
}
});
}
function handleUpdate(style) {