Skip to content

Instantly share code, notes, and snippets.

@AaronJackson
Created July 10, 2013 13:05
Show Gist options
  • Save AaronJackson/5966122 to your computer and use it in GitHub Desktop.
Save AaronJackson/5966122 to your computer and use it in GitHub Desktop.
var Bookmark = function (url, name, tag) {
this.url = url;
this.name = name;
if (tag) this.tags = [tag];
else this.tags = [];
};
Bookmark.list = [];
Bookmark.push = function (p) { Bookmark.list.push(p) };
chrome.bookmarks.getTree(function (tree) {
var stack = [tree[0]];
do {
var o = stack.pop();
if (o.children)
for (var i in o.children) {
o.children[i].pTitle = o.title;
stack.push(o.children[i]);
}
else Bookmark.push(new Bookmark(o.url, o.title, o.pTitle));
} while (stack.length)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment