|
182 | 182 | trigger, |
183 | 183 | pm, nm, |
184 | 184 | currYear, currMonth, currDay, |
185 | | - value = input.attr("data-value") || conf.value || input.val(), |
| 185 | + value = input.data("value") || conf.value || input.val(), |
186 | 186 | min = input.attr("min") || conf.min, |
187 | 187 | max = input.attr("max") || conf.max, |
188 | 188 | opened; |
|
206 | 206 | $.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","), function(i, attr) { |
207 | 207 | tmp.attr(attr, input.attr(attr)); |
208 | 208 | }); |
| 209 | + var data = input.data(); |
209 | 210 | input.replaceWith(tmp); |
210 | 211 | input = tmp; |
| 212 | + for (var key in data) { |
| 213 | + input.data(key, data[key]); |
| 214 | + } |
211 | 215 | } |
212 | 216 | input.addClass(css.input); |
213 | 217 |
|
|
268 | 272 | //{{{ pick |
269 | 273 |
|
270 | 274 | function select(date, conf, e) { |
271 | | - |
272 | 275 | // current value |
273 | 276 | value = date; |
274 | 277 | currYear = date.getFullYear(); |
|
284 | 287 | if (e.isDefaultPrevented()) { return; } |
285 | 288 |
|
286 | 289 | // formatting |
287 | | - input.val(format(date, conf.format, conf.lang)); |
288 | | - |
| 290 | + var val = format(date, conf.format, conf.lang); |
| 291 | + input.val(val).data("value", val); |
| 292 | + |
289 | 293 | // store value into input |
290 | 294 | input.data("date", date); |
291 | 295 |
|
|
469 | 473 | } |
470 | 474 |
|
471 | 475 | root.css({ |
472 | | - top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], |
| 476 | + top: pos.top + input.outerHeight(true) + conf.offset[0], |
473 | 477 | left: pos.left + conf.offset[1] |
474 | 478 | }); |
475 | 479 |
|
|
489 | 493 | //{{{ setValue |
490 | 494 |
|
491 | 495 | setValue: function(year, month, day) { |
492 | | - |
493 | 496 | var date = integer(month) >= -1 ? new Date(integer(year), integer(month), integer(day == undefined || isNaN(day) ? 1 : day)) : |
494 | 497 | year || value; |
495 | 498 |
|
|
500 | 503 | month = date.getMonth(); |
501 | 504 | day = date.getDate(); |
502 | 505 |
|
503 | | - |
504 | 506 | // roll year & month |
505 | 507 | if (month == -1) { |
506 | 508 | month = 11; |
|
592 | 594 |
|
593 | 595 | // current date |
594 | 596 | if (isSameDay(value, date)) { |
595 | | - a.attr("id", css.current).addClass(css.focus); |
| 597 | + a.attr("id", css.current).addClass(css.focus).addClass("calcurrent"); |
596 | 598 |
|
597 | 599 | // today |
598 | 600 | } else if (isSameDay(now, date)) { |
599 | | - a.attr("id", css.today); |
| 601 | + a.attr("id", css.today).addClass("caltoday"); |
600 | 602 | } |
601 | 603 | } |
602 | 604 |
|
|
618 | 620 | weeks.find("a").click(function(e) { |
619 | 621 | var el = $(this); |
620 | 622 | if (!el.hasClass(css.disabled)) { |
621 | | - $("#" + css.current).removeAttr("id"); |
622 | | - el.attr("id", css.current); |
| 623 | + $("#" + css.current).removeAttr("id").removeClass("calcurrent"); |
| 624 | + el.attr("id", css.current).addClass("calcurrent"); |
623 | 625 | select(el.data("date"), conf, e); |
624 | 626 | } |
625 | 627 | return false; |
|
768 | 770 | conf.css[key] = (conf.css.prefix || '') + (val || key); |
769 | 771 | } |
770 | 772 | }); |
771 | | - |
772 | 773 | var els; |
773 | 774 |
|
774 | 775 | this.each(function() { |
|
0 commit comments