(function ($) { function widget(element, options, callback) { this.element = element; this.options = options; this.callback = $.isFunction(callback) ? callback : $.noop; } function getCommits(user, repo, branch, callback) { $.ajax({ url: "https://api.github.com/repos/" + user + "/" + repo + "/commits?sha=" + branch, dataType: 'jsonp', success: callback }); } widget.prototype = (function() { function _widgetRun(widget) { if (!widget.options) { widget.element.append('Options for widget are not set.'); return; } var callback = widget.callback; var element = widget.element; var user = widget.options.user; var repo = widget.options.repo; var branch = widget.options.branch; var avatarSize = widget.options.avatarSize || 20; var last = widget.options.last == undefined ? 0 : widget.options.last; var limitMessage = widget.options.limitMessageTo == undefined ? 0 : widget.options.limitMessageTo; element.append('

Widget intitalization, please wait...

'); getCommits(user, repo, branch, function (data) { var commits = data.data; var totalCommits = (last < commits.length ? last : commits.length); element.empty(); var list = $('