Add buttons

This commit is contained in:
flaviut 2014-06-04 18:54:54 -04:00
commit b9b9848039
10 changed files with 91 additions and 35 deletions

View file

@ -5,7 +5,7 @@
<title>Nimrod by Example - <%= @item[:title] %></title>
<link rel="stylesheet" href="<%= @items['/stylesheets/main/'].path %>">
<link rel="stylesheet" href="<%= @items['/stylesheets/colorful/'].path %>" title="colorful">
<link rel="stylesheet" href="<%= @items['/stylesheets/cotton_candy/'].path %>" title="cottoncandy">
<link rel="stylesheet" href="<%= @items['/stylesheets/fontello/'].path %>">
<meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
<meta http-equiv="Default-Style" content="colorful">
</head>
@ -14,6 +14,7 @@
<%= @items["/toc/"].compiled_content(:snapshot => :last) %>
</div>
<div id="main">
<h1 id="gh-buttons"><a class="icon-fork" href="https://github.com/flaviut/nimrod-by-example/"></a> <a class="icon-star" href="https://github.com/flaviut/nimrod-by-example/stargazers" /><div id="starcount">?</div></a></h1>
<%= yield %>
</div>
<script>
@ -24,6 +25,17 @@
tocLinks[i].classList.add("visited");
}
}
var request = new XMLHttpRequest();
request.open("GET", "https://api.github.com/repos/flaviut/nimrod-by-example/stargazers", true);
request.onload = function (e) {
var starcount = JSON.parse(request.responseText).length;
var starcount_elem = document.getElementById("starcount");
starcount_elem.innerHTML = starcount;
};
request.onerror = function (e) {
console.error(request.statusText);
};
request.send(null);
</script>
</body>
</html>