New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-addtocalendar

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-addtocalendar - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

addtocalendar.min.js

@@ -1,1 +0,1 @@

var forEachAttr=function(attrs,cb){for(key in attrs){if(attrs.hasOwnProperty(key)&&key.indexOf("$")===-1){cb(key,attrs[key])}}};var formatIcsText=function(s,maxLength){function _wrap(s){if(s.length<=maxLength){return s}return s.substring(0,maxLength).replace(/\n/g,"\\n")+"\r\n "+_wrap(s.substring(maxLength),75)}return _wrap(s.replace(/\n/g,"\\n"),maxLength)};function formatTime(timestamp,format){var formats=["YYYYMMDD","HHmmss"];var date=function(){if(format){return new moment(timestamp,format)}return new moment(timestamp)}();return formats.map(function(format){return date.format(format)}).join("T")}function getMilitaryHours(hours){if(hours<10){hours="0"+hours}return hours+"00"}function getHoursDuration(startDate,endDate,timezone){var start=new moment(startDate);var end=new moment(endDate);if(timezone){start.utcOffset(timezone);end.utcOffset(timezone)}var hours=moment.duration(end.diff(start)).asHours();return getMilitaryHours(hours)}function getIcsBlob(icsData){return new Blob([icsData],{type:"application/octet-stream"})}function getIcsFileName(title){return title.replace(/[^\w ]+/g,"")+".ics"}function offsetTimezone(timestamp,timezone){}function getGoogleCalendarUrl(data){var googleCalendarUrl="https://www.google.com/calendar/render?action=TEMPLATE";googleCalendarUrl+="&text="+data.title;googleCalendarUrl+="&dates="+data.startDate+"/"+data.endDate;googleCalendarUrl+="&details="+data.description;googleCalendarUrl+="&location="+data.location;return googleCalendarUrl}function getIcsCalendar(data){return["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT","CLASS:PUBLIC","DESCRIPTION:"+formatIcsText(data.description,62),"DTSTART:"+data.startDate,"DTEND:"+data.endDate,"LOCATION:"+formatIcsText(data.location,64),"SUMMARY:"+formatIcsText(data.title,66),"TRANSP:TRANSPARENT","END:VEVENT","END:VCALENDAR"].join("\n")}function getMicrosoftCalendarUrl(data){var microsoftCalendarUrl="http://calendar.live.com/calendar/calendar.aspx?rru=addevent";microsoftCalendarUrl+="&summary="+data.title;microsoftCalendarUrl+="&dtstart="+data.startDate+"&dtend="+data.endDate;microsoftCalendarUrl+="&description="+data.description;microsoftCalendarUrl+="&location="+data.location;return microsoftCalendarUrl}function getYahooCalendarUrl(data){var yahooCalendarUrl="http://calendar.yahoo.com/?v=60&view=d&type=20";var duration=getHoursDuration(data.startDate,data.endDate);yahooCalendarUrl+="&TITLE="+data.title;yahooCalendarUrl+="&ST="+data.startDate+"&DUR="+duration;yahooCalendarUrl+="&DESC="+data.description;yahooCalendarUrl+="&in_loc="+data.location;return yahooCalendarUrl}"use strict";var addtocalendar=angular.module("jshor.angular-addtocalendar",["ngFileSaver"]);"use strict";addtocalendar.config(["$compileProvider",function($compileProvider){$compileProvider.aHrefSanitizationWhitelist(/^\s*(http(s)?|data):/)}]);"use strict";addtocalendar.controller("AddtocalendarCtrl",["$scope","$attrs","FileSaver",function($scope,$attrs,FileSaver){var dates={};$scope.description=$scope.description||"";function setTimesFromFormat(){var format=$scope.format;var timezone=$scope.timezone;["startDate","endDate"].forEach(function(t){dates[t]=formatTime($scope[t],format,timezone)})}function getSanitizedData(){var urlData={};forEachAttr($scope,function(key){urlData[key]=encodeURIComponent($scope[key])});return urlData}function buildUrl(){var urlData=angular.extend(getSanitizedData(),dates);$scope.calendarUrl={microsoft:getMicrosoftCalendarUrl(urlData),google:getGoogleCalendarUrl(urlData),yahoo:getYahooCalendarUrl(urlData),icalendar:getIcsCalendar($scope),dlIcal:dlIcal}}function dlIcal(){var fileName=getIcsFileName($scope.title);var icsData=$scope.calendarUrl.icalendar;var icsBlob=getIcsBlob(icsData);FileSaver.saveAs(icsBlob,fileName)}function init(){buildUrl();setTimesFromFormat()}forEachAttr($attrs,function(key){$attrs.$observe(key,init)});init()}]);"use strict";addtocalendar.directive("addtocalendar",function(){function getTemplate(prefix){return' <div class="btn-group dropdown" '+prefix+' on-toggle="toggled(open)"> <span ng-class="className || \'btn btn-sm btn-default '+prefix+"-toggle'\" "+prefix+'-toggle> {{btnText || \'Add to calendar\'}} <span class="caret"></span> </span> <ul class="dropdown-menu"> <li><a ng-click="calendarUrl.dlIcal()" ng-if="calendarUrl.dlIcal">iCalendar</a></li> <li><a href="{{calendarUrl.google}}" target="_blank">Google Calendar</a></li> <li><a ng-click="calendarUrl.dlIcal()" ng-if="calendarUrl.dlIcal">Outlook</a></li> <li><a href="{{calendarUrl.yahoo}}" target="_blank">Yahoo! Calendar</a></li> <li><a href="{{calendarUrl.microsoft}}" target="_blank">Microsoft Calendar</a></li> </ul> </div>'}function resolveTemplate(tElement,tAttrs){if(tAttrs.$attr&&tAttrs.$attr["uibDropdown"]){return getTemplate("uib-dropdown")}return getTemplate("dropdown")}return{restrict:"E",scope:{startDate:"@",endDate:"@",title:"@",description:"@",location:"@",className:"@",btnText:"@"},controller:"AddtocalendarCtrl",template:resolveTemplate}});
var forEachAttr=function(attrs,cb){for(key in attrs){if(attrs.hasOwnProperty(key)&&key.indexOf("$")===-1){cb(key,attrs[key])}}};var formatIcsText=function(s,maxLength){function _wrap(s){if(s.length<=maxLength){return s}return s.substring(0,maxLength).replace(/\n/g,"\\n")+"\r\n "+_wrap(s.substring(maxLength),75)}return _wrap(s.replace(/\n/g,"\\n"),maxLength)};function formatTime(timestamp,inputFormat){var formats=["YYYYMMDD","HHmmss"];var date=function(){if(inputFormat){return new moment(timestamp,inputFormat)}return new moment(timestamp)}();return formats.map(function(format){return date.format(format)}).join("T")}function getMilitaryHours(hours){if(hours<10){hours="0"+hours}return hours+"00"}function getHoursDuration(startDate,endDate,timezone){var start=new moment(startDate);var end=new moment(endDate);if(timezone){start.utcOffset(timezone);end.utcOffset(timezone)}var hours=moment.duration(end.diff(start)).asHours();return getMilitaryHours(hours)}function getIcsBlob(icsData){return new Blob([icsData],{type:"application/octet-stream"})}function getIcsFileName(title){return title.replace(/[^\w ]+/g,"")+".ics"}function getGoogleCalendarUrl(data){var googleCalendarUrl="https://www.google.com/calendar/render?action=TEMPLATE";googleCalendarUrl+="&text="+data.title;googleCalendarUrl+="&dates="+data.startDate+"/"+data.endDate;googleCalendarUrl+="&details="+data.description;googleCalendarUrl+="&location="+data.location;return googleCalendarUrl}function getIcsCalendar(data){return["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT","CLASS:PUBLIC","DESCRIPTION:"+formatIcsText(data.description,62),"DTSTART:"+data.startDate,"DTEND:"+data.endDate,"LOCATION:"+formatIcsText(data.location,64),"SUMMARY:"+formatIcsText(data.title,66),"TRANSP:TRANSPARENT","END:VEVENT","END:VCALENDAR"].join("\n")}function getMicrosoftCalendarUrl(data){var microsoftCalendarUrl="http://calendar.live.com/calendar/calendar.aspx?rru=addevent";microsoftCalendarUrl+="&summary="+data.title;microsoftCalendarUrl+="&dtstart="+data.startDate+"&dtend="+data.endDate;microsoftCalendarUrl+="&description="+data.description;microsoftCalendarUrl+="&location="+data.location;return microsoftCalendarUrl}function getYahooCalendarUrl(data){var yahooCalendarUrl="http://calendar.yahoo.com/?v=60&view=d&type=20";var duration=getHoursDuration(data.startDate,data.endDate);yahooCalendarUrl+="&TITLE="+data.title;yahooCalendarUrl+="&ST="+data.startDate+"&DUR="+duration;yahooCalendarUrl+="&DESC="+data.description;yahooCalendarUrl+="&in_loc="+data.location;return yahooCalendarUrl}"use strict";var addtocalendar=angular.module("jshor.angular-addtocalendar",["ngFileSaver"]);"use strict";addtocalendar.config(["$compileProvider",function($compileProvider){$compileProvider.aHrefSanitizationWhitelist(/^\s*(http(s)?|data):/)}]);"use strict";addtocalendar.controller("AddtocalendarCtrl",["$scope","$attrs","FileSaver",function($scope,$attrs,FileSaver){var dates={};$scope.description=$scope.description||"";function setTimesFromFormat(){var format=$scope.format;var timezone=$scope.timezone;["startDate","endDate"].forEach(function(t){dates[t]=formatTime($scope[t],format,timezone)})}function getSanitizedData(){var urlData={};forEachAttr($scope,function(key){urlData[key]=encodeURIComponent($scope[key])});return urlData}function buildUrl(){var urlData=angular.extend(getSanitizedData(),dates),icsData=angular.extend({},$scope,dates);$scope.calendarUrl={microsoft:getMicrosoftCalendarUrl(urlData),google:getGoogleCalendarUrl(urlData),yahoo:getYahooCalendarUrl(urlData),icalendar:getIcsCalendar(icsData),dlIcal:dlIcal}}function dlIcal(){var fileName=getIcsFileName($scope.title);var icsData=$scope.calendarUrl.icalendar;var icsBlob=getIcsBlob(icsData);FileSaver.saveAs(icsBlob,fileName)}function init(){setTimesFromFormat();buildUrl()}forEachAttr($attrs,function(key){$attrs.$observe(key,init)});init()}]);"use strict";addtocalendar.directive("addtocalendar",function(){function getTemplate(prefix){return' <div class="btn-group dropdown" '+prefix+' on-toggle="toggled(open)" title="{{(hoverText == undefined) ? title : hoverText}}"> <span ng-class="className || \'btn btn-sm btn-default '+prefix+"-toggle'\" "+prefix+'-toggle> {{(btnText == undefined) ? \'Add to calendar\' : btnText}} <span ng-if="caret != \'false\'" class="caret"></span> </span> <ul class="dropdown-menu"> <li><a ng-click="calendarUrl.dlIcal()" ng-if="calendarUrl.dlIcal">iCalendar</a></li> <li><a href="{{calendarUrl.google}}" target="_blank">Google Calendar</a></li> <li><a ng-click="calendarUrl.dlIcal()" ng-if="calendarUrl.dlIcal">Outlook</a></li> <li><a href="{{calendarUrl.yahoo}}" target="_blank">Yahoo! Calendar</a></li> <li><a href="{{calendarUrl.microsoft}}" target="_blank">Microsoft Calendar</a></li> </ul> </div>'}function resolveTemplate(tElement,tAttrs){if(tAttrs.$attr&&tAttrs.$attr["uibDropdown"]){return getTemplate("uib-dropdown")}return getTemplate("dropdown")}return{restrict:"E",scope:{startDate:"@",endDate:"@",title:"@",description:"@",location:"@",className:"@",btnText:"@",caret:"@",hoverText:"@",format:"@"},controller:"AddtocalendarCtrl",template:resolveTemplate}});

@@ -36,3 +36,4 @@ /**

function buildUrl() {
var urlData = angular.extend(getSanitizedData(), dates);
var urlData = angular.extend(getSanitizedData(), dates),
icsData = angular.extend({}, $scope, dates);

@@ -43,3 +44,3 @@ $scope.calendarUrl = {

yahoo: getYahooCalendarUrl(urlData),
icalendar: getIcsCalendar($scope),
icalendar: getIcsCalendar(icsData),
dlIcal: dlIcal

@@ -57,4 +58,4 @@ };

function init() {
setTimesFromFormat();
buildUrl();
setTimesFromFormat();
}

@@ -61,0 +62,0 @@

@@ -14,7 +14,9 @@ /**

return '\
<div class="btn-group dropdown" ' + prefix + ' on-toggle="toggled(open)">\
<div class="btn-group dropdown" ' + prefix + ' on-toggle="toggled(open)" \
title="{{(hoverText == undefined) ? title : hoverText}}">\
<span\
ng-class="className || \'btn btn-sm btn-default ' + prefix + '-toggle\'"\
' + prefix + '-toggle>\
{{btnText || \'Add to calendar\'}} <span class="caret"></span>\
{{(btnText == undefined) ? \'Add to calendar\' : btnText}}\
<span ng-if="caret != \'false\'" class="caret"></span>\
</span>\

@@ -47,3 +49,6 @@ <ul class="dropdown-menu">\

className: '@',
btnText: '@'
btnText: '@',
caret: '@',
hoverText: '@',
format: '@'
},

@@ -50,0 +55,0 @@ controller: 'AddtocalendarCtrl',

# Changelog
## v1.2.1
- fixes vendor calendar URL generation issue
- fixes start/end date generation and format string
- adds option to disable caret
- adds option to specify hover text
- allows blank btnText
## v1.2.0

@@ -4,0 +12,0 @@

The MIT License (MIT)
Copyright (c) 2016 J. P. Shor.
Copyright (c) 2016 angular-addtocalendar.

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "angular-addtocalendar",
"version": "1.2.0",
"version": "1.2.1",
"description": "AngularJS directive for adding events to calendar apps",

@@ -8,3 +8,3 @@ "main": "addtocalendar.min.js",

"test": "./node_modules/karma/bin/karma start karma.conf.js --single-run",
"build": "rm -rf ./coverage/ && ./node_modules/uglify-js/bin/uglifyjs lib/*.js lib/**/*.js addtocalendar/*.js -o addtocalendar.min.js"
"build": "rm -rf ./coverage/ && ./node_modules/uglify-js/bin/uglifyjs lib/*.js lib/**/*.js addtocalendar/*.js -o addtocalendar.min.js && cat lib/*.js lib/**/*.js addtocalendar/*.js > addtocalendar.js"
},

@@ -11,0 +11,0 @@ "repository": {

# angular-addtocalendar
### v1.2.0
### v1.2.1

@@ -82,2 +82,4 @@ An AngularJS directive for adding an event to calendar apps. It supports .ics files for iCalendar and Outlook and also supports Google Calendar, Yahoo! Calendar and Microsoft Calendar.

| `uib-dropdown` | Whether to use ui-bootstrap dropdown | `null` Default `Add to calendar` | `null` | No |
| `caret` | Whether to use the caret. | String interpreted as boolean Default: `true` | false | No |
| `hover-text` | Text to use as the title of the element. | String Default: value of title attribute | Add to calendar | No |

@@ -96,3 +98,3 @@ # Styling

| Edge | Yes |
| Safari | 9+ |
| Safari | No support* |
| Firefox | 20.0+ |

@@ -103,2 +105,4 @@ | Opera | 15.0+ |

* iCalendar (ironically) and Outlook do not work due to well-known file saving bug in Safari.
## Bugs

@@ -110,2 +114,2 @@

Available [here](https://github.com/jshor/angular-addtocalendar/blob/master/CHANGELOG.md).
Available [here](https://github.com/jshor/angular-addtocalendar/blob/master/CHANGELOG.md).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc