kalendae_assets 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kalendae_assets/version.rb +1 -1
- data/vendor/assets/images/close.png +0 -0
- data/vendor/assets/javascripts/kalendae.js +357 -122
- data/vendor/assets/stylesheets/kalendae.css +139 -30
- metadata +19 -12
Binary file
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* Kalendae, a framework agnostic javascript date picker *
|
3
3
|
* Copyright(c) 2012 Jarvis Badgley (chipersoft@gmail.com) *
|
4
4
|
* http://github.com/ChiperSoft/Kalendae *
|
5
|
-
* Version 0.
|
5
|
+
* Version 0.2 *
|
6
6
|
********************************************************************/
|
7
7
|
|
8
8
|
(function (undefined) {
|
@@ -30,6 +30,8 @@ var Kalendae = function (targetElement, options) {
|
|
30
30
|
i = 0,
|
31
31
|
j = opts.months;
|
32
32
|
|
33
|
+
if (util.isIE8()) util.addClassName($container, 'ie8');
|
34
|
+
|
33
35
|
//generate the column headers (Su, Mo, Tu, etc)
|
34
36
|
i = 7;
|
35
37
|
while (i--) {
|
@@ -59,16 +61,29 @@ var Kalendae = function (targetElement, options) {
|
|
59
61
|
}
|
60
62
|
self.viewStartDate = vsd.date(1);
|
61
63
|
|
64
|
+
var viewDelta = ({
|
65
|
+
'past' : opts.months-1,
|
66
|
+
'today-past' : opts.months-1,
|
67
|
+
'any' : opts.months>2?Math.floor(opts.months/2):0,
|
68
|
+
'today-future' : 0,
|
69
|
+
'future' : 0
|
70
|
+
})[this.settings.direction];
|
71
|
+
|
72
|
+
|
73
|
+
if (viewDelta && moment().month()==moment(self.viewStartDate).month()){
|
74
|
+
self.viewStartDate = moment(self.viewStartDate).subtract({M:viewDelta}).date(1);
|
75
|
+
}
|
76
|
+
|
62
77
|
|
63
78
|
if (typeof opts.blackout === 'function') {
|
64
79
|
self.blackout = opts.blackout;
|
65
80
|
} else if (!!opts.blackout) {
|
66
81
|
var bdates = parseDates(opts.blackout, opts.parseSplitDelimiter);
|
67
82
|
self.blackout = function (input) {
|
68
|
-
input = moment(input).
|
83
|
+
input = moment(input).yearDay();
|
69
84
|
if (input < 1 || !self._sel || self._sel.length < 1) return false;
|
70
85
|
var i = bdates.length;
|
71
|
-
while (i--) if (bdates[i].
|
86
|
+
while (i--) if (bdates[i].yearDay() === input) return true;
|
72
87
|
return false;
|
73
88
|
}
|
74
89
|
} else {
|
@@ -93,8 +108,10 @@ var Kalendae = function (targetElement, options) {
|
|
93
108
|
|
94
109
|
//title bar
|
95
110
|
$title = util.make('div', {'class':classes.title}, $cal);
|
96
|
-
util.make('a', {'class':classes.
|
97
|
-
util.make('a', {'class':classes.
|
111
|
+
util.make('a', {'class':classes.previousYear}, $title); //previous button
|
112
|
+
util.make('a', {'class':classes.previousMonth}, $title); //previous button
|
113
|
+
util.make('a', {'class':classes.nextYear}, $title); //next button
|
114
|
+
util.make('a', {'class':classes.nextMonth}, $title); //next button
|
98
115
|
$caption = util.make('span', {'class':classes.caption}, $title); //title caption
|
99
116
|
|
100
117
|
//column headers
|
@@ -126,26 +143,43 @@ var Kalendae = function (targetElement, options) {
|
|
126
143
|
|
127
144
|
util.addEvent($container, 'mousedown', function (event, target) {
|
128
145
|
var clickedDate;
|
129
|
-
if (util.hasClassName(target, classes.
|
146
|
+
if (util.hasClassName(target, classes.nextMonth)) {
|
130
147
|
//NEXT MONTH BUTTON
|
131
|
-
if (self.publish('view-changed', self, ['next']) !== false) {
|
148
|
+
if (!self.disableNext && self.publish('view-changed', self, ['next-month']) !== false) {
|
132
149
|
self.viewStartDate.add('months',1);
|
133
150
|
self.draw();
|
134
151
|
}
|
135
152
|
return false;
|
136
153
|
|
137
|
-
} else if (util.hasClassName(target, classes.
|
154
|
+
} else if (util.hasClassName(target, classes.previousMonth)) {
|
138
155
|
//PREVIOUS MONTH BUTTON
|
139
|
-
if (self.publish('view-changed', self, ['previous']) !== false) {
|
156
|
+
if (!self.disablePreviousMonth && self.publish('view-changed', self, ['previous-month']) !== false) {
|
140
157
|
self.viewStartDate.subtract('months',1);
|
141
158
|
self.draw();
|
142
159
|
}
|
143
160
|
return false;
|
144
161
|
|
162
|
+
} else if (util.hasClassName(target, classes.nextYear)) {
|
163
|
+
//NEXT MONTH BUTTON
|
164
|
+
if (!self.disableNext && self.publish('view-changed', self, ['next-year']) !== false) {
|
165
|
+
self.viewStartDate.add('years',1);
|
166
|
+
self.draw();
|
167
|
+
}
|
168
|
+
return false;
|
169
|
+
|
170
|
+
} else if (util.hasClassName(target, classes.previousYear)) {
|
171
|
+
//PREVIOUS MONTH BUTTON
|
172
|
+
if (!self.disablePreviousMonth && self.publish('view-changed', self, ['previous-year']) !== false) {
|
173
|
+
self.viewStartDate.subtract('years',1);
|
174
|
+
self.draw();
|
175
|
+
}
|
176
|
+
return false;
|
177
|
+
|
178
|
+
|
145
179
|
|
146
180
|
} else if (util.hasClassName(target.parentNode, classes.days) && util.hasClassName(target, classes.dayActive) && (clickedDate = target.getAttribute('data-date'))) {
|
147
181
|
//DAY CLICK
|
148
|
-
clickedDate = moment(clickedDate, opts.dayAttributeFormat);
|
182
|
+
clickedDate = moment(clickedDate, opts.dayAttributeFormat).hours(12);
|
149
183
|
if (self.publish('date-clicked', self, [clickedDate]) !== false) {
|
150
184
|
|
151
185
|
switch (opts.mode) {
|
@@ -182,6 +216,7 @@ Kalendae.prototype = {
|
|
182
216
|
months: 1, /* total number of months to display side by side */
|
183
217
|
weekStart: 0, /* day to use for the start of the week. 0 is Sunday */
|
184
218
|
direction: 'any', /* past, today-past, any, today-future, future */
|
219
|
+
directionScrolling: true, /* if a direction other than any is defined, prevent scrolling out of range */
|
185
220
|
viewStartDate: null, /* date in the month to display. When multiple months, this is the left most */
|
186
221
|
blackout: null, /* array of dates, or function to be passed a date */
|
187
222
|
selected: null, /* dates already selected. can be string, date, or array of strings or dates. */
|
@@ -206,8 +241,10 @@ Kalendae.prototype = {
|
|
206
241
|
monthMiddle :'k-middle-month',
|
207
242
|
monthLast :'k-last-month',
|
208
243
|
title :'k-title',
|
209
|
-
|
210
|
-
|
244
|
+
previousMonth :'k-btn-previous-month',
|
245
|
+
nextMonth :'k-btn-next-month',
|
246
|
+
previousYear :'k-btn-previous-year',
|
247
|
+
nextYear :'k-btn-next-year',
|
211
248
|
caption :'k-caption',
|
212
249
|
header :'k-header',
|
213
250
|
days :'k-days',
|
@@ -216,15 +253,24 @@ Kalendae.prototype = {
|
|
216
253
|
daySelected :'k-selected',
|
217
254
|
dayInRange :'k-range',
|
218
255
|
dayToday :'k-today',
|
219
|
-
monthSeparator :'k-separator'
|
256
|
+
monthSeparator :'k-separator',
|
257
|
+
disablePreviousMonth :'k-disable-previous-month-btn',
|
258
|
+
disableNextMonth :'k-disable-next-month-btn',
|
259
|
+
disablePreviousYear :'k-disable-previous-year-btn',
|
260
|
+
disableNextYear :'k-disable-next-year-btn'
|
220
261
|
},
|
221
262
|
|
263
|
+
disablePreviousMonth: false,
|
264
|
+
disableNextMonth: false,
|
265
|
+
disablePreviousYear: false,
|
266
|
+
disableNextYear: false,
|
267
|
+
|
222
268
|
directions: {
|
223
|
-
'past' :function (date) {return moment(date).
|
224
|
-
'today-past' :function (date) {return moment(date).
|
269
|
+
'past' :function (date) {return moment(date).yearDay() >= today.yearDay();},
|
270
|
+
'today-past' :function (date) {return moment(date).yearDay() > today.yearDay();},
|
225
271
|
'any' :function (date) {return false;},
|
226
|
-
'today-future' :function (date) {return moment(date).
|
227
|
-
'future' :function (date) {return moment(date).
|
272
|
+
'today-future' :function (date) {return moment(date).yearDay() < today.yearDay();},
|
273
|
+
'future' :function (date) {return moment(date).yearDay() <= today.yearDay();}
|
228
274
|
},
|
229
275
|
|
230
276
|
getSelectedAsDates : function () {
|
@@ -272,13 +318,13 @@ Kalendae.prototype = {
|
|
272
318
|
},
|
273
319
|
|
274
320
|
isSelected : function (input) {
|
275
|
-
input = moment(input).
|
321
|
+
input = moment(input).yearDay();
|
276
322
|
if (input < 1 || !this._sel || this._sel.length < 1) return false;
|
277
323
|
|
278
324
|
switch (this.settings.mode) {
|
279
325
|
case 'range':
|
280
|
-
var a = this._sel[0] ? this._sel[0].
|
281
|
-
b = this._sel[1] ? this._sel[1].
|
326
|
+
var a = this._sel[0] ? this._sel[0].yearDay() : 0,
|
327
|
+
b = this._sel[1] ? this._sel[1].yearDay() : 0;
|
282
328
|
|
283
329
|
if (a === input || b === input) return 1;
|
284
330
|
if (!a || !b) return 0;
|
@@ -289,7 +335,7 @@ Kalendae.prototype = {
|
|
289
335
|
case 'multiple':
|
290
336
|
var i = this._sel.length;
|
291
337
|
while (i--) {
|
292
|
-
if (this._sel[i].
|
338
|
+
if (this._sel[i].yearDay() === input) {
|
293
339
|
return true;
|
294
340
|
}
|
295
341
|
}
|
@@ -299,7 +345,7 @@ Kalendae.prototype = {
|
|
299
345
|
case 'single':
|
300
346
|
/* falls through */
|
301
347
|
default:
|
302
|
-
return (this._sel[0] && (this._sel[0].
|
348
|
+
return (this._sel[0] && (this._sel[0].yearDay() === input));
|
303
349
|
}
|
304
350
|
|
305
351
|
return false;
|
@@ -307,13 +353,13 @@ Kalendae.prototype = {
|
|
307
353
|
|
308
354
|
setSelected : function (input, draw) {
|
309
355
|
this._sel = parseDates(input, this.settings.parseSplitDelimiter, this.settings.format);
|
310
|
-
this._sel.sort(function (a,b) {return a.
|
356
|
+
this._sel.sort(function (a,b) {return a.yearDay() - b.yearDay();});
|
311
357
|
|
312
358
|
if (draw !== false) this.draw();
|
313
359
|
},
|
314
360
|
|
315
361
|
addSelected : function (date, draw) {
|
316
|
-
date = moment(date).hours(
|
362
|
+
date = moment(date).hours(12);
|
317
363
|
switch (this.settings.mode) {
|
318
364
|
case 'multiple':
|
319
365
|
if (!this.isSelected(date)) this._sel.push(date);
|
@@ -323,7 +369,7 @@ Kalendae.prototype = {
|
|
323
369
|
|
324
370
|
if (this._sel.length !== 1) this._sel = [date];
|
325
371
|
else {
|
326
|
-
if (date.
|
372
|
+
if (date.yearDay() > this._sel[0].yearDay()) this._sel[1] = date;
|
327
373
|
else this._sel = [date, this._sel[0]];
|
328
374
|
}
|
329
375
|
break;
|
@@ -333,17 +379,17 @@ Kalendae.prototype = {
|
|
333
379
|
this._sel = [date];
|
334
380
|
break;
|
335
381
|
}
|
336
|
-
this._sel.sort(function (a,b) {return a.
|
382
|
+
this._sel.sort(function (a,b) {return a.yearDay() - b.yearDay();});
|
337
383
|
this.publish('change', this);
|
338
384
|
if (draw !== false) this.draw();
|
339
385
|
return true;
|
340
386
|
},
|
341
387
|
|
342
388
|
removeSelected : function (date, draw) {
|
343
|
-
date = moment(date).
|
389
|
+
date = moment(date).yearDay();
|
344
390
|
var i = this._sel.length;
|
345
391
|
while (i--) {
|
346
|
-
if (this._sel[i].
|
392
|
+
if (this._sel[i].yearDay() === date) {
|
347
393
|
this._sel.splice(i,1);
|
348
394
|
this.publish('change', this);
|
349
395
|
if (draw !== false) this.draw();
|
@@ -355,7 +401,7 @@ Kalendae.prototype = {
|
|
355
401
|
|
356
402
|
draw : function draw() {
|
357
403
|
// return;
|
358
|
-
var month = moment(this.viewStartDate),
|
404
|
+
var month = moment(this.viewStartDate).hours(12), //force middle of the day to avoid any weird date shifts
|
359
405
|
day,
|
360
406
|
classes = this.classes,
|
361
407
|
cal,
|
@@ -369,16 +415,6 @@ Kalendae.prototype = {
|
|
369
415
|
|
370
416
|
c = this.calendars.length;
|
371
417
|
|
372
|
-
var viewDelta = ({
|
373
|
-
'past' : c-1,
|
374
|
-
'today-past' : c-1,
|
375
|
-
'any' : c>2?Math.floor(c/2):0,
|
376
|
-
'today-future' : 0,
|
377
|
-
'future' : 0
|
378
|
-
})[this.settings.direction];
|
379
|
-
|
380
|
-
if (viewDelta) month = month.subtract({M:viewDelta});
|
381
|
-
|
382
418
|
do {
|
383
419
|
day = moment(month).date(1);
|
384
420
|
day.day( day.day() < this.settings.weekStart ? this.settings.weekStart-7 : this.settings.weekStart);
|
@@ -399,7 +435,7 @@ Kalendae.prototype = {
|
|
399
435
|
if (day.month() != month.month()) klass.push(classes.dayOutOfMonth);
|
400
436
|
else if (!(this.blackout(day) || this.direction(day)) || s>0) klass.push(classes.dayActive);
|
401
437
|
|
402
|
-
if (
|
438
|
+
if (day.yearDay() === today.yearDay()) klass.push(classes.dayToday);
|
403
439
|
|
404
440
|
dateString = day.format(this.settings.dayAttributeFormat);
|
405
441
|
if (opts.dateClassMap[dateString]) klass.push(opts.dateClassMap[dateString]);
|
@@ -414,6 +450,52 @@ Kalendae.prototype = {
|
|
414
450
|
month.add('months',1);
|
415
451
|
} while (++i < c);
|
416
452
|
|
453
|
+
if (opts.directionScrolling) {
|
454
|
+
var diff = -(moment().diff(month, 'months'));
|
455
|
+
if (opts.direction==='today-past' || opts.direction==='past') {
|
456
|
+
|
457
|
+
if (diff <= 0) {
|
458
|
+
this.disableNextMonth = false;
|
459
|
+
util.removeClassName(this.container, classes.disableNextMonth);
|
460
|
+
} else {
|
461
|
+
this.disableNextMonth = true;
|
462
|
+
util.addClassName(this.container, classes.disableNextMonth);
|
463
|
+
}
|
464
|
+
|
465
|
+
} else if (opts.direction==='today-future' || opts.direction==='future') {
|
466
|
+
|
467
|
+
if (diff > opts.months) {
|
468
|
+
this.disablePreviousMonth = false;
|
469
|
+
util.removeClassName(this.container, classes.disablePreviousMonth);
|
470
|
+
} else {
|
471
|
+
this.disablePreviousMonth = true;
|
472
|
+
util.addClassName(this.container, classes.disablePreviousMonth);
|
473
|
+
}
|
474
|
+
|
475
|
+
}
|
476
|
+
|
477
|
+
|
478
|
+
if (opts.direction==='today-past' || opts.direction==='past') {
|
479
|
+
if (month.add({Y:1}).diff(moment(), 'years') < 0) {
|
480
|
+
this.disableNextYear = false;
|
481
|
+
util.removeClassName(this.container, classes.disableNextYear);
|
482
|
+
} else {
|
483
|
+
this.disableNextYear = true;
|
484
|
+
util.addClassName(this.container, classes.disableNextYear);
|
485
|
+
}
|
486
|
+
|
487
|
+
} else if (opts.direction==='today-future' || opts.direction==='future') {
|
488
|
+
if (month.subtract({Y:1}).diff(moment(), 'years') > 0) {
|
489
|
+
this.disablePreviousYear = false;
|
490
|
+
util.removeClassName(this.container, classes.disablePreviousYear);
|
491
|
+
} else {
|
492
|
+
this.disablePreviousYear = true;
|
493
|
+
util.addClassName(this.container, classes.disablePreviousYear);
|
494
|
+
}
|
495
|
+
|
496
|
+
}
|
497
|
+
|
498
|
+
}
|
417
499
|
}
|
418
500
|
}
|
419
501
|
|
@@ -426,10 +508,10 @@ var parseDates = function (input, delimiter, format) {
|
|
426
508
|
input = [input];
|
427
509
|
}
|
428
510
|
|
429
|
-
c = input.length;
|
511
|
+
var c = input.length;
|
430
512
|
i = 0;
|
431
513
|
do {
|
432
|
-
if (input[i]) output.push( moment(input[i], format).hours(
|
514
|
+
if (input[i]) output.push( moment(input[i], format).hours(12) );
|
433
515
|
} while (++i < c);
|
434
516
|
|
435
517
|
return output;
|
@@ -440,6 +522,11 @@ var parseDates = function (input, delimiter, format) {
|
|
440
522
|
window.Kalendae = Kalendae;
|
441
523
|
|
442
524
|
var util = Kalendae.util = {
|
525
|
+
|
526
|
+
isIE8: function() {
|
527
|
+
return !!( (/msie 8./i).test(navigator.appVersion) && !(/opera/i).test(navigator.userAgent) && window.ActiveXObject && XDomainRequest && !window.msPerformance );
|
528
|
+
},
|
529
|
+
|
443
530
|
// ELEMENT FUNCTIONS
|
444
531
|
|
445
532
|
$: function (elem) {
|
@@ -464,6 +551,16 @@ var util = Kalendae.util = {
|
|
464
551
|
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
|
465
552
|
},
|
466
553
|
|
554
|
+
getStyle: function (elem, styleProp) {
|
555
|
+
var y;
|
556
|
+
if (elem.currentStyle) {
|
557
|
+
y = elem.currentStyle[styleProp];
|
558
|
+
} else if (window.getComputedStyle) {
|
559
|
+
y = window.getComputedStyle(elem, null)[styleProp];
|
560
|
+
}
|
561
|
+
return y;
|
562
|
+
},
|
563
|
+
|
467
564
|
domReady:function (f){/in/.test(document.readyState) ? setTimeout(function() {util.domReady(f);},9) : f()},
|
468
565
|
|
469
566
|
// Adds a listener callback to a DOM element which is fired on a specified
|
@@ -516,6 +613,13 @@ var util = Kalendae.util = {
|
|
516
613
|
elem.className = util.trimString(elem.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' '));
|
517
614
|
},
|
518
615
|
|
616
|
+
isFixed: function (elem) {
|
617
|
+
do {
|
618
|
+
if (util.getStyle(elem, 'position') === 'fixed') return true;
|
619
|
+
} while ((elem = elem.offsetParent));
|
620
|
+
return false;
|
621
|
+
},
|
622
|
+
|
519
623
|
getPosition: function (elem, isInner) {
|
520
624
|
var x = elem.offsetLeft,
|
521
625
|
y = elem.offsetTop,
|
@@ -629,6 +733,14 @@ Kalendae.Input = function (targetElement, options) {
|
|
629
733
|
//call our parent constructor
|
630
734
|
Kalendae.call(self, opts);
|
631
735
|
|
736
|
+
//create the close button
|
737
|
+
if (opts.closeButton) {
|
738
|
+
var $closeButton = util.make('a', {'class':classes.closeButton}, self.container)
|
739
|
+
util.addEvent($closeButton, 'click', function () {
|
740
|
+
$input.blur();
|
741
|
+
});
|
742
|
+
}
|
743
|
+
|
632
744
|
if (overwriteInput) $input.value = self.getSelected();
|
633
745
|
|
634
746
|
var $container = self.container,
|
@@ -670,12 +782,13 @@ Kalendae.Input.prototype = util.merge(Kalendae.prototype, {
|
|
670
782
|
defaults : util.merge(Kalendae.prototype.defaults, {
|
671
783
|
format: 'MM/DD/YYYY',
|
672
784
|
side: 'bottom',
|
785
|
+
closeButton: true,
|
673
786
|
offsetLeft: 0,
|
674
787
|
offsetTop: 0
|
675
788
|
}),
|
676
789
|
classes : util.merge(Kalendae.prototype.classes, {
|
677
|
-
positioned : 'k-floating'
|
678
|
-
|
790
|
+
positioned : 'k-floating',
|
791
|
+
closeButton: 'k-btn-close'
|
679
792
|
}),
|
680
793
|
|
681
794
|
show : function () {
|
@@ -706,6 +819,8 @@ Kalendae.Input.prototype = util.merge(Kalendae.prototype, {
|
|
706
819
|
break;
|
707
820
|
}
|
708
821
|
|
822
|
+
style.position = util.isFixed($input) ? 'fixed' : 'absolute';
|
823
|
+
|
709
824
|
},
|
710
825
|
|
711
826
|
hide : function () {
|
@@ -801,13 +916,12 @@ var MinPubSub = function(d){
|
|
801
916
|
}
|
802
917
|
};
|
803
918
|
|
804
|
-
};//
|
919
|
+
};// moment.js
|
805
920
|
// Altered slightly for use in Kalendae.js
|
806
|
-
//
|
807
|
-
//
|
808
|
-
//
|
809
|
-
//
|
810
|
-
// Version 1.3.0
|
921
|
+
// version : 1.5.0
|
922
|
+
// author : Tim Wood
|
923
|
+
// license : MIT
|
924
|
+
// momentjs.com
|
811
925
|
|
812
926
|
var moment = Kalendae.moment = (function (Date, undefined) {
|
813
927
|
|
@@ -817,18 +931,27 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
817
931
|
hasModule = (typeof module !== 'undefined'),
|
818
932
|
paramsToParse = 'months|monthsShort|monthsParse|weekdays|weekdaysShort|longDateFormat|calendar|relativeTime|ordinal|meridiem'.split('|'),
|
819
933
|
i,
|
934
|
+
jsonRegex = /^\/?Date\((\-?\d+)/i,
|
820
935
|
charactersToReplace = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LT|LL?L?L?)/g,
|
821
936
|
nonuppercaseLetters = /[^A-Z]/g,
|
822
937
|
timezoneRegex = /\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,
|
823
938
|
tokenCharacters = /(\\)?(MM?M?M?|dd?d?d|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?|T)/g,
|
824
939
|
inputCharacters = /(\\)?([0-9]+|([a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+|([\+\-]\d\d:?\d\d))/gi,
|
940
|
+
isoRegex = /\d{4}.\d\d.\d\d(T(\d\d(.\d\d(.\d\d)?)?)?([\+\-]\d\d:?\d\d)?)?/,
|
941
|
+
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
|
942
|
+
isoTimes = [
|
943
|
+
['HH:mm:ss', /T\d\d:\d\d:\d\d/],
|
944
|
+
['HH:mm', /T\d\d:\d\d/],
|
945
|
+
['HH', /T\d\d/]
|
946
|
+
],
|
825
947
|
timezoneParseRegex = /([\+\-]|\d\d)/gi,
|
826
|
-
VERSION = "1.
|
948
|
+
VERSION = "1.5.0",
|
827
949
|
shortcuts = 'Month|Date|Hours|Minutes|Seconds|Milliseconds'.split('|');
|
828
950
|
|
829
951
|
// Moment prototype object
|
830
|
-
function Moment(date) {
|
952
|
+
function Moment(date, isUTC) {
|
831
953
|
this._d = date;
|
954
|
+
this._isUTC = !!isUTC;
|
832
955
|
}
|
833
956
|
|
834
957
|
// left zero fill a number
|
@@ -847,7 +970,7 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
847
970
|
input = isString ? {} : _input,
|
848
971
|
ms, d, M, currentDate;
|
849
972
|
if (isString && val) {
|
850
|
-
input[_input] = val;
|
973
|
+
input[_input] = +val;
|
851
974
|
}
|
852
975
|
ms = (input.ms || input.milliseconds || 0) +
|
853
976
|
(input.s || input.seconds || 0) * 1e3 + // 1000
|
@@ -886,16 +1009,15 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
886
1009
|
}
|
887
1010
|
|
888
1011
|
// format date using native date object
|
889
|
-
function
|
890
|
-
var
|
891
|
-
currentMonth = m.month(),
|
1012
|
+
function formatMoment(m, inputString) {
|
1013
|
+
var currentMonth = m.month(),
|
892
1014
|
currentDate = m.date(),
|
893
1015
|
currentYear = m.year(),
|
894
1016
|
currentDay = m.day(),
|
895
1017
|
currentHours = m.hours(),
|
896
1018
|
currentMinutes = m.minutes(),
|
897
1019
|
currentSeconds = m.seconds(),
|
898
|
-
currentZone = m.zone(),
|
1020
|
+
currentZone = -m.zone(),
|
899
1021
|
ordinal = moment.ordinal,
|
900
1022
|
meridiem = moment.meridiem;
|
901
1023
|
// check if the character is a format
|
@@ -989,18 +1111,18 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
989
1111
|
case 'zz' :
|
990
1112
|
// depreciating 'zz' fall through to 'z'
|
991
1113
|
case 'z' :
|
992
|
-
return (
|
1114
|
+
return (m._d.toString().match(timezoneRegex) || [''])[0].replace(nonuppercaseLetters, '');
|
993
1115
|
case 'Z' :
|
994
|
-
return (currentZone
|
1116
|
+
return (currentZone < 0 ? '-' : '+') + leftZeroFill(~~(Math.abs(currentZone) / 60), 2) + ':' + leftZeroFill(~~(Math.abs(currentZone) % 60), 2);
|
995
1117
|
case 'ZZ' :
|
996
|
-
return (currentZone
|
1118
|
+
return (currentZone < 0 ? '-' : '+') + leftZeroFill(~~(10 * Math.abs(currentZone) / 6), 4);
|
997
1119
|
// LONG DATES
|
998
1120
|
case 'L' :
|
999
1121
|
case 'LL' :
|
1000
1122
|
case 'LLL' :
|
1001
1123
|
case 'LLLL' :
|
1002
1124
|
case 'LT' :
|
1003
|
-
return
|
1125
|
+
return formatMoment(m, moment.longDateFormat[input]);
|
1004
1126
|
// DEFAULT
|
1005
1127
|
default :
|
1006
1128
|
return input.replace(/(^\[)|(\\)|\]$/g, "");
|
@@ -1017,6 +1139,7 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1017
1139
|
isUsingUTC = false,
|
1018
1140
|
inputParts = string.match(inputCharacters),
|
1019
1141
|
formatParts = format.match(tokenCharacters),
|
1142
|
+
len = Math.min(inputParts.length, formatParts.length),
|
1020
1143
|
i,
|
1021
1144
|
isPm;
|
1022
1145
|
|
@@ -1091,22 +1214,22 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1091
1214
|
// fall through to ZZ
|
1092
1215
|
case 'ZZ' :
|
1093
1216
|
isUsingUTC = true;
|
1094
|
-
a = input.match(timezoneParseRegex);
|
1095
|
-
if (a[1]) {
|
1217
|
+
a = (input || '').match(timezoneParseRegex);
|
1218
|
+
if (a && a[1]) {
|
1096
1219
|
timezoneHours = ~~a[1];
|
1097
1220
|
}
|
1098
|
-
if (a[2]) {
|
1221
|
+
if (a && a[2]) {
|
1099
1222
|
timezoneMinutes = ~~a[2];
|
1100
1223
|
}
|
1101
1224
|
// reverse offsets
|
1102
|
-
if (a[0] === '
|
1225
|
+
if (a && a[0] === '+') {
|
1103
1226
|
timezoneHours = -timezoneHours;
|
1104
1227
|
timezoneMinutes = -timezoneMinutes;
|
1105
1228
|
}
|
1106
1229
|
break;
|
1107
1230
|
}
|
1108
1231
|
}
|
1109
|
-
for (i = 0; i <
|
1232
|
+
for (i = 0; i < len; i++) {
|
1110
1233
|
addTime(formatParts[i], inputParts[i]);
|
1111
1234
|
}
|
1112
1235
|
// handle am pm
|
@@ -1149,7 +1272,7 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1149
1272
|
curScore;
|
1150
1273
|
for (i = 0; i < formats.length; i++) {
|
1151
1274
|
curDate = makeDateFromStringAndFormat(string, formats[i]);
|
1152
|
-
curScore = compareArrays(inputParts,
|
1275
|
+
curScore = compareArrays(inputParts, formatMoment(new Moment(curDate), formats[i]).match(inputCharacters));
|
1153
1276
|
if (curScore < scoreToBeat) {
|
1154
1277
|
scoreToBeat = curScore;
|
1155
1278
|
output = curDate;
|
@@ -1158,12 +1281,57 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1158
1281
|
return output;
|
1159
1282
|
}
|
1160
1283
|
|
1284
|
+
// date from iso format
|
1285
|
+
function makeDateFromString(string) {
|
1286
|
+
var format = 'YYYY-MM-DDT',
|
1287
|
+
i;
|
1288
|
+
if (isoRegex.exec(string)) {
|
1289
|
+
for (i = 0; i < 3; i++) {
|
1290
|
+
if (isoTimes[i][1].exec(string)) {
|
1291
|
+
format += isoTimes[i][0];
|
1292
|
+
break;
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
return makeDateFromStringAndFormat(string, format + 'Z');
|
1296
|
+
}
|
1297
|
+
return new Date(string);
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
// helper function for _date.from() and _date.fromNow()
|
1301
|
+
function substituteTimeAgo(string, number, withoutSuffix) {
|
1302
|
+
var rt = moment.relativeTime[string];
|
1303
|
+
return (typeof rt === 'function') ?
|
1304
|
+
rt(number || 1, !!withoutSuffix, string) :
|
1305
|
+
rt.replace(/%d/i, number || 1);
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
function relativeTime(milliseconds, withoutSuffix) {
|
1309
|
+
var seconds = round(Math.abs(milliseconds) / 1000),
|
1310
|
+
minutes = round(seconds / 60),
|
1311
|
+
hours = round(minutes / 60),
|
1312
|
+
days = round(hours / 24),
|
1313
|
+
years = round(days / 365),
|
1314
|
+
args = seconds < 45 && ['s', seconds] ||
|
1315
|
+
minutes === 1 && ['m'] ||
|
1316
|
+
minutes < 45 && ['mm', minutes] ||
|
1317
|
+
hours === 1 && ['h'] ||
|
1318
|
+
hours < 22 && ['hh', hours] ||
|
1319
|
+
days === 1 && ['d'] ||
|
1320
|
+
days <= 25 && ['dd', days] ||
|
1321
|
+
days <= 45 && ['M'] ||
|
1322
|
+
days < 345 && ['MM', round(days / 30)] ||
|
1323
|
+
years === 1 && ['y'] || ['yy', years];
|
1324
|
+
args[2] = withoutSuffix;
|
1325
|
+
return substituteTimeAgo.apply({}, args);
|
1326
|
+
}
|
1327
|
+
|
1161
1328
|
moment = function (input, format) {
|
1162
|
-
if (input === null) {
|
1329
|
+
if (input === null || input === '') {
|
1163
1330
|
return null;
|
1164
1331
|
}
|
1165
|
-
var date
|
1166
|
-
|
1332
|
+
var date,
|
1333
|
+
matched;
|
1334
|
+
// parse Moment object
|
1167
1335
|
if (input && input._d instanceof Date) {
|
1168
1336
|
date = new Date(+input._d);
|
1169
1337
|
// parse string and format
|
@@ -1173,19 +1341,68 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1173
1341
|
} else {
|
1174
1342
|
date = makeDateFromStringAndFormat(input, format);
|
1175
1343
|
}
|
1176
|
-
//
|
1344
|
+
// evaluate it as a JSON-encoded date
|
1177
1345
|
} else {
|
1346
|
+
matched = jsonRegex.exec(input);
|
1178
1347
|
date = input === undefined ? new Date() :
|
1348
|
+
matched ? new Date(+matched[1]) :
|
1179
1349
|
input instanceof Date ? input :
|
1180
1350
|
isArray(input) ? dateFromArray(input) :
|
1351
|
+
typeof input === 'string' ? makeDateFromString(input) :
|
1181
1352
|
new Date(input);
|
1182
1353
|
}
|
1183
1354
|
return new Moment(date);
|
1184
1355
|
};
|
1185
1356
|
|
1357
|
+
// creating with utc
|
1358
|
+
moment.utc = function (input, format) {
|
1359
|
+
if (isArray(input)) {
|
1360
|
+
return new Moment(new Date(Date.UTC.apply({}, input)), true);
|
1361
|
+
}
|
1362
|
+
return (format && input) ? moment(input + ' 0', format + ' Z').utc() : moment(input).utc();
|
1363
|
+
};
|
1364
|
+
|
1365
|
+
// humanizeDuration
|
1366
|
+
moment.humanizeDuration = function (num, type, withSuffix) {
|
1367
|
+
var difference = +num,
|
1368
|
+
rel = moment.relativeTime,
|
1369
|
+
output;
|
1370
|
+
switch (type) {
|
1371
|
+
case "seconds" :
|
1372
|
+
difference *= 1000; // 1000
|
1373
|
+
break;
|
1374
|
+
case "minutes" :
|
1375
|
+
difference *= 60000; // 60 * 1000
|
1376
|
+
break;
|
1377
|
+
case "hours" :
|
1378
|
+
difference *= 3600000; // 60 * 60 * 1000
|
1379
|
+
break;
|
1380
|
+
case "days" :
|
1381
|
+
difference *= 86400000; // 24 * 60 * 60 * 1000
|
1382
|
+
break;
|
1383
|
+
case "weeks" :
|
1384
|
+
difference *= 604800000; // 7 * 24 * 60 * 60 * 1000
|
1385
|
+
break;
|
1386
|
+
case "months" :
|
1387
|
+
difference *= 2592000000; // 30 * 24 * 60 * 60 * 1000
|
1388
|
+
break;
|
1389
|
+
case "years" :
|
1390
|
+
difference *= 31536000000; // 365 * 24 * 60 * 60 * 1000
|
1391
|
+
break;
|
1392
|
+
default :
|
1393
|
+
withSuffix = !!type;
|
1394
|
+
break;
|
1395
|
+
}
|
1396
|
+
output = relativeTime(difference, !withSuffix);
|
1397
|
+
return withSuffix ? (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output) : output;
|
1398
|
+
};
|
1399
|
+
|
1186
1400
|
// version number
|
1187
1401
|
moment.version = VERSION;
|
1188
1402
|
|
1403
|
+
// default format
|
1404
|
+
moment.defaultFormat = isoFormat;
|
1405
|
+
|
1189
1406
|
// language switching and caching
|
1190
1407
|
moment.lang = function (key, values) {
|
1191
1408
|
var i,
|
@@ -1263,33 +1480,10 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1263
1480
|
}
|
1264
1481
|
});
|
1265
1482
|
|
1266
|
-
//
|
1267
|
-
function
|
1268
|
-
|
1269
|
-
|
1270
|
-
rt(number || 1, !!withoutSuffix, string) :
|
1271
|
-
rt.replace(/%d/i, number || 1);
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
function relativeTime(milliseconds, withoutSuffix) {
|
1275
|
-
var seconds = round(Math.abs(milliseconds) / 1000),
|
1276
|
-
minutes = round(seconds / 60),
|
1277
|
-
hours = round(minutes / 60),
|
1278
|
-
days = round(hours / 24),
|
1279
|
-
years = round(days / 365),
|
1280
|
-
args = seconds < 45 && ['s', seconds] ||
|
1281
|
-
minutes === 1 && ['m'] ||
|
1282
|
-
minutes < 45 && ['mm', minutes] ||
|
1283
|
-
hours === 1 && ['h'] ||
|
1284
|
-
hours < 22 && ['hh', hours] ||
|
1285
|
-
days === 1 && ['d'] ||
|
1286
|
-
days <= 25 && ['dd', days] ||
|
1287
|
-
days <= 45 && ['M'] ||
|
1288
|
-
days < 345 && ['MM', round(days / 30)] ||
|
1289
|
-
years === 1 && ['y'] || ['yy', years];
|
1290
|
-
args[2] = withoutSuffix;
|
1291
|
-
return substituteTimeAgo.apply({}, args);
|
1292
|
-
}
|
1483
|
+
// compare moment object
|
1484
|
+
moment.isMoment = function (obj) {
|
1485
|
+
return obj instanceof Moment;
|
1486
|
+
};
|
1293
1487
|
|
1294
1488
|
// shortcut for prototype
|
1295
1489
|
moment.fn = Moment.prototype = {
|
@@ -1302,7 +1496,7 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1302
1496
|
return +this._d;
|
1303
1497
|
},
|
1304
1498
|
|
1305
|
-
|
1499
|
+
'native' : function () {
|
1306
1500
|
return this._d;
|
1307
1501
|
},
|
1308
1502
|
|
@@ -1314,8 +1508,18 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1314
1508
|
return this._d;
|
1315
1509
|
},
|
1316
1510
|
|
1511
|
+
utc : function () {
|
1512
|
+
this._isUTC = true;
|
1513
|
+
return this;
|
1514
|
+
},
|
1515
|
+
|
1516
|
+
local : function () {
|
1517
|
+
this._isUTC = false;
|
1518
|
+
return this;
|
1519
|
+
},
|
1520
|
+
|
1317
1521
|
format : function (inputString) {
|
1318
|
-
return
|
1522
|
+
return formatMoment(this, inputString ? inputString : moment.defaultFormat);
|
1319
1523
|
},
|
1320
1524
|
|
1321
1525
|
add : function (input, val) {
|
@@ -1330,13 +1534,14 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1330
1534
|
|
1331
1535
|
diff : function (input, val, asFloat) {
|
1332
1536
|
var inputMoment = moment(input),
|
1333
|
-
|
1537
|
+
zoneDiff = (this.zone() - inputMoment.zone()) * 6e4,
|
1538
|
+
diff = this._d - inputMoment._d - zoneDiff,
|
1334
1539
|
year = this.year() - inputMoment.year(),
|
1335
1540
|
month = this.month() - inputMoment.month(),
|
1336
|
-
|
1541
|
+
date = this.date() - inputMoment.date(),
|
1337
1542
|
output;
|
1338
1543
|
if (val === 'months') {
|
1339
|
-
output = year * 12 + month +
|
1544
|
+
output = year * 12 + month + date / 30;
|
1340
1545
|
} else if (val === 'years') {
|
1341
1546
|
output = year + month / 12;
|
1342
1547
|
} else {
|
@@ -1345,16 +1550,13 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1345
1550
|
val === 'hours' ? diff / 36e5 : // 1000 * 60 * 60
|
1346
1551
|
val === 'days' ? diff / 864e5 : // 1000 * 60 * 60 * 24
|
1347
1552
|
val === 'weeks' ? diff / 6048e5 : // 1000 * 60 * 60 * 24 * 7
|
1348
|
-
|
1553
|
+
diff;
|
1349
1554
|
}
|
1350
1555
|
return asFloat ? output : round(output);
|
1351
1556
|
},
|
1352
1557
|
|
1353
1558
|
from : function (time, withoutSuffix) {
|
1354
|
-
|
1355
|
-
rel = moment.relativeTime,
|
1356
|
-
output = relativeTime(difference, withoutSuffix);
|
1357
|
-
return withoutSuffix ? output : (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output);
|
1559
|
+
return moment.humanizeDuration(this.diff(time), !withoutSuffix);
|
1358
1560
|
},
|
1359
1561
|
|
1360
1562
|
fromNow : function (withoutSuffix) {
|
@@ -1362,9 +1564,7 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1362
1564
|
},
|
1363
1565
|
|
1364
1566
|
calendar : function () {
|
1365
|
-
var
|
1366
|
-
todayAtZeroHour = moment([today.year(), today.month(), today.date()]),
|
1367
|
-
diff = this.diff(todayAtZeroHour, 'days', true),
|
1567
|
+
var diff = this.diff(moment().sod(), 'days', true),
|
1368
1568
|
calendar = moment.calendar,
|
1369
1569
|
allElse = calendar.sameElse,
|
1370
1570
|
format = diff < -6 ? allElse :
|
@@ -1382,24 +1582,50 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1382
1582
|
},
|
1383
1583
|
|
1384
1584
|
isDST : function () {
|
1385
|
-
return this.zone()
|
1585
|
+
return (this.zone() < moment([this.year()]).zone() ||
|
1586
|
+
this.zone() < moment([this.year(), 5]).zone());
|
1386
1587
|
},
|
1387
1588
|
|
1388
1589
|
day : function (input) {
|
1389
1590
|
var day = this._d.getDay();
|
1390
|
-
return input
|
1591
|
+
return (typeof input === 'undefined') ? day :
|
1391
1592
|
this.add({ d : input - day });
|
1593
|
+
},
|
1594
|
+
|
1595
|
+
sod: function () {
|
1596
|
+
return this.clone()
|
1597
|
+
.hours(0)
|
1598
|
+
.minutes(0)
|
1599
|
+
.seconds(0)
|
1600
|
+
.milliseconds(0);
|
1601
|
+
},
|
1602
|
+
|
1603
|
+
eod: function () {
|
1604
|
+
// end of day = start of day plus 1 day, minus 1 millisecond
|
1605
|
+
return this.sod().add({
|
1606
|
+
d : 1,
|
1607
|
+
ms : -1
|
1608
|
+
});
|
1609
|
+
},
|
1610
|
+
|
1611
|
+
zone : function () {
|
1612
|
+
return this._isUTC ? 0 : this._d.getTimezoneOffset();
|
1613
|
+
},
|
1614
|
+
|
1615
|
+
daysInMonth : function () {
|
1616
|
+
return this.clone().month(this.month() + 1).date(0).date();
|
1392
1617
|
}
|
1393
1618
|
};
|
1394
1619
|
|
1395
1620
|
// helper for adding shortcuts
|
1396
1621
|
function makeShortcut(name, key) {
|
1397
1622
|
moment.fn[name] = function (input) {
|
1398
|
-
|
1399
|
-
|
1623
|
+
var utc = this._isUTC ? 'UTC' : '';
|
1624
|
+
if (typeof input !== 'undefined') {
|
1625
|
+
this._d['set' + utc + key](input);
|
1400
1626
|
return this;
|
1401
1627
|
} else {
|
1402
|
-
return this._d['get' + key]();
|
1628
|
+
return this._d['get' + utc + key]();
|
1403
1629
|
}
|
1404
1630
|
};
|
1405
1631
|
}
|
@@ -1412,15 +1638,24 @@ var moment = Kalendae.moment = (function (Date, undefined) {
|
|
1412
1638
|
// add shortcut for year (uses different syntax than the getter/setter 'year' == 'FullYear')
|
1413
1639
|
makeShortcut('year', 'FullYear');
|
1414
1640
|
|
1415
|
-
// add shortcut for timezone offset (no setter)
|
1416
|
-
moment.fn.zone = function () {
|
1417
|
-
return this._d.getTimezoneOffset();
|
1418
|
-
};
|
1419
|
-
|
1420
1641
|
return moment;
|
1421
1642
|
})(Date);
|
1422
1643
|
|
1423
|
-
|
1644
|
+
//function to reset the date object to 00:00 GMT
|
1645
|
+
moment.fn.stripTime = function () {
|
1646
|
+
this._d = new Date(Math.floor(this._d.valueOf() / 86400000) * 86400000);
|
1647
|
+
return this;
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
|
1651
|
+
//function to get the total number of days since the epoch.
|
1652
|
+
moment.fn.yearDay = function (input) {
|
1653
|
+
var yearday = Math.floor(this._d / 86400000);
|
1654
|
+
return (typeof input === 'undefined') ? yearday :
|
1655
|
+
this.add({ d : input - yearday });
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
today = moment().stripTime();
|
1424
1659
|
|
1425
1660
|
if (typeof jQuery !== 'undefined') {
|
1426
1661
|
jQuery.fn.kalendae = function (options) {
|
@@ -1,18 +1,19 @@
|
|
1
|
-
|
1
|
+
/** Base container **/
|
2
2
|
.kalendae {
|
3
3
|
display: inline-block;zoom:1;*display:inline;
|
4
4
|
background:#eee;
|
5
5
|
padding:10px;
|
6
6
|
margin:5px;
|
7
7
|
border-radius:5px;
|
8
|
-
|
9
|
-
|
8
|
+
-moz-border-radius: 5px;
|
9
|
+
-webkit-border-radius: 5px;
|
10
10
|
font-size:11px;
|
11
11
|
font-family:'Helvetica Neue', 'Helvetica';
|
12
12
|
cursor:default;
|
13
13
|
position:relative;
|
14
14
|
}
|
15
15
|
|
16
|
+
/** Popup Container for Kalendae.Input **/
|
16
17
|
.kalendae.k-floating {
|
17
18
|
position:absolute;
|
18
19
|
top:0;
|
@@ -24,25 +25,78 @@
|
|
24
25
|
-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.75);
|
25
26
|
}
|
26
27
|
|
28
|
+
/** Kalendae.Input's popup close button **/
|
29
|
+
.kalendae .k-btn-close {
|
30
|
+
position:absolute;
|
31
|
+
top:-8px;
|
32
|
+
right:-8px;
|
33
|
+
width:16px;
|
34
|
+
height:16px;
|
35
|
+
background:white;
|
36
|
+
border:2px solid #ccc;
|
37
|
+
color:#999;
|
38
|
+
line-height:17px;
|
39
|
+
text-align:center;
|
40
|
+
font-size:13px;
|
41
|
+
border-radius:10px;
|
42
|
+
box-shadow:0 1px 3px rgba(0,0,0,0.75);
|
43
|
+
cursor:pointer;
|
44
|
+
}
|
45
|
+
.kalendae .k-btn-close:after {content:"\2716";}
|
46
|
+
.kalendae .k-btn-close:hover {
|
47
|
+
color:#7EA0E2;
|
48
|
+
background:white;
|
49
|
+
border-color:#7EA0E2;
|
50
|
+
}
|
51
|
+
|
52
|
+
/** Month Container **/
|
27
53
|
.kalendae .k-calendar {display: inline-block;zoom:1;*display:inline;width:155px;vertical-align:top;}
|
54
|
+
|
55
|
+
/** Month Separator **/
|
28
56
|
.kalendae .k-separator {display: inline-block;zoom:1;*display:inline;width:2px;vertical-align:top;background:#ddd;height:155px;margin:0px 10px;}
|
29
57
|
|
30
|
-
|
31
|
-
.kalendae .k-
|
58
|
+
/** Month Title Row **/
|
59
|
+
.kalendae .k-title {text-align:center;white-space:nowrap;position:relative;height:18px;}
|
60
|
+
.kalendae .k-caption {font-size:12px;line-height:18px;}
|
61
|
+
|
62
|
+
|
63
|
+
/** Month and Year Buttons **/
|
64
|
+
.kalendae .k-btn-previous-month,
|
65
|
+
.kalendae .k-btn-next-month,
|
66
|
+
.kalendae .k-btn-previous-year,
|
67
|
+
.kalendae .k-btn-next-year {width:16px;height:16px;cursor:pointer;position:absolute;top:0;color:#777;font-size:20px;line-height:14px;}
|
68
|
+
|
69
|
+
.kalendae .k-btn-previous-year {left:0;}
|
70
|
+
.kalendae .k-btn-previous-month {left:16px;}
|
71
|
+
.kalendae .k-btn-next-month {right:16px;}
|
72
|
+
.kalendae .k-btn-next-year {right:0;}
|
32
73
|
|
33
|
-
.kalendae .k-previous
|
34
|
-
.kalendae .k-next {
|
35
|
-
.kalendae .k-previous {float:left;}
|
36
|
-
.kalendae .k-next {float:right;background-position:top right}
|
74
|
+
.kalendae .k-btn-previous-month:after {content:"\276E";}
|
75
|
+
.kalendae .k-btn-next-month:after {content:"\276F";}
|
37
76
|
|
38
|
-
.kalendae .k-previous:
|
39
|
-
.kalendae .k-next:
|
77
|
+
.kalendae .k-btn-previous-year:after {content:"\276E\276E";}
|
78
|
+
.kalendae .k-btn-next-year:after {content:"\276F\276F";}
|
40
79
|
|
41
|
-
.kalendae .k-
|
42
|
-
.kalendae .k-
|
43
|
-
.kalendae .k-middle-month .k-previous,
|
44
|
-
.kalendae .k-last-month .k-previous {display:none;}
|
80
|
+
.kalendae .k-btn-previous-year,
|
81
|
+
.kalendae .k-btn-next-year {letter-spacing:-4px;text-align:left;}
|
45
82
|
|
83
|
+
.kalendae .k-btn-previous-month:hover,
|
84
|
+
.kalendae .k-btn-next-month:hover {color:#7EA0E2;}
|
85
|
+
|
86
|
+
.kalendae .k-btn-previous-year:hover,
|
87
|
+
.kalendae .k-btn-next-year:hover {color:#6FDF81;}
|
88
|
+
|
89
|
+
/** Remove extra buttons when calendar shows multiple months **/
|
90
|
+
.kalendae .k-first-month .k-btn-next-month,
|
91
|
+
.kalendae .k-middle-month .k-btn-next-month,
|
92
|
+
.kalendae .k-middle-month .k-btn-previous-month,
|
93
|
+
.kalendae .k-last-month .k-btn-previous-month,
|
94
|
+
.kalendae .k-first-month .k-btn-next-year,
|
95
|
+
.kalendae .k-middle-month .k-btn-next-year,
|
96
|
+
.kalendae .k-middle-month .k-btn-previous-year,
|
97
|
+
.kalendae .k-last-month .k-btn-previous-year {display:none;}
|
98
|
+
|
99
|
+
/** Force specific width for month container contents **/
|
46
100
|
.kalendae .k-title,
|
47
101
|
.kalendae .k-header,
|
48
102
|
.kalendae .k-days {
|
@@ -52,11 +106,20 @@
|
|
52
106
|
}
|
53
107
|
|
54
108
|
|
109
|
+
/** Hide unusable buttons **/
|
110
|
+
.kalendae.k-disable-next-month-btn .k-btn-next-month,
|
111
|
+
.kalendae.k-disable-previous-month-btn .k-btn-previous-month,
|
112
|
+
.kalendae.k-disable-next-year-btn .k-btn-next-year,
|
113
|
+
.kalendae.k-disable-previous-year-btn .k-btn-previous-year {
|
114
|
+
display:none;
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
/** Week columns and day cells **/
|
55
119
|
.kalendae .k-header span,
|
56
120
|
.kalendae .k-days span {
|
57
121
|
float:left;
|
58
122
|
margin:1px 1px;
|
59
|
-
/* outline:1px solid red;*/
|
60
123
|
}
|
61
124
|
|
62
125
|
.kalendae .k-header span {
|
@@ -75,45 +138,91 @@
|
|
75
138
|
padding:2px 3px 2px 2px;
|
76
139
|
border:1px solid transparent;
|
77
140
|
border-radius:3px;
|
78
|
-
|
79
|
-
|
141
|
+
-moz-border-radius: 3px;
|
142
|
+
-webkit-border-radius: 3px;
|
80
143
|
color:#999;
|
81
144
|
}
|
82
145
|
|
146
|
+
/** Today **/
|
83
147
|
.kalendae .k-today {
|
84
148
|
text-decoration:underline;
|
85
149
|
}
|
86
150
|
|
151
|
+
/** Selectable but not selected day **/
|
152
|
+
.kalendae .k-days span.k-active {
|
153
|
+
border-color:#ddd;
|
154
|
+
background-color:#fff;
|
155
|
+
cursor:pointer;
|
156
|
+
color:#333;
|
157
|
+
}
|
158
|
+
|
159
|
+
/** Selected day, when outside the selectable area **/
|
87
160
|
.kalendae .k-days span.k-selected {
|
88
161
|
border-color:#1072A5;
|
89
162
|
color:#1072A5;
|
90
163
|
}
|
91
164
|
|
165
|
+
/** Selected day, when inside the selectable area **/
|
92
166
|
.kalendae .k-days span.k-selected.k-active {
|
93
167
|
background:#7EA0E2;
|
94
168
|
color:white;
|
95
169
|
}
|
96
170
|
|
97
|
-
|
98
|
-
background:#C4D4F1;
|
99
|
-
border-color:#19AEFE;
|
100
|
-
color:#333;
|
101
|
-
}
|
171
|
+
/** Days between the start and end points on a range, outside of the selectable area **/
|
102
172
|
.kalendae .k-days span.k-range {
|
103
173
|
background:none;
|
104
174
|
border-color:#6DD4FE;
|
105
|
-
/* color:#333;*/
|
106
175
|
}
|
107
176
|
|
108
|
-
|
109
|
-
|
110
|
-
background
|
111
|
-
|
177
|
+
/** Days between the start and end points on a range, inside of the selectable area **/
|
178
|
+
.kalendae .k-days span.k-range.k-active {
|
179
|
+
background:#C4D4F1;
|
180
|
+
border-color:#19AEFE;
|
112
181
|
color:#333;
|
113
182
|
}
|
114
183
|
|
115
|
-
|
184
|
+
/** Selectable day, hovered **/
|
185
|
+
.kalendae .k-days span.k-active:hover {
|
116
186
|
border-color:#666;
|
117
187
|
}
|
118
188
|
|
119
|
-
|
189
|
+
/** Days outside of the month view (before the first day of the month, after the last day of the month) **/
|
190
|
+
.kalendae .k-days span.k-out-of-month {color:#ddd;}
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
/*-------------------------------------IE8 ONLY CODE BELOW THIS LINE--------------------------------------------*/
|
195
|
+
|
196
|
+
.kalendae.ie8.k-floating {
|
197
|
+
border:1px solid #ccc;
|
198
|
+
}
|
199
|
+
|
200
|
+
.kalendae.ie8 .k-btn-close {
|
201
|
+
width:20px;
|
202
|
+
height:20px;
|
203
|
+
border:none;
|
204
|
+
background:url('close.png') no-repeat top left;
|
205
|
+
}
|
206
|
+
.kalendae.ie8 .k-btn-close:after {display:none;}
|
207
|
+
|
208
|
+
.kalendae.ie8 .k-btn-previous-month,
|
209
|
+
.kalendae.ie8 .k-btn-next-month,
|
210
|
+
.kalendae.ie8 .k-btn-previous-year,
|
211
|
+
.kalendae.ie8 .k-btn-next-year {width:16px;height:16px;cursor:pointer;background:#777 url('arrows.png') no-repeat center left;position:absolute;top:0;}
|
212
|
+
|
213
|
+
.kalendae.ie8 .k-btn-next-month,
|
214
|
+
.kalendae.ie8 .k-btn-next-year {background-position:center right;}
|
215
|
+
|
216
|
+
.kalendae.ie8 .k-btn-previous-month:hover,
|
217
|
+
.kalendae.ie8 .k-btn-next-month:hover {background-color:#7EA0E2;}
|
218
|
+
|
219
|
+
.kalendae.ie8 .k-btn-previous-year,
|
220
|
+
.kalendae.ie8 .k-btn-next-year {background-color:#333;}
|
221
|
+
|
222
|
+
.kalendae.ie8 .k-btn-previous-year:hover,
|
223
|
+
.kalendae.ie8 .k-btn-next-year:hover {background-color:#6FDF81;}
|
224
|
+
|
225
|
+
.kalendae.ie8 .k-btn-previous-month:after,
|
226
|
+
.kalendae.ie8 .k-btn-next-month:after,
|
227
|
+
.kalendae.ie8 .k-btn-previous-year:after,
|
228
|
+
.kalendae.ie8 .k-btn-next-year:after {display:none;}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kalendae_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154387040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154387040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154386120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154386120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154384920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154384920
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: capybara
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154383380 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154383380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: turn
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154381380 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154381380
|
69
69
|
description: Make Kalendae available in the Rails asset pipeline.
|
70
70
|
email:
|
71
71
|
- sdball@gmail.com
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- test/lib/kalendae_assets_spec.rb
|
121
121
|
- test/spec_helper.rb
|
122
122
|
- vendor/assets/images/arrows.png
|
123
|
+
- vendor/assets/images/close.png
|
123
124
|
- vendor/assets/javascripts/kalendae.js
|
124
125
|
- vendor/assets/stylesheets/kalendae.css
|
125
126
|
homepage: https://github.com/sdball/kalendae_assets
|
@@ -134,12 +135,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
135
|
- - ! '>='
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
138
|
+
segments:
|
139
|
+
- 0
|
140
|
+
hash: 3463384061095231419
|
137
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
142
|
none: false
|
139
143
|
requirements:
|
140
144
|
- - ! '>='
|
141
145
|
- !ruby/object:Gem::Version
|
142
146
|
version: '0'
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
hash: 3463384061095231419
|
143
150
|
requirements: []
|
144
151
|
rubyforge_project:
|
145
152
|
rubygems_version: 1.8.10
|