Team:Warsaw/JSTest2
From 2008.igem.org
(Difference between revisions)
(14 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 49: | Line 54: | ||
<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 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(/\+/g,' ')); | 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 |
- | var num=0; | + | //alert (typeof(d)); |
- | for (var j=0;j<days.length;j++) | + | if (typeof(d)=="string") |
- | { | + | { |
- | if(days[j]!="") ans+="arg"+j+"="+days[j]+String.fromCharCode(38); | + | //if (d.match(/from\ 2008.igem.org/i)==null) continue; |
- | else num=j; | + | var days=d.split(';'); |
- | } | + | var ans=""; |
- | ans=codebase+"num="+num+String.fromCharCode(38)+ans+"name="+escape(removeHTMLTags(i)); | + | var num=0; |
- | document.getElementById("result").innerHTML+='<a href="'+ans+'">'+i+"</a><br>"; | + | 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 234: | 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 |