/
common.js
63 lines (48 loc) · 1.28 KB
/
common.js
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
var subCount = 0;
$(document).ready(function() {
$(".listitem").each(function(index) {
$(this).css("top", ((index + 1.5) * 6) + "%");
});
$(".listitem").click(function(e) {
displayCode($(this).attr("id").replace("sub", ""));
});
$(".hiddenListitem").click(function(){
displayCode($(this).attr("id").replace("sub", ""));
});
$(".notes").click(function(e) {
$("#notes").hide();
var notes = $(this).parents().filter("li").attr("data-notes");
if (notes != "") $("#notes").text(notes).show();
e.stopPropagation();
});
$("#notes").click(function() {
$("#notes").hide();
});
$("#code").click(function() {
$("#code").hide();
});
$("#navPrev").click(function() {
window.location.href = prev;
});
$("#navNext").click(function() {
window.location.href = next;
});
$("#main").click(function(){
subCount++;
var id = "#sub" + subCount;
$(id).css("top", ((subCount + 1.5) * 6) + "%");
$(id).show();
});
});
function spaces(times) {
var spaces = "";
times += "";
if (times.substr(0, 1) == "-") {
times = parseInt(times.substr(1));
} else {
spaces = "<br />";
times = parseInt(times);
}
for (t = 0; t < times; t++) {spaces += " "};
return spaces;
}