Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
71f83ec
addevent styling
Nov 30, 2018
1a42286
forgot css gen
Nov 30, 2018
11f3a00
addevent html instance, texts globals
Dec 4, 2018
e06a4ea
fix generator
Dec 4, 2018
7b3ac17
and docs
Dec 4, 2018
9757a5d
readme
Dec 4, 2018
fc206fa
more timezone, allday, google madness, min.js
Dec 5, 2018
625fce3
Merge branch 'feature/allday'
Dec 5, 2018
4456cb5
larger rework; naming; code struct
Dec 6, 2018
18f4076
minified + widget
Dec 6, 2018
59b9206
code cleanup
Dec 6, 2018
cb0bb5a
cleanup css
Dec 6, 2018
b2a3e31
ics file name
Dec 6, 2018
8ab0072
detab
Dec 6, 2018
031c3df
CONFIG.selector
Dec 6, 2018
7d792c7
consistency, off365 logo, generator picks css from head
Dec 21, 2018
1d99f28
Merge branch 'develop'
Dec 21, 2018
34171c0
msblob
May 29, 2019
419f54b
space
May 29, 2019
168e0a8
more space
May 29, 2019
49ea867
trying mousedown - double uriencode is perhaps a problem
May 30, 2019
2fb0742
escaped for ie<edg
Jun 3, 2019
db3a554
Export generateCalendars method
yringler Sep 19, 2019
6d236cd
whitespace
Sep 23, 2019
e3aee84
Merge branch 'master' of https://github.com/commonpike/add-to-calenda…
Sep 23, 2019
3bbbe44
Merge branch 'feature/msblob' into develop
Sep 23, 2019
e23007e
Merge commit 'refs/pull/8/head' of https://github.com/commonpike/add-…
Sep 23, 2019
cdbca9b
pr 8
Sep 23, 2019
4f8f378
Merge branch 'pull/8' into develop
Sep 23, 2019
0f538fc
minified, css, links
Sep 23, 2019
eb34fd3
issue2
Sep 23, 2019
d78eef0
document addToCalendarData
Sep 23, 2019
3c66ed4
Merge branch 'develop'
Sep 23, 2019
9650c33
typo
Sep 23, 2019
337b933
Merge branch 'develop'
Sep 23, 2019
59174e4
ehm .. must stash
Sep 23, 2019
703df2b
oops
Sep 23, 2019
8621c15
Merge branch 'master' into develop
Sep 23, 2019
ddadd40
Merge branch 'develop'
Sep 23, 2019
08832d9
ooops updated min.js
Oct 4, 2019
dc9081f
Merge branch 'develop'
Oct 4, 2019
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
79 changes: 64 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# OuiCal
# OuiCal2

A simple JS library that enables you to add an "add to calendar" button for your upcoming events.

## Inspiration

This project was inspired by [Eventbrite's](http://www.eventbrite.com/) add to calendar feature (which should have been open sourced #justSayin).
This project was inspired by [Eventbrite's](http://www.eventbrite.com/) add to calendar feature (which should have been open sourced #justSayin).

Later, it was adjusted to look and behave more like [AddToCalendar](https://addtocalendar.com), which suddenly became a commercial tool, and very expensive too #justSayin.

## How to use it?

Call 'createCalendar' with your event info, pass in any optional parameters such as a class and/ or id and boom! Insert your add-to-calendar div wherever you'd like.
### Method 1

Call 'addToCalendar' with your event info, pass in any optional parameters such as a class and/ or id and boom! Insert your add-to-calendar div wherever you'd like.

The only fields that are mandatory are:

- Event title
- Start time
- Event duration, in minutes

## Example
#### Example

var myCalendar = createCalendar({
var myCalendar = addToCalendar({
options: {
class: 'my-class',

Expand All @@ -32,12 +35,19 @@ The only fields that are mandatory are:
// Event start date
start: new Date('June 15, 2013 19:00'),

// Event timezone. Will convert the given time to that zone
timezone: America/Los_Angeles,

// Event duration (IN MINUTES)
duration: 120,

// You can also choose to set an end time
// If an end time is set, this will take precedence over duration
end: new Date('June 15, 2013 23:00'),
// end: new Date('June 15, 2013 23:00'),

// You can also choose to set 'all day'
// If this is set, this will override end time, duration and timezone
// allday:true,

// Event Address
address: 'The internet',
Expand All @@ -49,23 +59,62 @@ The only fields that are mandatory are:

document.querySelector('#place-where-I-want-this-calendar').appendChild(myCalendar);

[Here is a live example](http://carlsednaoui.github.io/add-to-calendar-buttons/example.html)
### Method 2

Write your events data in several hidden HTML tags with the right classnames, and wrap them in a div. Then call 'createCalendar' with the outer div and boom! The calendar is appended to your wrapping div.
The only fields that are mandatory are:

- Event title
- Start time


#### Example

<div title="Add to Calendar" class="add-to-calendar">
<span class="start">12/18/2018 08:00 AM</span>
<span class="timezone">America/Los_Angeles</span>
<!--span class="end">12/18/2018 10:00 AM</span-->
<!--span class="duration">60</span-->
<!--span class="allday">true</span-->
<span class="title">Summary of the event</span>
<span class="description">Description of the event</span>
<span class="location">Location of the event</span>
</div>


### method 3

If you are ony interested in the data, call 'addToCalendarData' with your event info, pass in any optional parameters as described in method #1. An object with some html links is returned.


#### Example

var caldata = addToCalendarData({
data: {
// Event title
title: 'Get on the front page of HN',

// Event start date
start: new Date('June 15, 2013 19:00'),

//.. and the rest was optional.

}
});
console.log(caldata);

## Looking for Instant Gratification?
[Copy OuiCal into Chrome's JS console](https://raw.github.com/carlsednaoui/ouical/master/ouical.js) (or whatever browser you're using).

## Demo

Then call this:
[Here is a live example](https://commonpike.github.io/add-to-calendar-buttons/example.html)

document.getElementsByTagName('body')[0].appendChild(createCalendar({data:{title:"this is the title of my event", start: new Date(), duration: 90}}));

\#winning!

## Calendar Generator
Need to generate an add-to-calendar widget on the fly? No problem, [go here](http://carlsednaoui.github.io/add-to-calendar-buttons/generator/generator.html).
Need to generate an add-to-calendar widget on the fly? No problem, [go here](https://commonpike.github.io/add-to-calendar-buttons/generator/generator.html).

## GitHub Project Page
[Official Project Page](http://carlsednaoui.github.io/ouical/)
[Official Project Page](http://commonpike.github.io/ouical/)

## License
[MIT](http://opensource.org/licenses/MIT)
100 changes: 91 additions & 9 deletions main.css → add-to-calendar.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
#add-to-calendar-checkbox-label {
/* --------------------
this css is embedded in the script in
minified version. it is here for reference
only
-------------------- */

.add-to-calendar {
position: relative;
text-align: left;
}

.add-to-calendar > * {
display:none;
}

.add-to-calendar > .add-to-calendar-widget {
display:block;
}

.add-to-calendar-label {
cursor: pointer;
}

.add-to-calendar-checkbox ~ a {
.add-to-calendar-checkbox + div.add-to-calendar-dropdown {
display: none;
margin-left: 20px;
}

.add-to-calendar-checkbox:checked ~ a {
.add-to-calendar-checkbox:checked + div.add-to-calendar-dropdown {
display: block;
width: 150px;
margin-left: 20px;
}

input[type=checkbox].add-to-calendar-checkbox {
position: absolute;
top: -9999px;
left: -9999px;
visibility:hidden;
}

.add-to-calendar-checkbox + div.add-to-calendar-dropdown a {
cursor:pointer;
display:block;
}

.add-to-calendar-checkbox ~ a:before {
.add-to-calendar-checkbox + div.add-to-calendar-dropdown a:before {
width: 16px;
height: 16px;
display: inline-block;
Expand All @@ -35,10 +57,70 @@ input[type=checkbox].add-to-calendar-checkbox {
/*this is the default icon*/
}

.icon-off365:before {
/*this is the default icon*/
}

.icon-yahoo:before {
background-position: -36px +4px;
}

.icon-google:before {
background-position: -52px 0;
}
}

/* --------------------
prettify
-------------------- */

.add-to-calendar-widget {
font-family:sans-serif;
margin: 1em 0;
position:relative;
}

.add-to-calendar-label {
display: inline-block;
background-color: white;
background-image: url(data:image/vndmicrosofticon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/wAAAAAAAAAAVlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/AAAAAFZWVv9WVlb///////////9WVlb///////////9WVlb///////////9WVlb///////////9WVlb/VlZW/wAAAABWVlb/VlZW////////////VlZW////////////VlZW////////////VlZW////////////VlZW/1ZWVv8AAAAAVlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/AAAAAFZWVv9WVlb///////////9WVlb///////////9WVlb///////////9WVlb///////////9WVlb/VlZW/wAAAABWVlb/VlZW////////////VlZW////////////VlZW////////////VlZW////////////VlZW/1ZWVv8AAAAAVlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/AAAAAFZWVv9WVlb///////////9WVlb///////////9WVlb///////////9WVlb///////////9WVlb/VlZW/wAAAABWVlb/VlZW////////////VlZW////////////VlZW////////////VlZW////////////VlZW/1ZWVv8AAAAAVlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/AAAAAFZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/1ZWVv9WVlb/VlZW/wAAAAAAAAAAVlZW/1ZWVv///////////1ZWVv9WVlb/VlZW/1ZWVv9WVlb///////////9WVlb/VlZW/wAAAAAAAAAAAAAAAAAAAABWVlb///////////9WVlb/AAAAAAAAAAAAAAAAVlZW////////////VlZW/wAAAAAAAAAAAAAAAAAAAAAAAAAAVlZW/1ZWVv9WVlb/VlZW/wAAAAAAAAAAAAAAAFZWVv9WVlb/VlZW/1ZWVv8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==);
background-position: 10px 45%;
background-repeat:no-repeat;
padding: 1em 1em 1em 40px;
background-size: 20px 20px;
border-radius: 3px;
box-shadow: 0 0 0 0.5px rgba(50, 50, 93, .17),
0 2px 5px 0 rgba(50, 50, 93, .1),
0 1px 1.5px 0 rgba(0, 0, 0, .07),
0 1px 2px 0 rgba(0, 0, 0, .08),
0 0 0 0 transparent!important;
}

.add-to-calendar-dropdown {
position: absolute;
z-index: 99;
background-color: white;
top: 0;
left:0;
padding: 1em;
margin:0!important;
border-radius: 3px;
box-shadow: 0 0 0 0.5px rgba(50, 50, 93, .17),
0 2px 5px 0 rgba(50, 50, 93, .1),
0 1px 1.5px 0 rgba(0, 0, 0, .07),
0 1px 2px 0 rgba(0, 0, 0, .08),
0 0 0 0 transparent!important;
}

.add-to-calendar-dropdown a {
display: block;
line-height: 1.75em;
text-decoration: none;
color: inherit;
opacity:.7;
}

.add-to-calendar-dropdown a:hover {
opacity:1;
}


Loading