Team:TU Delft/header2

From 2010.igem.org

(Difference between revisions)
 
(43 intermediate revisions not shown)
Line 27: Line 27:
<!-- Internet Explorer PNG fix - END /-->
<!-- Internet Explorer PNG fix - END /-->
-
<!-- Scripting - START /-->
 
-
<script type="text/javascript" src="http://nix.lv/history/jquery.history.js"></script>
 
-
<script type="text/javascript">
 
-
//Global Vars
 
-
var activePage = "</html>{{{contentpage|home}}}<html>";
 
-
 
-
// Set document ready callback
 
-
$(function() {
 
-
// Initialize history plugin.
 
-
$.history.init(pageload);
 
-
 
-
if(activePage == "home") {
 
-
$.history.load("pages/home");
 
-
rewriteLinks($("#load"));
 
-
}
 
-
 
-
// set onlick event for menu buttons
 
-
$("#wrapper a").click(function(){
 
-
var hash = this.href;
 
-
hash = hash.replace(/^.*#/, '');
 
-
$.history.load(hash);
 
-
return false;
 
-
});
 
-
 
-
// setup hovering
 
-
$(".menu_button").hover(
 
-
function () { $(this).addClass("hover"); },
 
-
function () { $(this).removeClass("hover"); }
 
-
);
 
-
});
 
-
 
-
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) {
 
-
// hash doesn't contain the first # character.
 
-
if(hash) {
 
-
    var kvmap = splitHash(hash);
 
-
 
-
if (kvmap.url) {
 
-
var url = wgServer + "/Team:TU_Delft/" +kvmap.page+ "?action=render";
 
-
$("#load").fadeOut(200);
 
-
$.get(url, function(data) {
 
-
$("#load").html(data).fadeIn(200);
 
-
rewriteLinks($("#load"));
 
-
});
 
-
} else {
 
-
 
-
}
 
-
} else {
 
-
// start page
 
-
$("#load").empty();
 
-
}
 
-
}
 
-
 
-
 
-
function rewriteLinks(elem) {
 
-
$("a",elem).each(function() {
 
-
var txt = $(this).text();
 
-
if(txt != "edit")
 
-
this.href = this.href.replace("Team:TU_Delft/", wgPageName+ "#page=");
 
-
});
 
-
}
 
-
 
-
</script>
 
-
 
-
<!-- Scripting - END /-->
 
<!-- Main CSS - START /-->
<!-- Main CSS - START /-->

Latest revision as of 12:56, 24 July 2010