Team:Warsaw/JSTest2

.hidden { display:none; } .visible {display:block; }

Browse by topics  

Jump Toggle source core dump



/* <![CDATA[ */

function removeHTMLTags(strInputCode ){ strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){			return (p1 == "lt")? "<" : ">";		}); var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, ""); return strTagStrippedText; }

var codebase="http://2009.igem.org/wiki/index.php?title=Team:Warsaw/JSTest"+String.fromCharCode(38);

var months=['January','February','March','April','May','June','July','August','September','October','November','December'];

var adresbase='http://2009.igem.org/Team:Warsaw/Calendar-Main/';

Array.prototype.indexOf = function( v, b, s ) { for( var i = +b || 0, l = this.length; i < l; i++ ) { if( this[i]===v || s ) if ( this[i]==v ) { return i; } } return -1; };

function longmonth(mon) { var long=['May','July','August','October']; if (long.indexOf(mon,0,false)>=0) return true; return false; }

function nextday(date) { date=date.replace(' ','_'); date=date.replace(' ','_'); var date_array=date.split('_'); var d=parseInt(date_array[0]); var m=date_array[1]; //var y="2009"; var y=parseInt(date_array[2]); var next_day;

if (d+1<31) { next_day=(d+1)+'_'+m+'_'+y; } else { var next_month=months[(parseInt(months.indexOf(m,0,false))+1)]; next_day='1'+'_'+next_month+'_'+y; } if (longmonth(m)) if((d+1)==31) { next_day=(d+1)+'_'+m+'_'+y; }

return next_day; }

var eday="empty"; eday=eday.replace("y","yday");

var topics=new Array; function find_topics(day,end_day) {

var nday=nextday(day);

document.getElementById("progress").innerHTML="Processing: "+day;

if (window.XMLHttpRequest) { // Mozilla, Safari, Opera ... var req = new XMLHttpRequest; } else if (window.ActiveXObject) { // IE  var req = new ActiveXObject("Microsoft.XMLHTTP"); } var ans;

if (window.overrideMimeType) req.overrideMimeType('text/xml'); req.onreadystatechange = function { //początek wewnętrznej funkcji if (req.readyState == 4) { if (req.status == 200) { ans=req.responseText; if(ans.search(eday)<0) {               var a_t=get_topics(ans); for (var i=0;i<a_t.length;i++) {                 if (topics[a_t[i]]==undefined)topics[a_t[i]]=nday+';'; else topics[a_t[i]]+=nday+';';

}               }                if (day==end_day) { document.getElementById("progress").innerHTML="Done"; create_links(topics); document.getElementById("dump").value=document.getElementById("result").innerHTML; return true; }               else { find_topics(nday,end_day); } } }

}; //koniec wewnętrznej funkcji

req.open('GET', adresbase+nday, true); req.send(null); }

function analyze { var start_day=parseInt(document.params.start_day.value); var start_month=document.params.start_month.value; var start_year=parseInt(document.params.start_year.value); var end_day=parseInt(document.params.end_day.value); var end_month=document.params.end_month.value; var end_year=parseInt(document.params.end_year.value);

if (start_day>0) if (start_day<32) var start_date=start_day+'_'+start_month+'_'+start_year; else { document.getElementById("progress").innerHTML="Start day error" return; } if (end_day>0) if (end_day<32) var end_date=end_day+'_'+end_month+'_'+end_year; else { document.getElementById("progress").innerHTML="End day error" return; }

if (start_month==end_month) if(end_day/gi,""); var ans_topics=new Array; h3=new RegExp(/(.*)<\/h3>/ig); var titles=ans.match(h3); for (var i=0;i0) { var notags=titles[i].split(/|(<\/h3>)/i); if (notags[3]==undefined) var currtitle=removeHTMLTags(notags[0]); else var currtitle=removeHTMLTags(notags[3]); currtitle=trimStr(currtitle.replace('[edit]','')); currtitle=trimStr(currtitle.replace(/\+/g,' ')); if(currtitle!="") ans_topics.push(currtitle); } } return ans_topics; }

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\ 2009.igem.org/i)==null) continue; var days=d.split(';'); var ans=""; var num=0; for (var j=0;j'+i+" \n"; } } }

function and(cond1,cond2) { if (cond1==true) if (cond2==true) return true; return false; }

var dump_visible=false; function toggle_dump { if (dump_visible) { document.getElementById("dump").className="hidden"; dump_visible=false; } else { document.getElementById("dump").className="visible"; dump_visible=true; } }

/* ]]> */