changeset 223:45ccec189bd7

Fix overzealous preventDefault.
author Edho Arief <edho@myconan.net>
date Sun, 12 May 2013 12:48:13 +0900
parents 9bc35555d3e3
children 6e9718a1ee11
files app/assets/javascripts/zp.hash_magic.js
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/assets/javascripts/zp.hash_magic.js	Sun May 12 12:38:03 2013 +0900
+++ b/app/assets/javascripts/zp.hash_magic.js	Sun May 12 12:48:13 2013 +0900
@@ -14,6 +14,9 @@
       }
     },
     set_hash: function(e) {
+      if (typeof e !== "undefined" &&
+          zp.formatter.links().filter(e.target).length === 0 &&
+          zp.viewer_width.links().filter(e.target).length === 0) { return }
       var
         format = zp.formatter.current(),
         width = zp.viewer_width.current,
@@ -22,7 +25,7 @@
       if (width !== "auto") { hash += "." + width }
       if (hash === "#!pl") { hash = " " }
       history.replaceState(null, "", hash)
-      if (e !== undefined) { e.preventDefault() }
+      if (typeof e !== "undefined") { e.preventDefault() }
     },
     init: function() {
       this.load_hash()