Coder Social home page Coder Social logo

hackernews-button's Introduction

Embeddable Hacker News vote / counter button

HN Button

Async, embeddable submit + vote counter button for Hacker News.

  • If the story has not been posted to HN, "Submit" button is shown, otherwise latest point count is displayed.
  • Auto-detects Google Analytics and registers clicks events (see reports under Traffic Sources > Social > Social Plugins).

Embedding the button

Step 1, place the HN link where you want the button appear on the page:

<!-- Auto-detect URL of current page and title if necessary -->
<a href="http://news.ycombinator.com/submit" class="hn-share-button">Vote on HN</a>

<!-- Override the URL and Title for the button -->
<a href="http://news.ycombinator.com/submit" class="hn-share-button" data-title="Some Title" data-url="http://www.igvita.com/">Vote on HN</a>

Step 2, include the (async) javascript file:

<script src="//hnbutton.appspot.com/static/hn.min.js" async defer></script>

Note: you can safely embed multiple buttons on the same page.

Misc

  • Kudos to @sbashyal and @stbullard for the button styling (hnlike.com)
  • Kudos to Algolia for an awesome HN API
  • (MIT License) - Copyright (c) 2012 Ilya Grigorik

hackernews-button's People

Contributors

gjtorikian avatar igrigorik avatar joshblum avatar mathiasbynens avatar patrickkettner avatar stereobooster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hackernews-button's Issues

Make the button "standard" height to match Twitter and G+ buttons

I've currently got a Twitter button and a Google Plus button and decided to add the HN button as well. However, the HN button doesn't line up vertically with the other buttons. I've attributed this to the HN icon only being 19px high, while the others are 20px.

This really is just a cosmetic issue and isn't critical, but I would prefer have a homogeneous sharing zone on my website. Having the HN button just 1 pixel off is noticeable.

Here's a screenshot from my site:

preview

class on iframe

The resulting iframe doesn't have a class to target it through css.

The hnsearch api appears to be down

  wget http://api.thriftdb.com/api.hnsearch.com/items/_search?
  --2014-08-26 23:13:51--  http://api.thriftdb.com/api.hnsearch.com/items/_search?
  Resolving api.thriftdb.com... 54.236.170.141, 107.23.43.191
  Connecting to api.thriftdb.com|54.236.170.141|:80... connected.
  HTTP request sent, awaiting response... No data received.
  Retrying.

Encode the URL sent to HNSearch

Howdy—

I just noticed this one.

I submitted an article to HN, that stayed buried: http://news.ycombinator.com/item?id=4882860

Then, another user posted an article, and that gained Front Page Fame: http://news.ycombinator.com/item?id=4886560

The difference? His/Her URL added a "#" to the end of the link, making it appear "new" to HN. Which is fine. The problem is, though, the button on my site looks like it only has a "1" point, while the article should actually have a higher number.

It'd be nice to add data-hn-id or something to the original link to remedy situations like this. I took a look at it myself and it seems a bulk of the work occurs in the Go code, which I'm not too familiar with.

Thanks for listening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.