-
-
Save usametov/9a20574cd51e33cb902223c4ca4f54d4 to your computer and use it in GitHub Desktop.
Chrome extension to export all bookmarks
This file contains hidden or 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