Fix undefined displaying in case of year not defined in fonts.json

This commit is contained in:
Carey Li 2016-07-14 01:27:08 +10:00
parent f78ad43c04
commit 1b7b984556
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>"
);
});