summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-05-03 11:41:43 +0300
committerAlon Levy <alon@pobox.com>2015-05-03 11:41:43 +0300
commit206438b12edb046cfeb9580240ec707c94e01da7 (patch)
treeb416a3c7b6f61a60e6db44005055d240bc3113f1 /src/client
parentccb570b9773f1bf3bd62e83673a6a1707044c94e (diff)
client: on doc change, change url via window.history.replaceState
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rz_core.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/rz_core.js b/src/client/rz_core.js
index 376031c7..2357f427 100644
--- a/src/client/rz_core.js
+++ b/src/client/rz_core.js
@@ -265,10 +265,16 @@ function load_from_json(result) {
update_view__graph(true);
}
-function set_title(rzdoc_name)
+function page_title(rzdoc_name)
{
// [!] needs to be synced with server provided title (index.html). double the code, half the latency.
- document.title = rzdoc_name + ' -- Rhizi Prototype';
+ return rzdoc_name + ' -- Rhizi Prototype';
+}
+
+function url_for_doc(rzdoc_name)
+{
+ // [!] needs to be synced with server
+ return '/rz/' + rzdoc_name;
}
/**
@@ -282,8 +288,8 @@ function rzdoc__open(rzdoc_name) {
main_graph.clear();
edit_graph.clear();
main_graph.load_from_backend();
- set_title(rzdoc_name);
get_search().clear();
+ window.history.replaceState(null, page_title(rzdoc_name), url_for_doc(rzdoc_name));
var rzdoc_bar = $('#rzdoc-bar_doc-label');
var rzdoc_bar__doc_lable = $('#rzdoc-bar_doc-label');