From: Tim Wood Date: Fri, 3 Feb 2012 19:06:44 +0000 (-0700) Subject: Building for #125 X-Git-Tag: 1.4.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f899eb84eec681f928beb67b27fb118233b05e44;p=thirdparty%2Fmoment.git Building for #125 --- diff --git a/moment.min.js b/moment.min.js index 672581fbf..f0d488979 100755 --- a/moment.min.js +++ b/moment.min.js @@ -1,2 +1,2 @@ /* Moment.js | version : 1.3.0 | author : Tim Wood | license : MIT */ -(function(a,b){function r(a){this._d=a}function s(a,b){var c=a+"";while(c.length11?t.pm:t.am;case"A":return m>11?t.PM:t.AM;case"H":return m;case"HH":return s(m,2);case"h":return m%12||12;case"hh":return s(m%12||12,2);case"m":return n;case"mm":return s(n,2);case"s":return o;case"ss":return s(o,2);case"zz":case"z":return(b.toString().match(l)||[""])[0].replace(k,"");case"Z":return(p>0?"+":"-")+s(~~(Math.abs(p)/60),2)+":"+s(~~(Math.abs(p)%60),2);case"ZZ":return(p>0?"+":"-")+s(~~(10*Math.abs(p)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return w(b,c.longDateFormat[d]);default:return d.replace(/(^\[)|(\\)|\]$/g,"")}}var e=new r(b),f=e.month(),g=e.date(),h=e.year(),i=e.day(),m=e.hours(),n=e.minutes(),o=e.seconds(),p=-e.zone(),q=c.ordinal,t=c.meridiem;return d.replace(j,u)}function x(b,d){function p(a,b){var d;switch(a){case"M":case"MM":e[1]=~~b-1;break;case"MMM":case"MMMM":for(d=0;d<12;d++)if(c.monthsParse[d].test(b)){e[1]=d;break}break;case"D":case"DD":case"DDD":case"DDDD":e[2]=~~b;break;case"YY":b=~~b,e[0]=b+(b>70?1900:2e3);break;case"YYYY":e[0]=~~Math.abs(b);break;case"a":case"A":l=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"Z":case"ZZ":h=!0,d=(b||"").match(o),d&&d[1]&&(f=~~d[1]),d&&d[2]&&(g=~~d[2]),d&&d[0]==="+"&&(f=-f,g=-g)}}var e=[0,0,1,0,0,0,0],f=0,g=0,h=!1,i=b.match(n),j=d.match(m),k,l;for(k=0;k11?t.pm:t.am;case"A":return m>11?t.PM:t.AM;case"H":return m;case"HH":return s(m,2);case"h":return m%12||12;case"hh":return s(m%12||12,2);case"m":return n;case"mm":return s(n,2);case"s":return o;case"ss":return s(o,2);case"zz":case"z":return(b.toString().match(l)||[""])[0].replace(k,"");case"Z":return(p>0?"+":"-")+s(~~(Math.abs(p)/60),2)+":"+s(~~(Math.abs(p)%60),2);case"ZZ":return(p>0?"+":"-")+s(~~(10*Math.abs(p)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return w(b,c.longDateFormat[d]);default:return d.replace(/(^\[)|(\\)|\]$/g,"")}}var e=new r(b),f=e.month(),g=e.date(),h=e.year(),i=e.day(),m=e.hours(),n=e.minutes(),o=e.seconds(),p=-e.zone(),q=c.ordinal,t=c.meridiem;return d.replace(j,u)}function x(b,d){function p(a,b){var d;switch(a){case"M":case"MM":e[1]=~~b-1;break;case"MMM":case"MMMM":for(d=0;d<12;d++)if(c.monthsParse[d].test(b)){e[1]=d;break}break;case"D":case"DD":case"DDD":case"DDDD":e[2]=~~b;break;case"YY":b=~~b,e[0]=b+(b>70?1900:2e3);break;case"YYYY":e[0]=~~Math.abs(b);break;case"a":case"A":l=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"Z":case"ZZ":h=!0,d=(b||"").match(o),d&&d[1]&&(f=~~d[1]),d&&d[2]&&(g=~~d[2]),d&&d[0]==="+"&&(f=-f,g=-g)}}var e=[0,0,1,0,0,0,0],f=0,g=0,h=!1,i=b.match(n),j=d.match(m),k,l;for(k=0;kMoment.js Documentation

Moment.js Documentation

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Where to get it

Github

Production Version 1.3.03.3kb minified & gzippedDevelopment Version 1.3.022.5kb full source + comments

You can also clone the project with Git by running:

git clone git://github.com/timrwood/moment

npm

npm install moment

Where to use it

Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.

In NodeJS

var moment = require('moment');
+Moment.js Documentation

Moment.js Documentation

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Where to get it

Github

Production Version 1.3.03.3kb minified & gzippedDevelopment Version 1.3.022.6kb full source + comments

You can also clone the project with Git by running:

git clone git://github.com/timrwood/moment

npm

npm install moment

Where to use it

Moment was designed to work in both the browser and in NodeJS. All code will work in both environments. All unit tests are run in both environments.

In NodeJS

var moment = require('moment');
 moment().add('hours', 1).fromNow(); // "1 hour ago"
 

In the browser

<script src="moment.min.js"></script>
 moment().add('hours', 1).fromNow(); // "1 hour ago"
@@ -124,7 +124,7 @@ a.diff(b, 'years', true) // 1.5
 

Native Javascript Date

To get the native Date object that Moment.js wraps, use moment.fn.toDate.

moment([2007, 0, 29]).toDate(); // returns native Date object

Note: moment.fn.native has been replaced by moment.fn.toDate and will be depreciated in the future. -

Value

moment.fn.valueOfsimply outputs the unix timestamp. +

Value

moment.fn.valueOf simply outputs the unix timestamp.

moment(1318874398806).valueOf(); // 1318874398806

Milliseconds

These are the getters mentioned in the Manipulationsection above.

These map to the corresponding function on the native Dateobject.

moment().milliseconds() === new Date().getMilliseconds();
moment().milliseconds(); // get the milliseconds (0 - 999)

Seconds

moment().minutes(); // get the seconds (0 - 59)

Minutes

moment().minutes(); // get the minutes (0 - 59)

Hours

moment().hours(); // get the hours (0 - 23)

Date

moment().date(); // get the date of the month (1 - 31)

Day

moment().day(); // get the day of the week (0 - 6)

Month

moment().month(); // get the month (0 - 11)

Year

moment().year(); // get the four digit year

Leap Year

moment.fn.isLeapYearreturns true if that year is a leap year, and false if it is not. diff --git a/site/index.html b/site/index.html index 4005fe55b..81c431b00 100644 --- a/site/index.html +++ b/site/index.html @@ -1,4 +1,4 @@ -Moment.js - A lightweight javascript date library

Moment.js

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Use it

var now = moment();
+Moment.js - A lightweight javascript date library

Moment.js

A lightweight javascript date library for parsing, manipulating, and formatting dates.

Use it

var now = moment();
 console.log(now.format('dddd, MMMM Do YYYY, h:mm:ss a'));
 
var halloween = moment([2011, 9, 31]); // October 31st
 console.log(halloween.fromNow());
diff --git a/site/js/home.min.js b/site/js/home.min.js
index 274319d85..7cc62ec73 100644
--- a/site/js/home.min.js
+++ b/site/js/home.min.js
@@ -1 +1 @@
-function snippetPopup(a){top.consoleRef=window.open("","myconsole","width=600,height=300,left=50,top=50,menubar=0,toolbar=0,location=0,status=0,scrollbars=1,resizable=1"),top.consoleRef.document.writeln("Snippet :: Code View :: "+location.href+""+''+"
"+a+"
"+""),top.consoleRef.document.close()}function sh_isEmailAddress(a){return/^mailto:/.test(a)?!1:a.indexOf("@")!==-1}function sh_setHref(a,b,c){var d=c.substring(a[b-2].pos,a[b-1].pos);d.length>=2&&d.charAt(0)==="<"&&d.charAt(d.length-1)===">"&&(d=d.substr(1,d.length-2)),sh_isEmailAddress(d)&&(d="mailto:"+d),a[b-2].node.href=d}function sh_konquerorExec(a){var b=[""];return b.index=a.length,b.input=a,b}function sh_highlightString(a,b){if(/Konqueror/.test(navigator.userAgent)&&!b.konquered){for(var c=0;cv&&m(t.substring(v,B.index),null);var G=y[C],H=G[1],I;if(H instanceof Array)for(var J=0;J0){var d=c.split(" ");for(var e=0;e0&&b.push(d[e])}return b}function sh_addClass(a,b){var c=sh_getClasses(a);for(var d=0;d element with class="'+g+'", but no such language exists');continue}break}}}(function(a,b){function r(a){this._d=a}function s(a,b){var c=a+"";while(c.length11?t.pm:t.am;case"A":return m>11?t.PM:t.AM;case"H":return m;case"HH":return s(m,2);case"h":return m%12||12;case"hh":return s(m%12||12,2);case"m":return n;case"mm":return s(n,2);case"s":return o;case"ss":return s(o,2);case"zz":case"z":return(b.toString().match(l)||[""])[0].replace(k,"");case"Z":return(p>0?"+":"-")+s(~~(Math.abs(p)/60),2)+":"+s(~~(Math.abs(p)%60),2);case"ZZ":return(p>0?"+":"-")+s(~~(10*Math.abs(p)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return w(b,c.longDateFormat[d]);default:return d.replace(/(^\[)|(\\)|\]$/g,"")}}var e=new r(b),f=e.month(),g=e.date(),h=e.year(),i=e.day(),m=e.hours(),n=e.minutes(),o=e.seconds(),p=-e.zone(),q=c.ordinal,t=c.meridiem;return d.replace(j,u)}function x(b,d){function p(a,b){var d;switch(a){case"M":case"MM":e[1]=~~b-1;break;case"MMM":case"MMMM":for(d=0;d<12;d++)if(c.monthsParse[d].test(b)){e[1]=d;break}break;case"D":case"DD":case"DDD":case"DDDD":e[2]=~~b;break;case"YY":b=~~b,e[0]=b+(b>70?1900:2e3);break;case"YYYY":e[0]=~~Math.abs(b);break;case"a":case"A":l=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"Z":case"ZZ":h=!0,d=(b||"").match(o),d&&d[1]&&(f=~~d[1]),d&&d[2]&&(g=~~d[2]),d&&d[0]==="+"&&(f=-f,g=-g)}}var e=[0,0,1,0,0,0,0],f=0,g=0,h=!1,i=b.match(n),j=d.match(m),k,l;for(k=0;k' elements are currently unsupported.";return console.log(l),!1}if(g.data("orgHtml")==undefined||g.data("orgHtml")==null){var i=g.html();g.data("orgHtml",i)}if(!g.parent().hasClass("snippet-wrap")){if(typeof b!="string"){if(g.attr("class").length>0)var j=' class="'+g.attr("class")+'"';else var j="";if(g.attr("id").length>0)var k=' id="'+g.attr("id")+'"';else var k="";var l="Snippet Error: You must specify a language on inital usage of Snippet. Reference ";return console.log(l),!1}g.addClass("sh_"+b).addClass("snippet-formatted").wrap("
"),g.removeAttr("style"),sh_highlightDocument();if(d.showNum){var m=g.html();m=m.replace(/\n/g,"
  • "),m="
    1. "+m+"
    ";while(m.indexOf("
  • ")!=-1)m=m.replace("
  • ","")}else{var m=g.html();m=m.replace(/\n/g,"
  • "),m="
    • "+m+"
    ";while(m.indexOf("
  • ")!=-1)m=m.replace("
  • ","")}m=m.replace(/\t/g,"    "),g.html(m);while(g.find("li").eq(0).html()=="")g.find("li").eq(0).remove();g.find("li").each(function(){if(a(this).html().length<2){var b=a(this).html().replace(/\s/g,"");b==""&&(a.browser.opera?a(this).html(" "):a(this).html(" "))}});var n="",o="";g.parent().append(n),g.parent().prepend(o),g.parent().hover(function(){a(this).find(".snippet-menu").fadeIn("fast")},function(){a(this).find(".snippet-menu").fadeOut("fast")});if(d.clipboard!=""&&d.clipboard!=0){var p=g.parent().find("a.snippet-copy");p.show(),p.parents(".snippet-menu").show();var q=g.parents(".snippet-wrap").find(".snippet-textonly").text();ZeroClipboard.setMoviePath(d.clipboard);var r=new ZeroClipboard.Client;r.setText(q),r.glue(p[0],p.parents(".snippet-menu")[0]),r.addEventListener("complete",function(a,b){b.length>500&&(b=b.substr(0,500)+"...\n\n("+(b.length-500)+" characters not shown)"),alert("Copied text to clipboard:\n\n "+b)}),p.parents(".snippet-menu").hide()}else g.parent().find("a.snippet-copy").hide();g.parent().find("a.snippet-text").click(function(){var b=a(this).parents(".snippet-wrap").find(".snippet-formatted"),c=a(this).parents(".snippet-wrap").find(".snippet-textonly");return b.toggle(),c.toggle(),c.is(":visible")?a(this).html("html"):a(this).html("text"),a(this).blur(),!1}),g.parent().find("a.snippet-window").click(function(){var b=a(this).parents(".snippet-wrap").find(".snippet-textonly").html();return snippetPopup(b),a(this).blur(),!1}),d.menu||g.prev(".snippet-menu").find("pre,.snippet-clipboard").hide();if(d.collapse){var s=g.parent().attr("class"),t="",u="";g.parents(".snippet-container").append(t),g.parent().append(u);var v=g.parents(".snippet-container");d.startCollapsed?(v.find(".snippet-reveal").show(),v.find(".snippet-wrap").eq(0).hide()):(v.find(".snippet-reveal").hide(),v.find(".snippet-wrap").eq(0).show()),v.find("a.snippet-toggle").click(function(){return v.find(".snippet-wrap").toggle(),!1})}if(d.transparent){var w={"background-color":"transparent","box-shadow":"none","-moz-box-shadow":"none","-webkit-box-shadow":"none"};g.css(w),g.next(".snippet-textonly").css(w),g.parents(".snippet-container").find(".snippet-reveal pre").css(w)}d.startText&&(g.hide(),g.next(".snippet-textonly").show(),g.parent().find(".snippet-text").html("html"));if(d.box!=""){var x=" ",y=d.box.split(",");for(var z=0;z");var F=g.find("li").eq(0);F.unwrap()}}else{var E=g.find("li").eq(0).parent();if(E.hasClass("snippet-num")){E.wrap("
      ");var F=g.find("li").eq(0);F.unwrap()}}if(d.box!=""){var x=" ",y=d.box.split(",");for(var z=0;z-1&&(b.splice(c,1),this.className=b.join(" ")),this},a.hasClass=function(a){return!!this.className.match(new RegExp("\\s*"+a+"\\s*"))}),a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){var d=this.clients[a];d&&d.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a,b){var c={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};while(a&&a!=b)c.left+=a.offsetLeft,c.top+=a.offsetTop,a=a.offsetParent;return c},Client:function(a){this.handlers={},this.id=ZeroClipboard.nextId++,this.movieId="ZeroClipboardMovie_"+this.id,ZeroClipboard.register(this.id,this),a&&this.glue(a)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(a,b,c){this.domElement=ZeroClipboard.$(a);var d=99;this.domElement.style.zIndex&&(d=parseInt(this.domElement.style.zIndex,10)+1),typeof b=="string"?b=ZeroClipboard.$(b):typeof b=="undefined"&&(b=document.getElementsByTagName("body")[0]);var e=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div"),this.div.className="snippet-clipboard";var f=this.div.style;f.position="absolute",f.left=""+e.left+"px",f.top=""+e.top+"px",f.width=""+e.width+"px",f.height=""+e.height+"px",f.zIndex=d;if(typeof c=="object")for(addedStyle in c)f[addedStyle]=c[addedStyle];b.appendChild(this.div),this.div.innerHTML=this.getHTML(e.width,e.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+=''}else c+='';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null,this.div=null}},reposition:function(a){a&&(this.domElement=ZeroClipboard.$(a),this.domElement||this.hide());if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement),c=this.div.style;c.left=""+b.left+"px",c.top=""+b.top+"px"}},setText:function(a){this.clipText=a,this.ready&&this.movie.setText(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,""),this.handlers[a]||(this.handlers[a]=[]),this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a,this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100),this.ready=!0;return}this.ready=!0;try{this.movie.setText(this.clipText)}catch(d){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(d){}break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var e=0,f=this.handlers[a].length;e|\|/g,"sh_symbol",-1],[/\{|\}/g,"sh_cbracket",-1],[/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,"sh_function",-1],[/([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,["sh_usertype","sh_usertype","sh_normal"],-1]],[[/$/g,null,-2],[/(?:?)|(?:?)/g,"sh_url",-1],[/<\?xml/g,"sh_preproc",2,1],[//g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,"sh_keyword",6,1],[/&(?:[A-Za-z0-9]+);/g,"sh_preproc",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,"sh_keyword",6,1],[/@[A-Za-z]+/g,"sh_type",-1],[/(?:TODO|FIXME|BUG)(?:[:]?)/g,"sh_todo",-1]],[[/\?>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/\\(?:\\|")/g,null,-1],[/"/g,"sh_string",-2]],[[/>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/-->/g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[//g,"sh_comment",-2],[/