/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: elof.bigestans at gmail
  • Date: 2013-05-28 11:22:15 UTC
  • mfrom: (112 lenasys_b)
  • mto: This revision was merged to the branch mainline in revision 113.
  • Revision ID: elof.bigestans@gmail.com-20130528112215-d6qidnvlxm7w29di
* Merged trunk AND
* Modified js/login.js and js/bannermenu.js, specifically functions related to the login popup! 

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/* Functions that run when the page loads */
4
4
$(document).ready(function() {
5
5
 
 
6
        /* Makes the bannermenu scrollable horizontally but not vertically */
 
7
        $('#bannerBody').scrollToFixed();
 
8
 
6
9
        /* Sets the click-function for the usermenubutton */
7
10
        $('#bannerUserMenuButton').click(function(e){
8
11
                
10
13
                        if(response == 'yes') {
11
14
                                // If the user is logged in and the usermenu-div is hidden it's shown.
12
15
                                if($('#dropdownUserMenu').is(':hidden')) {
13
 
                                        // Secure that the courseblock-div is hidden when the usermenu-div is oppened.
 
16
                                        // TODO: Secure that the courseblock-div is hidden when the usermenu-div is oppened.
 
17
                                        /*
14
18
                                        if($('#dropdownMenuCourseBlock').is(':visible')) {
15
19
                                                $('#dropdownMenuCourseBlock').hide();
16
20
                                        }
17
21
                                        $('#dropdownUserMenu').load('bannermenu.php #dropdownUserMenu');
 
22
                                        */
18
23
                                        $('#dropdownUserMenu').show();
19
24
                                }
20
25
                                // If the user is logged in and the usermenu-div is shown it's hidden.
25
30
                        else {
26
31
                                // If the user is not logged in and the popup-div is hidden it's filled and shown.
27
32
                                if($('#popup').is(':hidden')) {
28
 
                                        $('#popup').load('ajax/popup/loginForm #loginForm', function(){
 
33
                                        $('#popup').load('ajax/popup/login', function(){
29
34
                                                $('#popup').show();
 
35
                                                $("#popup .hint").click(loginHint);
30
36
                                        });
31
37
                                }
32
38
                                // If the user is not logged in and the popup-div shows it's hidden.
52
58
                }
53
59
 
54
60
        });
55
 
        
56
 
        
57
 
        /* ROLLES KOD NEDAN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
58
 
        
59
 
        /* TODO: SHOULD OPEN A POPUP VIA AJAX */
60
 
        /* Blurs body and opens password changer */
61
 
        $('li[name="changePwd"]').click(function(e){
62
 
                e.stopPropagation();
63
 
                $('#popoutMenu').stop(false, false).slideUp(300);
64
 
                popoutMenu=0;
65
 
            $('body *').not('#passwordChanger, #passwordChanger *').animate({
66
 
                opacity:0.4}, 400);
67
 
                $('#passwordChanger').fadeIn(300);
68
 
                $('#passwordChanger').css('z-index', 3000);
69
 
        });
70
 
        
71
 
        $('body').click(function(e){
72
 
                $('#formContainer').fadeOut(300);
73
 
                $('#passwordChanger').fadeOut(300);
74
 
                $('body *').animate({
75
 
                opacity:1}, 400);
76
 
                $('#changePassword')[0].reset();
77
 
        });
78
 
        
79
 
        $('#passwordChanger').click(function(e){
80
 
                e.stopPropagation();
81
 
        });
82
 
        
83
 
        $('#formContainer').click(function(e){
84
 
                e.stopPropagation();
85
 
        });
86
 
        
87
 
        $('#popoutLink').click(function(e){
88
 
                if(popoutMenu==0){
89
 
                        $('#popoutMenu').stop(false, true).slideDown(300);
90
 
                        popoutMenu=1;
91
 
                        e.stopPropagation();
92
 
                // FIXA SÅ MENYN INTE KOMMER UPP IGEN
93
 
                }
94
 
                else if(popoutMenu==1){
95
 
                        $('#popoutMenu').stop(false, false).slideUp(300);       
96
 
                        popoutMenu=0;
97
 
                        e.stopPropagation();
98
 
                }
99
 
        });
100
 
        
101
 
        
102
 
});
103
 
 
104
 
/* TODO: Do I need these? */
105
 
/* Global variables */
106
 
var popoutMenu=0;
107
 
var expandedCourses=0;
108
 
 
109
 
window.onkeyup = function(event){
110
 
        if(event.keyCode==27){
111
 
                $('#formContainer').fadeOut(300);
112
 
                $('#passwordChanger').fadeOut(300);
113
 
                $('body *').animate({
114
 
                opacity:1}, 400);
115
 
                $('#changePassword')[0].reset();
116
 
        }
117
 
}
118
 
 
119
 
/* Closing password changer and reactivates body */
120
 
function cancelPasswordChange(){
121
 
        $('#passwordChanger').fadeOut(300);
122
 
        $('body *').animate({
123
 
        opacity:1}, 400);
124
 
        $('#changePassword')[0].reset();
125
 
}
126
 
 
127
 
 
128
 
/* Expand/Collapse courses in popout menu */
129
 
function expandCourses(){
130
 
        if(expandedCourses==0){
131
 
        $('#expandedCourses').stop(false, true).slideDown(300);
132
 
        expandedCourses=1;
133
 
        }
134
 
        else if(expandedCourses==1){
135
 
                $('#expandedCourses').stop(false, false).slideUp(300);  
136
 
                expandedCourses=0;
137
 
        }
138
 
}
139
 
 
 
61
});
 
 
b'\\ No newline at end of file'