Team:Uppsala/notebook
From 2013.igem.org
(Difference between revisions)
Line 116: | Line 116: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
+ | |||
var month = new Date().getMonth(); | var month = new Date().getMonth(); | ||
var year = new Date().getFullYear(); | var year = new Date().getFullYear(); | ||
- | var cal_table = ''; | + | var cal_table = ''; |
- | var eventString | + | var eventString; |
- | + | ||
var days_with_dirys = new Array('t2013630', 't201371', 't201372', 't201381', 't2013919'); | var days_with_dirys = new Array('t2013630', 't201371', 't201372', 't201381', 't2013919'); | ||
- | var inputs = | + | var inputs = 10; |
- | + | var days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31); | |
+ | |||
+ | /*getWeek() will calculate current week nr*/ | ||
Date.prototype.getWeek = function() | Date.prototype.getWeek = function() | ||
{ | { | ||
Line 130: | Line 132: | ||
} | } | ||
- | function | + | /*writes/rewrites the calculator string */ |
+ | function calendar_normal() | ||
{ | { | ||
var m = month+1; | var m = month+1; | ||
Line 136: | Line 139: | ||
var today = date.getDate(); | var today = date.getDate(); | ||
cal_table = ''; | cal_table = ''; | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
if(year<=200) | if(year<=200) | ||
{ | { | ||
Line 148: | Line 148: | ||
days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31); | days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31); | ||
- | if(year%4 == 0) | + | if(year%4 == 0 && year!=1900) |
{ | { | ||
- | |||
- | |||
days_in_month[1]=29; | days_in_month[1]=29; | ||
- | + | } | |
- | + | ||
total = days_in_month[month]; | total = days_in_month[month]; | ||
var date_today = months[month]+' '+year; | var date_today = months[month]+' '+year; | ||
- | cal_table = cal_table + '<table class="cal_calendar" ><tbody id="cal_body"><tr class="head"><th class="arrow"> <input id="left" type="image" onclick="left_arrow()" src="https://static.igem.org/mediawiki/2013/a/a1/Arrowleft.png"></th><th colspan="6" >'+date_today+'</th><th class="arrow"><input id="right" type="image" onclick="right_arrow()" src="https://static.igem.org/mediawiki/2013/0/0b/Arrowright.png"></th></tr>'; | + | cal_table = cal_table + '<table class="cal_calendar" ><tbody id="cal_body"><tr class="head"><th class="arrow"><input id="left" type="image" onclick="left_arrow()" src="https://static.igem.org/mediawiki/2013/a/a1/Arrowleft.png"></th><th colspan="6" >'+date_today+'</th><th class="arrow"><input id="right" type="image" onclick="right_arrow()" src="https://static.igem.org/mediawiki/2013/0/0b/Arrowright.png"></th></tr>'; |
cal_table = cal_table + '<tr class="cal_d_weeks"><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th><th>Week</th></tr><tr>'; | cal_table = cal_table + '<tr class="cal_d_weeks"><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th><th>Week</th></tr><tr>'; | ||
week = 0; | week = 0; | ||
Line 173: | Line 171: | ||
for(i=1;i<=total;i++) | for(i=1;i<=total;i++) | ||
{ | { | ||
- | if(week==0) | + | if(week===0) |
{ | { | ||
cal_table = cal_table + '<tr>'; | cal_table = cal_table + '<tr>'; | ||
} | } | ||
- | + | if(year == date.getFullYear()) | |
{ | { | ||
if(month == date.getMonth()){ | if(month == date.getMonth()){ | ||
Line 197: | Line 195: | ||
cal_table = cal_table +'<td id="'+'t'+year+m+i+'" class="not_today"><input type="submit" onclick="showNotes(year, month, value)" value="'+i+'"></td>'; | cal_table = cal_table +'<td id="'+'t'+year+m+i+'" class="not_today"><input type="submit" onclick="showNotes(year, month, value)" value="'+i+'"></td>'; | ||
} | } | ||
- | + | ||
- | + | week++; | |
markerNotes(year, m, i); | markerNotes(year, m, i); | ||
if(week==7) | if(week==7) | ||
Line 233: | Line 231: | ||
} | } | ||
- | + | function left_arrow() | |
- | function left_arrow() | + | |
{ | { | ||
month = month-1; | month = month-1; | ||
if(month == -1) | if(month == -1) | ||
{ | { | ||
- | year = year-1; | + | year = year - 1; |
month = 11; | month = 11; | ||
} | } | ||
- | + | calendar_normal(); | |
document.getElementById('calendar').innerHTML = cal_table; | document.getElementById('calendar').innerHTML = cal_table; | ||
} | } | ||
Line 251: | Line 248: | ||
if(month == 12) | if(month == 12) | ||
{ | { | ||
- | year = year+1; | + | year = year +1; |
month = 0; | month = 0; | ||
} | } | ||
- | + | calendar_normal(); | |
document.getElementById('calendar').innerHTML = cal_table; | document.getElementById('calendar').innerHTML = cal_table; | ||
} | } | ||
Line 265: | Line 262: | ||
document.getElementById('file_holder').innerHTML = eventString; | document.getElementById('file_holder').innerHTML = eventString; | ||
} | } | ||
- | + | ||
- | + | function showNotesOfweek(y, wnr) | |
- | function showNotesOfweek(y, wnr) | + | |
{ | { | ||
- | var d = new Date(y, 0, 0); | + | var d = new Date(y,0,0); |
if(y == 2012 ){ | if(y == 2012 ){ | ||
- | + | wnr++; | |
- | + | } | |
- | var w = d.getTime() + 604800000 * (wnr-1); | + | var w = d.getTime() + 604800000 * (wnr-1); |
var m = new Date(w).getMonth()+1; | var m = new Date(w).getMonth()+1; | ||
var y = new Date(w).getFullYear(); | var y = new Date(w).getFullYear(); | ||
Line 304: | Line 300: | ||
eventString = ''; | eventString = ''; | ||
} | } | ||
+ | |||
function markerNotes(y, m, d) | function markerNotes(y, m, d) | ||
{ | { | ||
Line 357: | Line 354: | ||
ds = '<h1>Uppsala IGEM team´s awesome synbioday at 12.15 to 17.00</h1>'; | ds = '<h1>Uppsala IGEM team´s awesome synbioday at 12.15 to 17.00</h1>'; | ||
} | } | ||
- | |||
else | else | ||
{ | { | ||
Line 374: | Line 370: | ||
document.getElementById(id).innerHTML = ds; | document.getElementById(id).innerHTML = ds; | ||
} | } | ||
+ | |||
</script> | </script> |
Revision as of 14:49, 9 September 2013