Add checkmark read timer

This commit is contained in:
flaviut 2014-06-19 23:58:43 -04:00
commit 0438be29f2

View file

@ -18,13 +18,15 @@
<%= yield %> <%= yield %>
</div> </div>
<script> <script>
localStorage.setItem(window.location.pathname, true); function setVisibleTags(){
var tocLinks = document.querySelectorAll("#sidebar a:link, a:visited"); var tocLinks = document.querySelectorAll("#sidebar a:link, a:visited");
for(var i = 0; i < tocLinks.length; i++){ for(var i = 0; i < tocLinks.length; i++){
if(localStorage.getItem(tocLinks[i].getAttribute("href")) != null){ if(localStorage.getItem(tocLinks[i].getAttribute("href")) != null){
tocLinks[i].classList.add("visited"); tocLinks[i].classList.add("visited");
} }
} }
}
function updateStarCounter(){
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open("GET", "https://api.github.com/repos/flaviut/nimrod-by-example/stargazers", true); request.open("GET", "https://api.github.com/repos/flaviut/nimrod-by-example/stargazers", true);
request.onload = function (e) { request.onload = function (e) {
@ -36,6 +38,13 @@
console.error(request.statusText); console.error(request.statusText);
}; };
request.send(null); request.send(null);
}
setTimeout(function() {
localStorage.setItem(window.location.pathname, true);
setVisibleTags();
}, 10000);
setVisibleTags()
updateStarCounter()
</script> </script>
</body> </body>
</html> </html>