Merge pull request #10 from carey-li/patch-dateChecking

Fix undefined displaying in case of year not defined in fonts.json
This commit is contained in:
Koen Lageveen 2016-07-14 20:53:30 +02:00 committed by GitHub
commit 72859c722f
1 changed files with 8 additions and 2 deletions

View File

@ -342,10 +342,16 @@ function updateGutters(cm) {
$.each(data, function(k,v) {
font_aliases.push(v.alias);
$("#select-font").append("<option value=\"" + v.alias + "\">" + v.name + "</option>");
if (typeof v.year === "undefined") {
yearString = "";
} else {
yearString = " (" + v.year + ")";
}
$("#font-info").append(
"<p class=\"" + v.alias + "\"> " + v.name +
" - " + "<a href=\""+ v.website + "\" rel=\"external\">" + v.author + "</a>" +
" (" + v.year + ")" +
" - " + "<a href=\""+ v.website + "\" rel=\"external\">" + v.author + "</a>" + yearString +
"</p>"
);
});