HN Comments
A jQuery plugin that embeds a hacker news thread relating to a particular url into your page.
It uses the highly controversial third-party API from ihackernews.
It also uses like a million lines of html strings, it makes me want to vomit a little bit.
It's tested against (and requires) jQuery 1.4.4.
-
Add it to your blogosites html (after jQuery)
-
Call
loadHNCommentsfrom the element you want the comments to appear in.$("#Comments").loadHNComments(url);If you don't call it with a url, it will use the current page's
window.location.href.
If you have node + npm installed you probably can (and want to) build it from source.
A minimal build requires coffeescript.
$ npm install coffeescript
$ cake compile:coffee
You should find hn.js in the build folder.
If you have less you can also build the default styles... (but really they're nothing special)
$ npm install less
$ cake compile:styles
A more complete build will compile the scripts and styles and minify the javascript output.
$ npm install coffee-script less uglify
$ cake compile
$ cake compress
You should find hn.js, hn.min.js and hn.css.
Include hn.min.js and hn.css in your page.
Licensing
Everything in this repo is copyright (c) 2010, Gerard Paapu and available under the MIT License.