disable page navigation controls when not needed

This commit is contained in:
Bala Clark 2011-09-08 12:54:06 +02:00
parent b235efdbfd
commit 8663e817c3

View file

@ -4,7 +4,6 @@
TODOs: TODOs:
Fo sho: Fo sho:
- improve prev/next buttons, only show them when they can possibly work (not at beginning/end)
- more smart image preloading, preload in both directions when a comic is loaded in the middle - more smart image preloading, preload in both directions when a comic is loaded in the middle
- fix manga mode - fix manga mode
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com - check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
@ -610,7 +609,9 @@ function ComicBook(id, srcs, opts) {
// draw the page(s) // draw the page(s)
context.drawImage(page, offsetW, offsetH, page_width, page_height); context.drawImage(page, offsetW, offsetH, page_width, page_height);
if (options.displayMode === "double" && typeof page2 === "object") { context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height); } if (options.displayMode === "double" && typeof page2 === "object") {
context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height);
}
// apply any image enhancements previously defined // apply any image enhancements previously defined
$.each(options.enhance, function(action, options) { $.each(options.enhance, function(action, options) {
@ -626,6 +627,17 @@ function ComicBook(id, srcs, opts) {
// disable the fit width button if needed // disable the fit width button if needed
$("button.cb-fit-width").attr("disabled", (options.zoomMode === "fitWidth")); $("button.cb-fit-width").attr("disabled", (options.zoomMode === "fitWidth"));
// disable prev/next buttons if not needed
$(".cb-navigate").show();
if (pointer === 0) {
$(".cb-navigate.left").hide();
$(".cb-navigate.right").show();
}
if (pointer === srcs.length-1) {
$(".cb-navigate.left").show();
$(".cb-navigate.right").hide();
}
// user callback // user callback
if (typeof options.afterDrawPage === "function") { if (typeof options.afterDrawPage === "function") {
options.afterDrawPage(pointer + 1); options.afterDrawPage(pointer + 1);