Wednesday June 25, 2003
Added Calendar to Menu
I added a calendar to my "badges" menu on the top left. This is a JavaScript-based calendar that I obtained from Matt Kruse's JavaScript Toolbox. I don't know if I'm satisfied with the green background on the "cal" image, but it'll have to do for now. I've noticed a couple of issues in Safari (too far down and too the right, and doesn't go away like it should), but it seems to work pretty good in IE/Mozilla. I tried disabling dates > today, but couldn't get it to work (yeah, I tried the code from Matt's site).
I don't know if it's worth the effort of talking to Roller's CalendarModel to get the actual days that somethings been posted. However, it would probably be fairly easy to generate a JavaScript array for the current month, rather than an HTML-based <table>.
If you're interested, here's how you can add this sucker to your Roller weblog:
1. Add the following code to the <head> of your template.
<script type="text/javascript" src="pathToScript.js"></script>
<script type="text/javascript">
var cal = new CalendarPopup("calDiv");
cal.setReturnFunction("showDate");
document.write(cal.getStyles());
// Function to get input back from calendar popup
function showDate(y,m,d) {
var day = y+LZ(m)+LZ(d);
location.href = "$ctxPath/page/$userName/" + day;
}
</script>
2. Add an empty, invisible div anywhere w/in the <body> of your template (I put mine at the bottom).
<div id="calDiv"
style="position: absolute; visibility: hidden"></div>
3. Add a link (can contain an image) to invoke the calendar popup.
<a href="?" name="calAnchor" id="calAnchor"
onclick="cal.showCalendar(this.id); return false">
Calendar</a>
You can download the calendar.js file from this site, but please don't link to it - I have enough bandwidth problems as is (and I'm going to move it to a new theme name). Enjoy!
Posted in General
at Jun 25 2003, 09:49:49 PM MDT
2 Comments
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Danman on June 26, 2003 at 01:28 AM MDT #
Posted by Matt Raible on June 26, 2003 at 05:06 AM MDT #