summaryrefslogtreecommitdiffstats
path: root/theme
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
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')
-rw-r--r--theme/assets/website/app.js6
-rw-r--r--theme/javascript/state.js6
-rw-r--r--theme/templates/website/page.html2
3 files changed, 11 insertions, 3 deletions
diff --git a/theme/assets/website/app.js b/theme/assets/website/app.js
index 1230ac8..e8d80d9 100644
--- a/theme/assets/website/app.js
+++ b/theme/assets/website/app.js
@@ -24736,9 +24736,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($);
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($);
diff --git a/theme/templates/website/page.html b/theme/templates/website/page.html
index 527e181..c6db959 100644
--- a/theme/templates/website/page.html
+++ b/theme/templates/website/page.html
@@ -14,7 +14,7 @@
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
{% block content %}
- <div class="book" data-level="{{ progress.current.level }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}">
+ <div class="book" data-level="{{ progress.current.level }}" data-filepath="{{ progress.current.path }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}">
{% include "includes/summary.html" %}
<div class="book-body">
<div class="body-inner">