GitHub “Star”-gazer Buttons with MooTools/jQuery/PHP

No iFrames required – just pure javascript/php

Show your Love to GitHub#

GitHubButtons is a fork of the famous github-buttons from @mdo using the original styles with a complete new javascript part based on MooTools/jQuery without the need of iframes. It’s targeted on MooTools/jQuery/PHP-Users which are already using various stuff on their pages – all other users should use the original iframe version to save bandwidth! Demo Page

screenshot

Screenshot – GitHub-Buttons for MooTools & jQuery

Features#

  • Stargazer Button
  • Follower Button
  • Watcher/Subscriber Button
  • Fork Button
  • Up-to-date counts using the GitHub v3 API via JSONP
  • Two sizes available
  • Use it directly on your page without the security risk of iframes!
  • Ultra lightweight (2kB JS + 6kB CSS)
  • Custom button text supported
  • You can set the “count” manually – e.g. using server-side-caching to avoid the GitHub API rate limitation
  • jQuery as well as MooTools and PHP are supported by native code – use the framework/library of your choice

Demo#

A Demo, including multi-language-example is available here.

Easy at it is – jQuery Example#

1. Create a button-container on your page#

<body>
....
<div id="container1"></div>

2. Include the Script+Styles#

....
<!-- Include GitHub-Buttons Styles -->
<link rel="stylesheet" type="text/css" href="Build/GitHubButtons.yui.css" />

<!-- Include jQuery Library Framework -->
<script type="text/javascript" src="Resources/jquery-2.1.1.min.js"></script>

<!-- Include GitHub-Buttons -->
<script type="text/javascript" src="Source/GitHubButtons.jQuery.js"></script>
...

3. Initialize the Button#

jQuery(function(jq){
    // create first button into "container1"
    jq('#container1').GitHubButton({
        owner : 'AndiDittrich',
        repo : 'EnlighterJS',
        large : true,
        type : 'star',
        text : 'Starring:'
    });
));

API Rate Limiting#

The public/unauthenticated GitHub API is rate-limited by 60 requests/hour and ip-address. This can cause some trouble on your site, because the JSONP requests of the MooTools/jQuery versions will return an invalid result. To fix this issue, since v2.3, a PHP based plugin is available including server-side-caching.

Download#

Like it ? You can download the full package on GitHub it is released under the Apache 2.0 License.

Resources#