blob: 5d17e02dbfcf046dab53c0d5324afe381113728f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
$(document).ready(function(){
// Show profile link instead of login if user is logged in
var email = $.cookie(Botleagues.cookie_login_email);
if (typeof email != 'undefined' && $.cookie(Botleagues.cookie_login_valid_till) > (new Date()).getTime()) {
setupLoginMenu();
}
});
function setupLoginMenu() {
$('#nav .login-link').remove();
var extra_links = {'Leagues': '/leagues', 'My Bots': '/profile/bots', 'Profile': '/profile', 'Logout': '/logout'};
for (var text in extra_links) {
var li = $('<li>').append(
$('<a>')
.attr('role', 'presentation')
.attr('title', text)
.attr('href', extra_links[text])
.text(text));
if (extra_links[text] == selected_page) { // selected_page is added in layout-main.jade
li.addClass('active');
}
li.appendTo($('#nav'));
}
}
|