Agenda bookmarklet
A ten minute hack to fix a ten second problem, linking to working group agendas and minutes.
In typical programmer fashion, I spent ten minutes last night crafting a solution to a problem that takes ten seconds by hand. But in the long run, I'll be ahead, right?
Several times a week, I go looking for
the most recent agenda for a working group, and often the most recent
minutes as well. For some working groups, XProc for example, the
pattern for these links is entirely predictable:
“http://www.w3.org/XML/XProc/
”.YEAR
/MONTH
/DAY
-agenda
So I go into the address bar and start typing. Eventually, I find it in the drop down or I get to the end of the string. Either way, it's tedious and I'm doing something the computer could do for me.
Thus are born the agenda and minutes bookmarklets.
The “agenda” link takes you to the agenda for next week's meeting; the “minutes” link takes you to the minutes for the last week's meeting. Depending on the day of the week, one or the other might not exist yet, though both do today (9 May 2008).
In case you're curious, here's the code for the business end of the agenda link, before it's obfuscated into a URI:
function nw(base,suffix,weekday) {
var today = new Date();
var dayms = 3600 * 24 * 1000;
var dow = today.getDay();
var date = new Date();
var offset = today.valueOf() - (dow * dayms) + (weekday * dayms);
if (weekday < dow) {
offset += 7 * dayms;
}
date.setTime(offset);
var uri = base + "/" + date.getFullYear() + "/";
if (date.getMonth() < 9) {
uri += "0";
}
uri += (date.getMonth()+1) + "/";
if (date.getDate() < 10) {
uri += "0";
}
uri += date.getDate() + "-" + suffix + ".html";
document.location = uri;
}
Calling “nw('http://www.w3.org/XML/XProc','agenda',4)
”
takes you to the agenda for the XProc call,
“nw('http://www.w3.org/2001/tag','agenda',4)
” takes you to
the agenda for the TAG call (both of which happen to be on Thursday, day 4),
etc. Putting the whole prefix in an argument
simplifies constructing a bookmarklet for the local copies of agendas and
minutes on my laptop.
Converting the nw
function for agendas into the
lw
function for minutes is an exercise left to the
reader. You can avoid the tedious process of obfuscation by simply copying
the links above.
Comments
Hi Norman,
Cool Bookmarklet.
the ".html" in the uri is not necessary btw.