use substring() instead of replace() for location.hash

This commit is contained in:
Bala Clark 2010-12-25 09:29:52 +01:00
parent d7e7450912
commit 84cc12ebaa

View file

@ -61,13 +61,11 @@ function ComicBook(id, srcs, opts) {
var context; // the 2d drawing context
var buffer = 4; // image preload buffer level
var loaded = 0; // the amount of images that have been loaded so far
var scale = 1; // page zoom scale, 1 = 100%
// the current page, can pass a default as a url hash
var pointer = (parseInt(window.location.hash.replace('#',''),10) - 1) || 0;
var pointer = (parseInt(location.hash.substring(1),10) - 1) || 0;
/**
* Figure out the cursor position relative to the canvas.
@ -267,7 +265,7 @@ function ComicBook(id, srcs, opts) {
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); }
window.location.hash = pointer + 1;
location.hash = pointer + 1;
// apply any image enhancements previously defined
$.each(options.enhance, function(action, options) {