Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar icons #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions jquery.addtocal.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


.ui-addtocal {
cursor:pointer;cursor:hand;
}
Expand All @@ -8,3 +6,32 @@ ul.ui-addtocal {
cursor:default;
position:absolute;
}

.addtocal:hover {
text-decoration: underline;
cursor:pointer;cursor:hand;
}

.addtocal .summary,
.addtocal .dtstart,
.addtocal .dtend,
.addtocal .description,
.addtocal .location,
.addtocal .icalurl,
.addtocal .vcalurl,
.addtocal .webcalurl,
.addtocal .url {
display:none;
}

.ui-addtocal .ui-menu-item {
cursor:pointer;cursor:hand;
}

.ui-addtocal .ui-menu-item img {
padding-right:5px;
max-height: 16px;
max-width: 16px;
height: expression(this.height >= this.width && this.height > 16 ? 16 : true);
width: expression(this.height < this.width && this.width > 16 ? 16 : true);
}
22 changes: 18 additions & 4 deletions jquery.addtocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
calendars : [
{value: 1,
label:"Add to Google Calendar",
//icon:"src/icon_google.png",
enabled : function(addtocal) { return true; },
formatlink : function(eventDetails) {
return "http://www.google.com/calendar/event?action=TEMPLATE&trp=false" +
Expand All @@ -33,6 +34,7 @@
"&sprop=" + eventDetails.url;
} },
{value: 2, label:"Add to Live Calendar",
icon:"src/icon_msnlive.png",
enabled : function(addtocal) { return true; },
formatlink : function(eventDetails) {
return "http://calendar.live.com/calendar/calendar.aspx?rru=addevent" +
Expand All @@ -42,6 +44,7 @@
"&location=" + eventDetails.location;
} },
{value: 3, label:"Add to Yahoo! Calendar",
icon:"src/icon_yahoo.png",
enabled : function(addtocal) { return true; },
formatlink : function(eventDetails) {
var minsDuration = ( Date.parse(eventDetails.end) - Date.parse(eventDetails.start) ) / 60 / 1000;
Expand All @@ -55,20 +58,29 @@
"&URL=" + eventDetails.url;
} },
{value: 4, label:"Add to 30boxes",
icon:"src/icon_30boxes.png",
enabled : function(addtocal) { return addtocal.options.icalEnabled; },
formatlink : function(eventDetails) {
return ( eventDetails.webcalurl ?
"http://30boxes.com/add.php?webcal=" + encodeURIComponent( eventDetails.webcalurl ) : null );
} },
{value: 5, label:"iCal",
icon:"src/icon_ical.png",
enabled : function(addtocal) { return addtocal.options.icalEnabled; },
formatlink : function(eventDetails) {
return (eventDetails.icalurl ? eventDetails.icalurl : null);
} },
{value: 6, label:"vCalendar",
icon:"src/icon_ical.png",
enabled : function(addtocal) { return addtocal.options.vcalEnabled; },
formatlink : function(eventDetails) {
return ( eventDetails.vcalurl ? eventDetails.vcalurl : null );
} },
{value: 1, label:"Add to Outlook",
icon:"src/icon_outlook.gif",
enabled : function(addtocal) { return addtocal.options.icalEnabled; },
formatlink : function(eventDetails) {
return (eventDetails.icalurl ? eventDetails.icalurl : null);
} }
],

Expand Down Expand Up @@ -205,7 +217,7 @@
var self = this;
self.source=[];
$.each( this.options.calendars, function(index, value) {
if(value.enabled(self)) self.source.push( {value: value.value, label: value.label } );
if(value.enabled(self)) self.source.push( {value: value.value, label: value.label, icon: value.icon } );
});
},

Expand Down Expand Up @@ -239,12 +251,14 @@
if ( typeof item === "string" ) {
return {
label: item,
value: item
value: item,
icon: item
};
}
return $.extend({
label: item.label || item.value,
value: item.value || item.label
value: item.value || item.label,
icon: item.icon || item.icon
}, item );
});
},
Expand Down Expand Up @@ -278,7 +292,7 @@
_renderItem: function( ul, item) {
return $( "<li></li>" )
.data( "item.addtocal", item )
.append( $( "<a></a>" ).text( item.label ) )
.append( $( "<a></a>" ).text( item.label ).prepend((item.icon ? "<img src='" + item.icon + "'>" : "")) )
.appendTo( ul );
},

Expand Down
Binary file added src/icon_30boxes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icon_google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icon_ical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icon_msnlive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icon_outlook.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icon_yahoo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.