nim-by-example/layouts/default.html
2014-12-25 17:16:07 -05:00

71 lines
3.1 KiB
HTML

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nim by Example - <%= @item[:title] %></title>
<link rel="stylesheet" type="text/css" href="http://necolas.github.io/normalize.css/3.0.1/normalize.css">
<link rel="stylesheet" href="<%= @items['/stylesheets/main/'].path %>">
<link rel="stylesheet" href="<%= @items['/stylesheets/colorful/'].path %>" title="colorful">
<link rel="stylesheet" href="<%= @items['/stylesheets/fontello/'].path %>">
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['«', '»']]}});
MathJax.Hub.config.tex2jax.skipTags = ["script", "noscript", "style", "textarea", "annotation", "annotation-xml"];
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" async></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-58002512-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
<meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
<meta http-equiv="Default-Style" content="colorful">
</head>
<body>
<div id="sidebar">
<%= @items["/toc/"].compiled_content(:snapshot => :last) %>
</div>
<div id="main">
<h1 id="gh-buttons"><a class="icon-fork" href="https://github.com/flaviut/nim-by-example/"></a> <a class="icon-star" href="https://github.com/flaviut/nim-by-example/stargazers" /><div id="starcount"></div></a></h1>
<script>
function setVisibleTags(){
var tocLinks = document.querySelectorAll("#sidebar a:link, a:visited");
for(var i = 0; i < tocLinks.length; i++){
if(localStorage.getItem(tocLinks[i].getAttribute("href")) != null){
tocLinks[i].classList.add("visited");
}
}
}
var starcount_elem = document.getElementById("starcount");
function updateStarCounter(){
if(localStorage.getItem("_watchers") != null){
starcount_elem.innerHTML = localStorage.getItem("_watchers");
}
var request = new XMLHttpRequest();
// horrible hack... but stargazer output is capped at 30 per request.
request.open("GET", "https://api.github.com/search/repositories?q=nim-by-example", true);
request.onload = function (e) {
var searchResults = JSON.parse(request.responseText);
var starcount = searchResults.items[0].stargazers_count;
starcount_elem.innerHTML = starcount;
localStorage.setItem("_watchers", starcount)
};
request.onerror = function (e) {
console.error(request.statusText);
};
request.send(null);
}
updateStarCounter()
localStorage.setItem(window.location.pathname, true);
setVisibleTags()
</script>
<%= yield %>
</div>
</body>
</html>