/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/bannermenu.js

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-17 15:27:18 UTC
  • mfrom: (67.1.6 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130517152718-jciwc9blgxj0nch1
Merged the changes from Jonsson's chages to the banner menu and chages to
the login screen to use it.

Show diffs side-by-side

added added

removed removed

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