bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
52.1.1
by b11johgu
Added controllers for examplepage, templatelayout. |
1 |
/* Global variables */
|
2 |
var popoutMenu=0; |
|
3 |
var expandedCourses=0; |
|
4 |
||
5 |
/* Functions */
|
|
6 |
$(document).ready(function(){ |
|
7 |
$('#expandedCourses').hide(); |
|
8 |
$('#popoutMenu').hide(); |
|
9 |
$('#passwordChanger').hide(); |
|
10 |
||
11 |
/* Check courses in expanded menu */ |
|
12 |
$('li[class="expanded"]').click(function(){ |
|
13 |
if($(this).hasClass('checkedCourse')){ |
|
14 |
$(this).removeClass('checkedCourse'); |
|
15 |
} |
|
16 |
else{ |
|
17 |
$(this).addClass("checkedCourse"); |
|
18 |
} |
|
19 |
}); |
|
20 |
||
21 |
/* Blurs body and opens password changer */ |
|
22 |
$('li[name="changePwd"]').click(function(e){ |
|
23 |
e.stopPropagation(); |
|
24 |
$('#popoutMenu').stop(false, false).slideUp(300); |
|
25 |
popoutMenu=0; |
|
26 |
$('body *').not('#passwordChanger, #passwordChanger *').animate({ |
|
27 |
opacity:0.4}, 400); |
|
28 |
$('#passwordChanger').fadeIn(300); |
|
29 |
$('#passwordChanger').css('z-index', 3000); |
|
30 |
}); |
|
31 |
|
|
32 |
$('body').click(function(e){ |
|
33 |
$('#formContainer').fadeOut(300); |
|
34 |
$('#passwordChanger').fadeOut(300); |
|
35 |
$('body *').animate({ |
|
36 |
opacity:1}, 400); |
|
37 |
$('#changePassword')[0].reset(); |
|
38 |
}); |
|
39 |
|
|
40 |
$('#passwordChanger').click(function(e){ |
|
41 |
e.stopPropagation(); |
|
42 |
}); |
|
43 |
|
|
44 |
$('#formContainer').click(function(e){ |
|
45 |
e.stopPropagation(); |
|
46 |
}); |
|
47 |
|
|
48 |
$('#popoutLink').click(function(e){ |
|
49 |
if(popoutMenu==0){ |
|
50 |
$('#popoutMenu').stop(false, true).slideDown(300); |
|
51 |
popoutMenu=1; |
|
52 |
e.stopPropagation(); |
|
53 |
// FIXA SÅ MENYN INTE KOMMER UPP IGEN |
|
54 |
} |
|
55 |
else if(popoutMenu==1){ |
|
56 |
$('#popoutMenu').stop(false, false).slideUp(300); |
|
57 |
popoutMenu=0; |
|
58 |
e.stopPropagation(); |
|
59 |
} |
|
60 |
}); |
|
61 |
|
|
62 |
$('#loginLink').click(function(e){ |
|
63 |
var target = $('#formContainer'); |
|
64 |
if(target.is(":hidden")){ |
|
65 |
target.fadeIn(300); |
|
66 |
$('#username').focus(); |
|
67 |
e.stopPropagation(); |
|
68 |
} |
|
69 |
else{ |
|
70 |
target.fadeOut(300); |
|
71 |
} |
|
72 |
|
|
73 |
}); |
|
74 |
});
|
|
75 |
||
76 |
window.onkeyup = function(event){ |
|
77 |
if(event.keyCode==27){ |
|
78 |
$('#formContainer').fadeOut(300); |
|
79 |
$('#passwordChanger').fadeOut(300); |
|
80 |
$('body *').animate({ |
|
81 |
opacity:1}, 400); |
|
82 |
$('#changePassword')[0].reset(); |
|
83 |
} |
|
84 |
}
|
|
85 |
||
86 |
/* Closing password changer and reactivates body */
|
|
87 |
function cancelPasswordChange(){ |
|
88 |
$('#passwordChanger').fadeOut(300); |
|
89 |
$('body *').animate({ |
|
90 |
opacity:1}, 400); |
|
91 |
$('#changePassword')[0].reset(); |
|
92 |
}
|
|
93 |
||
94 |
||
95 |
/* Expand/Collapse courses in popout menu */
|
|
96 |
function expandCourses(){ |
|
97 |
if(expandedCourses==0){ |
|
98 |
$('#expandedCourses').stop(false, true).slideDown(300); |
|
99 |
expandedCourses=1; |
|
100 |
} |
|
101 |
else if(expandedCourses==1){ |
|
102 |
$('#expandedCourses').stop(false, false).slideUp(300); |
|
103 |
expandedCourses=0; |
|
104 |
} |
|
105 |
}
|
|
106 |