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
|
/* TODO: cHANGE THIS FILE ENTIRELY!!! CHANGE CALLED ID'S AND CLASSES */
/* Functions that run when the page loads */
$(document).ready(function() {
/* Makes the bannermenu scrollable horizontally but not vertically */
$('#bannerBody').scrollToFixed();
/* Sets the click-function for the usermenubutton */
$('#bannerUserMenuButton').click(function(e){
$.get('ajax/isLoggedIn', function(response) {
if(response == 'yes') {
// If the user is logged in and the usermenu-div is hidden it's shown.
if($('#dropdownUserMenu').is(':hidden')) {
// TODO: Secure that the courseblock-div is hidden when the usermenu-div is oppened.
/*
if($('#dropdownMenuCourseBlock').is(':visible')) {
$('#dropdownMenuCourseBlock').hide();
}
$('#dropdownUserMenu').load('bannermenu.php #dropdownUserMenu');
*/
$('#dropdownUserMenu').show();
}
// If the user is logged in and the usermenu-div is shown it's hidden.
else {
$('#dropdownUserMenu').hide();
}
}
else {
// If the user is not logged in and the popup-div is hidden it's filled and shown.
if($('#popup').is(':hidden')) {
$('#popup').load('ajax/popup/login', function(){
$('#popup').show();
$("#popup .hint").click(loginHint);
});
}
// If the user is not logged in and the popup-div shows it's hidden.
else {
$('#popup').hide();
}
}
});
});
// TODO: Refresh the div with it's php before show.
/* Expand and collapse courses in dropdown menu */
$('#dropdownMenuExpandCourses').click(function(){
// If the course block is collapsed it's expanded.
if($('#dropdownMenuCourseBlock').is(':hidden')) {
$('#dropdownMenuCourseBlock').show();
}
// If the course block is expanded it's collapsed .
else {
$('#dropdownMenuCourseBlock').hide();
}
});
});
|