aboutsummaryrefslogtreecommitdiff
path: root/website2/resources/js
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2017-01-06 01:20:48 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2017-05-29 21:01:53 +0200
commitbb85d799b3ba549c8a29afab0b246cb13b10507a (patch)
tree50481e47684d59f2cbb7fc9611b46ba82346f1bb /website2/resources/js
parent6d0264e1970dbf205346d3655f21c39ac889a730 (diff)
downloadlombok-bb85d799b3ba549c8a29afab0b246cb13b10507a.tar.gz
lombok-bb85d799b3ba549c8a29afab0b246cb13b10507a.tar.bz2
lombok-bb85d799b3ba549c8a29afab0b246cb13b10507a.zip
setup pages added.
Diffstat (limited to 'website2/resources/js')
-rw-r--r--website2/resources/js/main.js46
1 files changed, 28 insertions, 18 deletions
diff --git a/website2/resources/js/main.js b/website2/resources/js/main.js
index 497b310c..4ac490d3 100644
--- a/website2/resources/js/main.js
+++ b/website2/resources/js/main.js
@@ -9,41 +9,51 @@
return lnk;
}
+ function captureLinkClick() {
+ var self = $(this);
+ if (self.data("clc")) return;
+ var href = self.attr("href");
+ self.data("clc", true);
+ if (!href || href.substr(0, 4) === "http" || href.substr(href.length - 4, 4) === ".xml") return;
+ self.on("click", function(evt) {
+ evt.preventDefault();
+ var key = toKey(window.location.pathname);
+ if ($("#" + key).length < 1) {
+ var d = $("<div />").attr("id", key).append($("#main-section").contents()).hide();
+ $("body").append(d);
+ }
+ History.pushState({urlPath: href}, self.text(), href);
+ });
+ }
+
function ajaxFeaturePages() {
if (!History.enabled) return;
History.replaceState({urlPath: window.location.pathname}, $("title").text(), History.getState().urlpath);
- $("a").each(function() {
- var self = $(this);
- var href = self.attr("href");
- if (!href) return;
- if (href.substring(0, 10) !== "/features/") return;
- self.on("click", function(evt) {
- evt.preventDefault();
- var key = toKey(window.location.pathname);
- if ($("#" + key).length < 1) {
- var d = $("<div />").attr("id", key).append($("#featureContent").contents()).hide();
- $("body").append(d);
- }
- History.pushState({urlPath: href}, self.text(), href);
- });
- });
+ $("a").each(captureLinkClick);
$(window).on("statechange", function() {
var hs = History.getState();
var u = hs.data.urlPath;
+ if (u === "/" || u === "") u = "/main.html";
if (u.substring(u.length - 5) !== ".html") u += ".html";
var key = toKey(u);
var sc = $("#" + key);
if (sc.length > 0) {
- var a = $("#featureContent");
- sc.show().attr("id", "featureContent");
+ var a = $("#main-section");
+ sc.show().attr("id", "main-section").attr("class", "container-fluid main-section");
a.replaceWith(sc);
} else {
$.ajax({
url: u,
success: function(response) {
- $("#featureContent").replaceWith($(response).find("#featureContent"));
+ var x = '<div class="container-fluid main-section" id="main-section">';
+ var y = '<footer';
+ var start = response.indexOf(x);
+ var end = response.indexOf(y);
+ var newH = $(response.substr(start, end - start));
+ $("#main-section").replaceWith(newH);
+ $("a").each(captureLinkClick);
}
});
}