summaryrefslogtreecommitdiffstats
path: root/theme/javascript/state.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-22 16:11:05 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-22 16:11:05 +0200
commit013f7f09da56b6a2666332705b593c065e884e3c (patch)
treeeaeaf6e8324f493ef42af88b7750aa15ad20a513 /theme/javascript/state.js
parentf082de1f927f4b9f287dfb9073bf52dd8817cac0 (diff)
downloadgitbook-013f7f09da56b6a2666332705b593c065e884e3c.zip
gitbook-013f7f09da56b6a2666332705b593c065e884e3c.tar.gz
gitbook-013f7f09da56b6a2666332705b593c065e884e3c.tar.bz2
Add gitbook.state.filepath
Fix gitbook.state.root
Diffstat (limited to 'theme/javascript/state.js')
-rw-r--r--theme/javascript/state.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/theme/javascript/state.js b/theme/javascript/state.js
index 68fafea..5fde20f 100644
--- a/theme/javascript/state.js
+++ b/theme/javascript/state.js
@@ -11,9 +11,13 @@ state.update = function(dom) {
state.level = $book.data('level');
state.basePath = $book.data('basepath');
state.revision = $book.data('revision');
+ state.filepath = $book.data('filepath');
// Absolute url to the root of the book
- state.root = url.resolve(location.origin, path.dirname(path.resolve(location.pathname, state.basePath)));
+ state.root = url.resolve(
+ location.protocol+'//'+location.host,
+ path.dirname(path.resolve(location.pathname, state.basePath))
+ );
};
state.update($);