diff --git a/background.js b/background.js index af32df5..f66404a 100644 --- a/background.js +++ b/background.js @@ -300,13 +300,18 @@ _tabbro_ = function() { // Set the notification color chrome.browserAction.setBadgeBackgroundColor({"color":"#990000"}) + // Set up the data tree + this.initializeTree() + // Add evnt listeners + this.addListeners() + //console.log("Tabbro v" + this.__VERSION + " ready!") + } + + this.initializeTree = function() { // If any non-sticky windows are in our data from a previous session, remove them this.pruneData(); // Add all open windows/tabs to the database tree this.loadInitialTree() - // Add evnt listeners - this.addListeners() - //console.log("Tabbro v" + this.__VERSION + " ready!") } this.loadInitialTree = function() { diff --git a/options.html b/options.html index b985bab..917a7ce 100644 --- a/options.html +++ b/options.html @@ -30,7 +30,7 @@

Load Data

- + \ No newline at end of file diff --git a/options.js b/options.js index c0febf0..93ac97b 100644 --- a/options.js +++ b/options.js @@ -45,6 +45,31 @@ function setup() { this.value = JSON.stringify(tabbro.tree) } - + var dumpin = document.getElementById("dumpin") + dumpin.onchange=function() { + var data = JSON.parse(this.value) + var windows = 0; + var tabs = 0; + for(var w in data) { + data[w].sticky = true + data[w].id = null + windows++ + for(var t in data[w].tabs) { + data[w].tabs[t].sticky = true + data[w].tabs[t].id = null + tabs++ + } + } + if(confirm("Replace all tabbro data?\n\nWindows: "+windows+"\nTabs: "+tabs)) { + tabbro.data.tree.splice(0, tabbro.data.tree.length) + for(var w in data) { + tabbro.data.tree.push(data[w]) + } + tabbro.save() + tabbro.loadInitialTree() + alert("Done!") + this.value="Paste JSON here" + } + } }