Team:Warsaw/JSTest2
From 2008.igem.org
(Difference between revisions)
(17 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
{{WarHead}} | {{WarHead}} | ||
<html> | <html> | ||
+ | <style> | ||
+ | .hidden { display:none; } | ||
+ | .visible {display:block; } | ||
+ | |||
+ | </style> | ||
<h3>Browse by topics</h3> | <h3>Browse by topics</h3> | ||
Line 46: | Line 51: | ||
</form> | </form> | ||
- | <a id="anch">Jump</a> | + | <a id="anch" style="display:none;">Jump</a> |
<div id="progress"></div> | <div id="progress"></div> | ||
- | <div id="result"></div> | + | <div id="result"> </div> |
+ | <br> | ||
+ | <div align="right"><a href="javascript:toggle_dump()">Toggle source</a></div> | ||
+ | <textarea id="dump" readonly="true" class="hidden" style="width:100%;height:400px">core dump</textarea> | ||
+ | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
Line 134: | Line 143: | ||
for (var i=0;i<a_t.length;i++) | for (var i=0;i<a_t.length;i++) | ||
{ | { | ||
- | if (topics[a_t[i]]==undefined)topics[a_t[i]]= | + | if (topics[a_t[i]]==undefined)topics[a_t[i]]=nday+';'; |
- | else topics[a_t[i]]+= | + | else topics[a_t[i]]+=nday+';'; |
} | } | ||
Line 142: | Line 151: | ||
document.getElementById("progress").innerHTML="Done"; | document.getElementById("progress").innerHTML="Done"; | ||
create_links(topics); | create_links(topics); | ||
+ | document.getElementById("dump").value=document.getElementById("result").innerHTML; | ||
return true; | return true; | ||
} | } | ||
Line 194: | Line 204: | ||
function get_topics(ans) | function get_topics(ans) | ||
{ | { | ||
+ | ans=ans.replace(/<h3><\/h3>/gi,""); | ||
var ans_topics=new Array(); | var ans_topics=new Array(); | ||
h3=new RegExp(/<h3.*>(.*)<\/h3>/ig); | h3=new RegExp(/<h3.*>(.*)<\/h3>/ig); | ||
Line 202: | Line 213: | ||
{ | { | ||
var notags=titles[i].split(/(<h3>)|(<\/h3>)/i); | var notags=titles[i].split(/(<h3>)|(<\/h3>)/i); | ||
- | + | if (notags[3]==undefined) var currtitle=removeHTMLTags(notags[0]); | |
- | var currtitle=removeHTMLTags(notags[3]); | + | else var currtitle=removeHTMLTags(notags[3]); |
- | currtitle=trimStr(currtitle.replace( | + | currtitle=trimStr(currtitle.replace(/\+/g,' ')); |
if(currtitle!="") ans_topics.push(currtitle); | if(currtitle!="") ans_topics.push(currtitle); | ||
} | } | ||
Line 215: | Line 226: | ||
for (i in topics) | for (i in topics) | ||
{ | { | ||
- | var | + | |
- | var ans= | + | var d=topics[i]; // another dirty IE hack |
- | for (var j=0;j<days.length;j++) if(days[j]!="") ans+="arg"+j+"="+days[j]+String.fromCharCode(38); | + | //alert (typeof(d)); |
- | ans+="name="+escape(removeHTMLTags(i)); | + | if (typeof(d)=="string") |
- | document.getElementById("result").innerHTML+='<a href="'+ans+'">'+i+"</a><br>"; | + | { |
- | } | + | //if (d.match(/from\ 2008.igem.org/i)==null) continue; |
+ | var days=d.split(';'); | ||
+ | var ans=""; | ||
+ | var num=0; | ||
+ | for (var j=0;j<days.length;j++) | ||
+ | { | ||
+ | if(days[j]!="") ans+="arg"+j+"="+days[j]+String.fromCharCode(38); | ||
+ | else num=j; | ||
+ | } | ||
+ | ans=codebase+"num="+num+String.fromCharCode(38)+ans+"name="+escape(removeHTMLTags(i)); | ||
+ | document.getElementById("result").innerHTML+='<a href="'+ans+'">'+i+"</a><br>\n"; | ||
+ | } | ||
+ | } | ||
} | } | ||
Line 229: | Line 252: | ||
} | } | ||
- | + | var dump_visible=false; | |
- | + | function toggle_dump() | |
- | var | + | { |
- | + | if (dump_visible) | |
- | + | { | |
- | + | document.getElementById("dump").className="hidden"; | |
- | + | dump_visible=false; | |
- | + | } | |
- | + | else | |
- | + | { | |
- | + | document.getElementById("dump").className="visible"; | |
- | + | dump_visible=true; | |
- | document.getElementById(" | + | } |
- | + | } | |
Latest revision as of 15:57, 27 October 2008
Browse by topics |