## Github Events Widget

Refresh Repaint

#### General options and initialisation

    $('#selector').githubEvents({
        username: 'RobinRadic',
        height: 300,
        template: 'github.events',
        className: 'gh-events-widget',
        max: 60,
        output: {
            events: {
                default: { // All output events have these default base values
                    icon: 'fa fa-info',
                    text: 'A github event has been triggered',
                    iconColor: 'default',
                    link: false
                },
                CommitCommentEvent: {
                    icon: 'fa fa-edit',
                    text: 'New comment on a commit' // Static text
                },
                CreateEvent: {
                    // Function as text value is also allowed. Has 'event' as parameter with event details.
                    text: function(event){
                        console.log('createEvent', event);
                        // event.actor, event.repo, etc... Each event has different properties

                        // You can use 'this' to change the output properties
                        this.icon = 'fa fa-plus';

                        // Return the text you want to show
                        return '<span>' + event.repo.name + '</span>';
                    }
                },
                PushEvent: {
                    text: function(event){
                        // You can use templates too
                        var tpl = R.templates.get('github.events.user');
                        return 'User: ' + $(tpl(event.actor)).html() + ' pushed to ' + event.repo.name;
                    }
                }
                // Check the source file in dist/github-events.js for more examples and all event names...
            }
        }
    });

#### Adding in slimScroll, popover and other stuff

    $('#selector').githubEvents({
    // Use the event 'repainted' to add extra stuff
    repainted: function (e, options) {
        var self = this;

        // Add slimScroll
        var $wrapper = $(document.createElement('div'));
        var $container = $(e.target.firstElementChild).wrapInner($wrapper);
        $($container[0].firstElementChild).slimScroll({
            height: options.height - (parseInt($container.css('padding').replace('px')) * 2),
            alwaysVisible: true
        });

        // Add popover
        $(e.target).find('.commits').popover({
            html: true,
            trigger: 'manual',
            container: 'body',
            placement: 'right',
            content: function () {
                return 'popovercontent'
            }
        }).hover(function (e) {
            e.preventDefault();
            $(this).popover('toggle');
        });
    }