Mercurial > zeropaste
diff app/assets/javascripts/zp.hash_magic.js @ 263:a9c45375a656
Nuke width adjuster from orbit.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 01:55:23 +0900 |
parents | e3468efc9ec9 |
children | fa4a1ba990ae |
line wrap: on
line diff
--- a/app/assets/javascripts/zp.hash_magic.js Tue Oct 15 22:42:24 2013 +0900 +++ b/app/assets/javascripts/zp.hash_magic.js Wed Oct 16 01:55:23 2013 +0900 @@ -1,31 +1,22 @@ //= require zp.formatter -//= require zp.viewer_width (function($) { window.zp.hash_magic = { load_hash: function() { - var hash_array = window.location.hash.slice(2).split(".") - format = hash_array[0] - width = hash_array[1] + var format = window.location.hash.slice(1) if (format !== undefined) { zp.formatter.links().filter("[href=#" + format + "]").click() } - if (width !== undefined) { - zp.viewer_width.resize(width) - } }, set_hash: function(e) { if (typeof e !== "undefined") { - if (zp.formatter.links().filter(e.target).length === 0 && - zp.viewer_width.links().filter(e.target).length === 0) { return } + if (zp.formatter.links().filter(e.target).length === 0) return else e.preventDefault() } var format = zp.formatter.current(), - width = zp.viewer_width.current, - hash = "#!" + hash = "#" hash += format - if (width !== "auto") { hash += "." + width } - if (hash === "#!pl") { hash = " " } + if (hash === "#pl") { hash = " " } history.replaceState(null, "", hash) }, init: function() {