formagic 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CONTRIBUTING.md +24 -0
- data/Gemfile +3 -0
- data/LICENSE.md +21 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/app/assets/images/datedropper/done.png +0 -0
- data/app/assets/images/datedropper/done.svg +1 -0
- data/app/assets/images/datedropper/next.png +0 -0
- data/app/assets/images/datedropper/next.svg +1 -0
- data/app/assets/images/datedropper/prev.png +0 -0
- data/app/assets/images/datedropper/prev.svg +1 -0
- data/app/assets/javascripts/formagic/form.coffee +229 -0
- data/app/assets/javascripts/formagic/group.coffee +28 -0
- data/app/assets/javascripts/formagic/inputs/checkbox.coffee +83 -0
- data/app/assets/javascripts/formagic/inputs/color.coffee +55 -0
- data/app/assets/javascripts/formagic/inputs/date.coffee +69 -0
- data/app/assets/javascripts/formagic/inputs/datetime.coffee +130 -0
- data/app/assets/javascripts/formagic/inputs/document.coffee +0 -0
- data/app/assets/javascripts/formagic/inputs/documents.coffee +173 -0
- data/app/assets/javascripts/formagic/inputs/documents_reorder.coffee +67 -0
- data/app/assets/javascripts/formagic/inputs/file.coffee +114 -0
- data/app/assets/javascripts/formagic/inputs/hidden.coffee +57 -0
- data/app/assets/javascripts/formagic/inputs/html.coffee +81 -0
- data/app/assets/javascripts/formagic/inputs/image.coffee +28 -0
- data/app/assets/javascripts/formagic/inputs/list.coffee +154 -0
- data/app/assets/javascripts/formagic/inputs/list_reorder.coffee +39 -0
- data/app/assets/javascripts/formagic/inputs/list_typeahead.coffee +55 -0
- data/app/assets/javascripts/formagic/inputs/markdown.coffee +93 -0
- data/app/assets/javascripts/formagic/inputs/password.coffee +32 -0
- data/app/assets/javascripts/formagic/inputs/redactor.coffee +53 -0
- data/app/assets/javascripts/formagic/inputs/redactor_character.coffee +75 -0
- data/app/assets/javascripts/formagic/inputs/redactor_images.coffee +166 -0
- data/app/assets/javascripts/formagic/inputs/select.coffee +84 -0
- data/app/assets/javascripts/formagic/inputs/select2.coffee +33 -0
- data/app/assets/javascripts/formagic/inputs/string.coffee +160 -0
- data/app/assets/javascripts/formagic/inputs/text.coffee +43 -0
- data/app/assets/javascripts/formagic/inputs/time.coffee +0 -0
- data/app/assets/javascripts/formagic.coffee +22 -0
- data/app/assets/javascripts/vendor/ace.js +18280 -0
- data/app/assets/javascripts/vendor/datedropper.js +1005 -0
- data/app/assets/javascripts/vendor/jquery.scrollparent.js +14 -0
- data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +55 -0
- data/app/assets/javascripts/vendor/jquery.typeahead.js +1782 -0
- data/app/assets/javascripts/vendor/marked.js +1272 -0
- data/app/assets/javascripts/vendor/mode-html.js +2436 -0
- data/app/assets/javascripts/vendor/mode-markdown.js +2820 -0
- data/app/assets/javascripts/vendor/moment.js +3083 -0
- data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +107 -0
- data/app/assets/javascripts/vendor/select2.js +5274 -0
- data/app/assets/stylesheets/formagic/checkbox.scss +8 -0
- data/app/assets/stylesheets/formagic/color.scss +12 -0
- data/app/assets/stylesheets/formagic/date.scss +37 -0
- data/app/assets/stylesheets/formagic/file.scss +29 -0
- data/app/assets/stylesheets/formagic/form.scss +36 -0
- data/app/assets/stylesheets/formagic/group.scss +22 -0
- data/app/assets/stylesheets/formagic/image.scss +19 -0
- data/app/assets/stylesheets/formagic/list.scss +39 -0
- data/app/assets/stylesheets/formagic/nested-form.scss +23 -0
- data/app/assets/stylesheets/formagic/redactor.scss +41 -0
- data/app/assets/stylesheets/formagic/select.scss +5 -0
- data/app/assets/stylesheets/formagic/select2.scss +95 -0
- data/app/assets/stylesheets/formagic/string.scss +14 -0
- data/app/assets/stylesheets/formagic/switch.scss +86 -0
- data/app/assets/stylesheets/formagic/text.scss +9 -0
- data/app/assets/stylesheets/formagic.scss +15 -0
- data/app/assets/stylesheets/vendor/datedropper.scss +523 -0
- data/app/assets/stylesheets/vendor/select2.scss +258 -0
- data/formagic.gemspec +30 -0
- data/lib/formagic/engine.rb +5 -0
- data/lib/formagic/version.rb +3 -0
- data/lib/formagic.rb +5 -0
- metadata +146 -0
@@ -0,0 +1,1005 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
//////////////////////////////////////
|
4
|
+
// DATEDROPPER Version 1.2 //
|
5
|
+
// Last Updates: 27/03/2015 //
|
6
|
+
// //
|
7
|
+
// Made with love by //
|
8
|
+
// Felice Gattuso //
|
9
|
+
//////////////////////////////////////
|
10
|
+
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
$.fn.dateDropper = function( options ) {
|
14
|
+
return $(this).each(function() {
|
15
|
+
|
16
|
+
// IF IS INPUT AND TYPE IS TEXT //
|
17
|
+
|
18
|
+
if( $(this).is('input') && $(this).attr('type') == "text" ) {
|
19
|
+
|
20
|
+
// DECLARE CURRENT VARIABLE //
|
21
|
+
|
22
|
+
var
|
23
|
+
dd_y_current = new Date().getFullYear(),
|
24
|
+
dd_d_current = new Date().getDate(),
|
25
|
+
dd_m_current = new Date().getMonth(),
|
26
|
+
|
27
|
+
// SET OPTIONS //
|
28
|
+
|
29
|
+
settings = $.extend({
|
30
|
+
|
31
|
+
animate_current : true,
|
32
|
+
animation : "fadein",
|
33
|
+
format : "m/d/Y",
|
34
|
+
lang : "en",
|
35
|
+
lock : false,
|
36
|
+
maxYear : dd_y_current,
|
37
|
+
minYear : 1970,
|
38
|
+
placeholder : false,
|
39
|
+
years_multiple : 10,
|
40
|
+
|
41
|
+
//style
|
42
|
+
color : "#f87a54",
|
43
|
+
textColor : "#000000",
|
44
|
+
bgColor : "#FFFFFF",
|
45
|
+
borderColor : "#000000",
|
46
|
+
borderRadius : 8,
|
47
|
+
boxShadow : "0 0px 0px 6px rgba(0,0,0,0.05)",
|
48
|
+
|
49
|
+
}, options ),
|
50
|
+
|
51
|
+
// DECLARE VARIABLE //
|
52
|
+
|
53
|
+
dd_input = $(this),
|
54
|
+
drop_length = $('.dd_wrap').length + 1,
|
55
|
+
bissextile = function(yr) {return !((yr % 4) || (!(yr % 100) && (yr % 400)));}, //bissextile year
|
56
|
+
range = 100,
|
57
|
+
isHex = /^#[0-9A-F]{6}$/i.test(settings.color),
|
58
|
+
ymultiselect = 0;
|
59
|
+
|
60
|
+
if(!isHex) settings.color = '#f87a54';
|
61
|
+
if(settings.maxYear<dd_y_current) dd_y_current = settings.maxYear;
|
62
|
+
|
63
|
+
var
|
64
|
+
yranger = function(yr) {
|
65
|
+
for ( var yy = settings.minYear; yy <= settings.maxYear ; yy++ ) {
|
66
|
+
|
67
|
+
var remainder = yy % settings.years_multiple;
|
68
|
+
if (remainder == 0)
|
69
|
+
if(yr>=yy&&yr<(yy+settings.years_multiple)||yr < yy) {
|
70
|
+
ymultiselect = yy;
|
71
|
+
return yy;
|
72
|
+
}
|
73
|
+
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
// SWITCH LANGUAGES //
|
78
|
+
|
79
|
+
switch(settings.lang) {
|
80
|
+
//Arabic
|
81
|
+
case 'ar':
|
82
|
+
var monthNames = [
|
83
|
+
"جانفي",
|
84
|
+
"فيفري",
|
85
|
+
"مارس",
|
86
|
+
"أفريل",
|
87
|
+
"ماي",
|
88
|
+
"جوان",
|
89
|
+
"جويلية",
|
90
|
+
"أوت",
|
91
|
+
"سبتمبر",
|
92
|
+
"أكتوبر",
|
93
|
+
"نوفمبر",
|
94
|
+
"ديسمبر"
|
95
|
+
];
|
96
|
+
var dayNames = [
|
97
|
+
'الأحد',
|
98
|
+
'الإثنين',
|
99
|
+
'الثلثاء',
|
100
|
+
'الأربعاء',
|
101
|
+
'الخميس',
|
102
|
+
'الجمعة',
|
103
|
+
'السبت'
|
104
|
+
];
|
105
|
+
break;
|
106
|
+
//italian
|
107
|
+
case 'it':
|
108
|
+
var monthNames = [
|
109
|
+
"Gennaio",
|
110
|
+
"Febbraio",
|
111
|
+
"Marzo",
|
112
|
+
"Aprile",
|
113
|
+
"Maggio",
|
114
|
+
"Giugno",
|
115
|
+
"Luglio",
|
116
|
+
"Agosto",
|
117
|
+
"Settembre",
|
118
|
+
"Ottobre",
|
119
|
+
"Novembre",
|
120
|
+
"Dicembre"
|
121
|
+
];
|
122
|
+
var dayNames = [
|
123
|
+
'Domenica',
|
124
|
+
'Lunedì',
|
125
|
+
'Martedì',
|
126
|
+
'Mercoledì',
|
127
|
+
'Giovedì',
|
128
|
+
'Venerdì',
|
129
|
+
'Sabato'
|
130
|
+
];
|
131
|
+
break;
|
132
|
+
//hungarian
|
133
|
+
case 'hu':
|
134
|
+
var monthNames = [
|
135
|
+
"január",
|
136
|
+
"február",
|
137
|
+
"március",
|
138
|
+
"április",
|
139
|
+
"május",
|
140
|
+
"június",
|
141
|
+
"július",
|
142
|
+
"augusztus",
|
143
|
+
"szeptember",
|
144
|
+
"október",
|
145
|
+
"november",
|
146
|
+
"december"
|
147
|
+
];
|
148
|
+
var dayNames = [
|
149
|
+
'vasárnap',
|
150
|
+
'hétfő',
|
151
|
+
'kedd',
|
152
|
+
'szerda',
|
153
|
+
'csütörtök',
|
154
|
+
'péntek',
|
155
|
+
'szombat'
|
156
|
+
];
|
157
|
+
break;
|
158
|
+
//greek
|
159
|
+
case 'gr':
|
160
|
+
var monthNames = [
|
161
|
+
"Ιανουάριος",
|
162
|
+
"Φεβρουάριος",
|
163
|
+
"Μάρτιος",
|
164
|
+
"Απρίλιος",
|
165
|
+
"Μάιος",
|
166
|
+
"Ιούνιος",
|
167
|
+
"Ιούλιος",
|
168
|
+
"Αύγουστος",
|
169
|
+
"Σεπτέμβριος",
|
170
|
+
"Οκτώβριος",
|
171
|
+
"Νοέμβριος",
|
172
|
+
"Δεκέμβριος"
|
173
|
+
];
|
174
|
+
var dayNames = [
|
175
|
+
'Κυριακή',
|
176
|
+
'Δευτέρα',
|
177
|
+
'Τρίτη',
|
178
|
+
'Τετάρτη',
|
179
|
+
'Πέμπτη',
|
180
|
+
'Παρασκευή',
|
181
|
+
'Σάββατο'
|
182
|
+
];
|
183
|
+
break;
|
184
|
+
//espanol
|
185
|
+
case 'es':
|
186
|
+
var monthNames = [
|
187
|
+
"Enero",
|
188
|
+
"Febrero",
|
189
|
+
"Marzo",
|
190
|
+
"Abril",
|
191
|
+
"Mayo",
|
192
|
+
"Junio",
|
193
|
+
"Julio",
|
194
|
+
"Agosto",
|
195
|
+
"Septiembre",
|
196
|
+
"Octubre",
|
197
|
+
"Noviembre",
|
198
|
+
"Diciembre"
|
199
|
+
];
|
200
|
+
var dayNames = [
|
201
|
+
'Domingo',
|
202
|
+
'Lunes',
|
203
|
+
'Martes',
|
204
|
+
'Miércoles',
|
205
|
+
'Jueves',
|
206
|
+
'Viernes',
|
207
|
+
'Sábado'
|
208
|
+
];
|
209
|
+
break;
|
210
|
+
//dansk
|
211
|
+
case 'da':
|
212
|
+
var monthNames = [
|
213
|
+
"januar",
|
214
|
+
"februar",
|
215
|
+
"marts",
|
216
|
+
"april",
|
217
|
+
"maj",
|
218
|
+
"juni",
|
219
|
+
"juli",
|
220
|
+
"august",
|
221
|
+
"september",
|
222
|
+
"oktober",
|
223
|
+
"november",
|
224
|
+
"december"
|
225
|
+
];
|
226
|
+
var dayNames = [
|
227
|
+
'søndag',
|
228
|
+
'mandag',
|
229
|
+
'tirsdag',
|
230
|
+
'onsdag',
|
231
|
+
'torsdag',
|
232
|
+
'fredag',
|
233
|
+
'lørdag'
|
234
|
+
];
|
235
|
+
break;
|
236
|
+
//deustche
|
237
|
+
case 'de':
|
238
|
+
var monthNames = [
|
239
|
+
"Januar",
|
240
|
+
"Februar",
|
241
|
+
"Marz",
|
242
|
+
"April",
|
243
|
+
"Mai",
|
244
|
+
"Juni",
|
245
|
+
"Juli",
|
246
|
+
"August",
|
247
|
+
"September",
|
248
|
+
"Oktober",
|
249
|
+
"November",
|
250
|
+
"Dezember"
|
251
|
+
];
|
252
|
+
var dayNames = [
|
253
|
+
'Sonntag',
|
254
|
+
'Montag',
|
255
|
+
'Dienstag',
|
256
|
+
'Mittwoch',
|
257
|
+
'Donnerstag',
|
258
|
+
'Freitag',
|
259
|
+
'Samstag'
|
260
|
+
];
|
261
|
+
break;
|
262
|
+
//dutch
|
263
|
+
case 'nl':
|
264
|
+
var monthNames = [
|
265
|
+
"januari",
|
266
|
+
"februari",
|
267
|
+
"maart",
|
268
|
+
"april",
|
269
|
+
"mei",
|
270
|
+
"juni",
|
271
|
+
"juli",
|
272
|
+
"augustus",
|
273
|
+
"september",
|
274
|
+
"oktober",
|
275
|
+
"november",
|
276
|
+
"december"
|
277
|
+
];
|
278
|
+
var dayNames = [
|
279
|
+
'zondag',
|
280
|
+
'maandag',
|
281
|
+
'dinsdag',
|
282
|
+
'woensdag',
|
283
|
+
'donderdag',
|
284
|
+
'vrijdag',
|
285
|
+
'zaterdag'
|
286
|
+
];
|
287
|
+
break;
|
288
|
+
//francais
|
289
|
+
case 'fr':
|
290
|
+
var monthNames = [
|
291
|
+
"Janvier",
|
292
|
+
"Février",
|
293
|
+
"Mars",
|
294
|
+
"Avril",
|
295
|
+
"Mai",
|
296
|
+
"Juin",
|
297
|
+
"Juillet",
|
298
|
+
"Août",
|
299
|
+
"Septembre",
|
300
|
+
"Octobre",
|
301
|
+
"Novembre",
|
302
|
+
"Décembre"
|
303
|
+
];
|
304
|
+
var dayNames = [
|
305
|
+
'Dimanche',
|
306
|
+
'Lundi',
|
307
|
+
'Mardi',
|
308
|
+
'Mercredi',
|
309
|
+
'Jeudi',
|
310
|
+
'Vendredi',
|
311
|
+
'Samedi'
|
312
|
+
];
|
313
|
+
break;
|
314
|
+
//polski
|
315
|
+
case 'pl':
|
316
|
+
var monthNames = [
|
317
|
+
"styczeń",
|
318
|
+
"luty",
|
319
|
+
"marzec",
|
320
|
+
"kwiecień",
|
321
|
+
"maj",
|
322
|
+
"czerwiec",
|
323
|
+
"lipiec",
|
324
|
+
"sierpień",
|
325
|
+
"wrzesień",
|
326
|
+
"październik",
|
327
|
+
"listopad",
|
328
|
+
"grudzień"
|
329
|
+
];
|
330
|
+
var dayNames = [
|
331
|
+
'niedziela',
|
332
|
+
'poniedziałek',
|
333
|
+
'wtorek',
|
334
|
+
'środa',
|
335
|
+
'czwartek',
|
336
|
+
'piątek',
|
337
|
+
'sobota'
|
338
|
+
];
|
339
|
+
break;
|
340
|
+
//portuguese
|
341
|
+
case 'pt':
|
342
|
+
var monthNames = [
|
343
|
+
"Janeiro",
|
344
|
+
"Fevereiro",
|
345
|
+
"Março",
|
346
|
+
"Abril",
|
347
|
+
"Maio",
|
348
|
+
"Junho",
|
349
|
+
"Julho",
|
350
|
+
"Agosto",
|
351
|
+
"Setembro",
|
352
|
+
"Outubro",
|
353
|
+
"Novembro",
|
354
|
+
"Dezembro"
|
355
|
+
];
|
356
|
+
var dayNames = [
|
357
|
+
"Domingo",
|
358
|
+
"Segunda",
|
359
|
+
"Terça",
|
360
|
+
"Quarta",
|
361
|
+
"Quinta",
|
362
|
+
"Sexta",
|
363
|
+
"Sábado"
|
364
|
+
];
|
365
|
+
break;
|
366
|
+
//slovenian
|
367
|
+
case 'si':
|
368
|
+
var monthNames = [
|
369
|
+
"januar",
|
370
|
+
"februar",
|
371
|
+
"marec",
|
372
|
+
"april",
|
373
|
+
"maj",
|
374
|
+
"junij",
|
375
|
+
"julij",
|
376
|
+
"avgust",
|
377
|
+
"september",
|
378
|
+
"oktober",
|
379
|
+
"november",
|
380
|
+
"december"
|
381
|
+
];
|
382
|
+
var dayNames = [
|
383
|
+
'nedelja',
|
384
|
+
'ponedeljek',
|
385
|
+
'torek',
|
386
|
+
'sreda',
|
387
|
+
'četrtek',
|
388
|
+
'petek',
|
389
|
+
'sobota'
|
390
|
+
];
|
391
|
+
break;
|
392
|
+
//ukrainian
|
393
|
+
case 'uk':
|
394
|
+
var monthNames = [
|
395
|
+
"січень",
|
396
|
+
"лютий",
|
397
|
+
"березень",
|
398
|
+
"квітень",
|
399
|
+
"травень",
|
400
|
+
"червень",
|
401
|
+
"липень",
|
402
|
+
"серпень",
|
403
|
+
"вересень",
|
404
|
+
"жовтень",
|
405
|
+
"листопад",
|
406
|
+
"грудень"
|
407
|
+
];
|
408
|
+
var dayNames = [
|
409
|
+
'неділя',
|
410
|
+
'понеділок',
|
411
|
+
'вівторок',
|
412
|
+
'середа',
|
413
|
+
'четвер',
|
414
|
+
'п\'ятниця',
|
415
|
+
'субота'
|
416
|
+
];
|
417
|
+
break;
|
418
|
+
//russian
|
419
|
+
case 'ru':
|
420
|
+
var monthNames = [
|
421
|
+
"январь",
|
422
|
+
"февраль",
|
423
|
+
"март",
|
424
|
+
"апрель",
|
425
|
+
"май",
|
426
|
+
"июнь",
|
427
|
+
"июль",
|
428
|
+
"август",
|
429
|
+
"сентябрь",
|
430
|
+
"октябрь",
|
431
|
+
"ноябрь",
|
432
|
+
"декабрь"
|
433
|
+
];
|
434
|
+
var dayNames = [
|
435
|
+
'воскресенье',
|
436
|
+
'понедельник',
|
437
|
+
'вторник',
|
438
|
+
'среда',
|
439
|
+
'четверг',
|
440
|
+
'пятница',
|
441
|
+
'суббота'
|
442
|
+
];
|
443
|
+
break;
|
444
|
+
//turkish
|
445
|
+
case 'tr':
|
446
|
+
var monthNames = [
|
447
|
+
"Ocak",
|
448
|
+
"Şubat",
|
449
|
+
"Mart",
|
450
|
+
"Nisan",
|
451
|
+
"Mayıs",
|
452
|
+
"Haziran",
|
453
|
+
"Temmuz",
|
454
|
+
"Ağustos",
|
455
|
+
"Eylül",
|
456
|
+
"Ekim",
|
457
|
+
"Kasım",
|
458
|
+
"Aralık"
|
459
|
+
];
|
460
|
+
var dayNames = [
|
461
|
+
'Pazar',
|
462
|
+
'Pazartesi',
|
463
|
+
'Sali',
|
464
|
+
'Çarşamba',
|
465
|
+
'Perşembe',
|
466
|
+
'Cuma',
|
467
|
+
'Cumartesi'
|
468
|
+
];
|
469
|
+
break;
|
470
|
+
//english
|
471
|
+
default:
|
472
|
+
var monthNames = [
|
473
|
+
"January",
|
474
|
+
"February",
|
475
|
+
"March",
|
476
|
+
"April",
|
477
|
+
"May",
|
478
|
+
"June",
|
479
|
+
"July",
|
480
|
+
"August",
|
481
|
+
"September",
|
482
|
+
"October",
|
483
|
+
"November",
|
484
|
+
"December"
|
485
|
+
];
|
486
|
+
var dayNames = [
|
487
|
+
'Sunday',
|
488
|
+
'Monday',
|
489
|
+
'Tuesday',
|
490
|
+
'Wednesday',
|
491
|
+
'Thursday',
|
492
|
+
'Friday',
|
493
|
+
'Saturday'
|
494
|
+
];
|
495
|
+
break;
|
496
|
+
};
|
497
|
+
|
498
|
+
|
499
|
+
// CREATE WRAP //
|
500
|
+
|
501
|
+
$('<div class="dd_wrap" id="dd_'+drop_length+'"><div class="dd_overlay"></div><div class="dd_"></div></div>')
|
502
|
+
.appendTo('body');
|
503
|
+
|
504
|
+
var
|
505
|
+
dd_id = $('#dd_'+drop_length),
|
506
|
+
dd_inner = dd_id.find('.dd_');
|
507
|
+
dd_overlay = dd_id.find('.dd_overlay');
|
508
|
+
|
509
|
+
// DATEDROPPER POSITION ON RESIZE //
|
510
|
+
|
511
|
+
$(window).on('resize',function(){
|
512
|
+
dd_inner.css({
|
513
|
+
'top':dd_input.offset().top+(dd_input.height()+12),
|
514
|
+
'left':(dd_input.offset().left+((dd_input.outerWidth()/2)-(range/2)))-2
|
515
|
+
});
|
516
|
+
});
|
517
|
+
|
518
|
+
// SET STYLE //
|
519
|
+
|
520
|
+
$( "<style>#dd_"+drop_length+" .dd_ {border-color: "+settings.borderColor+"; background: "+settings.bgColor+"; border-radius: "+settings.borderRadius+"px; -moz-border-radius: "+settings.borderRadius+"px; -webkit-border-radius: "+settings.borderRadius+"px; color: "+settings.textColor+";box-shadow: "+settings.boxShadow+";-webkit-box-shadow: "+settings.boxShadow+";-moz-box-shadow: "+settings.boxShadow+";}#dd_"+drop_length+" .dd_ .dd_submit,#dd_"+drop_length+" .dd_ .dd_r_ ul li.dd_sltd_ { background-color: "+settings.color+"; } #dd_"+drop_length+" .dd_ .dd_d_ .dd_sl_ ul li em , #dd_"+drop_length+" .dd_ .dd_d_ .dd_sl_ ul li.dd_sunday,#dd_"+drop_length+" .dd_ .dd_all_ ul li.dd_sunday{ color: "+settings.color+"; }#dd_"+drop_length+" .dd_ .dd_all_ ul li.dd_sunday{ border-bottom: 2px solid "+settings.color+"; } #dd_"+drop_length+" .dd_ .dd_r_ ul li:hover,#dd_"+drop_length+" .dd_ .dd_r_ ul li.dd_sltd_,#dd_"+drop_length+" .dd_ .dd_r_ ul li {border-color: "+settings.color+"; } #dd_"+drop_length+" .dd_ .dd_submit {-webkit-border-bottom-right-radius: "+((settings.borderRadius)-3)+"px;-webkit-border-bottom-left-radius: "+((settings.borderRadius)-3)+"px;-moz-border-radius-bottomright: "+((settings.borderRadius)-3)+"px;-moz-border-radius-bottomleft: "+((settings.borderRadius)-3)+"px;border-bottom-right-radius: "+((settings.borderRadius)-3)+"px;border-bottom-left-radius: "+((settings.borderRadius)-3)+"px;}#dd_"+drop_length+" .dd_:after {background:"+settings.bgColor+";border-top-color:"+settings.borderColor+";border-left-color:"+settings.borderColor+";}#dd_"+drop_length+" .dd_ .dd_r_ ul li,#dd_"+drop_length+" .dd_ .dd_all_ {background:"+settings.bgColor+";}#dd_"+drop_length+" .dd_ .dd_all_{box-shadow: inset 0 -2px 0 "+settings.color+";}#dd_"+drop_length+" .dd_ .dd_r_:after{border-bottom: 2px solid "+settings.color+"}</style>" ).appendTo( "head" );
|
521
|
+
|
522
|
+
// CREATE STRUCTURE //
|
523
|
+
|
524
|
+
dd_input
|
525
|
+
.attr({
|
526
|
+
'readonly':'readonly'
|
527
|
+
})
|
528
|
+
.addClass('dd_locked');
|
529
|
+
|
530
|
+
if(dd_input.val()) {
|
531
|
+
|
532
|
+
var
|
533
|
+
txt = dd_input.val(),
|
534
|
+
number_regex = txt.match(/(?:\d{4}|\d{1,2})/g),
|
535
|
+
format_regex = settings.format.match(/[a-zA-Z]+/g),
|
536
|
+
tempY = null,
|
537
|
+
tempD = null,
|
538
|
+
tempM = null;
|
539
|
+
|
540
|
+
if(number_regex) {
|
541
|
+
|
542
|
+
for(var i = 0; i<=number_regex.length; i++){
|
543
|
+
if(number_regex[i]){
|
544
|
+
if(number_regex[i].length==4) tempY = number_regex[i];
|
545
|
+
else if(number_regex[i].length<=2&&number_regex[i].length>0){
|
546
|
+
if(number_regex[i]<=12&&format_regex[i]=='m'||format_regex[i]=='n') tempM = number_regex[i];
|
547
|
+
else tempD = number_regex[i]
|
548
|
+
}
|
549
|
+
}
|
550
|
+
}
|
551
|
+
|
552
|
+
if(tempM<10) { if(tempM.length==2) tempM = tempM.substr(1); }
|
553
|
+
if(tempD<10) { if(tempD.length==2) tempD = tempD.substr(1); }
|
554
|
+
|
555
|
+
if(tempD==null) tempD = dd_d_current;
|
556
|
+
if(tempM==null) tempM = dd_m_current;
|
557
|
+
if(tempY==null) tempY = dd_y_current;
|
558
|
+
|
559
|
+
}
|
560
|
+
if(tempY<settings.minYear) settings.minYear = tempY;
|
561
|
+
if(tempY>settings.maxYear) settings.maxYear = tempY;
|
562
|
+
|
563
|
+
}
|
564
|
+
|
565
|
+
else {
|
566
|
+
if(settings.placeholder) dd_input.val(settings.placeholder);
|
567
|
+
}
|
568
|
+
|
569
|
+
|
570
|
+
dd_inner.append('<div class="dd_sw_ dd_m_"><a class="dd_nav_ dd_prev_"></a><a class="dd_nav_ dd_next_"></a><div class="dd_sl_"></div></div>');
|
571
|
+
dd_inner.append('<div class="dd_sw_ dd_d_"><a class="dd_nav_ dd_prev_"></a><a class="dd_nav_ dd_next_"></a><div class="dd_sl_"></div></div>');
|
572
|
+
dd_inner.append('<div class="dd_sw_ dd_y_"><a class="dd_nav_ dd_prev_"></a><a class="dd_nav_ dd_next_"></a><div class="dd_sl_"></div></div>');
|
573
|
+
dd_inner.append('<div class="dd_all_ dd_a_d_"></div>');
|
574
|
+
dd_inner.append('<div class="dd_all_ dd_a_m_"></div>');
|
575
|
+
dd_inner.append('<div class="dd_all_ dd_a_y_"></div>');
|
576
|
+
if(settings.years_multiple) dd_inner.append('<div class="dd_r_"></div>');
|
577
|
+
dd_inner.append('<div class="dd_submit"></div>');
|
578
|
+
|
579
|
+
var
|
580
|
+
dd_m = dd_inner.find('.dd_m_'),
|
581
|
+
dd_d = dd_inner.find('.dd_d_'),
|
582
|
+
dd_y = dd_inner.find('.dd_y_'),
|
583
|
+
dd_a_d = dd_inner.find('.dd_a_d_'),
|
584
|
+
dd_a_m = dd_inner.find('.dd_a_m_'),
|
585
|
+
dd_a_y = dd_inner.find('.dd_a_y_'),
|
586
|
+
dd_y_r = dd_inner.find('.dd_r_'),
|
587
|
+
dd_submit = dd_inner.find('.dd_submit');
|
588
|
+
|
589
|
+
// MONTH //
|
590
|
+
|
591
|
+
dd_m.find('.dd_sl_').append('<ul></ul>');
|
592
|
+
dd_a_m.append('<ul></ul>');
|
593
|
+
|
594
|
+
for ( var mm = 1; mm <= 12; mm++ ) {
|
595
|
+
|
596
|
+
months = (monthNames[mm-1]).substr(0, 3);
|
597
|
+
dd_m.find('ul').append('<li value="'+mm+'">'+months+'</li>');
|
598
|
+
dd_a_m.find('ul').append('<li value="'+mm+'">'+mm+'</li>')
|
599
|
+
|
600
|
+
}
|
601
|
+
|
602
|
+
// DAY //
|
603
|
+
|
604
|
+
dd_d.find('.dd_sl_').append('<ul></ul>');
|
605
|
+
dd_a_d.append('<ul></ul>');
|
606
|
+
|
607
|
+
for ( var dd = 1; dd <= 31; dd++ ) {
|
608
|
+
|
609
|
+
if(dd<10) ddd = '0'+dd; else ddd = dd;
|
610
|
+
dd_d.find('ul').append('<li value="'+dd+'">'+ddd+'<em ></em></li>');
|
611
|
+
dd_a_d.find('ul').append('<li value="'+dd+'">'+ddd+'</li>')
|
612
|
+
|
613
|
+
}
|
614
|
+
|
615
|
+
// YEAR //
|
616
|
+
|
617
|
+
dd_y.find('.dd_sl_').append('<ul></ul>');
|
618
|
+
|
619
|
+
for ( var yy = settings.minYear; yy <= settings.maxYear ; yy++ ) {
|
620
|
+
|
621
|
+
bissextile_return = bissextile(yy);
|
622
|
+
dd_y.find('ul').append('<li value="'+yy+'" data-filter="'+bissextile_return+'">'+yy+'</li>')
|
623
|
+
|
624
|
+
}
|
625
|
+
|
626
|
+
// YEARS MULTIPLE //
|
627
|
+
|
628
|
+
if(settings.years_multiple) {
|
629
|
+
|
630
|
+
dd_y_r.append('<ul></ul>');
|
631
|
+
dd_a_y.append('<ul></ul>');
|
632
|
+
|
633
|
+
for ( var yr = settings.minYear; yr <= settings.maxYear ; yr++ ) {
|
634
|
+
|
635
|
+
var remainder = yr % settings.years_multiple;
|
636
|
+
if (remainder == 0) {
|
637
|
+
dd_y_r.find('ul').append('<li value="'+yr+'"></li>');
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
var ww = range/dd_y_r.find('li').length;
|
642
|
+
|
643
|
+
}
|
644
|
+
|
645
|
+
// SET CURRENT DATE FUNCTIONS //
|
646
|
+
|
647
|
+
var
|
648
|
+
selectCurrent = function() {
|
649
|
+
dd_d.find('li').eq(dd_d_current-1).addClass('dd_sltd_');
|
650
|
+
dd_m.find('li').eq(dd_m_current).addClass('dd_sltd_');
|
651
|
+
dd_y.find('li[value='+dd_y_current+']').addClass('dd_sltd_');
|
652
|
+
if(settings.years_multiple) dd_y_r.find('li[value='+yranger(dd_y_current)+']').addClass('dd_sltd_');
|
653
|
+
},
|
654
|
+
setValueDate = function(){
|
655
|
+
dd_d.find('li').eq(tempD-1).addClass('dd_sltd_');
|
656
|
+
dd_m.find('li').eq(tempM-1).addClass('dd_sltd_');
|
657
|
+
dd_y.find('li[value='+tempY+']').addClass('dd_sltd_');
|
658
|
+
if(settings.years_multiple) dd_y_r.find('li[value='+yranger(tempY)+']').addClass('dd_sltd_');
|
659
|
+
},
|
660
|
+
setDateAnimate = function() {
|
661
|
+
dd_m.find('.dd_sl_').animate({scrollLeft:dd_m.find('li.dd_sltd_').index()*range},1200,'swing');
|
662
|
+
setTimeout(function(){
|
663
|
+
dd_d.find('.dd_sl_').animate({scrollLeft:dd_d.find('li.dd_sltd_').index()*range},1200,'swing');
|
664
|
+
setTimeout(function(){
|
665
|
+
dd_y.find('.dd_sl_').animate({scrollLeft:dd_y.find('li.dd_sltd_').index()*range},1200,'swing');
|
666
|
+
},200);
|
667
|
+
},400);
|
668
|
+
},
|
669
|
+
setSelectedDate = function() {
|
670
|
+
dd_m.find('.dd_sl_').scrollLeft(dd_m.find('li.dd_sltd_').index()*range);
|
671
|
+
dd_d.find('.dd_sl_').scrollLeft(dd_d.find('li.dd_sltd_').index()*range);
|
672
|
+
dd_y.find('.dd_sl_').scrollLeft(dd_y.find('li.dd_sltd_').index()*range);
|
673
|
+
}
|
674
|
+
|
675
|
+
|
676
|
+
if(!tempD&&!tempM&&!tempY) selectCurrent(); else setValueDate();
|
677
|
+
|
678
|
+
if(settings.format!='Y'&&settings.format!='m') {
|
679
|
+
|
680
|
+
dd_d.find('li').click(function(){
|
681
|
+
var
|
682
|
+
dd = dd_d.find('li.dd_sltd_').attr('value');
|
683
|
+
dd_a_d.find('li').removeClass('dd_sltd_')
|
684
|
+
dd_a_d.find('li[value='+dd+']').addClass('dd_sltd_');
|
685
|
+
dd_a_d.addClass('dd_open_');
|
686
|
+
});
|
687
|
+
dd_a_d.find('li').click(function(){
|
688
|
+
var
|
689
|
+
dd = $(this).attr('value');
|
690
|
+
dd_d.find('li[value='+dd+']').click();
|
691
|
+
dd_a_d.removeClass('dd_open_');
|
692
|
+
calc();
|
693
|
+
});
|
694
|
+
dd_m.find('li').click(function(){
|
695
|
+
var
|
696
|
+
dd = dd_m.find('li.dd_sltd_').attr('value');
|
697
|
+
dd_a_m.find('li').removeClass('dd_sltd_')
|
698
|
+
dd_a_m.find('li[value='+dd+']').addClass('dd_sltd_');
|
699
|
+
dd_a_m.addClass('dd_open_');
|
700
|
+
});
|
701
|
+
dd_a_m.find('li').click(function(){
|
702
|
+
var
|
703
|
+
dd = $(this).attr('value');
|
704
|
+
dd_m.find('li[value='+dd+']').click();
|
705
|
+
dd_a_m.removeClass('dd_open_');
|
706
|
+
calc();
|
707
|
+
});
|
708
|
+
dd_y.find('li').click(function(){
|
709
|
+
dd_a_y.find('ul').empty();
|
710
|
+
var
|
711
|
+
dd = dd_y_r.find('li.dd_sltd_').attr('value'),
|
712
|
+
dd2 = dd_y.find('li.dd_sltd_').attr('value'),
|
713
|
+
dd10 = parseInt(dd) + 9;
|
714
|
+
if(dd10>settings.maxYear) dd10=settings.maxYear;
|
715
|
+
dd_a_y.find('li').removeClass('dd_sltd_');
|
716
|
+
|
717
|
+
for ( var yr = dd; yr <= dd10 ; yr++ ) {
|
718
|
+
dd_a_y.find('ul').append('<li value="'+yr+'">'+yr+'</li>')
|
719
|
+
}
|
720
|
+
dd_a_y.find('li[value='+dd2+']').addClass('dd_sltd_');
|
721
|
+
dd_a_y.addClass('dd_open_');
|
722
|
+
|
723
|
+
dd_a_y.find('li').click(function(){
|
724
|
+
var
|
725
|
+
dd = $(this).attr('value');
|
726
|
+
dd_y.find('li[value='+dd+']').click();
|
727
|
+
dd_a_y.removeClass('dd_open_');
|
728
|
+
calc();
|
729
|
+
})
|
730
|
+
});
|
731
|
+
|
732
|
+
}
|
733
|
+
|
734
|
+
|
735
|
+
// SWITCH INTERFACE //
|
736
|
+
|
737
|
+
switch(settings.format) {
|
738
|
+
case 'Y': dd_m.hide();dd_d.hide(); break;
|
739
|
+
case 'm': dd_y.hide();dd_y_r.hide();dd_d.hide(); break;
|
740
|
+
}
|
741
|
+
|
742
|
+
// DECLARE CALC FUNCTIONS //
|
743
|
+
|
744
|
+
var
|
745
|
+
calc = function() {
|
746
|
+
|
747
|
+
var
|
748
|
+
dd = dd_d.find('li.dd_sltd_').attr('value'),
|
749
|
+
mm = dd_m.find('li.dd_sltd_').attr('value'),
|
750
|
+
YY = dd_y.find('li.dd_sltd_').attr('value'),
|
751
|
+
YR = dd_y_r.find('li.dd_sltd_'),
|
752
|
+
bis = dd_y.find('li.dd_sltd_').attr('data-filter');
|
753
|
+
|
754
|
+
dd_a_d.find('li').show();
|
755
|
+
if(bis=='true'&&mm=='2') {
|
756
|
+
dd_d.find('ul').width(29*range);
|
757
|
+
if(dd==30||dd==31) {
|
758
|
+
dd_d.find('li').removeClass('dd_sltd_')
|
759
|
+
dd_d.find('li[value=29]').addClass('dd_sltd_');
|
760
|
+
}
|
761
|
+
dd_a_d.find('li[value=30],li[value=31]').hide();
|
762
|
+
}
|
763
|
+
else if(bis!='true'&&mm=='2') {
|
764
|
+
dd_d.find('ul').width(28*range);
|
765
|
+
if(dd==29||dd==30||dd==31) {
|
766
|
+
dd_d.find('li').removeClass('dd_sltd_')
|
767
|
+
dd_d.find('li[value=28]').addClass('dd_sltd_');
|
768
|
+
}
|
769
|
+
dd_a_d.find('li[value=29],li[value=30],li[value=31]').hide();
|
770
|
+
}
|
771
|
+
else if(mm=='11'||mm=='4'||mm=='6'||mm=='9') {
|
772
|
+
dd_d.find('ul').width(30*range);
|
773
|
+
if(dd==31) {
|
774
|
+
dd_d.find('li').removeClass('dd_sltd_')
|
775
|
+
dd_d.find('li[value=30]').addClass('dd_sltd_');
|
776
|
+
}
|
777
|
+
dd_a_d.find('li[value=31]').hide();
|
778
|
+
}
|
779
|
+
else {
|
780
|
+
dd_d.find('ul').width(31*range);
|
781
|
+
}
|
782
|
+
|
783
|
+
dd_d.find('li').each(function(index, element) {
|
784
|
+
|
785
|
+
tod = $(this).attr('value');
|
786
|
+
|
787
|
+
d = new Date(mm+"/"+tod+"/"+YY);
|
788
|
+
x = d.getDay();
|
789
|
+
|
790
|
+
if(x==0) $(this).addClass('dd_sunday'); else $(this).removeClass('dd_sunday');
|
791
|
+
|
792
|
+
$(this).find('em').html(dayNames[x]);
|
793
|
+
|
794
|
+
});
|
795
|
+
dd_a_d.find('li').each(function(index, element) {
|
796
|
+
|
797
|
+
tod = $(this).attr('value');
|
798
|
+
|
799
|
+
d = new Date(mm+"/"+tod+"/"+YY);
|
800
|
+
x = d.getDay();
|
801
|
+
|
802
|
+
if(x==0) $(this).addClass('dd_sunday'); else $(this).removeClass('dd_sunday');
|
803
|
+
|
804
|
+
});
|
805
|
+
|
806
|
+
if(settings.years_multiple) {
|
807
|
+
|
808
|
+
next = YR.next('li');
|
809
|
+
prev = YR.prev('li');
|
810
|
+
|
811
|
+
if(YY>=next.attr('value')&&next.length) {
|
812
|
+
ymultiselect = next.attr('value');
|
813
|
+
dd_y_r.find('li').removeClass('dd_sltd_');
|
814
|
+
next.addClass('dd_sltd_');
|
815
|
+
}
|
816
|
+
else if(YY<ymultiselect&&prev.length) {
|
817
|
+
ymultiselect = prev.attr('value');
|
818
|
+
dd_y_r.find('li').removeClass('dd_sltd_');
|
819
|
+
prev.addClass('dd_sltd_');
|
820
|
+
}
|
821
|
+
}
|
822
|
+
},
|
823
|
+
dropperSubmit = function(str) {
|
824
|
+
dd_input.val(str).change();
|
825
|
+
dd_inner.addClass('dd_fadeout').removeClass('dd_'+settings.animation);
|
826
|
+
setTimeout(function(){dd_inner.hide().removeClass('dd_fadeout'); dd_id.hide();},300);
|
827
|
+
},
|
828
|
+
dropperAlert = function() {
|
829
|
+
dd_inner.addClass('dd_alert').removeClass('dd_'+settings.animation);
|
830
|
+
setTimeout(function(){
|
831
|
+
dd_inner.removeClass('dd_alert')
|
832
|
+
},500)
|
833
|
+
};
|
834
|
+
|
835
|
+
// YEARS MULTIPLE //
|
836
|
+
|
837
|
+
if(settings.years_multiple) {
|
838
|
+
|
839
|
+
dd_y_r.find('li').on('click',function(){
|
840
|
+
|
841
|
+
dd_y_r.find('li').removeClass('dd_sltd_');
|
842
|
+
$(this).addClass('dd_sltd_');
|
843
|
+
|
844
|
+
var x = $(this).attr('value');
|
845
|
+
|
846
|
+
ymultiselect = x;
|
847
|
+
|
848
|
+
dd_y.find('.dd_sl_').stop().animate({scrollLeft:(dd_y.find('li[value='+x+']').index())*range},600,'swing');
|
849
|
+
dd_y.find('li').removeClass('dd_sltd_');
|
850
|
+
dd_y.find('li[value='+x+']').addClass('dd_sltd_');
|
851
|
+
|
852
|
+
calc();
|
853
|
+
})
|
854
|
+
|
855
|
+
}
|
856
|
+
|
857
|
+
// DEFINE EACH DATEDROPPER SWIPER //
|
858
|
+
|
859
|
+
dd_inner.find('.dd_sw_').each(function(index, element) {
|
860
|
+
|
861
|
+
var
|
862
|
+
dd_sel = $(this).find('.dd_sl_'),
|
863
|
+
dd_nav = $(this).find('.dd_nav_'),
|
864
|
+
ls = dd_sel.find('li.dd_sltd_').index()*range,
|
865
|
+
lset = function(){
|
866
|
+
scroll_left = dd_sel.scrollLeft();
|
867
|
+
if(scroll_left>=ls+(range/2)) ls = ls+range;
|
868
|
+
if(scroll_left<=ls-(range/2)) ls = ls-range;
|
869
|
+
}
|
870
|
+
|
871
|
+
dd_sel.find('ul').width(dd_sel.find('li').length*range);
|
872
|
+
|
873
|
+
dd_sel.on('scroll mousemove',function(){
|
874
|
+
lset();
|
875
|
+
});
|
876
|
+
|
877
|
+
dd_nav.click(function(){
|
878
|
+
|
879
|
+
if($(this).hasClass('dd_next_')) obj = dd_sel.find('li.dd_sltd_').next('li');
|
880
|
+
else obj = dd_sel.find('li.dd_sltd_').prev('li');
|
881
|
+
|
882
|
+
if(obj.length) {
|
883
|
+
|
884
|
+
dd_sel.stop().animate({scrollLeft:obj.index()*range}, 200 );
|
885
|
+
dd_sel.find('li').removeClass('dd_sltd_');
|
886
|
+
obj.addClass('dd_sltd_');
|
887
|
+
calc();
|
888
|
+
}
|
889
|
+
});
|
890
|
+
|
891
|
+
dd_sel.on('touchend',function(){
|
892
|
+
|
893
|
+
dd_sel.stop().animate({scrollLeft:ls}, 200 );
|
894
|
+
|
895
|
+
var x = (ls/range);
|
896
|
+
|
897
|
+
dd_sel.find('li').removeClass('dd_sltd_');
|
898
|
+
dd_sel.find('li').eq(x).addClass('dd_sltd_');
|
899
|
+
|
900
|
+
calc();
|
901
|
+
|
902
|
+
});
|
903
|
+
|
904
|
+
dd_sel.find('li').click(function(){
|
905
|
+
dd_sel.animate({scrollLeft:($(this).index())*range}, 200);
|
906
|
+
dd_sel.find('li').removeClass('dd_sltd_');
|
907
|
+
$(this).addClass('dd_sltd_');
|
908
|
+
});
|
909
|
+
|
910
|
+
});
|
911
|
+
|
912
|
+
calc();
|
913
|
+
|
914
|
+
// INPUT CLICK TO ACTIVE DATEDROPPER //
|
915
|
+
|
916
|
+
dd_input.click(function(){
|
917
|
+
|
918
|
+
dd_id.show();
|
919
|
+
dd_inner.css({
|
920
|
+
'top':dd_input.offset().top+(dd_input.height()+12),
|
921
|
+
'left':(dd_input.offset().left+((dd_input.outerWidth()/2)-(range/2)))-2
|
922
|
+
}).show().addClass('dd_'+settings.animation);
|
923
|
+
|
924
|
+
if(dd_input.hasClass('dd_locked')) {
|
925
|
+
|
926
|
+
dd_input.removeClass('dd_locked');
|
927
|
+
|
928
|
+
if(settings.animate_current!=false) setDateAnimate();
|
929
|
+
else setSelectedDate();
|
930
|
+
|
931
|
+
}
|
932
|
+
|
933
|
+
else setSelectedDate();
|
934
|
+
|
935
|
+
});
|
936
|
+
|
937
|
+
// ON BLUR //
|
938
|
+
|
939
|
+
dd_overlay.click(function(){
|
940
|
+
dd_inner.addClass('dd_fadeout').removeClass('dd_'+settings.animation);
|
941
|
+
setTimeout(function(){
|
942
|
+
dd_inner.hide().removeClass('dd_fadeout');
|
943
|
+
dd_id.hide();
|
944
|
+
},300);
|
945
|
+
dd_inner.find('.dd_all_').removeClass('dd_open_');
|
946
|
+
});
|
947
|
+
|
948
|
+
// ON DATEDROPPER SUBMIT //
|
949
|
+
|
950
|
+
dd_submit.click(function(){
|
951
|
+
|
952
|
+
var
|
953
|
+
d = dd_d.find('li.dd_sltd_').attr('value'),
|
954
|
+
m = dd_m.find('li.dd_sltd_').attr('value'),
|
955
|
+
Y = dd_y.find('li.dd_sltd_').attr('value');
|
956
|
+
|
957
|
+
if(d<10) d = '0'+d;
|
958
|
+
if(m<10) m = '0'+m;
|
959
|
+
|
960
|
+
x = new Date(m+"/"+d+"/"+Y);
|
961
|
+
x = x.getDay();
|
962
|
+
|
963
|
+
//day
|
964
|
+
j = d.substr(1), // 1-31
|
965
|
+
D = dayNames[x].substr(0,3), // Sun, Mon
|
966
|
+
l = dayNames[x]; // Sunday, Monday
|
967
|
+
|
968
|
+
//month
|
969
|
+
if(m<10) n = m.substr(1); else n = m; // 1-12
|
970
|
+
M = monthNames[n-1].substr(0, 3), // Jan, Feb
|
971
|
+
F = monthNames[n-1], // January, February
|
972
|
+
|
973
|
+
str =
|
974
|
+
settings.format
|
975
|
+
.replace(/\b(Y)\b/i,Y)
|
976
|
+
.replace(/\b(m)\b/i,m)
|
977
|
+
.replace(/\b(d)\b/i,d)
|
978
|
+
.replace(/\b(D)\b/i,D)
|
979
|
+
.replace(/\b(j)\b/i,j)
|
980
|
+
.replace(/\b(l)\b/i,l)
|
981
|
+
.replace(/\b(F)\b/i,F)
|
982
|
+
.replace(/\b(M)\b/i,M)
|
983
|
+
.replace(/\b(n)\b/i,n);
|
984
|
+
|
985
|
+
if(settings.lock) {
|
986
|
+
|
987
|
+
d1d = dd_d_current; if(d1d<10) d1d = '0'+d1d;
|
988
|
+
d1m = dd_m_current+1; if(d1m<10) d1m = '0'+d1m;
|
989
|
+
d1y = dd_y_current;
|
990
|
+
|
991
|
+
var d1 = Date.parse(d1y+"-"+d1m+"-"+d1d) / 1000;
|
992
|
+
var d2 = Date.parse(Y+"-"+m+"-"+d) / 1000;
|
993
|
+
|
994
|
+
if(settings.lock=='from') { if(d2 < d1) dropperAlert(); else dropperSubmit(str); }
|
995
|
+
else { if(d2 > d1) dropperAlert(); else dropperSubmit(str); }
|
996
|
+
|
997
|
+
}
|
998
|
+
|
999
|
+
else dropperSubmit(str);
|
1000
|
+
|
1001
|
+
});
|
1002
|
+
}
|
1003
|
+
});
|
1004
|
+
};
|
1005
|
+
}( jQuery ));
|