aboutsummaryrefslogtreecommitdiff
path: root/website/resources/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/js/main.js')
-rw-r--r--website/resources/js/main.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/website/resources/js/main.js b/website/resources/js/main.js
index 146dd554..ebeeab9d 100644
--- a/website/resources/js/main.js
+++ b/website/resources/js/main.js
@@ -2,13 +2,13 @@
(function($) {
swfobject.registerObject("player", "9.0.98", "videos/expressInstall.swf");
-
+
function toKey(href) {
var lnk = "__savedContent_" + href.replace(/\//g, '_');
if (lnk.substring(lnk.length - 5) === ".html") lnk = lnk.substring(0, lnk.length - 5);
return lnk;
}
-
+
function captureLinkClick() {
var self = $(this);
if (self.data("clc")) return;
@@ -25,13 +25,17 @@
History.pushState({urlPath: href}, self.text(), href);
});
}
-
+
+ function collapseMenu() {
+ if ($(".navbar-collapse").is(".in")) $(".navbar-toggle").click()
+ }
+
function ajaxFeaturePages() {
if (!History.enabled) return;
History.replaceState({urlPath: window.location.pathname}, $("title").text(), History.getState().urlpath);
-
+
$("a").each(captureLinkClick);
-
+
$(window).on("statechange", function() {
var hs = History.getState();
var u = hs.data.urlPath;
@@ -44,6 +48,7 @@
var a = $("#main-section");
sc.show().attr("id", "main-section").attr("class", "container-fluid main-section");
a.replaceWith(sc);
+ collapseMenu();
} else {
$.ajax({
url: u,
@@ -54,12 +59,13 @@
var end = response.indexOf(y);
var newH = $(response.substr(start, end - start));
$("#main-section").replaceWith(newH);
+ collapseMenu();
$("a").each(captureLinkClick);
}
});
}
});
}
-
+
$(ajaxFeaturePages);
})($);