Gazelle/static/functions/cover_art.js

61 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-06-27 08:01:06 +00:00
(function () {
2013-05-27 08:00:58 +00:00
var show_all = false;
var current;
$(document).ready(function() {
2013-05-29 08:00:51 +00:00
show_all = $(".show_all_covers").text() == "Hide";
2013-05-27 08:00:58 +00:00
$(".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") {
2013-06-27 08:01:06 +00:00
if ($(this).attr("id") != current) {
2013-05-27 08:00:58 +00:00
$(this).hide();
}
$(".next_cover").show();
$(".prev_cover").show();
}
});
$(".cover_seperator").remove();
}
});
});
2013-06-27 08:01:06 +00:00
})();