Team:TU Delft/header2

From 2010.igem.org

(Difference between revisions)
Line 37: Line 37:
$(function() {
$(function() {
// Initialize history plugin.
// Initialize history plugin.
-
$.history.init(pageload);
+
$.history.init(historyCallback);
rewriteLinks($("#navlist"));
rewriteLinks($("#navlist"));
Line 71: Line 71:
}
}
-
function pageload(hash) {
+
function loadPage(page)
 +
{
 +
var url = wgServer + "/Team:TU_Delft/" +kvmap.page+ "?action=render";
 +
$("#load").fadeOut(200);
 +
$.get(url, function(data) {
 +
$("#load").html(data).fadeIn(200);
 +
rewriteLinks($("#load"));
 +
});
 +
}
 +
 
 +
function historyCallback(hash) {
// hash doesn't contain the first # character.
// hash doesn't contain the first # character.
if(hash) {
if(hash) {
-
    var kvmap = splitHash(hash);
+
if(hash.split('=').length == 0)
-
 
+
loadPage(hash);
-
if (kvmap.url) {
+
else {
-
var url = wgServer + "/Team:TU_Delft/" +kvmap.page+ "?action=render";
+
    var kvmap = splitHash(hash);
-
$("#load").fadeOut(200);
+
if (kvmap.page) loadPage(kvmap.page);
-
$.get(url, function(data) {
+
}  
-
$("#load").html(data).fadeIn(200);
+
-
rewriteLinks($("#load"));
+
-
});
+
-
} else {
+
-
+
-
}
+
} else {
} else {
// start page
// start page

Revision as of 11:48, 22 July 2010