Skip to content
项目

carlsednaoui/add-to-calendar-buttons

在 GitHub 查看

关于

轻松为网站添加“添加到日历”按钮。这个 JavaScript 库支持 Google 日历、iCal、Outlook 和 Yahoo 日历。

效率与自动化

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

OuiCal

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 add to calendar feature (which should have been open sourced #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.

The only fields that are mandatory are:

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

Example

var myCalendar = createCalendar({
  options: {
    class: 'my-class',
    
    // You can pass an ID. If you don't, one will be generated for you
    id: 'my-id'
  },
  data: {
    // Event title
    title: 'Get on the front page of HN',

    // Event start date
    start: new Date('June 15, 2013 19:00'),
    
    // 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'),     

    // Event Address
    address: 'The internet',

    // Event Description
    description: 'Get on the front page of HN, then prepare for world domination.'
  }
});

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

Here is a live example

Looking for Instant Gratification?

Copy OuiCal into Chrome's JS console (or whatever browser you're using).

Then call this:

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.

GitHub Project Page

Official Project Page

License

MIT

探索相关项目

加载中…