aboutsummaryrefslogtreecommitdiff
path: root/src/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/main.js')
-rw-r--r--src/js/main.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/js/main.js b/src/js/main.js
index 4444273..1f869c4 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -1,21 +1,25 @@
$(document).ready(function(){
// Show profile link instead of login if user is logged in
- var email = $.cookie(BotleaguesFrontend.cookie_login_email);
- if (typeof email != 'undefined' && $.cookie(BotleaguesFrontend.cookie_login_valid_till) > (new Date()).getTime()) {
- setupLoginMenu(email);
+ var email = $.cookie(Botleagues.cookie_login_email);
+ if (typeof email != 'undefined' && $.cookie(Botleagues.cookie_login_valid_till) > (new Date()).getTime()) {
+ setupLoginMenu();
}
});
-function setupLoginMenu(email) {
+function setupLoginMenu() {
$('#nav .login-link').remove();
- $('<li>').append(
- $('<a>')
- .attr('role', 'presentation')
- .attr('title', 'User profile')
- .attr('href', '/profile')
- .text(email))
- .appendTo($('#nav'));
+
+ if ($('#nav').find('[href="/profile"]').length == 0) {
+ $('<li>').append(
+ $('<a>')
+ .attr('role', 'presentation')
+ .attr('title', 'User profile')
+ .attr('href', '/profile')
+ .text('Profile'))
+ .appendTo($('#nav'));
+ }
+
$('<li>').append(
$('<a>')
.attr('role', 'presentation')