-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpc-admin.min.js
3549 lines (3224 loc) · 179 KB
/
mpc-admin.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* wp-color-picker-alpha
*
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
* Only run in input and is defined data alpha in true
*
* Version: 1.1
* https://github.com/23r9i0/wp-color-picker-alpha
* Copyright (c) 2015 Sergio P.A. (23r9i0).
* Licensed under the GPLv2 license.
*/
( function( $ ) {
// Variable for some backgrounds
var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==';
// html stuff for wpColorPicker copy of the original color-picker.js
var _before = '<a tabindex="0" class="wp-color-result" />',
_after = '<div class="wp-picker-holder" />',
_wrap = '<div class="wp-picker-container" />',
_button = '<input type="button" class="button button-small hidden" />';
/**
* Overwrite Color
* for enable support rbga
*/
Color.fn.toString = function() {
if ( this._alpha < 1 )
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
var hex = parseInt( this._color, 10 ).toString( 16 );
if ( this.error )
return '';
if ( hex.length < 6 ) {
for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
hex = '0' + hex;
}
}
return '#' + hex;
};
/**
* Overwrite wpColorPicker
*/
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
_create: function() {
// bail early for unsupported Iris.
if ( ! $.support.iris ) {
return;
}
var self = this,
el = self.element;
$.extend( self.options, el.data() );
// keep close bound so it can be attached to a body listener
self.close = $.proxy( self.close, self );
// set inputWrapper for toggling close/open
self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
self.initialValue = el.val();
// Set up HTML structure, hide things
el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
self.wrap = el.parent();
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button );
if ( self.options.defaultColor ) {
self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString );
} else {
self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear );
}
el.wrap( '<span class="wp-picker-input-wrap" />' ).after( self.button );
el.iris( {
target: self.pickerContainer,
hide: self.options.hide,
width: self.options.width,
mode: self.options.mode,
palettes: [ '#ffffff', '#f3f3f3', '#888888', '#555555', '#333333', '#75CDDE', '#F29760', '#88D482', '#DF5461', '#B39A68' ],
change: function( event, ui ) {
if ( self.options.alpha ) {
self.toggler.css( { 'background-image': 'url(' + image + ')' } ).html('<span />');
self.toggler.find('span').css({
'width': '100%',
'height': '100%',
'position': 'absolute',
'top': 0,
'left': 0,
'border-top-left-radius': '3px',
'border-bottom-left-radius': '3px',
'background': ui.color.toString()
});
} else {
self.toggler.css( { backgroundColor: ui.color.toString() } );
}
// check for a custom cb
if ( $.isFunction( self.options.change ) ) {
self.options.change.call( this, event, ui );
}
}
} );
el.val( self.initialValue );
self._addListeners();
if ( ! self.options.hide ) {
self.toggler.click();
}
},
_addListeners: function() {
var self = this;
// prevent any clicks inside this widget from leaking to the top and closing it
self.wrap.on( 'click.wpcolorpicker', function( event ) {
event.stopPropagation();
});
self.toggler.click( function(){
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
self.close();
} else {
self.open();
}
});
self.element.change( function( event ) {
var me = $( this ),
val = me.val();
// Empty or Error = clear
if ( val === '' || self.element.hasClass('iris-error') ) {
if ( self.options.alpha ) {
self.toggler.removeAttr('style');
self.toggler.find('span').css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
// fire clear callback if we have one
if ( $.isFunction( self.options.clear ) ) {
self.options.clear.call( this, event );
}
}
});
// open a keyboard-focused closed picker with space or enter
self.toggler.on( 'keyup', function( event ) {
if ( event.keyCode === 13 || event.keyCode === 32 ) {
event.preventDefault();
self.toggler.trigger( 'click' ).next().focus();
}
});
self.button.click( function( event ) {
var me = $( this );
if ( me.hasClass( 'wp-picker-clear' ) ) {
self.element.val( '' );
if ( self.options.alpha ) {
self.toggler.removeAttr('style');
self.toggler.find('span').css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
if ( $.isFunction( self.options.clear ) ) {
self.options.clear.call( this, event );
}
} else if ( me.hasClass( 'wp-picker-default' ) ) {
self.element.val( self.options.defaultColor );//.change();
}
});
}
});
/**
* Overwrite iris
*/
$.widget( 'a8c.iris', $.a8c.iris, {
_create: function() {
this._super();
// Global option for check is mode rbga is enabled
this.options.alpha = this.element.data( 'alpha' ) || false;
if( this.element.is( 'input' ) && ( this.element.is( '.mpc-color-picker' ) || this.element.parents( '.mpc-color-picker' ).length != 0 ) ) {
this.options.alpha = true;
}
// Is not input disabled
if ( ! this.element.is( ':input' ) ) {
this.options.alpha = false;
}
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
var self = this,
el = self.element,
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
controls = {
aContainer: aContainer,
aSlider: aSlider
};
// Set default width for input reset
self.options.defaultWidth = el.width();
// Update width for input
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != 1 ) {
el.width( parseInt( self.options.defaultWidth+100 ) );
}
// Push new controls
$.each( controls, function( k, v ){
self.controls[k] = v;
});
// Change size strip and add margin for sliders
self.controls.square.css({'margin-right': '0'});
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
stripsMargin = emptyWidth/6,
stripsWidth = (emptyWidth/2) - stripsMargin;
$.each( [ 'aContainer', 'strip' ], function( k, v ) {
self.controls[v].width( stripsWidth ).css({ 'margin-left': stripsMargin + 'px' });
});
// Add new slider
self._initControls();
if( self._color._alpha < 1 ) {
self.element.addClass( 'mpc-color-rgba' );
} else {
self.element.removeClass( 'mpc-color-rgba' );
}
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
self._color._alpha = 1;
self.active = 'external';
self._change();
});
// For updated widget
self._change();
}
},
_initControls: function() {
this._super();
if ( this.options.alpha ) {
var self = this,
controls = self.controls;
controls.aSlider.slider({
orientation: 'vertical',
min: 0,
max: 100,
step: 1,
value: parseInt( self._color._alpha*100 ),
slide: function( event, ui ) {
// Update alpha value
self._color._alpha = parseFloat( ui.value / 100 );
self._change.apply( self, arguments );
if( self._color._alpha < 1 ) {
self.element.addClass( 'mpc-color-rgba' );
} else {
self.element.removeClass( 'mpc-color-rgba' );
}
}
//change: function( event, ui ) {
// if( self._color._alpha < 1 ) {
// self.element.addClass( 'mpc-color-rgba' );
// } else {
// self.element.removeClass( 'mpc-color-rgba' );
// }
//}
});
}
},
_change: function() {
this._super();
var self = this,
el = self.element;
if ( this.options.alpha ) {
var controls = self.controls,
alpha = parseInt( self._color._alpha*100 ),
color = self._color.toRgb(),
gradient = [
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
],
defaultWidth = self.options.defaultWidth,
target = self.picker.closest('.wp-picker-container').find( '.wp-color-result' );
// Generate background slider alpha, only for CSS3 old browser duck!! :)
controls.aContainer.css({ 'background': 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' });
if ( target.hasClass('wp-picker-open') ) {
// Update alpha value
controls.aSlider.slider( 'value', alpha );
/**
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
* and change input width for view all value
*/
if ( self._color._alpha < 1 ) {
var style = controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' );
controls.strip.attr( 'style', style );
el.width( parseInt( defaultWidth+100 ) );
} else {
el.width( defaultWidth );
}
}
}
},
_addInputListeners: function( input ) {
var self = this,
debounceTimeout = 100,
callback = function( event ){
var color = new Color( input.val() ),
val = input.val().replace( /^#/, '' );
input.removeClass( 'iris-error' );
// we gave a bad color
if ( color.error ) {
// don't error on an empty input
if ( val !== '' ) {
input.addClass( 'iris-error' );
}
} else {
if ( color.toString() !== self._color.toString() ) {
// let's not do this on keyup for hex shortcodes
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) ) {
self._setOption( 'color', color.toString() );
}
}
}
};
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
// If we initialized hidden, show on first focus. The rest is up to you.
if ( self.options.hide ) {
input.one( 'focus', function() {
self.show();
});
}
}
} );
}( jQuery ) );
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015
* @version 1.3.3
*
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* @see http://php.net/manual/en/function.date.php
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
var DateFormatter;
(function () {
"use strict";
var _compare, _lpad, _extend, defaultSettings, DAY, HOUR;
DAY = 1000 * 60 * 60 * 24;
HOUR = 3600;
_compare = function (str1, str2) {
return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
};
_lpad = function (value, length, char) {
var chr = char || '0', val = value.toString();
return val.length < length ? _lpad(chr + val, length) : val;
};
_extend = function (out) {
var i, obj;
out = out || {};
for (i = 1; i < arguments.length; i++) {
obj = arguments[i];
if (!obj) {
continue;
}
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object') {
_extend(out[key], obj[key]);
} else {
out[key] = obj[key];
}
}
}
}
return out;
};
defaultSettings = {
dateSettings: {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
months: [
'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'
],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
meridiem: ['AM', 'PM'],
ordinal: function (number) {
var n = number % 10, suffixes = {1: 'st', 2: 'nd', 3: 'rd'};
return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n];
}
},
separators: /[ \-+\/\.T:@]/g,
validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
intParts: /[djwNzmnyYhHgGis]/g,
tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
tzClip: /[^-+\dA-Z]/g
};
DateFormatter = function (options) {
var self = this, config = _extend(defaultSettings, options);
self.dateSettings = config.dateSettings;
self.separators = config.separators;
self.validParts = config.validParts;
self.intParts = config.intParts;
self.tzParts = config.tzParts;
self.tzClip = config.tzClip;
};
DateFormatter.prototype = {
constructor: DateFormatter,
parseDate: function (vDate, vFormat) {
var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0};
if (!vDate) {
return undefined;
}
if (vDate instanceof Date) {
return vDate;
}
if (typeof vDate === 'number') {
return new Date(vDate);
}
if (vFormat === 'U') {
i = parseInt(vDate);
return i ? new Date(i * 1000) : vDate;
}
if (typeof vDate !== 'string') {
return '';
}
vFormatParts = vFormat.match(self.validParts);
if (!vFormatParts || vFormatParts.length === 0) {
throw new Error("Invalid date format definition.");
}
vDateParts = vDate.replace(self.separators, '\0').split('\0');
for (i = 0; i < vDateParts.length; i++) {
vDatePart = vDateParts[i];
iDatePart = parseInt(vDatePart);
switch (vFormatParts[i]) {
case 'y':
case 'Y':
len = vDatePart.length;
if (len === 2) {
out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart);
} else if (len === 4) {
out.year = iDatePart;
}
vDateFlag = true;
break;
case 'm':
case 'n':
case 'M':
case 'F':
if (isNaN(vDatePart)) {
vMonth = vSettings.monthsShort.indexOf(vDatePart);
if (vMonth > -1) {
out.month = vMonth + 1;
}
vMonth = vSettings.months.indexOf(vDatePart);
if (vMonth > -1) {
out.month = vMonth + 1;
}
} else {
if (iDatePart >= 1 && iDatePart <= 12) {
out.month = iDatePart;
}
}
vDateFlag = true;
break;
case 'd':
case 'j':
if (iDatePart >= 1 && iDatePart <= 31) {
out.day = iDatePart;
}
vDateFlag = true;
break;
case 'g':
case 'h':
vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
(vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
mer = vDateParts[vMeriIndex];
if (vMeriIndex > -1) {
vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
(_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) {
out.hour = iDatePart + vMeriOffset - 1;
} else if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
} else if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
vTimeFlag = true;
break;
case 'G':
case 'H':
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
vTimeFlag = true;
break;
case 'i':
if (iDatePart >= 0 && iDatePart <= 59) {
out.min = iDatePart;
}
vTimeFlag = true;
break;
case 's':
if (iDatePart >= 0 && iDatePart <= 59) {
out.sec = iDatePart;
}
vTimeFlag = true;
break;
}
}
if (vDateFlag === true && out.year && out.month && out.day) {
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
} else {
if (vTimeFlag !== true) {
return false;
}
out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
}
return out.date;
},
guessDate: function (vDateStr, vFormat) {
if (typeof vDateStr !== 'string') {
return vDateStr;
}
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g,
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec;
if (!vPattern.test(vFormatParts[0])) {
return vDateStr;
}
for (i = 0; i < vParts.length; i++) {
vDigit = 2;
iPart = vParts[i];
iSec = parseInt(iPart.substr(0, 2));
switch (i) {
case 0:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setMonth(iSec - 1);
} else {
vDate.setDate(iSec);
}
break;
case 1:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setDate(iSec);
} else {
vDate.setMonth(iSec - 1);
}
break;
case 2:
vYear = vDate.getFullYear();
if (iPart.length < 4) {
vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart));
vDigit = iPart.length;
} else {
vDate.setFullYear = parseInt(iPart.substr(0, 4));
vDigit = 4;
}
break;
case 3:
vDate.setHours(iSec);
break;
case 4:
vDate.setMinutes(iSec);
break;
case 5:
vDate.setSeconds(iSec);
break;
}
if (iPart.substr(vDigit).length > 0) {
vParts.splice(i + 1, 0, iPart.substr(vDigit));
}
}
return vDate;
},
parseFormat: function (vChar, vDate) {
var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) {
return fmt[t] ? fmt[t]() : s;
};
fmt = {
/////////
// DAY //
/////////
/**
* Day of month with leading 0: `01..31`
* @return {string}
*/
d: function () {
return _lpad(fmt.j(), 2);
},
/**
* Shorthand day name: `Mon...Sun`
* @return {string}
*/
D: function () {
return vSettings.daysShort[fmt.w()];
},
/**
* Day of month: `1..31`
* @return {number}
*/
j: function () {
return vDate.getDate();
},
/**
* Full day name: `Monday...Sunday`
* @return {number}
*/
l: function () {
return vSettings.days[fmt.w()];
},
/**
* ISO-8601 day of week: `1[Mon]..7[Sun]`
* @return {number}
*/
N: function () {
return fmt.w() || 7;
},
/**
* Day of week: `0[Sun]..6[Sat]`
* @return {number}
*/
w: function () {
return vDate.getDay();
},
/**
* Day of year: `0..365`
* @return {number}
*/
z: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j()), b = new Date(fmt.Y(), 0, 1);
return Math.round((a - b) / DAY);
},
//////////
// WEEK //
//////////
/**
* ISO-8601 week number
* @return {number}
*/
W: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j() - fmt.N() + 3), b = new Date(a.getFullYear(), 0, 4);
return _lpad(1 + Math.round((a - b) / DAY / 7), 2);
},
///////////
// MONTH //
///////////
/**
* Full month name: `January...December`
* @return {string}
*/
F: function () {
return vSettings.months[vDate.getMonth()];
},
/**
* Month w/leading 0: `01..12`
* @return {string}
*/
m: function () {
return _lpad(fmt.n(), 2);
},
/**
* Shorthand month name; `Jan...Dec`
* @return {string}
*/
M: function () {
return vSettings.monthsShort[vDate.getMonth()];
},
/**
* Month: `1...12`
* @return {number}
*/
n: function () {
return vDate.getMonth() + 1;
},
/**
* Days in month: `28...31`
* @return {number}
*/
t: function () {
return (new Date(fmt.Y(), fmt.n(), 0)).getDate();
},
//////////
// YEAR //
//////////
/**
* Is leap year? `0 or 1`
* @return {number}
*/
L: function () {
var Y = fmt.Y();
return (Y % 4 === 0 && Y % 100 !== 0 || Y % 400 === 0) ? 1 : 0;
},
/**
* ISO-8601 year
* @return {number}
*/
o: function () {
var n = fmt.n(), W = fmt.W(), Y = fmt.Y();
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0);
},
/**
* Full year: `e.g. 1980...2010`
* @return {number}
*/
Y: function () {
return vDate.getFullYear();
},
/**
* Last two digits of year: `00...99`
* @return {string}
*/
y: function () {
return fmt.Y().toString().slice(-2);
},
//////////
// TIME //
//////////
/**
* Meridian lower: `am or pm`
* @return {string}
*/
a: function () {
return fmt.A().toLowerCase();
},
/**
* Meridian upper: `AM or PM`
* @return {string}
*/
A: function () {
var n = fmt.G() < 12 ? 0 : 1;
return vSettings.meridiem[n];
},
/**
* Swatch Internet time: `000..999`
* @return {string}
*/
B: function () {
var H = vDate.getUTCHours() * HOUR, i = vDate.getUTCMinutes() * 60, s = vDate.getUTCSeconds();
return _lpad(Math.floor((H + i + s + HOUR) / 86.4) % 1000, 3);
},
/**
* 12-Hours: `1..12`
* @return {number}
*/
g: function () {
return fmt.G() % 12 || 12;
},
/**
* 24-Hours: `0..23`
* @return {number}
*/
G: function () {
return vDate.getHours();
},
/**
* 12-Hours with leading 0: `01..12`
* @return {string}
*/
h: function () {
return _lpad(fmt.g(), 2);
},
/**
* 24-Hours w/leading 0: `00..23`
* @return {string}
*/
H: function () {
return _lpad(fmt.G(), 2);
},
/**
* Minutes w/leading 0: `00..59`
* @return {string}
*/
i: function () {
return _lpad(vDate.getMinutes(), 2);
},
/**
* Seconds w/leading 0: `00..59`
* @return {string}
*/
s: function () {
return _lpad(vDate.getSeconds(), 2);
},
/**
* Microseconds: `000000-999000`
* @return {string}
*/
u: function () {
return _lpad(vDate.getMilliseconds() * 1000, 6);
},
//////////////
// TIMEZONE //
//////////////
/**
* Timezone identifier: `e.g. Atlantic/Azores, ...`
* @return {string}
*/
e: function () {
var str = /\((.*)\)/.exec(String(vDate))[1];
return str || 'Coordinated Universal Time';
},
/**
* Timezone abbreviation: `e.g. EST, MDT, ...`
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
return str || 'UTC';
},
/**
* DST observed? `0 or 1`
* @return {number}
*/
I: function () {
var a = new Date(fmt.Y(), 0), c = Date.UTC(fmt.Y(), 0),
b = new Date(fmt.Y(), 6), d = Date.UTC(fmt.Y(), 6);
return ((a - c) !== (b - d)) ? 1 : 0;
},
/**
* Difference to GMT in hour format: `e.g. +0200`
* @return {string}
*/
O: function () {
var tzo = vDate.getTimezoneOffset(), a = Math.abs(tzo);
return (tzo > 0 ? '-' : '+') + _lpad(Math.floor(a / 60) * 100 + a % 60, 4);
},
/**
* Difference to GMT with colon: `e.g. +02:00`
* @return {string}
*/
P: function () {
var O = fmt.O();
return (O.substr(0, 3) + ':' + O.substr(3, 2));
},
/**
* Timezone offset in seconds: `-43200...50400`
* @return {number}
*/
Z: function () {
return -vDate.getTimezoneOffset() * 60;
},
////////////////////
// FULL DATE TIME //
////////////////////
/**
* ISO-8601 date
* @return {string}
*/
c: function () {
return 'Y-m-d\\TH:i:sP'.replace(backspace, doFormat);
},
/**
* RFC 2822 date
* @return {string}
*/
r: function () {
return 'D, d M Y H:i:s O'.replace(backspace, doFormat);
},
/**
* Seconds since UNIX epoch
* @return {number}
*/
U: function () {
return vDate.getTime() / 1000 || 0;
}
};
return doFormat(vChar, vChar);
},
formatDate: function (vDate, vFormat) {
var self = this, i, n, len, str, vChar, vDateStr = '';
if (typeof vDate === 'string') {
vDate = self.parseDate(vDate, vFormat);
if (vDate === false) {
return false;
}
}
if (vDate instanceof Date) {
len = vFormat.length;
for (i = 0; i < len; i++) {
vChar = vFormat.charAt(i);
if (vChar === 'S') {
continue;
}
str = self.parseFormat(vChar, vDate);
if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
n = parseInt(str);
str += self.dateSettings.ordinal(n);
}
vDateStr += str;
}
return vDateStr;
}
return '';
}
};
})();/**
* @preserve jQuery DateTimePicker plugin v2.5.3
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<[email protected]>)
*/
/*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
;(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery', 'jquery-mousewheel'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict';
var default_options = {
i18n: {
ar: { // Arabic
months: [
"كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
],
dayOfWeekShort: [
"ن", "ث", "ع", "خ", "ج", "س", "ح"
],
dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
},
ro: { // Romanian
months: [
"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
],
dayOfWeekShort: [
"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
],
dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
},
id: { // Indonesian
months: [
"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
],
dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
},
is: { // Icelandic
months: [
"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
],
dayOfWeekShort: [
"Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
],
dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
},
bg: { // Bulgarian
months: [
"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
],
dayOfWeekShort: [
"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]