You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4 lines
14 KiB
4 lines
14 KiB
11 years ago
|
/*! globalize - v0.1.0pre - 2012-10-18
|
||
|
* http://wiki.jqueryui.com/Globalize
|
||
|
* Copyright 2012 ; Licensed MIT */
|
||
|
(function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N;n=function(e){return new n.prototype.init(e)},typeof require!="undefined"&&typeof exports!="undefined"&&typeof module!="undefined"?module.exports=n:e.Globalize=n,n.cultures={},n.prototype={constructor:n,init:function(e){return this.cultures=n.cultures,this.cultureSelector=e,this}},n.prototype.init.prototype=n.prototype,n.cultures["default"]={name:"en",englishName:"English",nativeName:"English",isRTL:!1,language:"en",numberFormat:{pattern:["-n"],decimals:2,",":",",".":".",groupSizes:[3],"+":"+","-":"-",NaN:"NaN",negativeInfinity:"-Infinity",positiveInfinity:"Infinity",percent:{pattern:["-n %","n %"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"%"},currency:{pattern:["($n)","$n"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"$"}},calendars:{standard:{name:"Gregorian_USEnglish","/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss"}}},messages:{}},n.cultures["default"].calendar=n.cultures["default"].calendars.standard,n.cultures.en=n.cultures["default"],n.cultureSelector="en",r=/^0x[a-f0-9]+$/i,i=/^[+\-]?infinity$/i,s=/^[+\-]?\d*\.?\d*(e[+\-]?\d+)?$/,o=/^\s+|\s+$/g,u=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},a=function(e,t){return e.substr(e.length-t.length)===t},f=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,p=arguments.length,d=!1;typeof u=="boolean"&&(d=u,u=arguments[1]||{},a=2),typeof u!="object"&&!c(u)&&(u={});for(;a<p;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;d&&i&&(h(i)||(s=l(i)))?(s?(s=!1,o=r&&l(r)?r:[]):o=r&&h(r)?r:{},u[n]=f(d,o,i)):i!==t&&(u[n]=i)}return u},l=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},c=function(e){return Object.prototype.toString.call(e)==="[object Function]"},h=function(e){return Object.prototype.toString.call(e)==="[object Object]"},p=function(e,t){return e.indexOf(t)===0},d=function(e){return(e+"").replace(o,"")},v=function(e){return isNaN(e)?NaN:Math[e<0?"ceil":"floor"](e)},m=function(e,t,n){var r;for(r=e.length;r<t;r+=1)e=n?"0"+e:e+"0";return e},g=function(e,t){var n=0,r=!1;for(var i=0,s=e.length;i<s;i++){var o=e.charAt(i);switch(o){case"'":r?t.push("'"):n++,r=!1;break;case"\\":r&&t.push("\\"),r=!r;break;default:t.push(o),r=!1}}return n},y=function(e,t){t=t||"F";var n,r=e.patterns,i=t.length;if(i===1){n=r[t];if(!n)throw"Invalid date format string '"+t+"'.";t=n}else i===2&&t.charAt(0)==="%"&&(t=t.charAt(1));return t},b=function(e,t,n){function T(e,t){var n,r=e+"";return t>1&&r.length<t?(n=c[t-2]+r,n.substr(n.length-t,t)):(n=r,n)}function N(){return h||p?h:(h=d.test(t),p=!0,h)}function C(e,t){if(w)return w[t];switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate();default:throw"Invalid part value "+t}}var r=n.calendar,i=r.convert,s;if(!t||!t.length||t==="i"){if(n&&n.name.length)if(i)s=b(e,r.patterns.F,n);else{var o=new Date(e.getTime()),u=S(e,r.eras);o.setFullYear(x(e,r,u)),s=o.toLocaleString()}else s=e.toString();return s}var a=r.eras,f=t==="s";t=y(r,t),s=[];var l,c=["0","00","000"],h,p,d=/([^d]|^)(d|dd)([^d]|$)/g,v=0,m=E(),w;!f&&i&&(w=i.fromGregorian(e));for(;;){var k=m.lastIndex,L=m.exec(t),A=t.slice(k,L?L.index:t.length);v+=g(A,s);if(!L)break;if(v%2){s.push(L[0]);continue}var O=L[0],M=O.length;switch(O){case"ddd":case"dddd":var _=M===3?r.days.namesAbbr:r.days.names
|