summaryrefslogtreecommitdiff
path: root/slideshows/advanced/template/events.js
blob: 82095f491bd737d4d46707bdf0d33eb62de52137 (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
61
62
63
64
65
$(document).ready(function(){

	var tot=$('.event').length;
	
	var screenWidth = $('.events').width();

	var bord = $('.event').outerWidth() - $('.event').innerWidth();
	var padd = $('.event').innerWidth() - $('.event').width();
	var marg = $('.event').outerWidth(true) - $('.event').outerWidth();
	$('.event').width((screenWidth-(tot * (bord+padd+marg)))/tot);

	$('.eventDate').each(function(index, value) {
		var colours = ['blue', 'green', 'chreme'];
		$(this).addClass(colours[index % 3]);
	});

	$('.eventField').each(function(index, value) {
		var classStr = $(this).attr('class').split(/\s+/);
		if(classStr.indexOf('start') != -1) {
			$(this).show();
		} else if(classStr.indexOf('summary') != -1) {
			$(this).show();
		}
	});

	$('.eventEl').click(function() {
		showWindow($(this));
	})
	setTimeout("reloadPage()", 21600000);
});

function reloadPage() { 
		location.reload();
};

function showWindow(data) {
	   
	var title = $('.summary',data).text();
	var body = $('.description',data).html();

	if(body == null) {
		body = 'no description available';
	}

	$('<div id="overlay">').css({
		width:$(document).width(),
		height:$(document).height(),
		opacity:0.6
		
	}).appendTo('body').click(function(){
		
		$(this).remove();
		$('#windowBox').remove();
		
	});
	
	$('body').append('<div id="windowBox"><div id="titleDiv">'+title+'</div>'+body+'</div>');

	$('#windowBox').css({
		width:500,
		height:350,
		left: ($(window).width() - 500)/2,
		top: ($(window).height() - 350)/2
	});
}