From: Tim Wood Date: Tue, 1 Nov 2011 00:59:30 +0000 (-0700) Subject: Rebuilding site homepage. X-Git-Tag: 1.1.1~18^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ed3ecf88bec9075d00fe35e2930d3b1ef04782b;p=thirdparty%2Fmoment.git Rebuilding site homepage. Creating build process for actual site. --- diff --git a/build.js b/build.js index 0da5def82..a7084f6db 100755 --- a/build.js +++ b/build.js @@ -1,7 +1,8 @@ var fs = require('fs'), uglify = require('uglify-js'), jshint = require('jshint'), - gzip = require('gzip'); + gzip = require('gzip'), + jade = require('jade'); /********************************************* @@ -41,6 +42,8 @@ var LANG_TEST = "en fr it pt".split(" "); var LANG_PREFIX = "var moment;if (typeof window === 'undefined') {moment = require('../moment.js');module = QUnit.module;}"; var VERSION = '1.1.0'; var MINIFY_COMMENT = '/* Moment.js | version : ' + VERSION + ' | author : Tim Wood | license : MIT */\n'; +var MINSIZE = 0; +var SRCSIZE = 0; /********************************************* @@ -72,7 +75,7 @@ function makeFile(filename, contents) { * @param {String} source The source JS * @param {String} dest The file destination */ -function minifyToFile(source, dest, prefix) { +function minifyToFile(source, dest, prefix, callback) { var ast, ugly; ast = uglify.parser.parse(source); @@ -81,6 +84,10 @@ function minifyToFile(source, dest, prefix) { ugly = uglify.uglify.gen_code(ast); makeFile('./' + dest + '.min.js', (prefix || '') + ugly); + + if (callback) { + callback((prefix || '') + ugly); + } } @@ -144,9 +151,9 @@ function hint(source, name) { (function(){ var source = LANG_PREFIX; for (i = 0; i < LANG_TEST.length; i++) { - source += fs.readFileSync('./test/lang/' + LANG_TEST[i] + '.js', 'utf8'); + source += fs.readFileSync('./site/test/lang/' + LANG_TEST[i] + '.js', 'utf8'); } - makeFile('./test/lang.js', source); + makeFile('./site/test/lang.js', source); })(); @@ -158,21 +165,68 @@ function hint(source, name) { (function(){ var source = fs.readFileSync('./moment.js', 'utf8'); if (hint(source, 'moment')) { - minifyToFile(source, 'moment', MINIFY_COMMENT); + minifyToFile(source, 'moment', MINIFY_COMMENT, function(src){ + gzip(src, function(err, data) { + MINSIZE = data.length; + makeDocs(); + }); + }); } gzip(source, function(err, data) { + SRCSIZE = source.length; + makeDocs(); console.log('size : ./moment.js ' + source.length + ' b (' + data.length + ' b)'); }); })(); /********************************************* - Docs + JS *********************************************/ (function(){ - var snippet = fs.readFileSync('./docs/snippet.js', 'utf8'); - var docs = fs.readFileSync('./docs/docs.js', 'utf8'); - minifyToFile(snippet + docs, 'docs/docs'); -})(); \ No newline at end of file + var snippet = fs.readFileSync('./sitesrc/js/snippet.js', 'utf8'); + var docs = fs.readFileSync('./sitesrc/js/docs.js', 'utf8'); + minifyToFile(snippet + docs, 'site/js/docs'); +})(); + +(function(){ + var moment = fs.readFileSync('./moment.js', 'utf8'); + var fr = fs.readFileSync('./lang/fr.js', 'utf8'); + var snippet = fs.readFileSync('./sitesrc/js/snippet.js', 'utf8'); + var home = fs.readFileSync('./sitesrc/js/home.js', 'utf8'); + minifyToFile(moment + fr + snippet + home, 'site/js/home'); +})(); + + +/********************************************* + Jade +*********************************************/ + + +function toKb(input){ + var num = Math.round(input / 100) / 10; + return num + 'kb'; +} + +function jadeToHtml(jadePath, htmlPath) { + var args = { + version : VERSION, + minsize : toKb(MINSIZE), + srcsize : toKb(SRCSIZE) + }; + var snippet = fs.readFile(jadePath, 'utf8', function(err, data){ + var compile = jade.compile(data, { + filename : 'sitesrc/html.jade' + }); + makeFile(htmlPath, compile(args)); + }); +} + +function makeDocs(minsize, srcsize) { + if (SRCSIZE === 0 || MINSIZE === 0) { + return; + } + jadeToHtml('./sitesrc/index.jade', './site/index.html'); +} \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 06f4a812a..000000000 --- a/index.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - Moment.js - - - - - Fork me on Github - -
-

- underscore.date - by timrwood -

-

Parsing + Manipulation + Formatting + Timeago + I18n + NodeJS

-

And all without modifying the native Date prototype, so it's safe for kids!

-
 
-
-

What is this?

-

Underscore.date is a javascript date library that helps parse, manipulate, and format dates.

-

It doesn't modify the native `Date` prototype, so it's safe to drop into any site.

-

While not dependant on underscore, it does follow - the same philosophy, and if underscore exists on your page, underscore.date will mix itself in.

-
-
-

Download : 2.02 kb (min + gzip)

-

You can download this project in either - zip or - tar formats. -

-

You can also clone the project with Git by running: -

$ git clone git://github.com/timrwood/underscore.date
-

-
-
-
 
-

Works in the browser and in Node.js!

- -

Node.js

- -
npm install underscore.date
- -
var _date = require('underscore.date');
-console.log(_date('September 9 1999').fromNow());
- -

In the browser

- -

If underscore exists, underscore.date will mix itself into the underscore namespace, so you can use as you would use an underscore function.

- -
_.date('September 9 1999').fromNow();
- -

Otherwise, you should use _date.

- -
_date('September 9 1999').fromNow();
- - - -

Examples

- -

Format a Unix timestamp

- -
_date(1300291340510).format("MMMM Do, YYYY") // >>> "March 16th, 2011" 
- -

Get timeago for a date string

- -
_date("7-10-1986", "MM-DD-YYYY").fromNow() // >>> "25 years ago" 
- -

Get the current time and add 3 hours

- -
_date().add({h:3}).fromNow() // >>> "in 3 hours" 
- -

Change the language

- -
_date(1300291340510).format("MMMM Do, YYYY") // >>> "March 16th, 2011"
-_date.lang('pt');
-_date(1300291340510).format("MMMM Do, YYYY") // >>> "Março 16o, 2011"
-_date.lang('en');
-_date(1300291340510).format("MMMM Do, YYYY") // >>> "March 16th, 2011"
- - -

Tests

-

underscore.date unit tests

- -

underscore.date performance tests

- -

Full source code and documentation at http://github.com/timrwood/underscore.date

- -
- - - - diff --git a/site/style.css b/site/css/style.css similarity index 51% rename from site/style.css rename to site/css/style.css index 00b9777e9..7afba3b09 100755 --- a/site/style.css +++ b/site/css/style.css @@ -50,11 +50,11 @@ input, select { vertical-align: middle; } */ -html { background:#AFBAC4 url(bg.png); text-align:center; color:#445; } +html { background:#eee; text-align:center; color:#333; } a { color:#09489A; } -h1, h2, h3, h4, h5, h6, th { font-family:Oswald, sans-serif; line-height:1.5em; margin-bottom:10px; text-shadow:1px 1px 0 #fff; } +h1, h2, h3, h4, h5, h6, th { font-family:Oswald, sans-serif; line-height:1.5em; } h1 { font-size:36px; padding-top:20px; } h2 { font-size:24px; padding-top:10px; } @@ -63,8 +63,6 @@ h4 { font-size:16px; } h5 { font-size:14px; } h6 { font-size:14px; } -h1 a { color:#445; } - body, p { font-size:14px; line-height:1.5em; font-family:"Helvetica", "Arial", sans-serif; } p { margin-bottom:20px; } @@ -90,11 +88,63 @@ b, strong { font-weight:bold; } .logo { text-align:center; border-bottom:#313749 10px solid; margin:0 -41px; } .fork-me { position:absolute; top:0; right:0; text-indent:-9999px; width:149px; height:149px; display:block; background:url(fork.png); } -/** - * layout - */ +/**************** + Nav +****************/ + + +#navwrap { + background-color: #333; + background-image: -webkit-gradient(linear, left top, left bottom, from(#333), to(#000)); + background-image: -webkit-linear-gradient(top, #333, #000); + background-image: -moz-linear-gradient(top, #333, #000); + background-image: -ms-linear-gradient(top, #333, #000); + background-image: -o-linear-gradient(top, #333, #000); + background-image: linear-gradient(top, #333, #000); + filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#333', EndColorStr='#000'); + height:60px; + border-bottom:1px solid #fff; +} +#navwrap h1 { float:left; line-height:60px; padding:0; color:#fff; margin-right:100px; padding-left:37px; background:url(../img/clock.png) 0 15px no-repeat; } +#nav { height:60px; width:960px; margin:0 auto; text-align:left; } +#navwrap ul { padding:10px 0; height:40px; } +#navwrap li { line-height:40px; height:40px; margin-right:10px; float:left; list-style:none; } +#navwrap li a { display:block; color:#fff; font-size:20px; font-family:Oswald, sans-serif; padding:0 10px; background:#333; border-radius:3px; text-decoration:none; } + + +/**************** + Home +****************/ + + +#home { margin:50px auto 200px; overflow:hidden; width:960px; } +#home h2 { background:url(../img/clock-large.png) 160px 0 no-repeat; line-height:201px; font-size:100px; text-align:left; padding-left:380px; text-shadow:-1px -1px 0 #fff; } +#home h3 { margin-bottom:50px; } +#home .col1 { width:280px; margin:0 20px; float:left; } +#home .col2 { width:600px; margin:0 20px; float:left; text-align:left; } +#home h4 { height:14px; border-bottom:6px solid #ddd; margin:0 0 40px; text-align:center; } +#home h4 span { background:#eee; padding:0 10px; line-height:30px; font-size:30px; } +#home h5 { height:8px; border-bottom:6px solid #ddd; margin:0 0 40px; text-align:center; } +#home h5 span { background:#eee; padding:0 10px; line-height:18px; font-size:18px; } + + +/**************** + Buttons +****************/ + + +.btn { display:block; margin-bottom:20px; text-decoration:none; } +.btn strong { display:block; font-size:20px; line-height:30px; font-family:Oswald, sans-serif; padding:0 10px; } +.btn .version { display:block; font-size:16px; } +.btn .filesize { display:block; font-size:16px; } + + +/**************** + Docs +****************/ -#nav { width:220px; padding:10px 10px 100px; position:fixed; top:0; bottom:0; left:0; overflow-x:hidden; overflow-y:scroll; text-align:left; background:rgba(0, 0, 0, .2); border-right:1px solid #fff; } + +#docnav { width:220px; padding:10px 10px 100px; position:fixed; top:0; bottom:0; left:0; overflow-x:hidden; overflow-y:scroll; text-align:left; background:rgba(0, 0, 0, .2); border-right:1px solid #fff; } #docs { padding:0 100px 0 300px; text-align:left; } .ca { text-align:center; } @@ -106,19 +156,23 @@ b, strong { font-weight:bold; } .clearfix { display:block; clear:both; visibility:hidden; line-height:0; height:0; } -#nav::-webkit-scrollbar{ height:8px; width:8px; } -#nav::-webkit-scrollbar-track-piece { margin:10px; border-radius:4px; } -#nav::-webkit-scrollbar-thumb:vertical{ height:25px; background-color:#666; -webkit-border-radius:4px; } -#nav h1 { font-size:24px; padding-top:10px; text-shadow:none; } -#nav h2 { font-size:18px; padding-top:10px; text-shadow:none; } -#nav h1 a, -#nav h2 a { text-decoration:none; } -#nav a { color:#445; display:block; padding:2px 10px; border-radius:4px; cursor:pointer; } -#nav a:hover { background:rgba(0, 0, 0, .1); } -#nav li { list-style:none; font-size:12px; } +#docnav::-webkit-scrollbar{ height:8px; width:8px; } +#docnav::-webkit-scrollbar-track-piece { margin:10px; border-radius:4px; } +#docnav::-webkit-scrollbar-thumb:vertical{ height:25px; background-color:#666; -webkit-border-radius:4px; } +#docnav h1 { font-size:24px; padding-top:10px; text-shadow:none; } +#docnav h2 { font-size:18px; padding-top:10px; text-shadow:none; } +#docnav h1 a, +#docnav h2 a { text-decoration:none; } +#docnav a { color:#445; display:block; padding:2px 10px; border-radius:4px; cursor:pointer; } +#docnav a:hover { background:rgba(0, 0, 0, .1); } +#docnav li { list-style:none; font-size:12px; } + + +/********************** + Typical Styles +**********************/ -/*---------- typical Styles ---------*/ .sh_typical{background:none; padding:0; margin:0; border:0 none;} .sh_typical .sh_sourceCode{color:#586e75;font-weight:normal;font-style:normal;} .sh_typical .sh_sourceCode .sh_keyword{color:#2aa198;font-weight:bold;font-style:normal;} @@ -146,7 +200,12 @@ b, strong { font-weight:bold; } .sh_typical .sh_sourceCode .sh_property{color:#268bd2;font-weight:bold;font-style:normal;} .sh_typical .sh_sourceCode .sh_value{color:#f00;font-weight:normal;font-style:normal;} -/*-------- Snippet Base Styles ----------*/ + +/******************* + Base Styles +*******************/ + + .snippet-wrap {position:relative;} *:first-child+html .snippet-wrap {display:inline-block;} * html .snippet-wrap {display:inline-block;} @@ -177,3 +236,98 @@ b, strong { font-weight:bold; } * html .snippet-wrap .snippet-num li .box-sp {width:27px;} .snippet-wrap .snippet-no-num li.box {border:1px solid;} .snippet-wrap .snippet-no-num li .box-sp {display:none;} + + +/**************** + Buttons +****************/ + + +.btn.minimal { + background: #e3e3e3; + border: 1px solid #bbb; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; + -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; + -ms-box-shadow: inset 0 0 1px 1px #f6f6f6; + -o-box-shadow: inset 0 0 1px 1px #f6f6f6; + box-shadow: inset 0 0 1px 1px #f6f6f6; + color: #333; + line-height: 1; + padding: 8px 0 9px; + text-align: center; + text-shadow: 0 1px 0 #fff; +} +.btn.minimal:hover { + background: #d9d9d9; + -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; + -moz-box-shadow: inset 0 0 1px 1px #eaeaea; + -ms-box-shadow: inset 0 0 1px 1px #eaeaea; + -o-box-shadow: inset 0 0 1px 1px #eaeaea; + box-shadow: inset 0 0 1px 1px #eaeaea; + color: #222; + cursor: pointer; +} +.btn.minimal:active { + background: #d0d0d0; + -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; + -moz-box-shadow: inset 0 0 1px 1px #e3e3e3; + -ms-box-shadow: inset 0 0 1px 1px #e3e3e3; + -o-box-shadow: inset 0 0 1px 1px #e3e3e3; + box-shadow: inset 0 0 1px 1px #e3e3e3; + color: #000; +} +.btn.cupid-green { + background-color: #7fbf4d; + background-image: -webkit-gradient(linear, left top, left bottom, from(#7fbf4d), to(#63a62f)); + background-image: -webkit-linear-gradient(top, #7fbf4d, #63a62f); + background-image: -moz-linear-gradient(top, #7fbf4d, #63a62f); + background-image: -ms-linear-gradient(top, #7fbf4d, #63a62f); + background-image: -o-linear-gradient(top, #7fbf4d, #63a62f); + background-image: linear-gradient(top, #7fbf4d, #63a62f); + border: 1px solid #63a62f; + border-bottom: 1px solid #5b992b; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 0 0 #96ca6d; + -moz-box-shadow: inset 0 1px 0 0 #96ca6d; + -ms-box-shadow: inset 0 1px 0 0 #96ca6d; + -o-box-shadow: inset 0 1px 0 0 #96ca6d; + box-shadow: inset 0 1px 0 0 #96ca6d; + color: #fff; + line-height: 1; + padding: 7px 0 8px 0; + text-align: center; + text-shadow: 0 -1px 0 #4c9021; +} +.btn.cupid-green:hover { + background-color: #76b347; + background-image: -webkit-gradient(linear, left top, left bottom, from(#76b347), to(#5e9e2e)); + background-image: -webkit-linear-gradient(top, #76b347, #5e9e2e); + background-image: -moz-linear-gradient(top, #76b347, #5e9e2e); + background-image: -ms-linear-gradient(top, #76b347, #5e9e2e); + background-image: -o-linear-gradient(top, #76b347, #5e9e2e); + background-image: linear-gradient(top, #76b347, #5e9e2e); + -webkit-box-shadow: inset 0 1px 0 0 #8dbf67; + -moz-box-shadow: inset 0 1px 0 0 #8dbf67; + -ms-box-shadow: inset 0 1px 0 0 #8dbf67; + -o-box-shadow: inset 0 1px 0 0 #8dbf67; + box-shadow: inset 0 1px 0 0 #8dbf67; + cursor: pointer; +} +.btn.cupid-green:active { + border: 1px solid #5b992b; + border-bottom: 1px solid #538c27; + -webkit-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; + -moz-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; + -ms-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; + -o-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; + box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; +} \ No newline at end of file diff --git a/docs/index.html b/site/docs/index.html similarity index 100% rename from docs/index.html rename to site/docs/index.html diff --git a/site/bg-body.png b/site/img/bg-body.png similarity index 100% rename from site/bg-body.png rename to site/img/bg-body.png diff --git a/site/bg.png b/site/img/bg.png similarity index 100% rename from site/bg.png rename to site/img/bg.png diff --git a/site/img/clock-large.png b/site/img/clock-large.png new file mode 100644 index 000000000..e2ca70550 Binary files /dev/null and b/site/img/clock-large.png differ diff --git a/site/img/clock.png b/site/img/clock.png new file mode 100644 index 000000000..b6bd56732 Binary files /dev/null and b/site/img/clock.png differ diff --git a/site/fork.png b/site/img/fork.png similarity index 100% rename from site/fork.png rename to site/img/fork.png diff --git a/site/index.html b/site/index.html new file mode 100644 index 000000000..431ef9849 --- /dev/null +++ b/site/index.html @@ -0,0 +1,10 @@ +

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 aWhileAgo = moment([2011, 10, 31]);
+console.log(aWhileAgo.fromNow());
+
var now = moment().add('days', 9);
+console.log(now.format('dddd, MMMM Do YYYY'));
+
var now = moment();
+moment.lang('fr')
+console.log(now.format('dddd, MMMM Do YYYY, h:mm:ss a'));
+
\ No newline at end of file diff --git a/docs/docs.min.js b/site/js/docs.min.js similarity index 100% rename from docs/docs.min.js rename to site/js/docs.min.js diff --git a/site/js/home.min.js b/site/js/home.min.js new file mode 100644 index 000000000..989945b3c --- /dev/null +++ b/site/js/home.min.js @@ -0,0 +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 k(a,b){var c=a+"";while(c.length11?"pm":"am";case"A":return i>11?"PM":"AM";case"H":return i;case"HH":return k(i,2);case"h":return i%12||12;case"hh":return k(i%12||12,2);case"m":return j;case"mm":return k(j,2);case"s":return l;case"ss":return k(l,2);case"zz":case"z":return(b.toString().match(p)||[""])[0].replace(n,"");case"L":case"LL":case"LLL":case"LLLL":return o(b,c.longDateFormat[d]);default:return d.replace("\\","")}}var e=b.getMonth(),f=b.getDate(),g=b.getFullYear(),h=b.getDay(),i=b.getHours(),j=b.getMinutes(),l=b.getSeconds(),m=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|LL?L?L?)/g,n=/[^A-Z]/g,p=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,q=c.ordinal;return d.replace(m,r)}function p(a,b){function i(a,b){switch(a){case"M":case"MM":c[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~b;break;case"a":case"A":h=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b}}var c=[0],d=/[0-9a-zA-Z]+/g,e=a.match(d),f=b.match(d),g,h;for(g=0;g' 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],[/