3
3
/* Functions that run when the page loads */
4
4
$(document).ready(function() {
6
/* Makes the bannermenu scrollable horizontally but not vertically */
7
$('#bannerBody').scrollToFixed();
9
/* Sets the click-function for the usermenubutton */
6
/* Secures that the dropdownmenus are not shown on pageload */
7
$('#dropdownCodeviewerMenu').hide();
8
$('#dropdownUserMenu').hide();
10
/* Check courses in expanded menu */
11
$('li.dropdownMenuCourseBlockNonActiveCourse').click(function(){
12
$('li.dropdownMenuCourseBlockActiveCourse').addClass('dropdownMenuCourseBlockNonActiveCourse');
13
$('li.dropdownMenuCourseBlockActiveCourse').removeClass('dropdownMenuCourseBlockActiveCourse');
15
$(this).removeClass('dropdownMenuCourseBlockNonActiveCourse');
16
$(this).addClass("dropdownMenuCourseBlockActiveCourse");
17
/*TA BORT DEN ENA KLASSEN OCH ANVÄND TOGGLE*/
10
22
$('#bannerUserMenuButton').click(function(e){
12
$.get('ajax/isLoggedIn', function(response) {
13
if(response == 'yes') {
14
// If the user is logged in and the usermenu-div is hidden it's shown.
15
if($('#dropdownUserMenu').is(':hidden')) {
16
// TODO: Secure that the courseblock-div is hidden when the usermenu-div is oppened.
18
if($('#dropdownMenuCourseBlock').is(':visible')) {
19
$('#dropdownMenuCourseBlock').hide();
21
$('#dropdownUserMenu').load('bannermenu.php #dropdownUserMenu');
23
$('#dropdownUserMenu').show();
25
// If the user is logged in and the usermenu-div is shown it's hidden.
27
$('#dropdownUserMenu').hide();
31
// If the user is not logged in and the popup-div is hidden it's filled and shown.
32
if($('#popup').is(':hidden')) {
33
$('#popup').load('ajax/popup/login', function(){
35
$("#popup .hint").click(loginHint);
38
// If the user is not logged in and the popup-div shows it's hidden.
47
// TODO: Refresh the div with it's php before show.
48
/* Expand and collapse courses in dropdown menu */
49
$('#dropdownMenuExpandCourses').click(function(){
51
// If the course block is collapsed it's expanded.
52
if($('#dropdownMenuCourseBlock').is(':hidden')) {
53
$('#dropdownMenuCourseBlock').show();
55
// If the course block is expanded it's collapsed .
57
$('#dropdownMenuCourseBlock').hide();
b'\\ No newline at end of file'
23
// fetch form through ajax
26
var target = $('#loginPopup');
27
if(target.is(":hidden")){
29
$('#username').focus();
42
/* ROLLES KOD NEDAN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
44
/* TODO: SHOULD OPEN A POPUP VIA AJAX */
45
/* Blurs body and opens password changer */
46
$('li[name="changePwd"]').click(function(e){
48
$('#popoutMenu').stop(false, false).slideUp(300);
50
$('body *').not('#passwordChanger, #passwordChanger *').animate({
52
$('#passwordChanger').fadeIn(300);
53
$('#passwordChanger').css('z-index', 3000);
56
$('body').click(function(e){
57
$('#formContainer').fadeOut(300);
58
$('#passwordChanger').fadeOut(300);
61
$('#changePassword')[0].reset();
64
$('#passwordChanger').click(function(e){
68
$('#formContainer').click(function(e){
72
$('#popoutLink').click(function(e){
74
$('#popoutMenu').stop(false, true).slideDown(300);
77
// FIXA SÅ MENYN INTE KOMMER UPP IGEN
79
else if(popoutMenu==1){
80
$('#popoutMenu').stop(false, false).slideUp(300);
89
/* TODO: Do I need these? */
90
/* Global variables */
92
var expandedCourses=0;
94
window.onkeyup = function(event){
95
if(event.keyCode==27){
96
$('#formContainer').fadeOut(300);
97
$('#passwordChanger').fadeOut(300);
100
$('#changePassword')[0].reset();
104
/* Closing password changer and reactivates body */
105
function cancelPasswordChange(){
106
$('#passwordChanger').fadeOut(300);
107
$('body *').animate({
109
$('#changePassword')[0].reset();
113
/* Expand/Collapse courses in popout menu */
114
function expandCourses(){
115
if(expandedCourses==0){
116
$('#expandedCourses').stop(false, true).slideDown(300);
119
else if(expandedCourses==1){
120
$('#expandedCourses').stop(false, false).slideUp(300);