Team:TU Delft/header2
From 2010.igem.org
(Difference between revisions)
Line 34: | Line 34: | ||
var activePage = "</html>{{{contentpage|home}}}<html>"; | var activePage = "</html>{{{contentpage|home}}}<html>"; | ||
- | // | + | // Set document ready callback |
$(function() { | $(function() { | ||
- | |||
// Initialize history plugin. | // Initialize history plugin. | ||
$.history.init(pageload); | $.history.init(pageload); | ||
Line 60: | Line 59: | ||
}); | }); | ||
+ | function splitHash(hash) { | ||
+ | var kvpairs = hash.split('&'); | ||
+ | var i; | ||
+ | var kvmap = {}; | ||
+ | for(i=0;i<kvpairs.length;i++) { | ||
+ | var s = kvpairs[i].split('='); | ||
+ | kvmap[s[0]] = s[1]; | ||
+ | } | ||
+ | return kvmap; | ||
+ | } | ||
function pageload(hash) { | function pageload(hash) { | ||
+ | var kvmap = splitHash(hash); | ||
+ | |||
// hash doesn't contain the first # character. | // hash doesn't contain the first # character. | ||
if(hash) { | if(hash) { | ||
var url = wgServer + "/Team:TU_Delft/" +hash+ "?action=render"; | var url = wgServer + "/Team:TU_Delft/" +hash+ "?action=render"; | ||
+ | $("#load").fadeOut(200); | ||
$.get(url, function(data) { | $.get(url, function(data) { | ||
$("#load").html(data).fadeIn(200); | $("#load").html(data).fadeIn(200); | ||
Line 77: | Line 89: | ||
function rewriteLinks(elem) { | function rewriteLinks(elem) { | ||
- | |||
$("a",elem).each(function() { | $("a",elem).each(function() { | ||
- | + | var txt = $(this).text(); | |
- | this.href = this.href.replace("Team:TU_Delft/", wgPageName+ "#"); | + | if(txt != "edit") |
+ | this.href = this.href.replace("Team:TU_Delft/", wgPageName+ "#page="); | ||
}); | }); | ||
- | |||
} | } | ||
Revision as of 10:46, 22 July 2010