fixed minor preload & hash nav bugs
This commit is contained in:
parent
e396f65748
commit
115c154c87
1 changed files with 7 additions and 5 deletions
|
@ -69,7 +69,7 @@ function ComicBook(id, srcs, opts) {
|
|||
// enables the back button
|
||||
function checkHash() {
|
||||
|
||||
var hash = parseInt(location.hash.substring(1),10) - 1;
|
||||
var hash = parseInt(location.hash.substring(1),10) - 1 || 0;
|
||||
|
||||
if (hash !== pointer && loaded.indexOf(hash) > -1) {
|
||||
pointer = hash;
|
||||
|
@ -148,7 +148,7 @@ function ComicBook(id, srcs, opts) {
|
|||
*/
|
||||
ComicBook.prototype.preload = function () {
|
||||
|
||||
var srcs = this.srcs;
|
||||
//var srcs = this.srcs;
|
||||
|
||||
if (no_pages < buffer) { buffer = no_pages; } // don't get stuck if the buffer level is higher than the number of pages
|
||||
|
||||
|
@ -186,8 +186,10 @@ function ComicBook(id, srcs, opts) {
|
|||
preload(i);
|
||||
}
|
||||
|
||||
//console.log(loaded[loaded.length-1], pointer, pointer + buffer);
|
||||
|
||||
// start rendering the comic when the buffer level has been reached (FIXME: buggy, fails if trying to load the last couple of pages)
|
||||
if (loaded.length === pointer + buffer) { ComicBook.prototype.drawPage(); }
|
||||
if (loaded[loaded.length-1] === pointer + buffer) { ComicBook.prototype.drawPage(); }
|
||||
if (loaded.length === no_pages) { $("#status").fadeOut(150).remove(); }
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue