diff --git a/API-ax5-util.md b/API-ax5-util.md index 7a0c997..df59492 100644 --- a/API-ax5-util.md +++ b/API-ax5-util.md @@ -47,6 +47,19 @@ ax5.util.isUndefined(); // return is undefined|''|null. ax5.util.isNothing(); + +// return is Date +ax5.util.isDate(); + +``` + +## ax5.util.isDateFormat +`ax5.util.isDateFormat(String)` + +```js +console.log(ax5.util.isDateFormat('20160101')); // true +console.log(ax5.util.isDateFormat('2016*01*01')); // true +console.log(ax5.util.isDateFormat('20161132')); // false ``` --- diff --git a/bower.json b/bower.json index e4033b0..aecaf37 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ax5core", - "version": "0.7.3", + "version": "0.7.4", "authors": [ "ThomasJ " ], diff --git a/dist/ax5core.js b/dist/ax5core.js index 5edc3e2..a277efb 100755 --- a/dist/ax5core.js +++ b/dist/ax5core.js @@ -755,6 +755,33 @@ return (typeof O === "undefined" || O === null || O === ""); } + function isDate(O) { + return (O instanceof Date && !isNaN(O.valueOf())); + } + + function isDateFormat(O) { + var + result = false + ; + if (O instanceof Date && !isNaN(O.valueOf())) { + result = true; + } + else { + O = O.replace(/\D/g, ''); + if (O.length > 7) { + var + mm = O.substr(4, 2), + dd = O.substr(6, 2) + ; + O = date(O); + if (O.getMonth() == (mm - 1) && O.getDate() == dd) { + result = true; + } + } + } + return result; + } + /** * 오브젝트의 첫번째 아이템을 반환합니다. * @method ax5.util.first @@ -1453,6 +1480,15 @@ * @param {String|Data} d * @param {Object} cond * @returns {Number} + * @example + * ```js + * ax5.util.dday('2016-01-29'); + * // 1 + * ax5.util.dday('2016-01-29', {today:'2016-01-28'}); + * // 1 + * ax5.util.dday('1977-03-29', {today:'2016-01-28', age:true}); + * // 39 + * ``` */ function dday(d, cond) { var memoryDay = date(d), DyMilli = ((1000 * 60) * 60) * 24, today = new Date(), diffnum, thisYearMemoryDay; @@ -1479,9 +1515,10 @@ thisYearMemoryDay = new Date(today.getFullYear() + 1, memoryDay.getMonth(), memoryDay.getDate()); diffnum = number((( getDayTime(thisYearMemoryDay) - getDayTime(today) ) / DyMilli), {floor: true}); } - if (cond["age"]) { - diffnum = thisYearMemoryDay.getFullYear() - memoryDay.getFullYear(); - } + } + if (cond["age"]) { + thisYearMemoryDay = new Date(today.getFullYear(), memoryDay.getMonth(), memoryDay.getDate()); + diffnum = thisYearMemoryDay.getFullYear() - memoryDay.getFullYear(); } return diffnum; @@ -1495,16 +1532,12 @@ * @returns {Object} * @example * ```js - * ax5.util.weeksOfMonth("2015-10-01"); // {year: 2015, month: 9, count: 5} - * ax5.util.weeksOfMonth("2015-09-19"); // {year: 2015, month: 9, count: 3} + * ax5.util.weeksOfMonth("2015-10-01"); // {year: 2015, month: 10, count: 1} + * ax5.util.weeksOfMonth("2015-09-19"); // {year: 2015, month: 10, count: 1} * ``` */ function weeksOfMonth(d) { var myDate = date(d); - //sOfMonth = new Date(myDate.getFullYear(), myDate.getMonth(), 1); - //sOfMonth.getDay() - //console.log(sOfMonth.getDay(), myDate.getDay()); - //console.log(parseInt(myDate.getDate() / 7 + 1)); return { year: myDate.getFullYear(), month: myDate.getMonth() + 1, @@ -1512,28 +1545,17 @@ }; } - /** - * 원하는 횟수 만큼 자릿수 맞춤 문자열을 포함한 문자열을 반환합니다. - * @method ax5.util.setDigit - * @param {String|Number} num - * @param {Number} length - * @param {String} [padder=0] - * @param {Number} [radix] - * @returns {String} - */ - function setDigit(num, length, padder, radix) { - var s = num.toString(radix || 10); - return times((padder || '0'), (length - s.length)) + s; - } - - function times(s, count) { return count < 1 ? '' : new Array(count + 1).join(s); } - /** * 년월에 맞는 날자수를 반환합니다. * @method ax5.util.daysOfMonth * @param {Number} y * @param {Number} m * @returns {Number} + * @examples + * ```js + * ax5.util.daysOfMonth(2015, 11); // 31 + * ax5.util.daysOfMonth(2015, 1); // 28 + * ``` */ function daysOfMonth(y, m) { if (m == 3 || m == 5 || m == 8 || m == 10) { @@ -1547,6 +1569,22 @@ } } + /** + * 원하는 횟수 만큼 자릿수 맞춤 문자열을 포함한 문자열을 반환합니다. + * @method ax5.util.setDigit + * @param {String|Number} num + * @param {Number} length + * @param {String} [padder=0] + * @param {Number} [radix] + * @returns {String} + */ + function setDigit(num, length, padder, radix) { + var s = num.toString(radix || 10); + return times((padder || '0'), (length - s.length)) + s; + } + + function times(s, count) { return count < 1 ? '' : new Array(count + 1).join(s); } + /** * 타겟엘리먼트의 부모 엘리멘트 트리에서 원하는 조건의 엘리먼트를 얻습니다. * @method ax5.util.findParentNode @@ -1682,7 +1720,7 @@ var returns; if (isObject(val)) { returns = ''; - for(var k in val){ + for (var k in val) { returns += k + ':' + val[k] + ';'; } return returns; @@ -1690,8 +1728,8 @@ else if (isString(val)) { returns = {}; var valSplited = val.split(/[ ]*;[ ]*/g); - valSplited.forEach(function(v){ - if((v = v.trim()) !== "") { + valSplited.forEach(function (v) { + if ((v = v.trim()) !== "") { var vSplited = v.split(/[ ]*:[ ]*/g); returns[vSplited[0]] = vSplited[1]; } @@ -1737,13 +1775,15 @@ error: error, date: date, dday: dday, - setDigit: setDigit, - times: times, daysOfMonth: daysOfMonth, weeksOfMonth: weeksOfMonth, + setDigit: setDigit, + times: times, findParentNode: findParentNode, cssNumber: cssNumber, - css: css + css: css, + isDate: isDate, + isDateFormat: isDateFormat } })(); diff --git a/dist/ax5core.min.js b/dist/ax5core.min.js index 835e8ee..7f87079 100755 --- a/dist/ax5core.min.js +++ b/dist/ax5core.min.js @@ -1 +1 @@ -(function(){"use strict";var e,t,r,n=this,o=window,i=document,a=(document.documentElement,/^(["'](\\.|[^"\\\n\r])*?["']|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/),u=/^-ms-/,l=/[\-_]([\da-z])/gi,s=/([A-Z])/g,f=/\./,c=/[-|+]?[\D]/gi,d=/\D/gi,p=new RegExp("([0-9])([0-9][0-9][0-9][,.])"),g=/&/g,h=/=/,m=/[ ]+/g,y={};y.guid=1,y.getGuid=function(){return y.guid++},y.info=e=function(){function r(e,r){return e={href:o.location.href,param:o.location.search,referrer:i.referrer,pathname:o.location.pathname,hostname:o.location.hostname,port:o.location.port},r=e.href.split(/[\?#]/),e.param=e.param.replace("?",""),e.url=r[0],e.href.search("#")>-1&&(e.hashdata=t.last(r)),r=null,e.baseUrl=t.left(e.href,"?").replace(e.pathname,""),e}function n(t,r,n){return e.errorMsg&&e.errorMsg[t]?{className:t,errorCode:r,methodName:n,msg:e.errorMsg[t][r]}:{className:t,errorCode:r,methodName:n}}var a="0.0.1",u="",l=function(){console.error(t.toArray(arguments).join(":"))},s={BACKSPACE:8,TAB:9,RETURN:13,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34,INSERT:45,SPACE:32},f=[{label:"SUN"},{label:"MON"},{label:"TUE"},{label:"WED"},{label:"THU"},{label:"FRI"},{label:"SAT"}],c=function(e,t,r,n,o,i){return e=navigator.userAgent.toLowerCase(),t=-1!=e.search(/mobile/g),i,-1!=e.search(/iphone/g)?{name:"iphone",version:0,mobile:!0}:-1!=e.search(/ipad/g)?{name:"ipad",version:0,mobile:!0}:-1!=e.search(/android/g)?(n=/(android)[ \/]([\w.]+)/.exec(e)||[],i=n[2]||"0",{name:"android",version:i,mobile:t}):(r="",n=/(opr)[ \/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],o=n[1]||"",i=n[2]||"0","msie"==o&&(o="ie"),{name:o,version:i,mobile:t})}(),d=!("undefined"==typeof window||"undefined"==typeof navigator||!o.document),p=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel",g={ax5dialog:{501:"Duplicate call error"},"single-uploader":{460:"There are no files to be uploaded.",461:"There is no uploaded files."},ax5calendar:{401:"Can not find target element"}};return{errorMsg:g,version:a,baseUrl:u,onerror:l,eventKeys:s,weekNames:f,browser:c,isBrowser:d,wheelEnm:p,urlUtil:r,getError:n}}(),y.util=t=function(){function t(e,t){if(R(e))return[];var r,n=0,o=e.length,i=void 0===o||"function"==typeof e;if(i){for(r in e)if("undefined"!=typeof e[r]&&t.call(e[r],r,e[r])===!1)break}else for(;o>n&&("undefined"==typeof e[n]||t.call(e[n],n,e[n++])!==!1););return e}function b(e,t){if(R(e))return[];var r,n,o=0,i=e.length,a=[];if(S(e)){for(r in e)if("undefined"!=typeof e[r]){if(n=void 0,(n=t.call(e[r],r,e[r]))===!1)break;a.push(n)}}else for(;i>o;)if("undefined"!=typeof e[o]){if(n=void 0,(n=t.call(e[o],o,e[o++]))===!1)break;a.push(n)}return a}function w(e,t){if(R(e))return-1;var r,n=0,o=e.length;if(S(e))for(r in e){if("undefined"!=typeof e[r]&&M(t)&&t.call(e[r],r,e[r]))return r;if(e[r]==t)return r}else for(;o>n;){if("undefined"!=typeof e[n]&&M(t)&&t.call(e[n],n,e[n]))return n;if(e[n]==t)return n;n++}return-1}function v(e,t){var r,o,i;if(A(e)){for(r=0,o=e.length,i=e[r];o-1>r&&("undefined"==typeof e[r]||(i=t.call(n,i,e[++r]))!==!1););return i}if(S(e)){for(r in e)if("undefined"!=typeof e[r]&&(i=t.call(n,i,e[r]))===!1)break;return i}return console.error("argument error : ax5.util.reduce - use Array or Object"),null}function T(e,t){for(var r=e.length-1,o=e[r];r>0&&("undefined"==typeof e[r]||(o=t.call(n,o,e[--r]))!==!1););return o}function x(e,t){if(R(e))return[];var r,n,o=0,i=e.length,a=[];if(S(e))for(r in e)"undefined"!=typeof e[r]&&(n=t.call(e[r],r,e[r]))&&a.push(e[r]);else for(;i>o;)"undefined"!=typeof e[o]&&((n=t.call(e[o],o,e[o]))&&a.push(e[o]),o++);return a}function E(e){var r="";if(y.util.isArray(e)){var n=0,o=e.length;for(r+="[";o>n;n++)n>0&&(r+=","),r+=E(e[n]);r+="]"}else if(y.util.isObject(e)){r+="{";var i=[];t(e,function(e,t){i.push('"'+e+'": '+E(t))}),r+=i.join(", "),r+="}"}else y.util.isString(e)?r='"'+e+'"':y.util.isNumber(e)?r=e:y.util.isUndefined(e)?r="undefined":y.util.isFunction(e)&&(r='"{Function}"');return r}function N(e,t){if(!t&&!a.test(e))return{error:500,msg:"syntax error"};try{return new Function("","return "+e)()}catch(r){return{error:500,msg:"syntax error"}}}function j(e){var t;return null!=e&&e==e.window?t="window":e&&1==e.nodeType?t="element":e&&11==e.nodeType?t="fragment":"undefined"==typeof e?t="undefined":"[object Object]"==ue.call(e)?t="object":"[object Array]"==ue.call(e)?t="array":"[object String]"==ue.call(e)?t="string":"[object Number]"==ue.call(e)?t="number":"[object NodeList]"==ue.call(e)?t="nodelist":"function"==typeof e&&(t="function"),t}function D(e){return null!=e&&e==e.window}function O(e){return!(!e||1!=e.nodeType&&11!=e.nodeType)}function S(e){return"[object Object]"==ue.call(e)}function A(e){return"[object Array]"==ue.call(e)}function M(e){return"function"==typeof e}function k(e){return"[object String]"==ue.call(e)}function C(e){return"[object Number]"==ue.call(e)}function F(e){return"[object NodeList]"==ue.call(e)||e&&e[0]&&1==e[0].nodeType}function U(e){return"undefined"==typeof e}function R(e){return"undefined"==typeof e||null===e||""===e}function P(e){if(S(e)){var t=Object.keys(e),r={};return r[t[0]]=e[t[0]],r}return A(e)?e[0]:void console.error("ax5.util.object.first","argument type error")}function $(e){if(S(e)){var t=Object.keys(e),r={};return r[t[t.length-1]]=e[t[t.length-1]],r}return A(e)?e[e.length-1]:void console.error("ax5.util.object.last","argument type error")}function z(e,t,r,n){var o;return"number"==typeof r&&(o=new Date,o.setDate(o.getDate()+r)),n=n||{},i.cookie=[escape(e),"=",escape(t),o?"; expires="+o.toUTCString():"",n.path?"; path="+n.path:"",n.domain?"; domain="+n.domain:"",n.secure?"; secure":""].join("")}function Y(e){for(var t=e+"=",r=i.cookie.split(";"),n=0,o=r.length;o>n;n++){for(var a=r[n];" "==a.charAt(0);)a=a.substring(1);if(-1!=a.indexOf(t))return unescape(a.substring(t.length,a.length))}return""}function B(t,n,o){for(var a,u,l=i.head||i.getElementsByTagName("head")[0],s=e.isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,f=t.length,c=[],d={},p=!1,g=r.get("script[src]"),h=(r.get("style[href]"),function(){1>f&&0==c.length&&!p&&(n&&n({}),p=!0)}),m=function(){1>f&&c.length>0&&!p&&(console.error(c),o&&o({type:"loadFail",list:c}),p=!0)},b=0,w=t.length;w>b;b++){for(var v,T,x,E=t[b],N=W(E,"."),j=!1,D=e.baseUrl+E,O="js"===N?"src":"href",S=g.length;S--;)if(g[S].getAttribute(O)===D){j=!0;break}j?(f--,h()):(v="js"===N?r.create("script",{type:"text/javascript",src:D,"data-src":D}):r.create("link",{rel:"stylesheet",type:"text/css",href:D}),T=function(e,t){e&&("load"===e.type||s.test((e.currentTarget||e.srcElement).readyState))&&(d[t]||f--,a&&clearTimeout(a),a=setTimeout(h,1))},x=function(t){f--,c.push({src:e.baseUrl+E,error:t}),u&&clearTimeout(u),u=setTimeout(m,1)},y.xhr({url:D,contentType:"",res:function(e,t){for(var n,o=!1,i=r.get("script[src]"),a=i.length;a--;)if(i[a].getAttribute(O)===D){o=!0;break}o||l.appendChild(v),v.onload=function(e){T(e,D),n&&clearTimeout(n)},n=setTimeout(function(){T({type:"load"},D)},500)},error:function(){x(this)}}))}}function H(e){return o.alert(E(e)),e}function L(e,t){return"undefined"==typeof e||"undefined"==typeof t?"":k(t)?e.indexOf(t)>-1?e.substr(0,e.indexOf(t)):e:C(t)?e.substr(0,t):""}function W(e,t){return"undefined"==typeof e||"undefined"==typeof t?"":(e=""+e,k(t)?e.lastIndexOf(t)>-1?e.substr(e.lastIndexOf(t)+1):e:C(t)?e.substr(e.length-t):"")}function I(e){return e.replace(u,"ms-").replace(l,function(e,t){return t.toUpperCase()})}function _(e){return I(e).replace(s,function(e,t){return"-"+t.toLowerCase()})}function q(e,r){var n,o=(""+e).split(f),i=Number(o[0])<0||"-0"==o[0],a=0;return o[0]=o[0].replace(c,""),o[1]?(o[1]=o[1].replace(d,""),a=Number(o[0]+"."+o[1])||0):a=Number(o[0])||0,n=i?-a:a,t(r,function(e,t){"round"==e&&(n=C(t)?0>t?+(Math.round(n+"e-"+Math.abs(t))+"e+"+Math.abs(t)):+(Math.round(n+"e+"+t)+"e-"+t):Math.round(n)),"floor"==e&&(n=Math.floor(n)),"ceil"==e?n=Math.ceil(n):"money"==e?n=function(e){var t=""+e;if(isNaN(t)||""==t)return"";var r=t.split(".");r[0]+=".";do r[0]=r[0].replace(p,"$1,$2");while(p.test(r[0]));return r.length>1?r.join(""):r[0].split(".")[0]}(n):"abs"==e?n=Math.abs(Number(n)):"byte"==e&&(n=function(e){e=Number(n);var t="KB",r=e/1024;return r/1024>1&&(t="MB",r/=1024),r/1024>1&&(t="GB",r/=1024),q(r,{round:1})+t}(n))}),n}function G(e){return"undefined"!=typeof e.length?Array.prototype.slice.call(e):[]}function J(e,t){var r=t.length,n=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[n++]=t[o];else for(;void 0!==t[o];)e[n++]=t[o++];return e.length=n,e}function K(e,r){var n;return k(e)&&"undefined"!=typeof r&&"param"==r?e:k(e)&&"undefined"!=typeof r&&"object"==r||k(e)&&"undefined"==typeof r?(n={},t(e.split(g),function(){var e=this.split(h);n[e[0]]=e[1]}),n):(n=[],t(e,function(e,t){n.push(e+"="+escape(t))}),n.join("&"))}function X(){y.info.onerror.apply(this,arguments)}function Q(e,t,r,n,o,i){var a,u;return u=new Date,"undefined"==typeof n&&(n=23),"undefined"==typeof o&&(o=59),a=new Date(Date.UTC(e,t,r||1,n,o,i||0)),0==t&&1==r&&a.getUTCHours()+a.getTimezoneOffset()/60<0?a.setUTCHours(0):a.setUTCHours(a.getUTCHours()+a.getTimezoneOffset()/60),a}function Z(t,r){var n,o,i,a,u,l,s,f,c,d;if(k(t))if(0==t.length)t=new Date;else if(t.length>15)l=t.split(/ /g),c=l[0].split(/\D/g),n=c[0],o=parseFloat(c[1]),i=parseFloat(c[2]),f=l[1]||"09:00",s=f.left(5).split(":"),a=parseFloat(s[0]),u=parseFloat(s[1]),("AM"===f.right(2)||"PM"===f.right(2))&&(a+=12),t=Q(n,o-1,i,a,u);else if(14==t.length)d=t.replace(/\D/g,""),t=Q(d.substr(0,4),d.substr(4,2)-1,q(d.substr(6,2)),q(d.substr(8,2)),q(d.substr(10,2)),q(d.substr(12,2)));else if(t.length>7)d=t.replace(/\D/g,""),t=Q(d.substr(0,4),d.substr(4,2)-1,q(d.substr(6,2)));else if(t.length>4)d=t.replace(/\D/g,""),t=Q(d.substr(0,4),d.substr(4,2)-1,1);else{if(t.length>2)return d=t.replace(/\D/g,""),Q(d.substr(0,4),d.substr(4,2)-1,1);t=new Date}return"undefined"==typeof r?t:(r.add&&(t=function(e,t){var r,n,o,i,a=864e5;return"undefined"!=typeof t.d?e.setTime(e.getTime()+t.d*a):"undefined"!=typeof t.m?(r=e.getFullYear(),n=e.getMonth(),o=e.getDate(),r+=parseInt(t.m/12),n+=t.m%12,i=ne(r,n),o>i&&(o=i),e=new Date(r,n,o,12)):"undefined"!=typeof t.y?e.setTime(e.getTime()+365*t.y*a):e.setTime(e.getTime()+t.y*a),e}(new Date(t),r.add)),r["return"]?function(){var n,o,i,a,u,l,s,f=r["return"];n=t.getUTCFullYear(),o=te(t.getMonth()+1,2),i=te(t.getDate(),2),a=te(t.getHours(),2),u=te(t.getMinutes(),2),l=te(t.getSeconds(),2),s=t.getDay();var c=/[^y]*(yyyy)[^y]*/gi;c.exec(f);var d=RegExp.$1,p=/[^m]*(mm)[^m]*/gi;p.exec(f);var g=RegExp.$1,h=/[^d]*(dd)[^d]*/gi;h.exec(f);var m=RegExp.$1,y=/[^h]*(hh)[^h]*/gi;y.exec(f);var b=RegExp.$1,w=/[^m]*(mi)[^i]*/gi;w.exec(f);var v=RegExp.$1,T=/[^s]*(ss)[^s]*/gi;T.exec(f);var x=RegExp.$1,E=/[^d]*(dw)[^w]*/gi;E.exec(f);var N=RegExp.$1;return"yyyy"===d&&(f=f.replace(d,W(n,d.length))),"mm"===g&&(1==g.length&&(o=t.getMonth()+1),f=f.replace(g,o)),"dd"===m&&(1==m.length&&(i=t.getDate()),f=f.replace(m,i)),"hh"===b&&(f=f.replace(b,a)),"mi"===v&&(f=f.replace(v,u)),"ss"===x&&(f=f.replace(x,l)),"dw"==N&&(f=f.replace(N,e.weekNames[s].label)),f}():t)}function V(e,t){function r(e){return Math.floor(e.getTime()/a)*a}var n,o,i=Z(e),a=864e5,u=new Date;return"undefined"==typeof t?n=q((r(i)-r(u))/a,{floor:!0}):(n=q((r(i)-r(u))/a,{floor:!0}),t.today&&(u=Z(t.today),n=q((r(i)-r(u))/a,{floor:!0})),t.thisYear&&(o=new Date(u.getFullYear(),i.getMonth(),i.getDate()),n=q((r(o)-r(u))/a,{floor:!0}),0>n&&(o=new Date(u.getFullYear()+1,i.getMonth(),i.getDate()),n=q((r(o)-r(u))/a,{floor:!0})),t.age&&(n=o.getFullYear()-i.getFullYear())),n)}function ee(e){var t=Z(e);return{year:t.getFullYear(),month:t.getMonth()+1,count:parseInt(t.getDate()/7+1)}}function te(e,t,r,n){var o=e.toString(n||10);return re(r||"0",t-o.length)+o}function re(e,t){return 1>t?"":new Array(t+1).join(e)}function ne(e,t){return 3==t||5==t||8==t||10==t?30:1==t?e%4==0&&e%100!=0||e%400==0?29:28:31}function oe(e,t){if(e)for(;function(){var r=!0;if("undefined"==typeof t)e=e.parentNode?e.parentNode:!1;else if(M(t))r=t(e);else if(S(t))for(var n in t)if("tagname"===n){if(e.tagName.toLocaleLowerCase()!=t[n]){r=!1;break}}else if("clazz"===n||"class_name"===n){if(!("className"in e)){r=!1;break}for(var o=e.className.split(m),i=!1,a=0;aa;a++)e.call(o,r[a])&&u.push(r[a]);return u}}()),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(void 0===this||null===this)throw TypeError();var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw TypeError();var n,o=arguments[1];for(n=0;r>n;n++)n in t&&e.call(o,t[n],n,t)}),Function.prototype.bind||(Function.prototype.bind=function(e){function t(){}if("function"!=typeof this)throw TypeError("function");var r=[].slice,n=r.call(arguments,1),o=this,i=function(){return o.apply(this instanceof t?this:e,n.concat(r.call(arguments)))};return t.prototype=o.prototype,i.prototype=new t,i}),function(){if(!document.querySelectorAll&&!document.querySelector&&document.createStyleSheet){var e=document.createStyleSheet(),t=function(t,r){var n,o=document.all,i=o.length,a=[];for(e.addRule(t,"foo:bar"),n=0;i>n&&!("bar"===o[n].currentStyle.foo&&(a.push(o[n]),a.length>r));n+=1);return e.removeRule(0),a};document.querySelectorAll=function(e){return t(e,1/0)},document.querySelector=function(e){return t(e,1)[0]||null}}}(),String.prototype.trim||!function(){String.prototype.trim=function(){return this.replace(t,"")}}(),window.JSON||(window.JSON={parse:function(e){return new Function("","return "+e)()},stringify:function(){var e,t=/["]/g;return e=function(r){var n,o,i;switch(n=typeof r){case"string":return'"'+r.replace(t,'\\"')+'"';case"number":case"boolean":return r.toString();case"undefined":return"undefined";case"function":return'""';case"object":if(!r)return"null";if(n="",r.splice){for(o=0,i=r.length;i>o;o++)n+=","+e(r[o]);return"["+n.substr(1)+"]"}for(o in r)r.hasOwnProperty(o)&&void 0!==r[o]&&"function"!=typeof r[o]&&(n+=',"'+o+'":'+e(r[o]));return"{"+n.substr(1)+"}"}}}()}),function(e){for(var t,r,n={},o=function(){},i="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=i.pop();)e[t]=e[t]||n;for(;r=a.pop();)e[r]=e[r]||o}(e.console=e.console||{});var r=document.getElementsByTagName("html")[0];document.getElementsByTagName("body")[0];window.innerWidth||(window.innerWidth=r.clientWidth),window.innerHeight||(window.innerHeight=r.clientHeight),window.scrollX||(window.scrollX=window.pageXOffset||r.scrollLeft),window.scrollY||(window.scrollY=window.pageYOffset||r.scrollTop)}.call(this),ax5.ui=function(e){function t(){this.config={},this.name="root",this.setConfig=function(e,t){return jQuery.extend(!0,this.config,e,!0),("undefined"==typeof t||t===!0)&&this.init(),this},this.init=function(){console.log(this.config)},this.bindWindowResize=function(e){setTimeout(function(){jQuery(window).resize(function(){this.bindWindowResize__&&clearTimeout(this.bindWindowResize__),this.bindWindowResize__=setTimeout(function(){e.call(this)}.bind(this),10)}.bind(this))}.bind(this),100)},this.stopEvent=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,!1},this.main=function(){}.apply(this,arguments)}return{root:t}}(ax5); \ No newline at end of file +(function(){"use strict";var e,t,r,n=this,o=window,i=document,a=(document.documentElement,/^(["'](\\.|[^"\\\n\r])*?["']|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/),u=/^-ms-/,l=/[\-_]([\da-z])/gi,s=/([A-Z])/g,f=/\./,c=/[-|+]?[\D]/gi,d=/\D/gi,p=new RegExp("([0-9])([0-9][0-9][0-9][,.])"),g=/&/g,h=/=/,m=/[ ]+/g,y={};y.guid=1,y.getGuid=function(){return y.guid++},y.info=e=function(){function r(e,r){return e={href:o.location.href,param:o.location.search,referrer:i.referrer,pathname:o.location.pathname,hostname:o.location.hostname,port:o.location.port},r=e.href.split(/[\?#]/),e.param=e.param.replace("?",""),e.url=r[0],e.href.search("#")>-1&&(e.hashdata=t.last(r)),r=null,e.baseUrl=t.left(e.href,"?").replace(e.pathname,""),e}function n(t,r,n){return e.errorMsg&&e.errorMsg[t]?{className:t,errorCode:r,methodName:n,msg:e.errorMsg[t][r]}:{className:t,errorCode:r,methodName:n}}var a="0.0.1",u="",l=function(){console.error(t.toArray(arguments).join(":"))},s={BACKSPACE:8,TAB:9,RETURN:13,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34,INSERT:45,SPACE:32},f=[{label:"SUN"},{label:"MON"},{label:"TUE"},{label:"WED"},{label:"THU"},{label:"FRI"},{label:"SAT"}],c=function(e,t,r,n,o,i){return e=navigator.userAgent.toLowerCase(),t=-1!=e.search(/mobile/g),i,-1!=e.search(/iphone/g)?{name:"iphone",version:0,mobile:!0}:-1!=e.search(/ipad/g)?{name:"ipad",version:0,mobile:!0}:-1!=e.search(/android/g)?(n=/(android)[ \/]([\w.]+)/.exec(e)||[],i=n[2]||"0",{name:"android",version:i,mobile:t}):(r="",n=/(opr)[ \/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],o=n[1]||"",i=n[2]||"0","msie"==o&&(o="ie"),{name:o,version:i,mobile:t})}(),d=!("undefined"==typeof window||"undefined"==typeof navigator||!o.document),p=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel",g={ax5dialog:{501:"Duplicate call error"},"single-uploader":{460:"There are no files to be uploaded.",461:"There is no uploaded files."},ax5calendar:{401:"Can not find target element"}};return{errorMsg:g,version:a,baseUrl:u,onerror:l,eventKeys:s,weekNames:f,browser:c,isBrowser:d,wheelEnm:p,urlUtil:r,getError:n}}(),y.util=t=function(){function t(e,t){if(R(e))return[];var r,n=0,o=e.length,i=void 0===o||"function"==typeof e;if(i){for(r in e)if("undefined"!=typeof e[r]&&t.call(e[r],r,e[r])===!1)break}else for(;o>n&&("undefined"==typeof e[n]||t.call(e[n],n,e[n++])!==!1););return e}function b(e,t){if(R(e))return[];var r,n,o=0,i=e.length,a=[];if(S(e)){for(r in e)if("undefined"!=typeof e[r]){if(n=void 0,(n=t.call(e[r],r,e[r]))===!1)break;a.push(n)}}else for(;i>o;)if("undefined"!=typeof e[o]){if(n=void 0,(n=t.call(e[o],o,e[o++]))===!1)break;a.push(n)}return a}function v(e,t){if(R(e))return-1;var r,n=0,o=e.length;if(S(e))for(r in e){if("undefined"!=typeof e[r]&&M(t)&&t.call(e[r],r,e[r]))return r;if(e[r]==t)return r}else for(;o>n;){if("undefined"!=typeof e[n]&&M(t)&&t.call(e[n],n,e[n]))return n;if(e[n]==t)return n;n++}return-1}function w(e,t){var r,o,i;if(A(e)){for(r=0,o=e.length,i=e[r];o-1>r&&("undefined"==typeof e[r]||(i=t.call(n,i,e[++r]))!==!1););return i}if(S(e)){for(r in e)if("undefined"!=typeof e[r]&&(i=t.call(n,i,e[r]))===!1)break;return i}return console.error("argument error : ax5.util.reduce - use Array or Object"),null}function T(e,t){for(var r=e.length-1,o=e[r];r>0&&("undefined"==typeof e[r]||(o=t.call(n,o,e[--r]))!==!1););return o}function x(e,t){if(R(e))return[];var r,n,o=0,i=e.length,a=[];if(S(e))for(r in e)"undefined"!=typeof e[r]&&(n=t.call(e[r],r,e[r]))&&a.push(e[r]);else for(;i>o;)"undefined"!=typeof e[o]&&((n=t.call(e[o],o,e[o]))&&a.push(e[o]),o++);return a}function N(e){var r="";if(y.util.isArray(e)){var n=0,o=e.length;for(r+="[";o>n;n++)n>0&&(r+=","),r+=N(e[n]);r+="]"}else if(y.util.isObject(e)){r+="{";var i=[];t(e,function(e,t){i.push('"'+e+'": '+N(t))}),r+=i.join(", "),r+="}"}else y.util.isString(e)?r='"'+e+'"':y.util.isNumber(e)?r=e:y.util.isUndefined(e)?r="undefined":y.util.isFunction(e)&&(r='"{Function}"');return r}function D(e,t){if(!t&&!a.test(e))return{error:500,msg:"syntax error"};try{return new Function("","return "+e)()}catch(r){return{error:500,msg:"syntax error"}}}function E(e){var t;return null!=e&&e==e.window?t="window":e&&1==e.nodeType?t="element":e&&11==e.nodeType?t="fragment":"undefined"==typeof e?t="undefined":"[object Object]"==se.call(e)?t="object":"[object Array]"==se.call(e)?t="array":"[object String]"==se.call(e)?t="string":"[object Number]"==se.call(e)?t="number":"[object NodeList]"==se.call(e)?t="nodelist":"function"==typeof e&&(t="function"),t}function j(e){return null!=e&&e==e.window}function O(e){return!(!e||1!=e.nodeType&&11!=e.nodeType)}function S(e){return"[object Object]"==se.call(e)}function A(e){return"[object Array]"==se.call(e)}function M(e){return"function"==typeof e}function k(e){return"[object String]"==se.call(e)}function C(e){return"[object Number]"==se.call(e)}function F(e){return"[object NodeList]"==se.call(e)||e&&e[0]&&1==e[0].nodeType}function U(e){return"undefined"==typeof e}function R(e){return"undefined"==typeof e||null===e||""===e}function P(e){return e instanceof Date&&!isNaN(e.valueOf())}function Y(e){var t=!1;if(e instanceof Date&&!isNaN(e.valueOf()))t=!0;else if(e=e.replace(/\D/g,""),e.length>7){var r=e.substr(4,2),n=e.substr(6,2);e=ee(e),e.getMonth()==r-1&&e.getDate()==n&&(t=!0)}return t}function $(e){if(S(e)){var t=Object.keys(e),r={};return r[t[0]]=e[t[0]],r}return A(e)?e[0]:void console.error("ax5.util.object.first","argument type error")}function z(e){if(S(e)){var t=Object.keys(e),r={};return r[t[t.length-1]]=e[t[t.length-1]],r}return A(e)?e[e.length-1]:void console.error("ax5.util.object.last","argument type error")}function B(e,t,r,n){var o;return"number"==typeof r&&(o=new Date,o.setDate(o.getDate()+r)),n=n||{},i.cookie=[escape(e),"=",escape(t),o?"; expires="+o.toUTCString():"",n.path?"; path="+n.path:"",n.domain?"; domain="+n.domain:"",n.secure?"; secure":""].join("")}function H(e){for(var t=e+"=",r=i.cookie.split(";"),n=0,o=r.length;o>n;n++){for(var a=r[n];" "==a.charAt(0);)a=a.substring(1);if(-1!=a.indexOf(t))return unescape(a.substring(t.length,a.length))}return""}function L(t,n,o){for(var a,u,l=i.head||i.getElementsByTagName("head")[0],s=e.isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,f=t.length,c=[],d={},p=!1,g=r.get("script[src]"),h=(r.get("style[href]"),function(){1>f&&0==c.length&&!p&&(n&&n({}),p=!0)}),m=function(){1>f&&c.length>0&&!p&&(console.error(c),o&&o({type:"loadFail",list:c}),p=!0)},b=0,v=t.length;v>b;b++){for(var w,T,x,N=t[b],D=_(N,"."),E=!1,j=e.baseUrl+N,O="js"===D?"src":"href",S=g.length;S--;)if(g[S].getAttribute(O)===j){E=!0;break}E?(f--,h()):(w="js"===D?r.create("script",{type:"text/javascript",src:j,"data-src":j}):r.create("link",{rel:"stylesheet",type:"text/css",href:j}),T=function(e,t){e&&("load"===e.type||s.test((e.currentTarget||e.srcElement).readyState))&&(d[t]||f--,a&&clearTimeout(a),a=setTimeout(h,1))},x=function(t){f--,c.push({src:e.baseUrl+N,error:t}),u&&clearTimeout(u),u=setTimeout(m,1)},y.xhr({url:j,contentType:"",res:function(e,t){for(var n,o=!1,i=r.get("script[src]"),a=i.length;a--;)if(i[a].getAttribute(O)===j){o=!0;break}o||l.appendChild(w),w.onload=function(e){T(e,j),n&&clearTimeout(n)},n=setTimeout(function(){T({type:"load"},j)},500)},error:function(){x(this)}}))}}function W(e){return o.alert(N(e)),e}function I(e,t){return"undefined"==typeof e||"undefined"==typeof t?"":k(t)?e.indexOf(t)>-1?e.substr(0,e.indexOf(t)):e:C(t)?e.substr(0,t):""}function _(e,t){return"undefined"==typeof e||"undefined"==typeof t?"":(e=""+e,k(t)?e.lastIndexOf(t)>-1?e.substr(e.lastIndexOf(t)+1):e:C(t)?e.substr(e.length-t):"")}function q(e){return e.replace(u,"ms-").replace(l,function(e,t){return t.toUpperCase()})}function G(e){return q(e).replace(s,function(e,t){return"-"+t.toLowerCase()})}function J(e,r){var n,o=(""+e).split(f),i=Number(o[0])<0||"-0"==o[0],a=0;return o[0]=o[0].replace(c,""),o[1]?(o[1]=o[1].replace(d,""),a=Number(o[0]+"."+o[1])||0):a=Number(o[0])||0,n=i?-a:a,t(r,function(e,t){"round"==e&&(n=C(t)?0>t?+(Math.round(n+"e-"+Math.abs(t))+"e+"+Math.abs(t)):+(Math.round(n+"e+"+t)+"e-"+t):Math.round(n)),"floor"==e&&(n=Math.floor(n)),"ceil"==e?n=Math.ceil(n):"money"==e?n=function(e){var t=""+e;if(isNaN(t)||""==t)return"";var r=t.split(".");r[0]+=".";do r[0]=r[0].replace(p,"$1,$2");while(p.test(r[0]));return r.length>1?r.join(""):r[0].split(".")[0]}(n):"abs"==e?n=Math.abs(Number(n)):"byte"==e&&(n=function(e){e=Number(n);var t="KB",r=e/1024;return r/1024>1&&(t="MB",r/=1024),r/1024>1&&(t="GB",r/=1024),J(r,{round:1})+t}(n))}),n}function K(e){return"undefined"!=typeof e.length?Array.prototype.slice.call(e):[]}function X(e,t){var r=t.length,n=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[n++]=t[o];else for(;void 0!==t[o];)e[n++]=t[o++];return e.length=n,e}function Q(e,r){var n;return k(e)&&"undefined"!=typeof r&&"param"==r?e:k(e)&&"undefined"!=typeof r&&"object"==r||k(e)&&"undefined"==typeof r?(n={},t(e.split(g),function(){var e=this.split(h);n[e[0]]=e[1]}),n):(n=[],t(e,function(e,t){n.push(e+"="+escape(t))}),n.join("&"))}function Z(){y.info.onerror.apply(this,arguments)}function V(e,t,r,n,o,i){var a,u;return u=new Date,"undefined"==typeof n&&(n=23),"undefined"==typeof o&&(o=59),a=new Date(Date.UTC(e,t,r||1,n,o,i||0)),0==t&&1==r&&a.getUTCHours()+a.getTimezoneOffset()/60<0?a.setUTCHours(0):a.setUTCHours(a.getUTCHours()+a.getTimezoneOffset()/60),a}function ee(t,r){var n,o,i,a,u,l,s,f,c,d;if(k(t))if(0==t.length)t=new Date;else if(t.length>15)l=t.split(/ /g),c=l[0].split(/\D/g),n=c[0],o=parseFloat(c[1]),i=parseFloat(c[2]),f=l[1]||"09:00",s=f.left(5).split(":"),a=parseFloat(s[0]),u=parseFloat(s[1]),("AM"===f.right(2)||"PM"===f.right(2))&&(a+=12),t=V(n,o-1,i,a,u);else if(14==t.length)d=t.replace(/\D/g,""),t=V(d.substr(0,4),d.substr(4,2)-1,J(d.substr(6,2)),J(d.substr(8,2)),J(d.substr(10,2)),J(d.substr(12,2)));else if(t.length>7)d=t.replace(/\D/g,""),t=V(d.substr(0,4),d.substr(4,2)-1,J(d.substr(6,2)));else if(t.length>4)d=t.replace(/\D/g,""),t=V(d.substr(0,4),d.substr(4,2)-1,1);else{if(t.length>2)return d=t.replace(/\D/g,""),V(d.substr(0,4),d.substr(4,2)-1,1);t=new Date}return"undefined"==typeof r?t:(r.add&&(t=function(e,t){var r,n,o,i,a=864e5;return"undefined"!=typeof t.d?e.setTime(e.getTime()+t.d*a):"undefined"!=typeof t.m?(r=e.getFullYear(),n=e.getMonth(),o=e.getDate(),r+=parseInt(t.m/12),n+=t.m%12,i=ne(r,n),o>i&&(o=i),e=new Date(r,n,o,12)):"undefined"!=typeof t.y?e.setTime(e.getTime()+365*t.y*a):e.setTime(e.getTime()+t.y*a),e}(new Date(t),r.add)),r["return"]?function(){var n,o,i,a,u,l,s,f=r["return"];n=t.getUTCFullYear(),o=oe(t.getMonth()+1,2),i=oe(t.getDate(),2),a=oe(t.getHours(),2),u=oe(t.getMinutes(),2),l=oe(t.getSeconds(),2),s=t.getDay();var c=/[^y]*(yyyy)[^y]*/gi;c.exec(f);var d=RegExp.$1,p=/[^m]*(mm)[^m]*/gi;p.exec(f);var g=RegExp.$1,h=/[^d]*(dd)[^d]*/gi;h.exec(f);var m=RegExp.$1,y=/[^h]*(hh)[^h]*/gi;y.exec(f);var b=RegExp.$1,v=/[^m]*(mi)[^i]*/gi;v.exec(f);var w=RegExp.$1,T=/[^s]*(ss)[^s]*/gi;T.exec(f);var x=RegExp.$1,N=/[^d]*(dw)[^w]*/gi;N.exec(f);var D=RegExp.$1;return"yyyy"===d&&(f=f.replace(d,_(n,d.length))),"mm"===g&&(1==g.length&&(o=t.getMonth()+1),f=f.replace(g,o)),"dd"===m&&(1==m.length&&(i=t.getDate()),f=f.replace(m,i)),"hh"===b&&(f=f.replace(b,a)),"mi"===w&&(f=f.replace(w,u)),"ss"===x&&(f=f.replace(x,l)),"dw"==D&&(f=f.replace(D,e.weekNames[s].label)),f}():t)}function te(e,t){function r(e){return Math.floor(e.getTime()/a)*a}var n,o,i=ee(e),a=864e5,u=new Date;return"undefined"==typeof t?n=J((r(i)-r(u))/a,{floor:!0}):(n=J((r(i)-r(u))/a,{floor:!0}),t.today&&(u=ee(t.today),n=J((r(i)-r(u))/a,{floor:!0})),t.thisYear&&(o=new Date(u.getFullYear(),i.getMonth(),i.getDate()),n=J((r(o)-r(u))/a,{floor:!0}),0>n&&(o=new Date(u.getFullYear()+1,i.getMonth(),i.getDate()),n=J((r(o)-r(u))/a,{floor:!0}))),t.age&&(o=new Date(u.getFullYear(),i.getMonth(),i.getDate()),n=o.getFullYear()-i.getFullYear()),n)}function re(e){var t=ee(e);return{year:t.getFullYear(),month:t.getMonth()+1,count:parseInt(t.getDate()/7+1)}}function ne(e,t){return 3==t||5==t||8==t||10==t?30:1==t?e%4==0&&e%100!=0||e%400==0?29:28:31}function oe(e,t,r,n){var o=e.toString(n||10);return ie(r||"0",t-o.length)+o}function ie(e,t){return 1>t?"":new Array(t+1).join(e)}function ae(e,t){if(e)for(;function(){var r=!0;if("undefined"==typeof t)e=e.parentNode?e.parentNode:!1;else if(M(t))r=t(e);else if(S(t))for(var n in t)if("tagname"===n){if(e.tagName.toLocaleLowerCase()!=t[n]){r=!1;break}}else if("clazz"===n||"class_name"===n){if(!("className"in e)){r=!1;break}for(var o=e.className.split(m),i=!1,a=0;aa;a++)e.call(o,r[a])&&u.push(r[a]);return u}}()),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(void 0===this||null===this)throw TypeError();var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw TypeError();var n,o=arguments[1];for(n=0;r>n;n++)n in t&&e.call(o,t[n],n,t)}),Function.prototype.bind||(Function.prototype.bind=function(e){function t(){}if("function"!=typeof this)throw TypeError("function");var r=[].slice,n=r.call(arguments,1),o=this,i=function(){return o.apply(this instanceof t?this:e,n.concat(r.call(arguments)))};return t.prototype=o.prototype,i.prototype=new t,i}),function(){if(!document.querySelectorAll&&!document.querySelector&&document.createStyleSheet){var e=document.createStyleSheet(),t=function(t,r){var n,o=document.all,i=o.length,a=[];for(e.addRule(t,"foo:bar"),n=0;i>n&&!("bar"===o[n].currentStyle.foo&&(a.push(o[n]),a.length>r));n+=1);return e.removeRule(0),a};document.querySelectorAll=function(e){return t(e,1/0)},document.querySelector=function(e){return t(e,1)[0]||null}}}(),String.prototype.trim||!function(){String.prototype.trim=function(){return this.replace(t,"")}}(),window.JSON||(window.JSON={parse:function(e){return new Function("","return "+e)()},stringify:function(){var e,t=/["]/g;return e=function(r){var n,o,i;switch(n=typeof r){case"string":return'"'+r.replace(t,'\\"')+'"';case"number":case"boolean":return r.toString();case"undefined":return"undefined";case"function":return'""';case"object":if(!r)return"null";if(n="",r.splice){for(o=0,i=r.length;i>o;o++)n+=","+e(r[o]);return"["+n.substr(1)+"]"}for(o in r)r.hasOwnProperty(o)&&void 0!==r[o]&&"function"!=typeof r[o]&&(n+=',"'+o+'":'+e(r[o]));return"{"+n.substr(1)+"}"}}}()}),function(e){for(var t,r,n={},o=function(){},i="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=i.pop();)e[t]=e[t]||n;for(;r=a.pop();)e[r]=e[r]||o}(e.console=e.console||{});var r=document.getElementsByTagName("html")[0];document.getElementsByTagName("body")[0];window.innerWidth||(window.innerWidth=r.clientWidth),window.innerHeight||(window.innerHeight=r.clientHeight),window.scrollX||(window.scrollX=window.pageXOffset||r.scrollLeft),window.scrollY||(window.scrollY=window.pageYOffset||r.scrollTop)}.call(this),ax5.ui=function(e){function t(){this.config={},this.name="root",this.setConfig=function(e,t){return jQuery.extend(!0,this.config,e,!0),("undefined"==typeof t||t===!0)&&this.init(),this},this.init=function(){console.log(this.config)},this.bindWindowResize=function(e){setTimeout(function(){jQuery(window).resize(function(){this.bindWindowResize__&&clearTimeout(this.bindWindowResize__),this.bindWindowResize__=setTimeout(function(){e.call(this)}.bind(this),10)}.bind(this))}.bind(this),100)},this.stopEvent=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,!1},this.main=function(){}.apply(this,arguments)}return{root:t}}(ax5); \ No newline at end of file diff --git a/package.json b/package.json index a2f0017..f9212c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ax5core", - "version": "0.7.3", + "version": "0.7.4", "description": "`ax5core` is a collection of utility functions that have been designed for use in ax5ui", "license": "MIT", "repository": { diff --git a/src/ax5-core.js b/src/ax5-core.js index a4303d3..115d319 100755 --- a/src/ax5-core.js +++ b/src/ax5-core.js @@ -755,6 +755,33 @@ return (typeof O === "undefined" || O === null || O === ""); } + function isDate(O) { + return (O instanceof Date && !isNaN(O.valueOf())); + } + + function isDateFormat(O) { + var + result = false + ; + if (O instanceof Date && !isNaN(O.valueOf())) { + result = true; + } + else { + O = O.replace(/\D/g, ''); + if (O.length > 7) { + var + mm = O.substr(4, 2), + dd = O.substr(6, 2) + ; + O = date(O); + if (O.getMonth() == (mm - 1) && O.getDate() == dd) { + result = true; + } + } + } + return result; + } + /** * 오브젝트의 첫번째 아이템을 반환합니다. * @method ax5.util.first @@ -1558,7 +1585,6 @@ function times(s, count) { return count < 1 ? '' : new Array(count + 1).join(s); } - /** * 타겟엘리먼트의 부모 엘리멘트 트리에서 원하는 조건의 엘리먼트를 얻습니다. * @method ax5.util.findParentNode @@ -1694,7 +1720,7 @@ var returns; if (isObject(val)) { returns = ''; - for(var k in val){ + for (var k in val) { returns += k + ':' + val[k] + ';'; } return returns; @@ -1702,8 +1728,8 @@ else if (isString(val)) { returns = {}; var valSplited = val.split(/[ ]*;[ ]*/g); - valSplited.forEach(function(v){ - if((v = v.trim()) !== "") { + valSplited.forEach(function (v) { + if ((v = v.trim()) !== "") { var vSplited = v.split(/[ ]*:[ ]*/g); returns[vSplited[0]] = vSplited[1]; } @@ -1755,7 +1781,9 @@ times: times, findParentNode: findParentNode, cssNumber: cssNumber, - css: css + css: css, + isDate: isDate, + isDateFormat: isDateFormat } })(); diff --git a/test/index.html b/test/index.html index bf0b1db..25c0547 100644 --- a/test/index.html +++ b/test/index.html @@ -20,6 +20,10 @@ width: "100px" })); console.log(ax5.util.css('width:100px;padding: 50px; background: #ccc')); + + console.log(ax5.util.isDateFormat('20160101')); + console.log(ax5.util.isDateFormat('2016*01*01')); + console.log(ax5.util.isDateFormat('20161132'));