Add hyphenation

This commit is contained in:
Flaviu Tamas 2015-04-27 17:15:48 -04:00
commit 440cba53d3
6 changed files with 141 additions and 37 deletions

30
content/js/main.js Normal file
View file

@ -0,0 +1,30 @@
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()