/** @Name : layDate v1.1 日期控件 @Author: 贤心 @Date: 2014-06-25 @QQ群:176047195 @Site:http://sentsin.com/layui/laydate 这是解压过后的 defSkin 是换肤函数,共有:default、dahong、danlan、huanglv、molv、yahui这6种。还有其他皮肤可去官网下载 */ ; ! function (a) { var b = { path: "", defSkin: "molv", format: "YYYY-MM-DD", min: "1900-01-01 00:00:00", max: "2099-12-31 23:59:59", isv: !1 }, c = {}, d = document, e = "createElement", f = "getElementById", g = "getElementsByTagName", h = ["laydate_box", "laydate_void", "laydate_click", "LayDateSkin", "skins/", "/laydate.css"]; a.laydate = function (b) { b = b || {}; try { h.event = a.event ? a.event : laydate.caller.arguments[0] } catch (d) { } return c.run(b), laydate }, laydate.v = "1.1", c.getPath = function () { var a = document.scripts, c = a[a.length - 1].src; return b.path ? b.path : c.substring(0, c.lastIndexOf("/") + 1) }(), c.use = function (a, b) { var f = d[e]("link"); f.type = "text/css", f.rel = "stylesheet", f.href = c.getPath + a + h[5], b && (f.id = b), d[g]("head")[0].appendChild(f), f = null }, c.trim = function (a) { return a = a || "", a.replace(/^\s|\s$/g, "").replace(/\s+/g, " ") }, c.digit = function (a) { return 10 > a ? "0" + (0 | a) : a }, c.stopmp = function (b) { return b = b || a.event, b.stopPropagation ? b.stopPropagation() : b.cancelBubble = !0, this }, c.each = function (a, b) { for (var c = 0, d = a.length; d > c && b(c, a[c]) !== !1; c++); }, c.hasClass = function (a, b) { return a = a || {}, new RegExp("\\b" + b + "\\b").test(a.className) }, c.addClass = function (a, b) { return a = a || {}, c.hasClass(a, b) || (a.className += " " + b), a.className = c.trim(a.className), this }, c.removeClass = function (a, b) { if (a = a || {}, c.hasClass(a, b)) { var d = new RegExp("\\b" + b + "\\b"); a.className = a.className.replace(d, "") } return this }, c.removeCssAttr = function (a, b) { var c = a.style; c.removeProperty ? c.removeProperty(b) : c.removeAttribute(b) }, c.shde = function (a, b) { a.style.display = b ? "none" : "block" }, c.query = function (a) { var e, b, h, i, j; return a = c.trim(a).split(" "), b = d[f](a[0].substr(1)), b ? a[1] ? /^\./.test(a[1]) ? (i = a[1].substr(1), j = new RegExp("\\b" + i + "\\b"), e = [], h = d.getElementsByClassName ? b.getElementsByClassName(i) : b[g]("*"), c.each(h, function (a, b) { j.test(b.className) && e.push(b) }), e[0] ? e : "") : (e = b[g](a[1]), e[0] ? b[g](a[1]) : "") : b : void 0 }, c.on = function (b, d, e) { return b.attachEvent ? b.attachEvent("on" + d, function () { e.call(b, a.even) }) : b.addEventListener(d, e, !1), c }, c.stopMosup = function (a, b) { "mouseup" !== a && c.on(b, "mouseup", function (a) { c.stopmp(a) }) }, c.run = function (a) { var d, e, g, b = c.query, f = h.event; try { g = f.target || f.srcElement || {} } catch (i) { g = {} } if (d = a.elem ? b(a.elem) : g, f && g.tagName) { if (!d || d === c.elem) return; c.stopMosup(f.type, d), c.stopmp(f), c.view(d, a), c.reshow() } else e = a.event || "click", c.each((0 | d.length) > 0 ? d : [d], function (b, d) { c.stopMosup(e, d), c.on(d, e, function (b) { c.stopmp(b), d !== c.elem && (c.view(d, a), c.reshow()) }) }) }, c.scroll = function (a) { return a = a ? "scrollLeft" : "scrollTop", d.body[a] | d.documentElement[a] }, c.winarea = function (a) { return document.documentElement[a ? "clientWidth" : "clientHeight"] }, c.isleap = function (a) { return 0 === a % 4 && 0 !== a % 100 || 0 === a % 400 }, c.checkVoid = function (a, b, d) { var e = []; return a = 0 | a, b = 0 | b, d = 0 | d, a < c.mins[0] ? e = ["y"] : a > c.maxs[0] ? e = ["y", 1] : a >= c.mins[0] && a <= c.maxs[0] && (a == c.mins[0] && (b < c.mins[1] ? e = ["m"] : b == c.mins[1] && d < c.mins[2] && (e = ["d"])), a == c.maxs[0] && (b > c.maxs[1] ? e = ["m", 1] : b == c.maxs[1] && d > c.maxs[2] && (e = ["d", 1]))), e }, c.timeVoid = function (a, b) { if (c.ymd[1] + 1 == c.mins[1] && c.ymd[2] == c.mins[2]) { if (0 === b && a < c.mins[3]) return 1; if (1 === b && a < c.mins[4]) return 1; if (2 === b && a < c.mins[5]) return 1 } else if (c.ymd[1] + 1 == c.maxs[1] && c.ymd[2] == c.maxs[2]) { if (0 === b && a > c.maxs[3]) return 1; if (1 === b && a > c.maxs[4]) return 1; if (2 === b && a > c.maxs[5]) return 1 } return a > (b ? 59 : 23) ? 1 : void 0 }, c.check = function () { var a = c.options.format.replace(/YYYY|MM|DD|hh|mm|ss/g, "\\d+\\").replace(/\\$/g, ""), b = new RegExp(a), d = c.elem[h.elemv], e = d.match(/\d+/g) || [], f = c.checkVoid(e[0], e[1], e[2]); if ("" !== d.replace(/\s/g, "")) { if (!b.test(d)) return c.elem[h.elemv] = "", c.msg("日期不符合格式,请重新选择。"), 1; if (f[0]) return c.elem[h.elemv] = "", c.msg("日期不在有效期内,请重新选择。"), 1; f.value = c.elem[h.elemv].match(b).join(), e = f.value.match(/\d+/g), e[1] < 1 ? (e[1] = 1, f.auto = 1) : e[1] > 12 ? (e[1] = 12, f.auto = 1) : e[1].length < 2 && (f.auto = 1), e[2] < 1 ? (e[2] = 1, f.auto = 1) : e[2] > c.months[(0 | e[1]) - 1] ? (e[2] = 31, f.auto = 1) : e[2].length < 2 && (f.auto = 1), e.length > 3 && (c.timeVoid(e[3], 0) && (f.auto = 1), c.timeVoid(e[4], 1) && (f.auto = 1), c.timeVoid(e[5], 2) && (f.auto = 1)), f.auto ? c.creation([e[0], 0 | e[1], 0 | e[2]], 1) : f.value !== c.elem[h.elemv] && (c.elem[h.elemv] = f.value) } }, c.months = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], c.viewDate = function (a, b, d) { var f = (c.query, {}), g = new Date; a < (0 | c.mins[0]) && (a = 0 | c.mins[0]), a > (0 | c.maxs[0]) && (a = 0 | c.maxs[0]), g.setFullYear(a, b, d), f.ymd = [g.getFullYear(), g.getMonth(), g.getDate()], c.months[1] = c.isleap(f.ymd[0]) ? 29 : 28, g.setFullYear(f.ymd[0], f.ymd[1], 1), f.FDay = g.getDay(), f.PDay = c.months[0 === b ? 11 : b - 1] - f.FDay + 1, f.NDay = 1, c.each(h.tds, function (a, b) { var g, d = f.ymd[0], e = f.ymd[1] + 1; b.className = "", a < f.FDay ? (b.innerHTML = g = a + f.PDay, c.addClass(b, "laydate_nothis"), 1 === e && (d -= 1), e = 1 === e ? 12 : e - 1) : a >= f.FDay && a < f.FDay + c.months[f.ymd[1]] ? (b.innerHTML = g = a - f.FDay + 1, a - f.FDay + 1 === f.ymd[2] && (c.addClass(b, h[2]), f.thisDay = b)) : (b.innerHTML = g = f.NDay++, c.addClass(b, "laydate_nothis"), 12 === e && (d += 1), e = 12 === e ? 1 : e + 1), c.checkVoid(d, e, g)[0] && c.addClass(b, h[1]), c.options.festival && c.festival(b, e + "." + g), b.setAttribute("y", d), b.setAttribute("m", e), b.setAttribute("d", g), d = e = g = null }), c.valid = !c.hasClass(f.thisDay, h[1]), c.ymd = f.ymd, h.year.value = c.ymd[0] + "年", h.month.value = c.digit(c.ymd[1] + 1) + "月", c.each(h.mms, function (a, b) { var d = c.checkVoid(c.ymd[0], (0 | b.getAttribute("m")) + 1); "y" === d[0] || "m" === d[0] ? c.addClass(b, h[1]) : c.removeClass(b, h[1]), c.removeClass(b, h[2]), d = null }), c.addClass(h.mms[c.ymd[1]], h[2]), f.times = [0 | c.inymd[3] || 0, 0 | c.inymd[4] || 0, 0 | c.inymd[5] || 0], c.each(new Array(3), function (a) { c.hmsin[a].value = c.digit(c.timeVoid(f.times[a], a) ? 0 | c.mins[a + 3] : 0 | f.times[a]) }), c[c.valid ? "removeClass" : "addClass"](h.ok, h[1]) }, c.festival = function (a, b) { var c; switch (b) { case "1.1": c = "元旦"; break; case "3.8": c = "妇女"; break; case "4.5": c = "清明"; break; case "5.1": c = "劳动"; break; case "6.1": c = "儿童"; break; case "9.10": c = "教师"; break; case "10.1": c = "国庆" } c && (a.innerHTML = c), c = null }, c.viewYears = function (a) { var b = c.query, d = ""; c.each(new Array(14), function (b) { d += 7 === b ? "
" + a + "
", c.shde(b("#" + h[0])), c.removeClass(e.times, "laydate_time1").addClass(e.times, "laydate_msg")) : (e.hmsarr[a] ? f = e.hmsarr[a] : (f += '