use substring() instead of replace() for location.hash
This commit is contained in:
parent
d7e7450912
commit
84cc12ebaa
1 changed files with 3 additions and 5 deletions
|
@ -61,13 +61,11 @@ function ComicBook(id, srcs, opts) {
|
||||||
var context; // the 2d drawing context
|
var context; // the 2d drawing context
|
||||||
|
|
||||||
var buffer = 4; // image preload buffer level
|
var buffer = 4; // image preload buffer level
|
||||||
|
|
||||||
var loaded = 0; // the amount of images that have been loaded so far
|
var loaded = 0; // the amount of images that have been loaded so far
|
||||||
|
|
||||||
var scale = 1; // page zoom scale, 1 = 100%
|
var scale = 1; // page zoom scale, 1 = 100%
|
||||||
|
|
||||||
// the current page, can pass a default as a url hash
|
// 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.
|
* 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);
|
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); }
|
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
|
// apply any image enhancements previously defined
|
||||||
$.each(options.enhance, function(action, options) {
|
$.each(options.enhance, function(action, options) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue