htdocs/site/js/github.js: switch to double quotes like the rest of the files.

This commit is contained in:
XhmikosR 2013-11-23 10:03:46 +02:00
parent 872b6e8fcc
commit ad2babcad0
2 changed files with 11 additions and 11 deletions

View File

@ -1,32 +1,32 @@
/*! Inspired by: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html */
/* jshint quotmark:true, jquery:true */
/* jshint jquery:true */
'use strict';
"use strict";
// htmlEntities taken from http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
}
jQuery.fn.listCommits = function(username, repository, branch) {
this.html('<span>Querying GitHub for recent commits&hellip;</span>');
this.html("<span>Querying GitHub for recent commits&hellip;</span>");
var target = this;
$.getJSON('https://api.github.com/repos/' + username + '/' + repository + '/commits?sha=' + branch + '&callback=?', function(response) {
$.getJSON("https://api.github.com/repos/" + username + "/" + repository + "/commits?sha=" + branch + "&callback=?", function(response) {
var commits = response.data;
var list = $('<ul class="rssfeeditems"/>');
var list = $("<ul class='rssfeeditems'/>");
target.empty().append(list);
$(commits).each(function(i) {
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha;
var githubUrl = "https://github.com/" + username + "/" + repository + "/commit/" + this.sha;
var shortMessage = htmlEntities(cutLines(this.commit.message));
if (this.author !== null) {
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>');
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>");
} else {
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a> <em>by <strong>' + this.commit.author.name + '</strong></em></li>');
list.append("<li><a href='" + githubUrl + "'>" + shortMessage + "</a> <em>by <strong>" + this.commit.author.name + "</strong></em></li>");
}
if (i === 9) {
@ -36,7 +36,7 @@ jQuery.fn.listCommits = function(username, repository, branch) {
});
function cutLines(message) {
var lineFeed = message.indexOf('\n');
var lineFeed = message.indexOf("\n");
if (lineFeed > -1) {
return message.slice(0, lineFeed);

File diff suppressed because one or more lines are too long