aboutsummaryrefslogtreecommitdiff
path: root/website/index.js
blob: 8bff415593457cf8df25547dc6d4fb5ed197a5fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$(function() {
	addGlow();
	fixDownloadLink();
});

function fixDownloadLink() {
	$("#downloadLink").attr("href", "http://projectlombok.googlecode.com/files/lombok.jar")
		.click(function(event) {
			showDownloadInfo();
			event.preventDefault();
	});
	
	$(".backToBar").click(function(event) {
		toggleButtonBar(true);
	});
}

function showDownloadInfo() {
	if ( !$("#downloadInfo").data("filled") ) {
		$("#downloadInfo").data("filled", true);
		$.ajax({
			type: "GET",
			url: "download.html",
			success: function(html) {
				var pos = html.search(/<p\s+id\s*=\s*"downloadHelp"[^>]*>/i);
				if ( pos == -1 ) return;
				html = html.substring(pos);
				pos = html.search(">");
				html = html.substring(pos + 1);
				pos = html.search(/<\s*\/\s*p\s*>/);
				html = html.substring(0, pos);
				var p = $("<p>").html(html).append($("#downloadInfo .downloadActions"));
				$("#downloadInfo span:first-child").replaceWith(p);
				toggleButtonBar(false);
			}
		});
	} else {
		toggleButtonBar(false);
	}
}

function toggleButtonBar(showOriginal) {
	if ( showOriginal ) {
		$("#downloadInfo").hide();
		$("#buttonBar").show();
	} else {
		$("#downloadInfo").show();
		$("#buttonBar").hide();
	}
}

function addGlow() {
	$("a").addClass("js");
	$(".button,.download").addGlow({
		radius: 20,
		textColor: '#00f',
		haloColor: '#00f',
		duration: 500
	});
}