-
-
Save elimisteve/c78c1abf7f170614df45 to your computer and use it in GitHub Desktop.
Chrome extension to export all bookmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//manifest.json | |
{ | |
"name": "bookmark-search-export", | |
"version": "1.0", | |
"manifest_version": 2, | |
"description": "This extention will dump all bookmarks", | |
"browser_action": { | |
"default_icon": "icon.png" | |
}, | |
"background": { | |
"scripts": ["export.js"], | |
"persistent": false | |
}, | |
"permissions": [ | |
"bookmarks" | |
] | |
} | |
//export.js | |
chrome.runtime.onInstalled.addListener(function() { | |
console.log("bookmark search exporter extention Installed."); | |
var bm_urls = new Array(); | |
function fetch_bookmarks(parentNode) { | |
parentNode.forEach(function(bookmark) { | |
if(! (bookmark.url === undefined || bookmark.url === null)) { | |
bm_urls.push(bookmark.url); | |
} | |
if (bookmark.children) { | |
fetch_bookmarks(bookmark.children); | |
} | |
}); | |
} | |
chrome.bookmarks.getTree(function(rootNode) { | |
fetch_bookmarks(rootNode); | |
console.log(JSON.stringify(bm_urls)); | |
}); | |
}); | |
chrome.bookmarks.onCreated.addListener(function(id, bookmark) { | |
console.log("bookmark added .. " + bookmark.url); | |
}); | |
chrome.bookmarks.onRemoved.addListener(function(id, removeInfo) { | |
console.log("bookmark removed .. " + id); | |
}); | |
chrome.bookmarks.onChanged.addListener(function(id, changeInfo){ | |
console.log("bookmark changed .. " + id); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment