Team:Cambridge/static/hack splash.js

From 2012.igem.org

Revision as of 09:46, 21 July 2012 by Emmyft (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/*

This file is part of the cambridge 2011 igem team's wiki. nothing is guaranteed.


                   Version 2, December 2004
Copyright (C) 2011 Haydn King hjking734@gmail.com


  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  • /

/*

    • Removes iGEM style content, then pulls in the Cambridge Team's styling & javascript
  • /
var get_login = function()
 {
   var page = $('#menubar.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 head = "<title>Cambridge iGEM</title>" + 
            "<link rel='stylesheet' type='text/css' href='/Team:Cambridge/static/wiki_splash.css?action=raw&ctype=text/css' />";

 var script = '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'; 
 var wiki_js = '/Team:Cambridge/static/wiki_splash.js?action=raw&ctype=text/javascript';
 var intro_js ='/Team:Cambridge/static/introduction_splash.js?action=raw&ctype=text/javascript';
   

$('head').html(head);

$(window).ready(function() {

 var login = get_login();
 $('body').html($('#cam_page'));
 
 //this is ugly, but it makes sure that the JS is loaded in the correct order
 $.getScript(script, function() {
   $.getScript(wiki_js, function() {
     $.getScript(intro_js, function() {
       wiki_main();
     });
   });
 });
 set_bk();
 set_login(login);

});