Add checkmark read timer
This commit is contained in:
parent
00bcb52973
commit
0438be29f2
1 changed files with 26 additions and 17 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue