summaryrefslogtreecommitdiffstats
path: root/static/functions/cover_art.js
blob: 7b5bc4f26c73e273379008edfab5743862707d07 (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
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
(function () {
	var show_all = false;
	var current;
	$(document).ready(function() {
		show_all = $(".show_all_covers").text() == "Hide";
		$(".next_cover").click(function(e) {
			e.preventDefault();
			var next = $(this).data("gazelle-next-cover");
			$("#cover_controls_" + (next - 1)).hide();
			$("#cover_controls_" + next).show();
			$("#cover_div_" + (next - 1)).hide();
			$("#cover_div_" + next).show();
			if ($("#cover_" + next).attr("src").length == 0) {
				$("#cover_" + next).attr("src", $("#cover_" + next).data("gazelle-temp-src"));
			}

		});
		$(".prev_cover").click(function(e) {
			e.preventDefault();
			var prev = $(this).data("gazelle-prev-cover");
			$("#cover_controls_" + (prev + 1)).hide();
			$("#cover_controls_" + prev).show();
			$("#cover_div_" + (prev + 1)).hide();
			$("#cover_div_" + prev).show();
		});

		$(".show_all_covers").click(function(e) {
			e.preventDefault();
			if (!show_all) {
				current = $("#covers div:visible").attr("id");
				show_all = true;
				$(this).text("Hide");
				$("#covers img").each(function() {
					$(this).attr("src", $(this).data("gazelle-temp-src"));
				});
				$("#covers div").each(function() {
					$(this).show();
					$(this).after("<span class=\"cover_seperator\"><br /><hr /><br /></span>");
					$(".next_cover").hide();
					$(".prev_cover").hide();
				});
				$(".cover_seperator:last").remove();
			} else {
				show_all = false;
				$(this).text("Show all");
				$("#covers div").each(function() {
					if ($(this).attr("class") != "head") {
						if ($(this).attr("id") != current) {
							$(this).hide();
						}
						$(".next_cover").show();
						$(".prev_cover").show();
					}
				});
				$(".cover_seperator").remove();
			}

		});
	});
})();