summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core/navigation.js
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/core/navigation.js')
-rwxr-xr-xtheme/javascript/core/navigation.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js
index c4a7971..853950d 100755
--- a/theme/javascript/core/navigation.js
+++ b/theme/javascript/core/navigation.js
@@ -28,16 +28,24 @@ define([
function handleNavigation (url, push) {
if (typeof history.pushState === "undefined") {
- // Refresh the page to the new URL if pushState not supported
- location.href = url;
+ // Refresh the page to the new URL if pushState not supported
+ location.href = url;
+ return
}
- return $.get(url).done(function (data) {
- $('.book-body').html($(data).find('.book-body').html());
- $('.book-summary').html($(data).find('.book-summary').html());
+ return $.get(url)
+ .done(function (data) {
+ var $newPage = $(data);
+ var title = data.match("<title>(.*?)</title>")[1];
+
+ $('title').text(title);
+ $('.book-body').html($newPage.find('.book-body').html());
+ $('.book-summary').html($newPage.find('.book-summary').html());
+
if (push) updateHistory(url, null);
progress.show();
- }).fail(function () {
+ })
+ .fail(function () {
location.href = url;
});
}