Open devynspencer opened 2 months ago
Might have an example here, but if so, the API for splitting a tab is not intuitive at all.
function splitSelected(parent, id) {
var obj = selected;
var tab_ids = obj.list;
if (id) {
id = parseInt(id, 10);
}
if (tab_ids.length > 0 && obj.type === 'Tab') {
if (!parent) {
for (var j = 0; j < tab_ids.length; j++) {
var t_id = tab_ids[j];
chrome.tabs.get(t_id, function (tab) {
chrome.windows.get(tab.windowId, function (win) {
chrome.windows.create({
url: tab.url,
incognito: win.incognito
}, function () {
chrome.tabs.remove(id);
});
});
});
}
} else {
var old_win_id, temp = [],
tab;
chrome.windows.get(id, function (new_win) {
for (var i = tab_ids.length - 1; i >= 0; i--) {
old_win_id = parseInt($('#' + tab_ids[i]).parent().parent().parent().attr('id').split('_')[0], 10);
temp.push(tab_ids[i]);
chrome.windows.get(old_win_id, function (old_win) {
tab = temp.pop();
if (new_win.incognito || old_win.incognito) {
chrome.tabs.get(tab, function (old_tab) {
chrome.tabs.create({
windowId: new_win.id,
url: old_tab.url
});
chrome.tabs.remove(tab);
});
} else {
chrome.tabs.move(tab, {
windowId: id,
index: -1
}, function () {
loadData();
});
}
});
}
});
}
}
}
Looks like the API straight-up doesn't support/expose this functionality yet. zzzz