Team:TU Delft/test
From 2010.igem.org
(Difference between revisions)
(11 intermediate revisions not shown) | |||
Line 118: | 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 140: | Line 139: | ||
function moveToAnchor(anchor) { | function moveToAnchor(anchor) { | ||
- | var pos = $('# | + | 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); | ||
+ | } | ||
} | } | ||
Line 209: | Line 212: | ||
} | } | ||
} | } | ||
- | |||
- | |||
function rewriteLinks(elem) { | function rewriteLinks(elem) { | ||
Line 218: | Line 219: | ||
if(this.hash) { | if(this.hash) { | ||
- | + | var anchor = this.hash.substring(1); | |
- | this.href = '#page=' + currentPage + ampersandStr + 'anchor=' + | + | |
+ | if (anchor.substring(0,5)!='page=') | ||
+ | this.href = '#page=' + currentPage + ampersandStr + 'anchor=' + anchor; | ||
} else if(txt != "edit") | } 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 651: | 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> |