All pastes #192488 Raw Edit

Miscellany

public javascript v1 · immutable
·published 2006-10-05 23:57 UTC
rendered paste body
function CalendarDay(d){	this.date = new Date(d);	this.events = [];		this.addEvent = CalendarEvent_AddEvent;	this.removeEvent = CalendarEvent_RemoveEvent;	this.createEvent = CalendarEvent_CreateEvent;}function CalendarEvent_AddEvent(id, title, desc, start_time, duration){	this.events.push( new CalendarEvent(id, title, desc, start_time, duration) );}function CalendarEvent_RemoveEvent(id){	var tmp = [], i, len = this.events.length;		for (i = 0; i < len; i++)		if (this.events[i].id != id)			tmp.push( this.events[i] );		this.events = tmp;}function CalendarEvent_CreateEvent(id){	// ajax stuff here to insert event into db and then	// call the addEvent method to add it to the events array}var calendar = [];calendar[0] = new CalendarDay("October 3rd, 2006");calendar[0].addEvent(0, "lunch date", "meet jessica for lunch at cheescake factory", "12pm", "45min");calendar[0].addEvent(1, "pick up the kids from school", "pick up kids and take them to jack in the crack", "3pm", "45min");