123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- 'use strict'
- /* eslint-disable require-jsdoc, no-unused-vars */
- var CalendarList = []
- function CalendarInfo () {
- this.id = null
- this.name = null
- this.checked = true
- this.color = null
- this.bgColor = null
- this.borderColor = null
- this.dragBgColor = null
- }
- function addCalendar (calendar) {
- CalendarList.push(calendar)
- }
- function findCalendar (id) {
- var found
- CalendarList.forEach(function (calendar) {
- if (calendar.id === id) {
- found = calendar
- }
- })
- return found || CalendarList[0]
- }
- function hexToRGBA (hex) {
- var radix = 16
- var r = parseInt(hex.slice(1, 3), radix)
- var g = parseInt(hex.slice(3, 5), radix)
- var b = parseInt(hex.slice(5, 7), radix)
- var a = parseInt(hex.slice(7, 9), radix) / 255 || 1
- var rgba = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + a + ')'
- return rgba
- }
- /* (function () {
- var calendar
- var id = 0
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'My Calendar'
- calendar.color = '#ffffff'
- calendar.bgColor = '#9e5fff'
- calendar.dragBgColor = '#9e5fff'
- calendar.borderColor = '#9e5fff'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'Company'
- calendar.color = '#ffffff'
- calendar.bgColor = '#00a9ff'
- calendar.dragBgColor = '#00a9ff'
- calendar.borderColor = '#00a9ff'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'Family'
- calendar.color = '#ffffff'
- calendar.bgColor = '#ff5583'
- calendar.dragBgColor = '#ff5583'
- calendar.borderColor = '#ff5583'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'Friend'
- calendar.color = '#ffffff'
- calendar.bgColor = '#03bd9e'
- calendar.dragBgColor = '#03bd9e'
- calendar.borderColor = '#03bd9e'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'Travel'
- calendar.color = '#ffffff'
- calendar.bgColor = '#bbdc00'
- calendar.dragBgColor = '#bbdc00'
- calendar.borderColor = '#bbdc00'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'etc'
- calendar.color = '#ffffff'
- calendar.bgColor = '#9d9d9d'
- calendar.dragBgColor = '#9d9d9d'
- calendar.borderColor = '#9d9d9d'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'Birthdays'
- calendar.color = '#ffffff'
- calendar.bgColor = '#ffbb3b'
- calendar.dragBgColor = '#ffbb3b'
- calendar.borderColor = '#ffbb3b'
- addCalendar(calendar)
- calendar = new CalendarInfo()
- id += 1
- calendar.id = String(id)
- calendar.name = 'National Holidays'
- calendar.color = '#ffffff'
- calendar.bgColor = '#ff4040'
- calendar.dragBgColor = '#ff4040'
- calendar.borderColor = '#ff4040'
- addCalendar(calendar)
- })() */
- (function () {
- if (CalendarList.length === 0) {
- var cList = JSON.parse(localStorage.getItem('calendarList'))
- for (var i = 0; i < cList.length; i++) {
- var calendar = new CalendarInfo()
- calendar.id = cList[i].id
- calendar.name = cList[i].name
- calendar.color = cList[i].color
- calendar.bgColor = cList[i].bgColor
- calendar.dragBgColor = cList[i].dragBgColor
- calendar.borderColor = cList[i].borderColor
- addCalendar(calendar)
- }
- }
- })()
|