From 6981172789d9e46b6499f6628df97e4cff7c074e Mon Sep 17 00:00:00 2001 From: Bala Clark Date: Sun, 28 Aug 2011 20:47:52 +0200 Subject: [PATCH] bugfixed potential self ddos :/ --- lib/ComicBook.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/ComicBook.js b/lib/ComicBook.js index 5e11c22..d907b9f 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -86,14 +86,9 @@ function ComicBook(id, srcs, opts) { return parseInt(location.hash.substring(1),10) - 1 || 0; } - function setHash() { - - var pageNo = pointer + 1; - - if (getHash() !== '#'+pageNo) { - location.hash = pageNo; - if (options.savePosition === true) { setLastPage(pageNo); }; - } + function setHash(pageNo) { + location.hash = pageNo; + if (options.savePosition === true) { setLastPage(pageNo); }; } /** @@ -330,7 +325,9 @@ 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); } - setHash(pointer + 1); + if (getHash() !== pointer) { + setHash(pointer + 1); + } // apply any image enhancements previously defined $.each(options.enhance, function(action, options) { @@ -495,5 +492,5 @@ function ComicBook(id, srcs, opts) { return false; } }; - + }