@@ -2,11 +2,7 @@ | |||||
<html lang="en"> | <html lang="en"> | ||||
<head> | <head> | ||||
<meta charset="utf-8"> | <meta charset="utf-8"> | ||||
{% if page.title == "Home" %} | |||||
<title>Ben Kurtovic</title> | |||||
{% else %} | |||||
<title>{{ page.title }} - Ben Kurtovic</title> | |||||
{% endif %} | |||||
<title>{% if page.title != "Home" %}{{ page.title }} - {% endif %}Ben Kurtovic</title> | |||||
<link rel="icon" type="image/png" href="/static/favicon.png" /> | <link rel="icon" type="image/png" href="/static/favicon.png" /> | ||||
<link rel="stylesheet" href="/static/main.css" /> | <link rel="stylesheet" href="/static/main.css" /> | ||||
<link rel="stylesheet" href="/static/syntax.css" /> <!-- shamelessly stolen from https://github.com/mojombo/tpw/blob/master/css/syntax.css --> | <link rel="stylesheet" href="/static/syntax.css" /> <!-- shamelessly stolen from https://github.com/mojombo/tpw/blob/master/css/syntax.css --> | ||||
@@ -121,12 +121,12 @@ title: Home | |||||
<div> | <div> | ||||
Tags: | Tags: | ||||
{% for tag in site.tags %} | {% for tag in site.tags %} | ||||
{{tag[0]}} | |||||
<span class="tag">{{tag[0]}}</span> | |||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<ul id="post-list"> | <ul id="post-list"> | ||||
{% for post in site.posts %} | {% for post in site.posts %} | ||||
<li>{{ post.date | date: "%b %-d, %Y" }}: <a class="underlined" href="{{ post.url }}">{{ post.title }}</a><br /><span class="subtitle">{{ post.description }}<br />{{ post.tags | join: ", " }} · <a href="{{ post.url }}#disqus_thread" data-disqus-identifier="{{ post.id }}"></a></span></li> | |||||
<li data-tags="{{ post.tags | join: "|" }}">{{ post.date | date: "%b %-d, %Y" }}: <a class="underlined" href="{{ post.url }}">{{ post.title }}</a><br /><span class="subtitle">{{ post.description }}<br />{{ post.tags | join: ", " }} · <a href="{{ post.url }}#disqus_thread" data-disqus-identifier="{{ post.id }}"></a></span></li> | |||||
{% endfor %} | {% endfor %} | ||||
</ul> | </ul> | ||||
</td> | </td> | ||||
@@ -129,6 +129,19 @@ a.underlined:hover, a.underlined:active { text-decoration: none; } | |||||
font-size: 14px; | font-size: 14px; | ||||
} | } | ||||
.tag { | |||||
background-color: #f2f2f2; | |||||
border: 1px solid #e8e8e8; | |||||
color: #888; | |||||
cursor: pointer; | |||||
padding: 0 3px; | |||||
} | |||||
.tag-selected { | |||||
background-color: #ddd; | |||||
color: black; | |||||
} | |||||
#post-info { | #post-info { | ||||
list-style-type: none; | list-style-type: none; | ||||
margin: 0; | margin: 0; | ||||
@@ -153,7 +166,7 @@ pre { | |||||
} | } | ||||
code { | code { | ||||
background: #f2f2f2; | |||||
background-color: #f2f2f2; | |||||
border: 1px solid #e8e8e8; | border: 1px solid #e8e8e8; | ||||
padding: 0 3px; | padding: 0 3px; | ||||
} | } | ||||
@@ -164,7 +177,7 @@ pre code { | |||||
} | } | ||||
.highlight, .highlighttable { | .highlight, .highlighttable { | ||||
background: #f2f2f2; | |||||
background-color: #f2f2f2; | |||||
border: 1px solid #e8e8e8; | border: 1px solid #e8e8e8; | ||||
font-size: 14px; | font-size: 14px; | ||||
line-height: 1.35em; | line-height: 1.35em; | ||||
@@ -1,4 +1,31 @@ | |||||
$(document).ready(function() { | |||||
function load_tag_filters() { | |||||
$(".tag").click(function() { | |||||
$(this).toggleClass("tag-selected"); | |||||
var allowed = []; | |||||
$(".tag-selected").each(function() { | |||||
allowed.push($(this).text()) | |||||
}); | |||||
var num_selected = $(".tag-selected").length; | |||||
if (num_selected == 0 || num_selected == $(".tag").length) | |||||
$("#post-list li").show(); | |||||
else { | |||||
$("#post-list li").hide(); | |||||
$("#post-list li").each(function() { | |||||
var tags = $(this).data("tags").split("|"); | |||||
for (var t in tags) { | |||||
if ($.inArray(tags[t], allowed) != -1) { | |||||
$(this).show(); | |||||
return; | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
function load_paragraph_links() { | |||||
$("#post").find("h1, h2, h3, h4, h5, h6").hover(function() { | $("#post").find("h1, h2, h3, h4, h5, h6").hover(function() { | ||||
$(this).append($("<a>") | $(this).append($("<a>") | ||||
.attr("href", "#" + this.id) | .attr("href", "#" + this.id) | ||||
@@ -7,4 +34,9 @@ $(document).ready(function() { | |||||
}, function() { | }, function() { | ||||
$(this).find(".para-link").remove(); | $(this).find(".para-link").remove(); | ||||
}); | }); | ||||
} | |||||
$(document).ready(function() { | |||||
load_tag_filters(); | |||||
load_paragraph_links(); | |||||
}); | }); |