Fixed manga mode

This commit is contained in:
Hidde Jansen 2011-11-04 21:53:40 +01:00
parent 21db5fd7d8
commit 0005837fd7
5 changed files with 76 additions and 43 deletions

View file

@ -4,7 +4,6 @@
TODOs:
Fo sho:
- fix manga mode
- trigger preload if requesting valid but not loaded images (can happen if network was interupted)
- loading and generally hackiness of pointer is buggy, fix.
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
@ -245,6 +244,16 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.drawPage();
})
)
.append(
$(document.createElement("button"))
.attr("title", ((options.manga == true) ? "change reading direction to 'left-to-right'" : "change reading direction to 'right-to-left'"))
.addClass("cb-read-direction")
.click(function(){
options.manga = !options.manga;
ComicBook.prototype.drawPage();
})
.attr("id", ((options.manga == true) ? "toright" : "toleft"))
)
.append(
$(document.createElement("p"))
.attr("id", "cb-comic-info")
@ -307,13 +316,27 @@ function ComicBook(id, srcs, opts) {
left: $(document.createElement("div"))
.addClass("cb-control cb-navigate cb-always-on left")
.click(function(e){
ComicBook.prototype.drawPrevPage();
if(options.manga == false)
{
ComicBook.prototype.drawPrevPage();
}
else
{
ComicBook.prototype.drawNextPage();
}
}),
right: $(document.createElement("div"))
.addClass("cb-control cb-navigate cb-always-on right")
.click(function(e) {
ComicBook.prototype.drawNextPage();
if(options.manga == false)
{
ComicBook.prototype.drawNextPage();
}
else
{
ComicBook.prototype.drawPrevPage();
}
})
},
@ -666,19 +689,39 @@ function ComicBook(id, srcs, opts) {
// disable the fit width button if needed
$("button.cb-fit-width").attr("disabled", (options.zoomMode === "fitWidth"));
//Change the icon on the read direction
if(options.manga == true)
{
$("button.cb-read-direction").attr("id", "toright");
}
else
{
$("button.cb-read-direction").attr("id", "toleft");
}
// disable prev/next buttons if not needed
$(".cb-navigate").show();
if (pointer === 0) {
if ((pointer === 0) && (options.manga == false)) {
$(".cb-navigate.left").hide();
$(".cb-navigate.right").show();
}
if (pointer === srcs.length-1 || (typeof page2 === "object" && pointer === srcs.length-2)) {
else if ((pointer === 0) && (options.manga == true))
{
$(".cb-navigate.left").show();
$(".cb-navigate.right").hide();
}
if ((pointer === srcs.length-1 || (typeof page2 === "object" && pointer === srcs.length-2)) && (options.manga == false)) {
$(".cb-navigate.left").show();
$(".cb-navigate.right").hide();
}
else if ((pointer === srcs.length-1 || (typeof page2 === "object" && pointer === srcs.length-2)) && (options.manga == true))
{
$(".cb-navigate.left").hide();
$(".cb-navigate.right").show();
}
// user callback
if (typeof options.afterDrawPage === "function") {
options.afterDrawPage(pointer + 1);