Created
September 29, 2014 15:26
-
-
Save akx/9499e3017149af7d025e to your computer and use it in GitHub Desktop.
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
[].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