summaryrefslogtreecommitdiffstats
path: root/templates/includes/book/header.html
blob: 7cd16c9f67d487910ef7683b617e5fca16cfb412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<div class="book-header">
    <!-- Actions Left -->
    <a href="https://github.com/{{ githubId }}" target="_blank" class="btn pull-left"><i class="fa fa-github-alt"></i></a>
    <a href="#" class="btn pull-left toggle-summary"><i class="fa fa-align-justify"></i> Summary</a>

    <!-- Actions Right -->
    <a href="/star/{{ githubId }}" class="btn pull-right count-star"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
    <a href="/watch/{{ githubId }}" class="btn pull-right count-watch"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>


    <!-- Title -->
    <h1><a href="{{ basePath }}/README.html" >{{ title }}</a></h1>
</div>
<script>
$(document).ready(function() {
    var $book = $(".book");

    // Toggle summary
    $book.find(".book-header .toggle-summary").click(function(e) {
        e.preventDefault();
        $book.toggleClass("with-summary");
    });

    // Star and watch count
    $.getJSON("https://api.github.com/repos/{{ githubId }}")
    .done(function(repo) {
        $book.find(".count-star span").text(repo.stargazers_count);
        $book.find(".count-watch span").text(repo.subscribers_count);
    });
});
</script>