Team:TU Delft/header2
From 2010.igem.org
(Difference between revisions)
Line 46: | Line 46: | ||
function () { $(this).removeClass("hover"); } | function () { $(this).removeClass("hover"); } | ||
); | ); | ||
- | |||
- | |||
- | |||
- | |||
}); | }); | ||
+ | function isDefined(variable) | ||
+ | { | ||
+ | return typeof(window[variable]) != "undefined"; | ||
+ | } | ||
function splitHash(hash) { | function splitHash(hash) { | ||
Line 69: | Line 69: | ||
var url = wgServer + "/Team:TU_Delft/" + page + "?action=render"; | var url = wgServer + "/Team:TU_Delft/" + page + "?action=render"; | ||
$("#load").fadeOut(200); | $("#load").fadeOut(200); | ||
+ | if (isDefined('page_init')) | ||
+ | delete page_init; | ||
+ | |||
$.get(url, function(data) { | $.get(url, function(data) { | ||
- | $("#load").html(data).fadeIn(200); | + | $("#load").html(data).fadeIn(200).queue(function() { |
- | + | if(isDefined('page_init')) page_init(); | |
+ | rewriteLinks($("#load")); | ||
+ | }); | ||
}); | }); | ||
} | } | ||
Line 77: | Line 82: | ||
function historyCallback() { | function historyCallback() { | ||
var hash = location.hash; | var hash = location.hash; | ||
- | |||
if(hash) { | if(hash) { | ||
hash = hash.substring(1); | hash = hash.substring(1); | ||
- | if(hash.split('=').length | + | if(hash.split('=').length > 1) { |
- | + | ||
- | + | ||
- | + | ||
var kvmap = splitHash(hash); | var kvmap = splitHash(hash); | ||
if (kvmap.page) { | if (kvmap.page) { | ||
- | |||
loadPage(kvmap.page); | loadPage(kvmap.page); | ||
} | } | ||
} | } | ||
} else { | } else { | ||
- | + | loadPage('pages/home'); | |
- | + | ||
- | loadPage('pages/home'); | + | |
} | } | ||
} | } |
Revision as of 21:38, 22 July 2010