Team:TU Delft
From 2010.igem.org
(Difference between revisions)
Line 60: | Line 60: | ||
// $("#iGEM_TU_Delft_container").html('<iframe src="'+url+'" width="100%" height="100%"></iframe>'); | // $("#iGEM_TU_Delft_container").html('<iframe src="'+url+'" width="100%" height="100%"></iframe>'); | ||
// }); | // }); | ||
+ | |||
} | } | ||
Line 117: | Line 118: | ||
function include_js(file, cb) { | function include_js(file, cb) { | ||
- | + | var html_doc = document.getElementsByTagName('head')[0]; | |
- | + | var js = document.createElement('script'); | |
- | + | js.setAttribute('type', 'text/javascript'); | |
- | + | js.setAttribute('src', file); | |
- | + | html_doc.appendChild(js); | |
- | + | js.onreadystatechange = function () { | |
- | + | if (js.readyState == 'complete') | |
- | + | cb(); | |
- | + | } | |
- | + | ||
- | + | js.onload = cb; | |
} | } | ||
Line 137: | Line 137: | ||
} | } | ||
- | function loadPage(page) | + | |
+ | function moveToAnchor(anchor) { | ||
+ | try { | ||
+ | var pos = $('#iGEM_TU_Delft_container > a[name='+anchor+']').offset(); | ||
+ | dbgout('anchor: '+anchor+'; pos=' + pos.left + ','+pos.top ); | ||
+ | window.scroll(pos.left, pos.top); | ||
+ | } catch (err) { | ||
+ | dbgout('moveToAnchor error: ' + err); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | function loadPage(page, anchor) | ||
{ | { | ||
var showLoadAnim = !!currentPage; | var showLoadAnim = !!currentPage; | ||
currentPage = page; | currentPage = page; | ||
var url = wgServer + "/Team:TU_Delft/" + page + "?action=render"; | var url = wgServer + "/Team:TU_Delft/" + page + "?action=render"; | ||
- | if(page.substring(0, 5) == "User:") { | + | if(page.substring(0, 5) == "User:") { |
- | url = wgServer + "/" + page + "?action=render"; | + | url = wgServer + "/" + page + "?action=render"; |
- | } | + | } |
$(window).trigger('page_close'); | $(window).trigger('page_close'); | ||
Line 159: | Line 171: | ||
$(window).trigger('page_init'); | $(window).trigger('page_init'); | ||
rewriteLinks($("#iGEM_TU_Delft_container")); | rewriteLinks($("#iGEM_TU_Delft_container")); | ||
+ | if (anchor) moveToAnchor(anchor); | ||
updateContentEditLink(); | updateContentEditLink(); | ||
$("#iGEM_TU_Delft_container").fadeTo(200,1); | $("#iGEM_TU_Delft_container").fadeTo(200,1); | ||
Line 189: | Line 202: | ||
if (changepage) { | if (changepage) { | ||
- | loadPage(changepage); | + | loadPage(changepage, kvmap.anchor); |
- | } else | + | } else { |
+ | if(kvmap.anchor) moveToAnchor(kvmap.anchor); | ||
$(window).trigger('hashupdate'); | $(window).trigger('hashupdate'); | ||
+ | } | ||
} | } | ||
} else { | } else { | ||
Line 197: | Line 212: | ||
} | } | ||
} | } | ||
- | |||
function rewriteLinks(elem) { | function rewriteLinks(elem) { | ||
Line 204: | Line 218: | ||
var url = this.href; | var url = this.href; | ||
- | if(this.hash) | + | if(this.hash) { |
- | this. | + | var anchor = this.hash.substring(1); |
- | else if(txt != "edit") | + | |
+ | if (anchor.substring(0,5)!='page=') | ||
+ | this.href = '#page=' + currentPage + ampersandStr + 'anchor=' + anchor; | ||
+ | } else if(txt != "edit") | ||
this.href = this.href.replace("https://2010.igem.org/Team:TU_Delft/", "#page="); | this.href = this.href.replace("https://2010.igem.org/Team:TU_Delft/", "#page="); | ||
- | // | + | // dbgout('rewriting ' + url + ' to ' + this.href); |
}); | }); | ||
} | } | ||
Line 276: | Line 293: | ||
for (count=0;count<(constituentFolders.length);count++) | for (count=0;count<(constituentFolders.length);count++) | ||
{ | { | ||
- | if(constituentFolders[count].substring(0, 5) == "User:") { | + | if(constituentFolders[count].substring(0, 5) == "User:") { |
- | outputStr=outputStr + " <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=Team/'>Team</a> <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=Team/members'>Members</a> <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=" + buildDepth(constituentFolders,count) + constituentFolders[count] + "'>" + capitaliseFirstLetter(constituentFolders[count]).replace(/-/gi," ").substring(5) + "</a>"; | + | outputStr = outputStr + " <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=Team/'>Team</a> <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=Team/members'>Members</a> <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=" + buildDepth(constituentFolders,count) + constituentFolders[count] + "'>" + capitaliseFirstLetter(constituentFolders[count]).replace(/-/gi," ").substring(5) + "</a>"; |
- | } | + | } |
- | if(constituentFolders[count].substring(0, 5) !== "User:") { | + | if(constituentFolders[count].substring(0, 5) !== "User:") { |
outputStr=outputStr + " <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=" + buildDepth(constituentFolders,count) + constituentFolders[count] + "'>" + capitaliseFirstLetter(constituentFolders[count]).replace(/-/gi," ") + "</a>"; | outputStr=outputStr + " <span class='doubleright'>»</span> <a href='https://2010.igem.org/Team:TU_Delft#page=" + buildDepth(constituentFolders,count) + constituentFolders[count] + "'>" + capitaliseFirstLetter(constituentFolders[count]).replace(/-/gi," ") + "</a>"; | ||
- | } | + | } |
} | } | ||
} | } | ||
Line 589: | Line 606: | ||
padding: 3px; | padding: 3px; | ||
} | } | ||
- | |||
#navlist li ul li a:hover { | #navlist li ul li a:hover { | ||
Line 595: | Line 611: | ||
background-color: #54c9f5; | background-color: #54c9f5; | ||
text-decoration: underline; | text-decoration: underline; | ||
- | |||
- | |||
- | |||
- | |||
} | } | ||
Line 642: | Line 654: | ||
<ul id="navlist"> | <ul id="navlist"> | ||
- | <li><a class="menubutton" id="home" href="https://2010.igem.org/Team:TU_Delft | + | <li><a class="menubutton" id="home" href="https://2010.igem.org/Team:TU_Delft/Home" title="Home"><span>Home</span></a></li> |
- | <li><a class="menubutton" id="team" href="https://2010.igem.org/Team:TU_Delft | + | <li><a class="menubutton" id="team" href="https://2010.igem.org/Team:TU_Delft/Team" title="Team"><span>Team</span></a> |
<ul> | <ul> | ||
Line 669: | Line 681: | ||
</ul> | </ul> | ||
</li> | </li> | ||
- | <li><a class="menubutton" id=" | + | <li><a class="menubutton" id="insilico" href="https://2010.igem.org/Team:TU_Delft#page=Notebook" title="Notebook">Notebook</a> |
<ul> | <ul> | ||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Notebook" title="Overview">Overview</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Notebook" title="Overview">Overview</a></li> | ||
Line 687: | Line 699: | ||
</li> | </li> | ||
<li><a class="menubutton" id="insilico" href="https://2010.igem.org/Team:TU_Delft#page=Modeling" title="In Silico">In Silico</a> | <li><a class="menubutton" id="insilico" href="https://2010.igem.org/Team:TU_Delft#page=Modeling" title="In Silico">In Silico</a> | ||
- | <ul | + | <ul> |
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Modeling" title="Overview">Overview</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Modeling" title="Overview">Overview</a></li> | ||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Modeling/MFA" title="MFA">MFA</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Modeling/MFA" title="MFA">MFA</a></li> | ||
Line 733: | Line 745: | ||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration" title="Overview">Overview</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration" title="Overview">Overview</a></li> | ||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/sponsors" title="Sponsors">Sponsors</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/sponsors" title="Sponsors">Sponsors</a></li> | ||
- | |||
- | |||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/igem-teams" title="iGEM Teams">iGEM Teams</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/igem-teams" title="iGEM Teams">iGEM Teams</a></li> | ||
<li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/acknowledgements" title="Acknowledgements">Acknowledgements</a></li> | <li><a href="https://2010.igem.org/Team:TU_Delft#page=Collaboration/acknowledgements" title="Acknowledgements">Acknowledgements</a></li> |