diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index d271308..975f992 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,7 @@ +== 0.1.2 released 2013-01-08 + +* Truncate details to avoid 414 error on Google Calendar site (thanks to woodchuck) + == 0.1.1 released 2011-03-20 * Patch for javascript compatibility in older IE (thanks to nfarina) diff --git a/README.rdoc b/README.rdoc index 6ecfc64..0e953c4 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,4 +1,4 @@ -= jQuery UI AddToCal widget v0.1.0 += jQuery UI AddToCal widget v0.1.2 AddToCal is a jQuery UI widget that provides "Add to Calendar" functionality for any website. Given event details, it allows users to add the event to any supported calendar system. diff --git a/addtocal.htm b/addtocal.htm index 5837a74..61190e8 100644 --- a/addtocal.htm +++ b/addtocal.htm @@ -7,7 +7,7 @@ @@ -49,29 +49,29 @@

jQuery UI AddToCal Widget Demo

-

This demonstrates the basic add-to-calendar function. +

This demonstrates the basic add-to-calendar function. For more information and source files, see the project's github repository.

- +
Basic event holder (click me)
- +
hCalendar annotated event
8th Aug 2010 7-8am UTC
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Sed quam sem, tincidunt sit amet blandit vitae, vehicula sit amet sem. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Sed quam sem, tincidunt sit amet blandit vitae, vehicula sit amet sem. Quisque aliquam commodo lorem vel facilisis. (click me)
- +
- + diff --git a/jquery.addtocal.js b/jquery.addtocal.js index a7e6195..eca6500 100644 --- a/jquery.addtocal.js +++ b/jquery.addtocal.js @@ -1,5 +1,5 @@ /* - * jQuery.addtocal v0.1.1 + * jQuery.addtocal v0.1.2 * http://github.com/tardate/jquery.addtocalendar * * Copyright (c) 2010 Paul GALLAGHER http://tardate.com @@ -9,11 +9,11 @@ */ (function($) { - + $.widget("tardate.AddToCal", { options: { - + /* * calendars is a collection of all the supported calendars and the method for formating * the calendar link in each case. If you want to use a calendar system not supported here, you can @@ -71,12 +71,12 @@ return ( eventDetails.vcalurl ? eventDetails.vcalurl : null ); } } ], - + /* icalEnabled: set if iCal links are to be supported (requires you to provide an iCal format resource) */ icalEnabled: true, /* vcalEnabled: set if vCalendar links are to be supported (requires you to provide an vCalendar format resource) */ vcalEnabled: true, - + /* getEventDetails is the most critical function to provide. * It is called when a user selects a calendar to add an event to. * The element parameter is the jQuery object for the event invoked. @@ -94,8 +94,8 @@ title: null, details: null, location: null, url: null}; }, - - + + /* * sanitizeEventDetails cleans up and normalises the event details provided by getEventDetails */ @@ -117,7 +117,7 @@ eventDetails.url = ( eventDetails.url ? encodeURIComponent( eventDetails.url ) : '' ); return eventDetails; }, - + /* records the currently selected calendar service */ selectedCalendarTarget: null, /* positioning of the addtocal widget */ @@ -127,7 +127,7 @@ at: "left bottom", collision: "none" }, - + /* main method called on selection of calendar service */ select: function(event, ui) { var eventDetails = ui.sanitizeEventDetails( ui.getEventDetails($(this)) ); @@ -138,9 +138,9 @@ if(link) window.open(link); } }, - + source:[], - + _create: function() { var self = this, doc = this.element[ 0 ].ownerDocument; @@ -160,7 +160,7 @@ selected: function( event, ui ) { var item = ui.item.data( "item.addtocal" ), previous = self.previous; - + // only trigger when focus was lost (click on menu) if ( self.element[0] !== doc.activeElement ) { self.element.focus(); @@ -168,7 +168,7 @@ } self.options.selectedCalendarTarget = item.value; self._trigger( "select", event, self.options ); - + self.close( event ); self.selectedItem = item; } @@ -177,30 +177,30 @@ .css({ top: 0, left: 0 }) .hide() .data( "menu" ); - + if ( $.fn.bgiframe ) { this.menu.element.bgiframe(); } - + //Close the popup if click elsewhere in the window $(document).bind("click", function(event, ui) { self.close( event ); }); - + }, - + destroy: function() { this.element .removeClass( "ui-addtocal" ); this.menu.element.remove(); $.Widget.prototype.destroy.call( this ); }, - + _setOption: function( key, value ) { $.Widget.prototype._setOption.apply( this, arguments ); if ( key === "appendTo" ) { this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) } }, - + _initSource: function() { var self = this; self.source=[]; @@ -208,7 +208,7 @@ if(value.enabled(self)) self.source.push( {value: value.value, label: value.label } ); }); }, - + toggleMenu: function( event ) { var content = this.source; if ( content.length && ! ( this.menu.element.is(":visible") ) ) { @@ -220,7 +220,7 @@ this.close(); } }, - + close: function( event ) { clearTimeout( this.closing ); if ( this.menu.element.is(":visible") ) { @@ -229,7 +229,7 @@ this.menu.deactivate(); } }, - + _normalize: function( items ) { // assume all items have the right format when the first item is complete if ( items.length && items[0].label && items[0].value ) { @@ -248,7 +248,7 @@ }, item ); }); }, - + _suggest: function( items ) { var ul = this.menu.element .empty() @@ -262,30 +262,30 @@ this.menu.element.show().position( $.extend({ of: this.element }, this.options.position )); - + menuWidth = ul.width( "" ).outerWidth(); textWidth = this.element.outerWidth(); ul.outerWidth( Math.max( menuWidth, textWidth ) ); }, - + _renderMenu: function( ul, items ) { var self = this; $.each( items, function( index, item ) { self._renderItem( ul, item ); }); }, - + _renderItem: function( ul, item) { return $( "
  • " ) .data( "item.addtocal", item ) .append( $( "" ).text( item.label ) ) .appendTo( ul ); }, - + widget: function() { return this.menu.element; } - + }); }(jQuery));