Created
March 31, 2011 05:40
-
-
Save cou929/895872 to your computer and use it in GitHub Desktop.
Extract list of community member data from "http://nodeguide.com/community.html" and make hatena notation.
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
var ul = document.querySelectorAll("ul"); | |
var i; | |
var out = ""; | |
for (i=2; i<ul.length; i++) { | |
var li = Array.slice.call(ul[i].querySelectorAll("li")); | |
li.map(function(x) { | |
var c = x.childNodes; | |
if (c.length === 1) { | |
var del = c[0].nodeValue.indexOf(":"); | |
var head = c[0].nodeValue.substr(0, del-1); | |
var con = c[0].nodeValue.substr(del+1); | |
out += "|*" + head + " | " + con + " | <br />"; | |
} else { | |
var head = c[0].nodeValue.substr(0, c[0].nodeValue.length - 2); | |
var url = c[1].getAttribute('href'); | |
var con = c[1].childNodes[0].nodeValue; | |
out += "|*" + head + " | [" + url + ":title=" + con + "] | <br />"; | |
} | |
}); | |
out += "<br />" | |
} | |
var div = document.createElement("div"); | |
div.innerHTML = out; | |
document.body.appendChild(div); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment