Team:Warsaw/JSTest2
From 2008.igem.org
(Difference between revisions)
(19 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
{{WarHead}} | {{WarHead}} | ||
<html> | <html> | ||
+ | <style> | ||
+ | .hidden { display:none; } | ||
+ | .visible {display:block; } | ||
- | <h3> | + | </style> |
+ | |||
+ | <h3>Browse by topics</h3> | ||
<form name="params" action="JavaScript:analyze()"> | <form name="params" action="JavaScript:analyze()"> | ||
<table class="month" width="100%"> | <table class="month" width="100%"> | ||
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> | ||
+ | <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 108: | Line 117: | ||
eday=eday.replace("y","yday"); | eday=eday.replace("y","yday"); | ||
- | |||
+ | var topics=new Array(); | ||
function find_topics(day,end_day) | function find_topics(day,end_day) | ||
{ | { | ||
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 141: | Line 150: | ||
if (day==end_day) { | if (day==end_day) { | ||
document.getElementById("progress").innerHTML="Done"; | document.getElementById("progress").innerHTML="Done"; | ||
- | + | 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,' ')); |
- | ans_topics.push(currtitle); | + | if(currtitle!="") ans_topics.push(currtitle); |
} | } | ||
} | } | ||
Line 211: | Line 222: | ||
} | } | ||
+ | function create_links(topics) | ||
+ | { | ||
+ | for (i in topics) | ||
+ | { | ||
+ | |||
+ | var d=topics[i]; // another dirty IE hack | ||
+ | //alert (typeof(d)); | ||
+ | if (typeof(d)=="string") | ||
+ | { | ||
+ | //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"; | ||
+ | } | ||
+ | } | ||
+ | } | ||
function and(cond1,cond2) | function and(cond1,cond2) | ||
Line 218: | 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 |