Mercurial > zeropaste
view app/assets/javascripts/zp.hash_magic.js.coffee @ 366:26545fe719ca
Remove caching system.
Too much complexity for something that is really simple.
| author | edogawaconan <me@myconan.net> | 
|---|---|
| date | Sat, 14 Feb 2015 01:35:45 +0900 | 
| parents | f802099acd37 | 
| children | 
line wrap: on
 line source
#= require zp.formatter window.zp.hash_magic = load_hash: -> format = window.location.hash.slice(1) tab_link = (fmt) -> zp.formatter.links().filter("[href='##{fmt}']") format = "pl" unless tab_link(format).length tab_link(format).click() set_hash: (e) -> format = zp.formatter.current() newpath = window.location.pathname newpath += "##{format}" if (format != "pl") history.replaceState null, "", newpath init: -> return unless $("#paste").length @load_hash() if (history.replaceState) @set_hash() zp.formatter.links().on("shown.bs.tab", this.set_hash)
