Fix font onclick. Add pin icon.
This commit is contained in:
parent
c1296a3a6b
commit
5b25fdadae
|
@ -85,7 +85,7 @@ section.select-list {
|
||||||
}
|
}
|
||||||
section.select-list .entry {
|
section.select-list .entry {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: flex;
|
||||||
padding: .5em 1em;
|
padding: .5em 1em;
|
||||||
}
|
}
|
||||||
section.select-list .entry:hover {
|
section.select-list .entry:hover {
|
||||||
|
@ -105,7 +105,10 @@ section.select-list .active .name {
|
||||||
}
|
}
|
||||||
section.select-list a.favoritelink {
|
section.select-list a.favoritelink {
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
color: red;
|
color: #ccc;
|
||||||
|
}
|
||||||
|
section.select-list a.pinned {
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
section.select-list a.website {
|
section.select-list a.website {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
15
index.js
15
index.js
|
@ -80,6 +80,7 @@ function renderSelectList() {
|
||||||
$("#select-font").empty();
|
$("#select-font").empty();
|
||||||
|
|
||||||
var icon = '<svg class="octicon" viewBox="0 0 12 14" version="1.1" width="12" height="14" aria-hidden="true"><path fill-rule="evenodd" d="M11 10h1v3c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h3v1H1v10h10v-3zM6 2l2.25 2.25L5 7.5 6.5 9l3.25-3.25L12 8V2H6z"></path></svg>';
|
var icon = '<svg class="octicon" viewBox="0 0 12 14" version="1.1" width="12" height="14" aria-hidden="true"><path fill-rule="evenodd" d="M11 10h1v3c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h3v1H1v10h10v-3zM6 2l2.25 2.25L5 7.5 6.5 9l3.25-3.25L12 8V2H6z"></path></svg>';
|
||||||
|
var pinIcon = '<svg class="octicon octicon-pin" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 1.2V2l.5 1L6 6H2.2c-.44 0-.67.53-.34.86L5 10l-4 5 5-4 3.14 3.14a.5.5 0 0 0 .86-.34V10l3-4.5 1 .5h.8c.44 0 .67-.53.34-.86L10.86.86a.5.5 0 0 0-.86.34z"></path></svg>';
|
||||||
|
|
||||||
var favoritesMap = {};
|
var favoritesMap = {};
|
||||||
try {
|
try {
|
||||||
|
@ -112,12 +113,13 @@ function renderSelectList() {
|
||||||
}
|
}
|
||||||
$("#select-font").append(
|
$("#select-font").append(
|
||||||
"<div class='entry'>" +
|
"<div class='entry'>" +
|
||||||
"<a href='#" + v.alias + "' data-value=\"" + v.alias + "\">" +
|
"<a class=\"favoritelink" + (favoritesMap[v.alias] ? ' pinned' : '') + "\" onclick=\"toggleFavorite('" + v.alias + "')\">" +
|
||||||
"<a class='favoritelink' onclick=\"toggleFavorite('" + v.alias + "')\"> <span>" +
|
pinIcon +
|
||||||
(favoritesMap[v.alias] ? "♥︎" : "♡") + "</span></a>" +
|
"</a>" +
|
||||||
"<span class='name'>" + v.name + "</span>" +
|
"<a href='#" + v.alias + "' data-value=\"" + v.alias + "\">" +
|
||||||
"<span class='details'>" + v.author + " (" + v.year + ") — " + v.style + render_info + liga_info + "</span>" +
|
"<span class='name'>" + v.name + "</span>" +
|
||||||
"</a>" +
|
"<span class='details'>" + v.author + " (" + v.year + ") — " + v.style + render_info + liga_info + "</span>" +
|
||||||
|
"</a>" +
|
||||||
"<a class='website' href='" + v.website + "' rel=external> <span>Info & Download</span>" + icon + "</a></div>"
|
"<a class='website' href='" + v.website + "' rel=external> <span>Info & Download</span>" + icon + "</a></div>"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -140,6 +142,7 @@ function toggleFavorite(alias) {
|
||||||
console.error('could not save favorite', err);
|
console.error('could not save favorite', err);
|
||||||
}
|
}
|
||||||
renderSelectList();
|
renderSelectList();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Reference in New Issue