Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A simple Mootools extension of Request.JSONP to pull Github repo data.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 source
Octocat-spinner-32 README.md
Octocat-spinner-32 package.yml
README.md

Request-Github

A simple extension of Request.JSONP to pull Github repo data.

How to use

window.addEvents({

    domready: function() {

        //Change to use your Github username
        new Request.Github('svizion', {
            show_forks: false,
            count     : 10,
            data: {
                type: "public",
                sort: "updated"
            },
            onFailure: function(err) {
                $$('#gh_repos li.loading').addClass('error').set("html", "Github is busted! or maybe my scripting skillz need work...");
            },

            onSuccess: function(repos) {

                if (repos.data) repos = repos.data;

                var i = 0,
                    fragment = '',
                    // Change the id to your element.
                    t = document.id('gh_repos');

                // Count the repos and slice the array/object
                if (this.options.count){
                    repos.splice(this.options.count);
                }
                for (i = 0; i < repos.length; i++) {
                    // Weed out the forks.
                    if ( ! this.options.show_forks && repos[i].fork) {
                        continue;
                    }

                    // Build up the html
                    fragment += '<li><a href="' + repos[i].html_url + '">' + repos[i].name + '</a><p>' + repos[i].description + '</p></li>';
                }
                // Drop it in the DOM
                t.set('html', fragment);

            }
        }).send();
    }


});

Please see Github's API Docs for other options.

Something went wrong with that request. Please try again.