diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-11-22 06:44:14 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-11-22 06:44:14 +0000 |
| commit | 874c74dad6c9fcd33a756722d3d8339574084fb4 (patch) | |
| tree | ce7453adf546bd3e4b364dd32401826f50a6c8fd | |
| parent | make links black (diff) | |
| download | mmm-874c74dad6c9fcd33a756722d3d8339574084fb4.tar.gz mmm-874c74dad6c9fcd33a756722d3d8339574084fb4.zip | |
fix browser nav buttons
| -rw-r--r-- | mmm/mmmfs/browser.moon | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mmm/mmmfs/browser.moon b/mmm/mmmfs/browser.moon index 370c039..6bbd5fd 100644 --- a/mmm/mmmfs/browser.moon +++ b/mmm/mmmfs/browser.moon @@ -34,8 +34,15 @@ class Browser -- update URL bar if MODE == 'CLIENT' @path\subscribe (path) -> - path ..= '/' unless '/' == path\sub -1 - window.history\pushState nil, '', path + return if @skip + vis_path = path .. (if '/' == path\sub -1 then '' else '/') + window.history\pushState path, '', vis_path + + window.onpopstate = (_, event) -> + if event.state + @skip = true + @path\set event.state + @skip = nil -- active fileder -- (re)set every time @path changes |
