# HG changeset patch # User Edho Arief # Date 1368331009 -32400 # Node ID 6e9718a1ee1172c6d7be49e683cd31b5d0c00031 # Parent 45ccec189bd76218a5f2ee41f8328ac36b632544 Combine event-related actions diff -r 45ccec189bd7 -r 6e9718a1ee11 app/assets/javascripts/zp.hash_magic.js --- a/app/assets/javascripts/zp.hash_magic.js Sun May 12 12:48:13 2013 +0900 +++ b/app/assets/javascripts/zp.hash_magic.js Sun May 12 12:56:49 2013 +0900 @@ -14,9 +14,11 @@ } }, 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 } + if (typeof e !== "undefined") { + if (zp.formatter.links().filter(e.target).length === 0 && + zp.viewer_width.links().filter(e.target).length === 0) { return } + else e.preventDefault() + } var format = zp.formatter.current(), width = zp.viewer_width.current, @@ -25,7 +27,6 @@ if (width !== "auto") { hash += "." + width } if (hash === "#!pl") { hash = " " } history.replaceState(null, "", hash) - if (typeof e !== "undefined") { e.preventDefault() } }, init: function() { this.load_hash()