Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 97 lines (72 sloc) 3.76 kb
7ef6401 @tardate basic functionality
authored
1 = jQuery.addtocal
2
0effb2a @tardate add license and documentation
authored
3 jquery.addtocal is a jQuery UI widget that provides "Add to Calendar" functionality for any website.
4
5 Given event details, it allows users to add the event to any supported calendar system.
6
7 Supported calendar systems:
8 * Google Calendar
9 * Microsoft Live Calendar
10 * Yahoo! Calendar
11 * 30boxes
12 * Any iCal-compatible desktop application
13 * Any vCalendar-compatible desktop application
14
c143255 @tardate update documentation
authored
15 See the {addtocal.htm}[http://github.com/tardate/jquery.addtocalendar/blob/master//addtocal.htm] demo file for
16 an example of how to initialize and use jquery.addtocal.
0effb2a @tardate add license and documentation
authored
17
18 Using jquery.addtocal is simply a matter of initializing the widget, and attaching it to any DOM element that will
19 hold a calendarable event in your application.
20
21 You need to implement one method when initializing jquery.addtocal: getEventDetails( element ).
c143255 @tardate update documentation
authored
22 It is called when a user selects a calendar to add an event to.
23 The element parameter is the jQuery object for the event invoked.
0effb2a @tardate add license and documentation
authored
24 You must return an object packed with the relevant event details.
c143255 @tardate update documentation
authored
25 How you determine the event attributes will depend on your page structure, and whether you are using a standard markup such as
0effb2a @tardate add license and documentation
authored
26 the {hCalendar microformat}[http://microformats.org/wiki/hcalendar].
27
c143255 @tardate update documentation
authored
28 === Widget Initialzation
29 Here's an example of the minimal initialisation require. This example attaches the addtocal widget to all elements with the class 'addtocal'.
30
31 $(document).ready(function() {
32
33 $('.addtocal').AddToCal({
34 // ical and vcal require an ics or vcs file to be served.
35 // Disable these features if reqired (as a result the 30boxes, iCal and vCalendar menu links will not appear)
36 icalEnabled:false,
37 vcalEnabled:false,
38
39 getEventDetails: function( element ) {
40
41 ... [implement whatever is required to parse 'element' into the required event structure] ...
42
43 // return the required event structure
44 return {
45 webcalurl: null,
46 icalurl: null,
47 vcalurl: null,
48 start: start,
49 end: end,
50 title: title,
51 details: details,
52 location: null,
53 url: null
54 };
55 },
56 });
57
58 });
59
60 === Required getEventDetails event structure
61
62 The structure returned from getEventDetails has the following members:
63 * webcalurl: full url to webcal resource (if supported) e.g. webcal://mydomain/events/1.ics
64 * icalurl: full url to iCal resource (if supported) e.g. http://mydomain/events/1.ics
65 * vcalurl: full url to vCalendar resource (if supported) e.g. http://mydomain/events/1.vcs
66 * start: start time of the event (javascript date object)
67 * end: end time of the event (javascript date object)
68 * title: event title text
69 * details: event details text
70 * location: event location text
71 * url: full url to information about the event e.g. http://mydomain/events/1.html
72
73
74
0effb2a @tardate add license and documentation
authored
75 == Source
76 For more information and source files, see the project's {github repository}[http://github.com/tardate/jquery.addtocalendar].
77 Feel free to fork and enhance!
78
79 == Dependencies
80
81 * {jQuery 1.4.x}[http://jquery.com/]
82 * {jQuery UI 1.8.x}[http://jqueryui.com/]
83 * {rfc3339date.js}[http://github.com/tardate/rfc3339date.js]
7ef6401 @tardate basic functionality
authored
84
85 == Copyright
0effb2a @tardate add license and documentation
authored
86 Copyright (c) 2010 Paul GALLAGHER http://tardate.com
7ef6401 @tardate basic functionality
authored
87
0effb2a @tardate add license and documentation
authored
88 Dual licensed under the {MIT}[http://www.opensource.org/licenses/mit-license.php] or
89 {GPL Version 2}[http://www.gnu.org/licenses/gpl.html] licenses.
7ef6401 @tardate basic functionality
authored
90
91 == Other References
92
0effb2a @tardate add license and documentation
authored
93 * {Google Calendar}[http://www.google.com/googlecalendar/event_publisher_guide.html]
94 * {Windows Live Calendar}[http://mailcall.spaces.live.com/blog/cns!CC9301187A51FE33!49778.entry]
95 * {Yahoo!, Google, iCal}[http://davelms.co.uk/2006/09/04/add-to-calendar/]
96 * {hCalendar microformat}[http://microformats.org/wiki/hcalendar]
Something went wrong with that request. Please try again.