Team:TU Delft/header2

From 2010.igem.org

(Difference between revisions)
Line 46: Line 46:
function () { $(this).removeClass("hover"); }
function () { $(this).removeClass("hover"); }
);
);
-
 
-
if (console === undefined) {
 
-
console = {log:function(a){}};
 
-
}
 
});
});
 +
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() {
-
rewriteLinks($("#load"));
+
if(isDefined('page_init')) page_init();
 +
rewriteLinks($("#load"));
 +
});
});
});
}
}
Line 77: Line 82:
function historyCallback() {
function historyCallback() {
var hash = location.hash;
var hash = location.hash;
-
console.log('historyCallback: ' + hash);
 
if(hash) {
if(hash) {
hash = hash.substring(1);
hash = hash.substring(1);
-
if(hash.split('=').length == 1) {
+
if(hash.split('=').length > 1) {
-
console.log('load hash as page: ' + hash);
+
-
// loadPage(hash);
+
-
} else {
+
    var kvmap = splitHash(hash);
    var kvmap = splitHash(hash);
if (kvmap.page) {
if (kvmap.page) {
-
console.log('load hashmap.page: ' + kvmap.page);
 
loadPage(kvmap.page);
loadPage(kvmap.page);
}
}
}
}
} else {
} else {
-
// start default page
+
loadPage('pages/home');
-
//$("#load").empty();
+
-
loadPage('pages/home');
+
}
}
}
}

Revision as of 21:38, 22 July 2010