set up bower and grunt
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
bower_components/
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
|
grunt.initConfig({
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
concat: {
|
||||||
|
options: {
|
||||||
|
separator: ';'
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: ['ics.js'],
|
||||||
|
dest: '<%= pkg.name %>.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uglify: {
|
||||||
|
options: {
|
||||||
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("mm-dd-yyyy") %> */\n'
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
'ics.min.js': ['ics.js']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
qunit: {
|
||||||
|
files: ['tests/**/*.html']
|
||||||
|
},
|
||||||
|
jshint: {
|
||||||
|
files: ['Gruntfile.js', '*.js', 'tests/tests.js'],
|
||||||
|
options: {
|
||||||
|
// options here to override JSHint defaults
|
||||||
|
globals: {
|
||||||
|
jQuery: true,
|
||||||
|
console: true,
|
||||||
|
module: true,
|
||||||
|
document: true,
|
||||||
|
},
|
||||||
|
laxcomma: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
files: ['<%= jshint.files %>'],
|
||||||
|
tasks: ['jshint', 'qunit']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
|
||||||
|
grunt.registerTask('test', ['jshint', 'qunit']);
|
||||||
|
|
||||||
|
grunt.registerTask('default', ['jshint', 'qunit', 'uglify']);
|
||||||
|
|
||||||
|
};
|
||||||
@@ -7,9 +7,11 @@ Now you can make calendar friendly files client-side. It outputs .ics files, so
|
|||||||
|
|
||||||
How To Use
|
How To Use
|
||||||
----------
|
----------
|
||||||
Simply use the function...
|
Simply use invoke the object and use the functions...
|
||||||
|
|
||||||
download_ics(filename, subject, description, location, begin, end);
|
var cal = ics();
|
||||||
|
cal.addEvent(subject, description, location, begin, end);
|
||||||
|
cal.download(filename);
|
||||||
|
|
||||||
`begin` and `end` need to be formatted in a way that is friendly to `Date()`
|
`begin` and `end` need to be formatted in a way that is friendly to `Date()`
|
||||||
|
|
||||||
@@ -19,7 +21,11 @@ Example
|
|||||||
* **[Demo](http://htmlpreview.github.io/?https://github.com/nwcell/ics.js/blob/master/demo/demo.html)**
|
* **[Demo](http://htmlpreview.github.io/?https://github.com/nwcell/ics.js/blob/master/demo/demo.html)**
|
||||||
|
|
||||||
```
|
```
|
||||||
<a href="javascript:download_ics('demo', 'Demo Event', 'This is an awesome demo event', 'Sexy Land, AK', '8/7/2013', '8/9/2013')">Demo</a>
|
<script>
|
||||||
|
var cal = ics();
|
||||||
|
cal.addEvent('Demo Event', 'This is an awesome demo event', 'Nome, AK', '8/7/2013', '8/9/2013');
|
||||||
|
</script>
|
||||||
|
<a href="javascript:cal.download()">Demo</a>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "ics.js",
|
||||||
|
"main": "ics.js",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"homepage": "https://github.com/khornberg/ics.js"
|
||||||
|
"contributors": [
|
||||||
|
"Travis Krause <[email protected]>",
|
||||||
|
"Kyle Hornberg <[email protected]>"
|
||||||
|
],
|
||||||
|
"description": "A browser firendly .ics/.vcs file generator written entirely in javascript",
|
||||||
|
"keywords": [
|
||||||
|
"ics",
|
||||||
|
"iCal",
|
||||||
|
"iCalendar"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"private": true,
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"Blob.js": "eligrey/Blob.js",
|
||||||
|
"FileSaver": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-3
@@ -1,6 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<script type="text/javascript" async="" src="ics-min.js"></script>
|
<script type="text/javascript" src="../bower_components/FileSaver/FileSaver.js"></script>
|
||||||
|
<script type="text/javascript" src="../bower_components/Blob.js/Blob.js"></script>
|
||||||
|
<script type="text/javascript" src="../ics.min.js"></script>
|
||||||
|
<script type="text/javascript" src="demo.js"></script>
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -44,7 +47,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<a href="javascript:download_ics('demo', 'Demo Event', 'This is an awesome demo event', 'Sexy Land, AK', '8/7/2013', '8/9/2013')">Demo Event</a>
|
<a href="javascript:cal.download('christmas')">Download iCal</a>
|
||||||
|
Look at the console too!
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Demo
|
||||||
|
var cal = ics();
|
||||||
|
cal.addEvent('Christmas', 'Christian holiday celebrating the birth of Jesus Christ', 'Bethlehem', '12/25/2013', '12/25/2013');
|
||||||
|
cal.addEvent('Christmas', 'Christian holiday celebrating the birth of Jesus Christ', 'Bethlehem', '12/25/2014', '12/25/2014');
|
||||||
|
console.log('Events\n' + cal.events());
|
||||||
|
console.log('Calendar\n' + cal.calendar());
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
/*! ics.js 11-25-2013 */
|
||||||
|
var ics=function(){"use strict";if(navigator.userAgent.indexOf("MSIE")>-1&&-1==navigator.userAgent.indexOf("MSIE 10"))return console.log("Unsupported Browser"),void 0;var a=-1!==navigator.appVersion.indexOf("Win")?"\r\n":"\n",b=[],c=["BEGIN:VCALENDAR","VERSION:2.0"].join(a),d=a+"END:VCALENDAR";return{events:function(){return b},calendar:function(){return c+a+b.join(a)+d},addEvent:function(c,d,e,f,g){var h=new Date(f),i=new Date(g),j=("0000"+h.getFullYear().toString()).slice(-4),k=("00"+h.getMonth().toString()).slice(-2),l=("00"+h.getDate().toString()).slice(-2),m=j+(Number(k)+1)+l,n=("0000"+i.getFullYear().toString()).slice(-4),o=("00"+i.getMonth().toString()).slice(-2),p=("00"+i.getDate().toString()).slice(-2),q=n+(Number(o)+1)+p,r=["BEGIN:VEVENT","CLASS:PUBLIC","DESCRIPTION:"+d,"DTSTART;VALUE=DATE:"+m,"DTEND;VALUE=DATE:"+q,"LOCATION:"+e,"SUMMARY;LANGUAGE=en-us:"+c,"TRANSP:TRANSPARENT","END:VEVENT"].join(a);b.push(r)},download:function(e,f){f="undefined"!=typeof f?f:".ics",e="undefined"!=typeof e?e:"calendar";var g,h=c+a+b.join(a)+d;if(-1===navigator.userAgent.indexOf("MSIE 10"))g=new Blob([h]);else{var i=new BlobBuilder;i.append(h),g=i.getBlob("text/x-vCalendar;charset="+document.characterSet)}saveAs(g,e+f)}}};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "ics.js",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "A browser firendly .ics/.vcs file generator written entirely in javascript",
|
||||||
|
"main": "icsjs",
|
||||||
|
"dependencies": {
|
||||||
|
"grunt": "~0.4.2",
|
||||||
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
|
"grunt-contrib-jshint": "~0.7.2",
|
||||||
|
"grunt-contrib-qunit": "~0.3.0",
|
||||||
|
"grunt-contrib-uglify": "~0.2.7",
|
||||||
|
"grunt-mocha": "~0.4.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/khornberg/ics.js.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"ics",
|
||||||
|
"iCal",
|
||||||
|
"iCalendar"
|
||||||
|
],
|
||||||
|
"contributors": [
|
||||||
|
"Travis Krause <[email protected]>",
|
||||||
|
"Kyle Hornberg <[email protected]>"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/khornberg/ics.js/issues"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user