Team:RHIT/static/wiki.js

From 2012.igem.org

(Difference between revisions)
Line 1: Line 1:
var get_login = function()
var get_login = function()
-
{
+
{
   var page = $('#login.right-menu').find('#pt-userpage');
   var page = $('#login.right-menu').find('#pt-userpage');
   if(page.length == 0) return undefined;
   if(page.length == 0) return undefined;
   return page.children('a').text();
   return page.children('a').text();
-
}   
+
}   
-
var set_login = function(username)
+
var set_login = function(username)
-
{
+
{
   if(username != undefined)
   if(username != undefined)
   {
   {
Line 16: Line 16:
     $('#logged_in').show();
     $('#logged_in').show();
   }
   }
-
}
+
}
 +
 
 +
var login = get_login();
 +
set_login(login);

Revision as of 14:30, 18 July 2012

var get_login = function() {

  var page = $('#login.right-menu').find('#pt-userpage');
  if(page.length == 0) return undefined;
  return page.children('a').text();

}

var set_login = function(username) {

  if(username != undefined)
  {
    $('#user-link').text(username).attr('href', '/User:' + username);
    $('#edit-link').text('Edit Page');
    $('#edit-intro-link').text('Edit Introduction');
    $('#logged_out').hide();
    $('#logged_in').show();
  }

}

var login = get_login(); set_login(login);