Comparing version 0.0.3 to 0.0.5
{ | ||
"name": "calendarth", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"main": "./build/calendarth.min.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
{ | ||
"name": "calendarth", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "Fetch a public Google Calendar using AJAX", | ||
@@ -5,0 +5,0 @@ "main": "./src/", |
@@ -55,4 +55,22 @@ # Calendarth | ||
#### calendarth.getEventLink(eventItem) | ||
Will return a url that can be used to add the event to a user's Google Calendar. | ||
```js | ||
cal.fetch(function(err, calendarObj) { | ||
err === null; // true | ||
// get the first event item | ||
var eventItem = calendarObj.item.shift(); | ||
var addEventToCal = cal.getEventLink(eventItem); | ||
console.log(addEventToCal); | ||
}); | ||
``` | ||
## Release History | ||
- **v0.0.5**, *12 Apr 2014* | ||
- Add getEventLink() feature. | ||
- **v0.0.3**, *9 Apr 2014* | ||
@@ -59,0 +77,0 @@ - Published to NPM. |
@@ -59,1 +59,23 @@ /* | ||
}; | ||
/** | ||
* Return a url that will perform the "Add Event to Google Calendar" action. | ||
* | ||
* @param {Object} eventItem The event data object. | ||
* @return {string} The event link to use in the anchor element. | ||
*/ | ||
Calendarth.prototype.getEventLink = function(eventItem) { | ||
var out = 'http://www.google.com/calendar/event?action=TEMPLATE&text='; | ||
out += encodeURIComponent(eventItem.summary); | ||
out += '&dates='; | ||
out += encodeURIComponent(eventItem.start.dateTime ? | ||
eventItem.start.dateTime : eventItem.start.date); | ||
out += '/'; | ||
out += encodeURIComponent(eventItem.end.dateTime ? | ||
eventItem.end.dateTime : eventItem.end.date); | ||
out += '&details='; | ||
out += encodeURIComponent(eventItem.description); | ||
out += '&location='; | ||
out += encodeURIComponent(eventItem.location); | ||
out += '&trp=false&sprop=name:'; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1932261
37977
88
0