diff --git a/css/styles.css b/css/styles.css index ead1d80..3f9aac3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -129,6 +129,12 @@ #cb-toolbar button.cb-fit-width:hover { background-position: -24px -48px } #cb-toolbar button.cb-fit-width[disabled=disabled] { background-position: -48px -48px } +#cb-toolbar button.cb-read-direction#toleft{ background-position: 0 -144px } +#cb-toolbar button.cb-read-direction:hover#toleft{ background-position: -24px -144px } + +#cb-toolbar button.cb-read-direction#toright{ background-position: 0 -168px } +#cb-toolbar button.cb-read-direction:hover#toright { background-position: -24px -168px } + #cb-color { width: 246px; top: 44px; diff --git a/img/iconic/sprite.png b/img/iconic/sprite.png index d90c23e..f81dc18 100644 Binary files a/img/iconic/sprite.png and b/img/iconic/sprite.png differ diff --git a/img/iconic/sprite.psd b/img/iconic/sprite.psd index f7c1ab6..a6cf9d3 100644 Binary files a/img/iconic/sprite.psd and b/img/iconic/sprite.psd differ diff --git a/lib/ComicBook.js b/lib/ComicBook.js index de45221..21fc023 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -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); diff --git a/lib/ComicBook.min.js b/lib/ComicBook.min.js index 8633224..f9af946 100644 --- a/lib/ComicBook.min.js +++ b/lib/ComicBook.min.js @@ -1,39 +1,23 @@ -var Pixastic=function(){function c(a,g,o){a.addEventListener?a.addEventListener(g,o,!1):a.attachEvent&&a.attachEvent("on"+g,o)}function b(a){var g=!1,o=function(){g||(g=!0,a())};document.write('