From 84cc12ebaa23180ec83801d3115c0f22ec1bebb3 Mon Sep 17 00:00:00 2001 From: Bala Clark Date: Sat, 25 Dec 2010 09:29:52 +0100 Subject: [PATCH] use substring() instead of replace() for location.hash --- lib/ComicBook.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ComicBook.js b/lib/ComicBook.js index c63f009..bf20176 100644 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -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) {