HN Submit button 12 Jul, 2009 HN Submit button

I have been attempting to add “share” functionality to my website. Initially, I used the Digg button (http://digg.com/tools/integrate) and Reddit button (http://www.reddit.com/button).

Next I wanted to add Hacker News button. But there was none. But then again, there was this bookmarklet (http://ycombinator.com/bookmarklet.html). So I created the required HTML to get the required functionality, just using the bookmarklet:

<a href="javascript:window.location=%22http://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)"> Submit </a>

Then I thought of making a Hacker News submit button, just like Reddit and Digg. So I decided to read the sources and build the HN button based on that.  Man, Digg’s JS was such mess (yes, it was the minified version, but still, far too many lines of code). Reddit’s was a great deal simpler, easy-to-read and intuitive. Check them out: http://digg.com/tools/diggthis.js and http://www.reddit.com/button.js.

So I modelled the HN button based on Reddits’ Javascript. Here it is: http://saicharan.in/work/hn.js OR https://github.com/scharan/Goodies/blob/master/hn.js

To use it, simply include the following line:

<script type="text/javascript" src="http://saicharan.in/work/hn.js"></script>

Here is the code:

Update: This article briefly made it to the front page of HN! I saw it at #19!. Here are the comments from HN: http://news.ycombinator.com/item?id=700053



Tags  ·   button  ·   hacker news  ·   HN  ·   submit button  ·   Show Comments ▾


     
Original design for Tumblr crafted by Prashanth Kamalakanthan.
Adapted for Tumblr & Jekyll by Sai Charan. Customized theme available on Github.

Sai Charan's blog by Sai Charan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License