Track detached/attached tabs
This commit is contained in:
parent
c21d4af15a
commit
3ae524c591
|
@ -10,6 +10,9 @@ _tabbro_ = function() {
|
|||
// Tab tree
|
||||
this.tree = null;
|
||||
|
||||
// Detached tabs
|
||||
this.detached_tabs = [];
|
||||
|
||||
// Storage engine
|
||||
this._storage = chrome.storage.local;
|
||||
|
||||
|
@ -371,7 +374,7 @@ _tabbro_ = function() {
|
|||
// Add window listeners
|
||||
chrome.windows.onCreated.addListener(function(e) {
|
||||
if(e.type!="normal") return
|
||||
//console.log("windows.onCreated")
|
||||
console.log("windows.onCreated: "+e.id)
|
||||
//console.log(e)
|
||||
|
||||
if(bro.nextCreatedWindowIndex==null) {
|
||||
|
@ -393,7 +396,7 @@ _tabbro_ = function() {
|
|||
|
||||
|
||||
chrome.windows.onRemoved.addListener(function(windowid) {
|
||||
//console.log("windows.onRemoved")
|
||||
console.log("windows.onRemoved")
|
||||
//console.log(windowid)
|
||||
var thewindow = bro.t_getWindow(windowid)
|
||||
if(thewindow.sticky) {
|
||||
|
@ -418,7 +421,7 @@ _tabbro_ = function() {
|
|||
|
||||
// Add tab listeners
|
||||
chrome.tabs.onCreated.addListener(function(e) {
|
||||
//console.log("tabs.onCreated")
|
||||
console.log("tabs.onCreated")
|
||||
//console.log(e)
|
||||
|
||||
bro.t_addTabtoWindow(e.windowId, {
|
||||
|
@ -451,8 +454,8 @@ _tabbro_ = function() {
|
|||
|
||||
|
||||
chrome.tabs.onMoved.addListener(function(x) {
|
||||
//console.log("tabs.onMoved")
|
||||
//console.log(x)
|
||||
console.log("tabs.onMoved "+x)
|
||||
console.log(x)
|
||||
// TODO re-order data model when tabs are re-ordered
|
||||
})
|
||||
|
||||
|
@ -471,22 +474,30 @@ _tabbro_ = function() {
|
|||
})
|
||||
|
||||
|
||||
chrome.tabs.onDetached.addListener(function(x) {
|
||||
//console.log("tabs.onDetached")
|
||||
//console.log(x)
|
||||
// TODO this is when the user pulls a tab off the window
|
||||
chrome.tabs.onDetached.addListener(function(tabid) {
|
||||
// Remove tab from it's window
|
||||
var tab = bro.t_getTab(tabid)
|
||||
bro.t_removeTab(tabid)
|
||||
|
||||
// Add tab to bro.detached_tabs
|
||||
bro.detached_tabs[tabid] = tab
|
||||
})
|
||||
|
||||
|
||||
chrome.tabs.onAttached.addListener(function(x) {
|
||||
//console.log("tabs.onAttached")
|
||||
//console.log(x)
|
||||
// TODO this is when a the user drops a tab onto another window
|
||||
chrome.tabs.onAttached.addListener(function(tabid) {
|
||||
// Remove from bro.detached_tabs
|
||||
var tab = bro.detached_tabs.splice(tabid, 1)[0]
|
||||
|
||||
// Add tab to window
|
||||
chrome.tabs.get(tabid, function(_tab) {
|
||||
var thewindow = bro.t_getWindow(_tab.windowId)
|
||||
thewindow.tabs.splice(_tab.index, 0, tab)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
chrome.tabs.onRemoved.addListener(function(tabid) {
|
||||
//console.log("tabs.onRemoved")
|
||||
console.log("tabs.onRemoved "+tabid)
|
||||
//console.log(tabid)
|
||||
|
||||
|
||||
|
|
2
popup.js
2
popup.js
|
@ -71,7 +71,7 @@ function renderWindow(windowdata, winnum) {
|
|||
var win = element('li', {class:(windowdata.sticky?"sticky":"")});
|
||||
|
||||
var label = element('span', {class:"name-line", _parent:win})
|
||||
var label_icon = element('span', {class:"name-icon", _parent:label, _html:(windowdata.sticky?'<i class="fa fa-thumb-tack"></i> ':'<i class="fa fa-square-o"></i> ')})
|
||||
var label_icon = element('span', {class:"name-icon", _parent:label, _html:(windowdata.sticky?'<i class="fa fa-thumb-tack"></i> ':'')})
|
||||
var label_name = element('span', {class:"name-string", _parent:label, _html:windowdata.name, _ondblclick:function(){
|
||||
var namestringspan = this
|
||||
var name = namestringspan.innerHTML
|
||||
|
|
|
@ -57,8 +57,6 @@ table {
|
|||
@import url(http://fonts.googleapis.com/css?family=Open+Sans:700,400);
|
||||
|
||||
|
||||
|
||||
|
||||
/* STYLES */
|
||||
|
||||
/* GLOBAL */
|
||||
|
@ -122,6 +120,7 @@ ul#root > li:nth-child(2n) {
|
|||
ul#root > li > span {
|
||||
display: block;
|
||||
padding: 0px 10px 5px 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
ul#root li {
|
||||
position: relative;
|
||||
|
@ -131,10 +130,10 @@ ul#root > li {
|
|||
padding-bottom: 0px
|
||||
}
|
||||
ul#root > li > ul > li {
|
||||
padding-left: 50px;
|
||||
padding-left: 40px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px 16px;
|
||||
background-position: 30px center;
|
||||
background-position: 20px center;
|
||||
}
|
||||
ul#root > li > ul > li > span {
|
||||
overflow-x: hidden;
|
||||
|
|
Loading…
Reference in New Issue