Post by Ross on Sept 16, 2006 13:17:42 GMT -8
What this code does is that it sets the calendar to only show the current days events in the info center. However, due to the way it works it will only apply to new events posted.
<script type="text/javascript">
<!--
/*
Daily Calendar Events
Ross - support.proboards.com
Please do not repost
*/
if(location.href.match(/\.com\/?(index.cgi)?\??(&?action=home)?(#\w+)?$/)) {
var a = document.getElementsByTagName('a');
for(i=0; i<a.length; i++) {
if(a.item(i).href.match(/ion=calendarview/)) {
var today_events = 0;
var date = (new Date()).getDate();
var cal_links = a.item(i).parentNode.getElementsByTagName('a');
for(d=0; d<cal_links.length; d++) {
if(cal_links.item(d).innerHTML.match(new RegExp('#'+ date +'$'))) {
cal_links.item(d).innerHTML = cal_links.item(d).innerHTML.replace(/#\d{2}$/, '');
today_events++;
} else if(cal_links.item(d).innerHTML.match(/#\d{2}$/)) {
cal_links.item(d).style.display = 'none';
if(cal_links.item(d).nextSibling) {
cal_links.item(d).parentNode.removeChild(cal_links.item(d).nextSibling);
}
} else {
today_events++;
}
}
var par_row = a.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
if(today_events == 0) {
par_row.style.display = 'none';
par_row.previousSibling.style.display = 'none';
} else {
par_row.previousSibling.getElementsByTagName('b').item(0).innerHTML = 'Todays Events';
}
break;
}
}
} else if(document.postForm && document.postForm.day) {
document.postForm.subject.maxLength = '47';
document.postForm.onsubmit = function() {
document.postForm.subject.value += '#' + document.postForm.day.value;
return true;
}
} else if(location.href.match(/ion=calendar(view|&|$)/)) {
document.title = document.title.replace(/#\d{2}/, '');
var f = document.getElementsByTagName('font');
for(i=0; i<f.length; i++) {
if(f.item(i).innerHTML.match(/#\d{2}/i)) {
f.item(i).innerHTML = f.item(i).innerHTML.replace(/#\d{2}(<|$)/g, '$1');
}
}
}
//-->
</script>
Main Footer
<script type="text/javascript">
<!--
/*
Daily Calendar Events
Ross - support.proboards.com
Please do not repost
*/
if(location.href.match(/\.com\/?(index.cgi)?\??(&?action=home)?(#\w+)?$/)) {
var a = document.getElementsByTagName('a');
for(i=0; i<a.length; i++) {
if(a.item(i).href.match(/ion=calendarview/)) {
var today_events = 0;
var date = (new Date()).getDate();
var cal_links = a.item(i).parentNode.getElementsByTagName('a');
for(d=0; d<cal_links.length; d++) {
if(cal_links.item(d).innerHTML.match(new RegExp('#'+ date +'$'))) {
cal_links.item(d).innerHTML = cal_links.item(d).innerHTML.replace(/#\d{2}$/, '');
today_events++;
} else if(cal_links.item(d).innerHTML.match(/#\d{2}$/)) {
cal_links.item(d).style.display = 'none';
if(cal_links.item(d).nextSibling) {
cal_links.item(d).parentNode.removeChild(cal_links.item(d).nextSibling);
}
} else {
today_events++;
}
}
var par_row = a.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
if(today_events == 0) {
par_row.style.display = 'none';
par_row.previousSibling.style.display = 'none';
} else {
par_row.previousSibling.getElementsByTagName('b').item(0).innerHTML = 'Todays Events';
}
break;
}
}
} else if(document.postForm && document.postForm.day) {
document.postForm.subject.maxLength = '47';
document.postForm.onsubmit = function() {
document.postForm.subject.value += '#' + document.postForm.day.value;
return true;
}
} else if(location.href.match(/ion=calendar(view|&|$)/)) {
document.title = document.title.replace(/#\d{2}/, '');
var f = document.getElementsByTagName('font');
for(i=0; i<f.length; i++) {
if(f.item(i).innerHTML.match(/#\d{2}/i)) {
f.item(i).innerHTML = f.item(i).innerHTML.replace(/#\d{2}(<|$)/g, '$1');
}
}
}
//-->
</script>
Main Footer