Skip to content

Instantly share code, notes, and snippets.

@akx
Created September 29, 2014 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akx/9499e3017149af7d025e to your computer and use it in GitHub Desktop.
Save akx/9499e3017149af7d025e to your computer and use it in GitHub Desktop.
[].slice.call(document.querySelectorAll("div.post")).map(function(post){
var classList = [].slice.call(post.classList);
var categories = classList
.filter(function(c){return !c.indexOf("category-");})
.map(function(c){return c.replace("category-","");});
var postId = classList.filter(function(c){return !c.indexOf("post-");})[0];
postId = (postId ? 0 | postId.split("-",2)[1] : null);
var title = post.querySelector("a[rel=bookmark]").innerText;
var html = post.querySelector(".expand code").innerText;
return {title: title, categories: categories, html: html, id: postId};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment