3
3
/* Functions that run when the page loads */
4
4
$(document).ready(function() {
6
/* Secures that the dropdownmenus are not shown on pageload */
7
$('#bannerContentExample').hide();
8
$('#dropdownCodeviewerMenu').hide();
9
$('#dropdownUserMenu').hide();
6
/* Sets the click-function for the usermenubutton */
13
7
$('#bannerUserMenuButton').click(function(e){
14
$('#popup').load('ajax/popup/loginForm #loginForm');
18
/*var target = $('#loginPopup');
19
if(target.is(":hidden")){
21
$('#username').focus();
9
$.get('ajax/isLoggedIn', function(response) {
10
if(response == 'yes') {
11
// If the user is logged in and the usermenu-div is hidden it's shown.
12
if($('#dropdownUserMenu').is(':hidden')) {
13
// Secure that the courseblock-div is hidden when the usermenu-div is oppened.
14
if($('#dropdownMenuCourseBlock').is(':visible')) {
15
$('#dropdownMenuCourseBlock').hide();
17
$('#dropdownUserMenu').load('bannermenu.php #dropdownUserMenu');
18
$('#dropdownUserMenu').show();
20
// If the user is logged in and the usermenu-div is shown it's hidden.
22
$('#dropdownUserMenu').hide();
26
// If the user is not logged in and the popup-div is hidden it's filled and shown.
27
if($('#popup').is(':hidden')) {
28
$('#popup').load('ajax/popup/loginForm #loginForm', function(){
32
// If the user is not logged in and the popup-div shows it's hidden.
32
/* Check courses in expanded menu */
33
$('li.dropdownMenuCourseBlockNonActiveCourse').click(function(){
34
$('li.dropdownMenuCourseBlockActiveCourse').addClass('dropdownMenuCourseBlockNonActiveCourse');
35
$('li.dropdownMenuCourseBlockActiveCourse').removeClass('dropdownMenuCourseBlockActiveCourse');
41
// TODO: Refresh the div with it's php before show.
42
/* Expand and collapse courses in dropdown menu */
43
$('#dropdownMenuExpandCourses').click(function(){
45
// If the course block is collapsed it's expanded.
46
if($('#dropdownMenuCourseBlock').is(':hidden')) {
47
$('#dropdownMenuCourseBlock').show();
49
// If the course block is expanded it's collapsed .
51
$('#dropdownMenuCourseBlock').hide();
37
$(this).removeClass('dropdownMenuCourseBlockNonActiveCourse');
38
$(this).addClass("dropdownMenuCourseBlockActiveCourse");
39
/*TA BORT DEN ENA KLASSEN OCH ANVÄND TOGGLE*/