File size: 2,443 Bytes
4cadbaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$(document).ready(function() {
    var docsLoaded = false;

    $(window).hashchange(function(e){
        e.preventDefault();
        e.stopPropagation();

        if (location.hash === "#tryit") {
            $("#main > .content").hide();
            $("#tryit input").val("").keyup();
            $("#tryit").fadeIn(400, function() {
                $("#tryit input").val(".languagesSpoken .lang").keyup();
            });
        } else if (location.hash === "#cred") {
            $("#main > .content").hide();
            $("#cred").fadeIn(400);
        } else if (location.hash === '#overview' || location.hash === '') {
            $("#main > .content").hide();
            $("#splash").fadeIn(400);
        } else if (location.hash === '#code' || location.hash === '') {
            $("#main > .content").hide();
            $("#code").fadeIn(400);
        } else if (location.hash.substr(0,5) === "#docs") {
            function showIt() {
                var where = window.location.hash.substr(6);
                if (!where) {
                    $("#doc").fadeIn(400);
                } else {
                    $("#doc").show();
                    var dst = $("a[name='" + where + "']");
                    if (dst.length) {
                        $('html, body').animate({scrollTop:dst.offset().top - 100}, 500);
                    }
                }
            }
            $("#main > .content").hide();
            if (!docsLoaded) {
                $.get("JSONSelect.md").success(function(data) {
                    var converter = new Showdown.converter();
                    $("#doc").html(converter.makeHtml(data));
                    $("#doc a").each(function() {
                        var n = $(this).attr('href');
                        if (typeof n === 'string' && n.substr(0,1) === '#') {
                            $(this).attr('href', "#docs/" + n.substr(1));
                        }
                    });
                    docsLoaded = true;
                    showIt();
                }).error(function() {
                    $("#doc").text("Darnit, error fetching docs...").fadeIn(400);
                });
            } else {
                showIt();
            }
        } else {
        }
        return false;
    });

    // Trigger the event (useful on page load).
    if (window.location.hash === "")
        window.location.hash = "#overview";
    $(window).hashchange();
});