rem: function copyToClipboard() { var calendarEvent = gCalendarWindow.EventSelection.selectedEvents[0]; if(!calendarEvent) 
add: function copyToClipboard( calendarEventArray ) { if( !calendarEventArray) var calendarEventArray = gCalendarWindow.EventSelection.selectedEvents;  if(calendarEventArray.length == 0) 
context: function copyToClipboard(){   var calendarEvent = gCalendarWindow.EventSelection.selectedEvents[0];   if(!calendarEvent)      alert("No events selected");   var sTextiCalendar = calendarEvent.getIcalString();      // Create a second ical data string for manipulation to export patched iCalendar to outlook.   var sTextiCalendarPatched = sTextiCalendar;      // TODO HACK: Remove this hack when Calendar supports METHOD properties   var i = sTextiCalendarPatched.indexOf("METHOD")   if(i = -1)    {      var i = sTextiCalendarPatched.indexOf("VERSION")      if(i != -1) {         sTextiCalendarPatched =             sTextiCalendarPatched.substring(0,i) + "METHOD:PUBLISH\n" + sTextiCalendarPatched.substring(i, sTextiCalendarPatched.length);      }   }      // TODO HACK: Remove this hack when Calendar supports DTSTAMP properties   var i = sTextiCalendarPatched.indexOf("DTSTAMP")   if(i = -1)    {      var i = sTextiCalendarPatched.indexOf("UID")      if(i != -1) {         sTextiCalendarPatched =             sTextiCalendarPatched.substring(0,i) + "DTSTAMP:20020430T114937Z\n" + sTextiCalendarPatched.substring(i, sTextiCalendarPatched.length);      }   }      // HACK: TRIGGER patch hack for Outlook 2000   var i = sTextiCalendarPatched.indexOf("TRIGGER\n ;VALUE=DURATION\n :-");   if(i != -1) {      sTextiCalendarPatched =         sTextiCalendarPatched.substring(0,i+27) + sTextiCalendarPatched.substring(i+28, sTextiCalendarPatched.length);   }    var sTextHTML = eventToHTML( calendarEvent );    // 1. get the clipboard service   var clipboard = getClipboard();   // 2. create the transferable   var trans = createTransferable();    if ( trans && clipboard) {                           // 3. register the data flavors      trans.addDataFlavor("text/calendar");      trans.addDataFlavor("text/unicode");      trans.addDataFlavor("text/html");                           // 4. create the data objects      var icalWrapper = createSupportsWString();      var textWrapper = createSupportsWString();      var htmlWrapper = createSupportsWString();                           if ( icalWrapper && textWrapper && htmlWrapper ) {         // get the data         icalWrapper.data = sTextiCalendar;        // plainTextRepresentation;         textWrapper.data = sTextiCalendarPatched; // plainTextRepresentation;         htmlWrapper.data = sTextHTML;             // htmlRepresentation;                              // 5. add data objects to transferable         // Both Outlook 2000 client and Lotus Organizer use text/unicode when pasting iCalendar data         trans.setTransferData ( "text/calendar", icalWrapper, icalWrapper.data.length*2 ); // double byte data         trans.setTransferData ( "text/unicode", textWrapper, textWrapper.data.length*2 );         trans.setTransferData ( "text/html", htmlWrapper, htmlWrapper.data.length*2 );                     clipboard.setData( trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard );      }             }   }
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/5db62cc0e05b24b4c91aee6d9a96246990a55f30/calendarClipboard.js/clean/calendar/resources/content/calendarClipboard.js