/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-24 14:31:28 UTC
  • mfrom: (90.1.8 lenasys2)
  • Revision ID: gustav.hartvigsson@gmail.com-20130524143128-66hnjkl0cy1rgkgr
Merged Jonsson:s changes so you can display the login box.

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
 
        /* Secures that the dropdownmenus are not shown on pageload */
7
 
        $('#bannerContentExample').hide();
8
 
        $('#dropdownCodeviewerMenu').hide();
9
 
        $('#dropdownUserMenu').hide();
10
 
        $('#popup').hide();
11
 
 
12
 
        /* TODO: ??? */
 
6
        /* Sets the click-function for the usermenubutton */
13
7
        $('#bannerUserMenuButton').click(function(e){
14
 
                $('#popup').load('ajax/popup/loginForm #loginForm');
15
 
                $('#popup').show();
 
8
                
 
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
                                        $('#dropdownUserMenu').show();
 
14
                                }
 
15
                                // If the user is logged in and the usermenu-div is shown it's hidden.
 
16
                                else {
 
17
                                        $('#dropdownUserMenu').hide();
 
18
                                }
 
19
                        }
 
20
                        else {
 
21
                                // If the user is not logged in and the popup-div is hidden it's filled and shown.
 
22
                                if($('#popup').is(':hidden')) {
 
23
                                        $('#popup').load('ajax/popup/loginForm #loginForm', function(){
 
24
                                                $('#popup').show();
 
25
                                        });
 
26
                                }
 
27
                                // If the user is not logged in and the popup-div shows it's hidden.
 
28
                                else {
 
29
                                        $('#popup').hide();
 
30
                                }
 
31
                        }
 
32
                });
 
33
        
 
34
                
 
35
                
16
36
                
17
37
 
18
38
                /*var target = $('#loginPopup');