11/*! Inspired by: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html */
22
3- /* jshint quotmark:true, jquery:true */
3+ /* jshint jquery:true */
44
5- ' use strict' ;
5+ " use strict" ;
66
77// htmlEntities taken from http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
88function htmlEntities ( str ) {
9- return String ( str ) . replace ( / & / g, ' &' ) . replace ( / < / g, ' <' ) . replace ( / > / g, ' >' ) . replace ( / " / g, ' "' ) ;
9+ return String ( str ) . replace ( / & / g, " &" ) . replace ( / < / g, " <" ) . replace ( / > / g, " >" ) . replace ( / " / g, " "" ) ;
1010}
1111
1212jQuery . fn . listCommits = function ( username , repository , branch ) {
13- this . html ( ' <span>Querying GitHub for recent commits…</span>' ) ;
13+ this . html ( " <span>Querying GitHub for recent commits…</span>" ) ;
1414
1515 var target = this ;
16- $ . getJSON ( ' https://api.github.com/repos/' + username + '/' + repository + ' /commits?sha=' + branch + ' &callback=?' , function ( response ) {
16+ $ . getJSON ( " https://api.github.com/repos/" + username + "/" + repository + " /commits?sha=" + branch + " &callback=?" , function ( response ) {
1717 var commits = response . data ;
18- var list = $ ( ' <ul class=" rssfeeditems"/>' ) ;
18+ var list = $ ( " <ul class=' rssfeeditems'/>" ) ;
1919
2020 target . empty ( ) . append ( list ) ;
2121
2222 $ ( commits ) . each ( function ( i ) {
23- var githubUrl = ' https://github.com/' + username + '/' + repository + ' /commit/' + this . sha ;
23+ var githubUrl = " https://github.com/" + username + "/" + repository + " /commit/" + this . sha ;
2424 var shortMessage = htmlEntities ( cutLines ( this . commit . message ) ) ;
2525
2626 if ( this . author !== null ) {
27- list . append ( ' <li><a href="' + githubUrl + '">' + shortMessage + ' </a> <em>by <strong><a class=" author" href="' + ' https://github.com/' + this . author . login + '">' + this . author . login + ' </a></strong></em></li>' ) ;
27+ list . append ( " <li><a href='" + githubUrl + "'>" + shortMessage + " </a> <em>by <strong><a class=' author' href='" + " https://github.com/" + this . author . login + "'>" + this . author . login + " </a></strong></em></li>" ) ;
2828 } else {
29- list . append ( ' <li><a href="' + githubUrl + '">' + shortMessage + ' </a> <em>by <strong>' + this . commit . author . name + ' </strong></em></li>' ) ;
29+ list . append ( " <li><a href='" + githubUrl + "'>" + shortMessage + " </a> <em>by <strong>" + this . commit . author . name + " </strong></em></li>" ) ;
3030 }
3131
3232 if ( i === 9 ) {
@@ -36,7 +36,7 @@ jQuery.fn.listCommits = function(username, repository, branch) {
3636 } ) ;
3737
3838 function cutLines ( message ) {
39- var lineFeed = message . indexOf ( '\n' ) ;
39+ var lineFeed = message . indexOf ( "\n" ) ;
4040
4141 if ( lineFeed > - 1 ) {
4242 return message . slice ( 0 , lineFeed ) ;
0 commit comments