From 8663e817c33cdb90d15031e5e5b61fc7e5a4bc67 Mon Sep 17 00:00:00 2001 From: Bala Clark Date: Thu, 8 Sep 2011 12:54:06 +0200 Subject: [PATCH] disable page navigation controls when not needed --- lib/ComicBook.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/ComicBook.js b/lib/ComicBook.js index f8af198..1266c9d 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -4,7 +4,6 @@ TODOs: 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 - fix manga mode - 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) 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 $.each(options.enhance, function(action, options) { @@ -626,6 +627,17 @@ function ComicBook(id, srcs, opts) { // disable the fit width button if needed $("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 if (typeof options.afterDrawPage === "function") { options.afterDrawPage(pointer + 1);