xonecas.io
818
Du

dustymarkdown / commit 5a53b7b

Made some changes around, removed depency on ender.js

xonecas2011-05-05 5a53b7bfdbff99bb64b3b65e68b263067d02eb9a parent a8edc53

10 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

build.js+27−0
@@ -5,7 +5,32 @@ var fs = require('fs'),
55 dust = require('dust'),
66 markdown = require("node-markdown").Markdown;
77
8+/* this is for last, add production step that compresses
9+ everything, minifies js etc...
10+
11+// check for command line args
12+if (process.argv.length >= 3) {
13+ var args = process.argv.slice(2);
14+
15+ if (args[0] === '-u' || '--uglify') {
16+ var jsp = require("uglify-js").parser,
17+ pro = require("uglify-js").uglify,
18+ sqwish = require('sqwish').minify;
19+
20+ function uglify (orig_code) {
21+ var ast = jsp.parse(orig_code); // parse code and get the initial AST
22+ ast = pro.ast_mangle(ast); // get a new AST with mangled names
23+ ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
24+ var final_code = pro.gen_code(ast); // compressed code here
25+
26+ return final_code;
27+ }
28+ }
29+}
30+
831 // little tweak to dust
32+if (uglify === undefined)
33+*/
934 dust.optimizers.format = function(ctx, node) { return node };
1035
1136 //debug
@@ -13,6 +38,8 @@ var ins = require('util').inspect;
1338 function log (data) { console.log(ins(data)); };
1439
1540 // get all my templates and compile them
41+//@TODO -- make special templates for header and footer to avoid duplication.
42+
1643 function readTemplates (callback) {
1744 fs.readdir('./templates', function (err, templates) {
1845 if (err) throw err;
htdocs/about.html+2−51
@@ -1,54 +1,5 @@
1-<!doctype html>
2-<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3-<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
4-<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
5-<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
6-<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
7-<head>
8- <meta charset="utf-8">
9-
10- <title>Dusty Markdown</title>
11- <meta name="description" content="simple command line content manager">
12- <meta name="author" content="@xonecas">
13-
14- <!-- Mobile viewport optimized: j.mp/bplateviewport -->
15- <meta name="viewport" content="width=device-width, initial-scale=1.0">
16-
17- <!-- CSS: implied media="all" -->
18- <link rel="stylesheet" href="css/style.css">
19- <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
20-
21- <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
22- <script src="js/libs/modernizr.js"></script>
23-
24-</head>
25-
26-<body>
27- <header><h1>Dusty Markdown</h1></header>
28- <section id="main">
29- <h2>This is just an example page.</h2>
1+<!doctype html><!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--><head><meta charset="utf-8"><title>Dusty Markdown</title><meta name="description" content="simple command line content manager"><meta name="author" content="@xonecas"><meta name="viewport" content="width=device-width, in …
302
313 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with deskto …
324
33-<p>Click <a href="/">here</a> to go back.</p>
34- </section>
35-
36- <!-- JavaScript at the bottom for fast page loading -->
37- <script src="js/libs/ender.js"></script>
38-
39- <!-- scripts concatenated and minified via ant build script-->
40- <script src="js/script.js"></script>
41- <!-- end scripts-->
42-
43-
44- <!-- simple uniques and page requests tracker, see server.js -->
45- <script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script>
46- <script>
47- var s = localStorage, key = s.getItem('key');
48- if (key === null) { key = +new Date(); s.setItem('key', key); };
49- $.ajax('/track?key='+key);
50- </script>
51-
52-</body>
53-</html>
54-
5+<p>Click <a href="/">here</a> to go back.</p></section><script src="js/libs/ender.js"></script><script src="js/script.js"></script><!-- simple uniques and page requests tracker, see server.js --><script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script><script>var s = localStorage, key = s.getItem('key');if (key === null) { key = +new Date(); s.setItem('key', key); };$.ajax('/track?key='+key);</script></body></html>
htdocs/css/style.css+1−0
@@ -181,6 +181,7 @@ h1 {
181181 border-bottom: 5px solid #444;
182182 padding:5px 0;
183183 }
184+blockquote {border-left: 10px solid #eee; padding: 5px 5px 5px 10px;}
184185 ul { margin-bottom: 1em; }
185186 em { font-weight: bold; }
186187 footer { font-size: 0.875em; }
htdocs/index.html+28−84
@@ -1,44 +1,14 @@
1-<!doctype html>
2-<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3-<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
4-<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
5-<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
6-<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
7-<head>
8- <meta charset="utf-8">
9-
10- <title>Dusty Markdown</title>
11- <meta name="description" content="simple command line content manager">
12- <meta name="author" content="@xonecas">
13-
14- <!-- Mobile viewport optimized: j.mp/bplateviewport -->
15- <meta name="viewport" content="width=device-width, initial-scale=1.0">
16-
17- <!-- CSS: implied media="all" -->
18- <link rel="stylesheet" href="css/style.css">
19- <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
20-
21-
22- <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
23- <script src="js/libs/modernizr.js"></script>
24-
25-</head>
26-
27-<body>
28- <header>
29- <h1>Dusty Markdown</h1>
30- </header>
31- <section id="main" class="center">
32- <p>This project is the new content manager under xonecas.com.
33-It's very minimal and light, developer friendly. The idea
34-is that you can write the dynamic content in markdown and
35-use dust to combine static and dynamic.</p>
1+<!doctype html><!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--><head><meta charset="utf-8"><title>Dusty Markdown</title><meta name="description" content="simple command line content manager"><meta name="author" content="@xonecas"><meta name="viewport" content="width=device-width, in …
2+ <p>This project is the new content manager under <a href="http://xonecas.com">xonecas.com</a>.
3+ It's very minimal and light, developer friendly. The idea
4+ is that you can write the dynamic content in markdown and
5+ use dust to combine static and dynamic.</p>
6+</blockquote>
367
378 <h2>This app is only possible thanks to:</h2>
389
3910 <ul>
4011 <li>HTML5 Boilerplate</li>
41-<li>Ender <em>no-library</em></li>
4212 <li>Dust.js</li>
4313 <li>Markdown</li>
4414 </ul>
@@ -54,25 +24,25 @@ convention.</p>
5424 <p>This app is the example of that convention:</p>
5525
5626 <pre><code> root/
57- build.js // compiler
58- server.js // static asset provider
59-
60- templates/ // home to your pages/views
61- index.dust // root of the app
62- pagename.dust // pagename becomes
63- // http://server/pagename
64-
65- markdown/ // where your content goes
66- keyname.md // you can refer to this in
67- // your template susing {keyname}
68- section_keyname.md // you can refer to several
69- // keynames using {#section}
70- htdocs/ // your static content
27+ build.js // compiler
28+ server.js // static asset provider
29+
30+ templates/ // home to your pages/views
31+ index.dust // root of the app
32+ pagename.dust // pagename becomes
33+ // http://server/pagename
34+
35+ markdown/ // where your content goes
36+ keyname.md // you can refer to this in
37+ // your template using {keyname}
38+ section_keyname.md // you can refer to several
39+ // keynames using {#section}
40+ htdocs/ // your static content
7141 ...
72- ... // organize it how you want it
73- // just remember that the .html
74- // files are created by build.js
75- // so don't edit them by hand
42+ ... // organize it how you want it
43+ // just remember that the .html
44+ // files are created by build.js
45+ // so don't edit them by hand
7646 </code></pre>
7747
7848 <p>The default htdocs folder is from HTML5 Boilerplate and so is
@@ -85,45 +55,19 @@ There is also a very simple unique visitors/request counter.</p>
8555 <h2>Dependencies</h2>
8656
8757 <ul>
88-<li><code>npm install connect dust node-markdown ender</code></li>
58+<li><code>npm install connect dust node-markdown</code></li>
8959 </ul>
9060
9161 <h2>More docs:</h2>
9262
9363 <ul>
9464 <li><a href="http://h5bp.com/"><em>HTML5 Boilerplate</em> →</a></li>
95-<li><a href="http://ender.no.de/"><em>Ender</em> →</a></li>
9665 <li><a href="http://akdubya.github.com/dustjs/"><em>Dust</em> →</a></li>
9766 <li><a href="http://daringfireball.net/projects/markdown/basics"><em>Markdown</em> →</a></li>
98-</ul>
99- </section>
100- <footer class="center">
101- <h3>Thu, 29 of April, 2011</h3>
102-
103-<p>Added more documentation.</p> <h3>Thu, 28 of April, 2011</h3>
67+</ul></section><footer class="center"><h3>Thu, 28 of April, 2011</h3>
10468
10569 <p>This is an example entry so that I now it's working.</p> <h3>Thu, 28 of April, 2011</h3>
10670
107-<p>First cleaned up. Added defult pages. Things look pretty now.</p>
108- </footer>
109-
110-
111-
112- <!-- JavaScript at the bottom for fast page loading -->
113- <script src="js/libs/ender.js"></script>
114-
115- <!-- scripts concatenated and minified via ant build script-->
116- <script src="js/script.js"></script>
117- <!-- end scripts-->
118-
119-
120- <!-- simple uniques and page requests tracker, see server.js -->
121- <script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script>
122- <script>
123- var s = localStorage, key = s.getItem('key');
124- if (key === null) { key = +new Date(); s.setItem('key', key); };
125- $.ajax('/track?key='+key);
126- </script>
71+<p>First cleaned up. Added defult pages. Things look pretty now.</p> <h3>Thu, 29 of April, 2011</h3>
12772
128-</body>
129-</html>
73+<p>Added more documentation.</p> </footer><script src="js/libs/jquery.js"></script><script src="js/script.js"></script><!-- simple uniques and page requests tracker, see server.js --><script>Modernizr.localstorage || document.write('<script src="js/libs/storage.js">\x3C/script>')</script><script>var s = localStorage, key = s.getItem('key');if (key === null) { key = +new Date(); s.setItem('key', key); };$.get('/track?key='+key);</script></body></html>
htdocs/js/libs/ender.js+0−1058
@@ -1,1058 +0,0 @@
1-/*!
2- * Ender: open module JavaScript framework
3- * copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
4- * https://github.com/ender-js/ender
5- * License MIT
6- * Build: ender just bonzo qwery reqwest
7- */
8-!function (context) {
9-
10- function aug(o, o2) {
11- for (var k in o2) {
12- k != 'noConflict' && (o[k] = o2[k]);
13- }
14- }
15-
16- function _$(s, r) {
17- this.elements = typeof s !== 'string' && !s.nodeType && typeof s.length !== 'undefined' ? s : $._select(s, r);
18- this.length = this.elements.length;
19- for (var i = 0; i < this.length; i++) {
20- this[i] = this.elements[i];
21- }
22- }
23-
24- function $(s, r) {
25- return new _$(s, r);
26- }
27-
28- aug($, {
29- ender: function (o, proto) {
30- aug(proto ? _$.prototype : $, o);
31- },
32- _select: function () {
33- return [];
34- }
35- });
36-
37- var old = context.$;
38- $.noConflict = function () {
39- context.$ = old;
40- return this;
41- };
42-
43- (typeof module !== 'undefined') && module.exports ?
44- (module.exports = $) :
45- (context.$ = $);
46-
47-}(this);
48-/*!
49- * bonzo.js - copyright @dedfat 2011
50- * https://github.com/ded/bonzo
51- * Follow our software http://twitter.com/dedfat
52- * MIT License
53- */
54-!function (context) {
55-
56- var doc = document,
57- html = doc.documentElement,
58- specialAttributes = /^checked|value|selected$/,
59- stateAttributes = /^checked|selected$/,
60- ie = /msie/.test(navigator.userAgent),
61- uidList = [],
62- uuids = 0;
63-
64- function classReg(c) {
65- return new RegExp("(^|\\s+)" + c + "(\\s+|$)");
66- }
67-
68- function each(ar, fn) {
69- for (i = 0, len = ar.length; i < len; i++) {
70- fn(ar[i]);
71- }
72- }
73-
74- function trim(s) {
75- return s.replace(/(^\s*|\s*$)/g, '');
76- }
77-
78- function camelize(s) {
79- return s.replace(/-(.)/g, function (m, m1) {
80- return m1.toUpperCase();
81- });
82- }
83-
84- function is(node) {
85- return node && node.nodeName && node.nodeType == 1;
86- }
87-
88- function some(ar, fn, scope) {
89- for (var i = 0, j = ar.length; i < j; ++i) {
90- if (fn.call(scope, ar[i], i, ar)) {
91- return true;
92- }
93- }
94- return false;
95- }
96-
97- function sucks(o) {
98- for (var k in o) {
99- switch (k) {
100- case 'opacity':
101- o.filter = 'alpha(opacity=' + (o[k] * 100) + ')';
102- delete o[k];
103- break;
104- case '':
105- break;
106- }
107- }
108- }
109-
110- function _bonzo(elements) {
111- this.elements = [];
112- this.length = 0;
113- if (elements) {
114- this.elements = typeof elements !== 'string' && !elements.nodeType && typeof elements.length !== 'undefined' ? elements : [elements];
115- this.length = this.elements.length;
116- for (var i = 0; i < this.length; i++) {
117- this[i] = this.elements[i];
118- }
119- }
120- }
121-
122- _bonzo.prototype = {
123-
124- each: function (fn) {
125- for (var i = 0, l = this.length; i < l; i++) {
126- fn.call(this, this[i], i);
127- }
128- return this;
129- },
130-
131- map: function (fn, reject) {
132- var m = [], n;
133- for (var i = 0; i < this.length; i++) {
134- n = fn.call(this, this[i]);
135- reject ? (reject(n) && m.push(n)) : m.push(n);
136- }
137- return m;
138- },
139-
140- first: function () {
141- return bonzo(this[0]);
142- },
143-
144- last: function () {
145- return bonzo(this[this.length - 1]);
146- },
147-
148- html: function (html) {
149- return typeof html !== 'undefined' ?
150- this.each(function (el) {
151- el.innerHTML = html;
152- }) :
153- this.elements[0] ? this.elements[0].innerHTML : '';
154- },
155-
156- addClass: function (c) {
157- return this.each(function (el) {
158- this.hasClass(el, c) || (el.className = trim(el.className + ' ' + c));
159- });
160- },
161-
162- removeClass: function (c) {
163- return this.each(function (el) {
164- this.hasClass(el, c) && (el.className = trim(el.className.replace(classReg(c), ' ')));
165- });
166- },
167-
168- hasClass: function (el, c) {
169- return typeof c == 'undefined' ?
170- some(this.elements, function (i) {
171- return classReg(el).test(i.className);
172- }) :
173- classReg(c).test(el.className);
174- },
175-
176- toggleClass: function (c, condition) {
177- if (typeof condition !== 'undefined' && !condition) {
178- return this;
179- }
180- return this.each(function (el) {
181- this.hasClass(el, c) ?
182- (el.className = trim(el.className.replace(classReg(c), ' '))) :
183- (el.className = trim(el.className + ' ' + c));
184- });
185- },
186-
187- show: function (elements) {
188- return this.each(function (el) {
189- el.style.display = '';
190- });
191- },
192-
193- hide: function (elements) {
194- return this.each(function (el) {
195- el.style.display = 'none';
196- });
197- },
198-
199- append: function (node) {
200- return this.each(function (el) {
201- each(normalize(node), function (i) {
202- el.appendChild(i);
203- });
204- });
205- },
206-
207- prepend: function (node) {
208- return this.each(function (el) {
209- var first = el.firstChild;
210- each(normalize(node), function (i) {
211- el.insertBefore(i, first);
212- });
213- });
214- },
215-
216- appendTo: function (target) {
217- return this.each(function (el) {
218- target.appendChild(el);
219- });
220- },
221-
222- next: function () {
223- return this.related('nextSibling');
224- },
225-
226- previous: function () {
227- return this.related('previousSibling');
228- },
229-
230- related: function (method) {
231- return this.map(
232- function (el) {
233- el = el[method];
234- while (el && el.nodeType !== 1) {
235- el = el[method];
236- }
237- return el || 0;
238- },
239- function (el) {
240- return el;
241- }
242- );
243- },
244-
245- prependTo: function (target) {
246- return this.each(function (el) {
247- target.insertBefore(el, bonzo.firstChild(target));
248- });
249- },
250-
251- before: function (node) {
252- return this.each(function (el) {
253- each(bonzo.create(node), function (i) {
254- el.parentNode.insertBefore(i, el);
255- });
256- });
257- },
258-
259- insertBefore: function (node) {
260- return this.each(function (el) {
261- each(normalize(node), function (n) {
262- n.parentNode.insertBefore(el, n);
263- });
264- });
265- },
266-
267- insertAfter: function (node) {
268- return this.each(function (el) {
269- each(normalize(node), function (n) {
270- n.parentNode.insertBefore(el, (n.nextSibling || n));
271- });
272- });
273- },
274-
275- after: function (node) {
276- return this.each(function (el) {
277- each(bonzo.create(node), function (i) {
278- el.parentNode.insertBefore(i, el.nextSibling);
279- });
280- });
281- },
282-
283- css: function (o, v) {
284- if (v === undefined && typeof o == 'string') {
285- return this[0].style[camelize(o)];
286- }
287- var iter = o;
288- if (typeof o == 'string') {
289- iter = {};
290- iter[o] = v;
291- }
292- ie && sucks(iter);
293- var fn = function (el) {
294- for (var k in iter) {
295- iter.hasOwnProperty(k) && (el.style[camelize(k)] = iter[k]);
296- }
297- };
298- return this.each(fn);
299- },
300-
301- offset: function () {
302- var el = this.elements[0];
303- var width = el.offsetWidth;
304- var height = el.offsetHeight;
305- var top = el.offsetTop;
306- var left = el.offsetLeft;
307- while (el = el.offsetParent) {
308- top = top + el.offsetTop;
309- left = left + el.offsetLeft;
310- }
311-
312- return {
313- top: top,
314- left: left,
315- height: height,
316- width: width
317- };
318- },
319-
320- attr: function (k, v) {
321- var el = this.elements[0];
322- return typeof v == 'undefined' ?
323- specialAttributes.test(k) ?
324- stateAttributes.test(k) && typeof el[k] == 'string' ?
325- true : el[k] : el.getAttribute(k) :
326- this.each(function (el) {
327- el.setAttribute(k, v);
328- });
329- },
330-
331- removeAttr: function (k) {
332- return this.each(function (el) {
333- el.removeAttribute(k);
334- });
335- },
336-
337- data: function (k, v) {
338- var el = this.elements[0];
339- if (typeof v === 'undefined') {
340- el.getAttribute('data-node-uid') || el.setAttribute('data-node-uid', ++uuids);
341- var uid = el.getAttribute('data-node-uid');
342- uidList[uid] || (uidList[uid] = {});
343- return uidList[uid][k];
344- } else {
345- return this.each(function (el) {
346- el.getAttribute('data-node-uid') || el.setAttribute('data-node-uid', ++uuids);
347- var uid = el.getAttribute('data-node-uid');
348- var o = {};
349- o[k] = v;
350- uidList[uid] = o;
351- });
352- }
353- },
354-
355- remove: function () {
356- return this.each(function (el) {
357- el.parentNode && el.parentNode.removeChild(el);
358- });
359- },
360-
361- empty: function () {
362- return this.each(function (el) {
363- while (el.firstChild) {
364- el.removeChild(el.firstChild);
365- }
366- });
367- },
368-
369- detach: function () {
370- return this.map(function (el) {
371- return el.parentNode.removeChild(el);
372- });
373- },
374-
375- scrollTop: function (y) {
376- return scroll.call(this, null, y, 'y');
377- },
378-
379- scrollLeft: function (x) {
380- return scroll.call(this, x, null, 'x');
381- },
382-
383- serialize: function () {
384- var form = this[0],
385- inputs = form.getElementsByTagName('input'),
386- selects = form.getElementsByTagName('select'),
387- texts = form.getElementsByTagName('textarea');
388- return (bonzo(inputs).map(serial).join('') +
389- bonzo(selects).map(serial).join('') +
390- bonzo(texts).map(serial).join('')).replace(/&$/, '');
391- },
392-
393- serializeArray: function () {
394- for (var pairs = this.serialize().split('&'), i = 0, l = pairs.length, r = [], o; i < l; i++) {
395- pairs[i] && (o = pairs[i].split('=')) && r.push({name: o[0], value: o[1]});
396- }
397- return r;
398- }
399- };
400-
401- function enc(v) {
402- return encodeURIComponent(v);
403- }
404-
405- function serial(el) {
406- var n = el.name;
407- // don't serialize elements that are disabled or without a name
408- if (el.disabled || !n) {
409- return '';
410- }
411- n = enc(n);
412- switch (el.tagName.toLowerCase()) {
413- case 'input':
414- switch (el.type) {
415- case 'reset':
416- case 'button':
417- case 'image':
418- case 'file':
419- return '';
420- case 'checkbox':
421- case 'radio':
422- return el.checked ? n + '=' + (el.value ? enc(el.value) : true) + '&' : '';
423- default: // text hidden password submit
424- return n + '=' + (el.value ? enc(el.value) : true) + '&';
425- }
426- break;
427- case 'textarea':
428- return n + '=' + enc(el.value) + '&';
429- case 'select':
430- // @todo refactor beyond basic single selected value case
431- return n + '=' + enc(el.options[el.selectedIndex].value) + '&';
432- }
433- return '';
434- }
435-
436- function normalize(node) {
437- return typeof node == 'string' ? bonzo.create(node) : is(node) ? [node] : node;
438- }
439-
440- function scroll(x, y, type) {
441- var el = this.elements[0];
442- if (x == null && y == null) {
443- return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type];
444- }
445- if (isBody(el)) {
446- window.scrollTo(x, y);
447- } else {
448- x != null && (el.scrollLeft = x);
449- y != null && (el.scrollTop = y);
450- }
451- return this;
452- }
453-
454- function isBody(element) {
455- return element === window || (/^(?:body|html)$/i).test(element.tagName);
456- }
457-
458- function getWindowScroll() {
459- return { x: window.pageXOffset || html.scrollLeft, y: window.pageYOffset || html.scrollTop };
460- }
461-
462- function bonzo(els) {
463- return new _bonzo(els);
464- }
465-
466- bonzo.aug = function (o, target) {
467- for (var k in o) {
468- o.hasOwnProperty(k) && ((target || _bonzo.prototype)[k] = o[k]);
469- }
470- };
471-
472- bonzo.create = function (node) {
473- return typeof node == 'string' ?
474- function () {
475- var el = doc.createElement('div'), els = [];
476- el.innerHTML = node;
477- var nodes = el.childNodes;
478- el = el.firstChild;
479- els.push(el);
480- while (el = el.nextSibling) {
481- (el.nodeType == 1) && els.push(el);
482- }
483- return els;
484-
485- }() : is(node) ? [node.cloneNode(true)] : [];
486- };
487-
488- bonzo.doc = function () {
489- var w = html.scrollWidth,
490- h = html.scrollHeight,
491- vp = this.viewport();
492- return {
493- width: Math.max(w, vp.width),
494- height: Math.max(h, vp.height)
495- };
496- };
497-
498- bonzo.firstChild = function (el) {
499- for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) {
500- if (c[i].nodeType === 1) {
501- e = c[j = i];
502- }
503- }
504- return e;
505- };
506-
507- bonzo.viewport = function () {
508- var h = self.innerHeight,
509- w = self.innerWidth;
510- ie && (h = html.clientHeight) && (w = html.clientWidth);
511- return {
512- width: w,
513- height: h
514- };
515- };
516-
517- bonzo.isAncestor = 'compareDocumentPosition' in html ?
518- function (container, element) {
519- return (container.compareDocumentPosition(element) & 16) == 16;
520- } : 'contains' in html ?
521- function (container, element) {
522- return container !== element && container.contains(element);
523- } :
524- function (container, element) {
525- while (element = element.parentNode) {
526- if (element === container) {
527- return true;
528- }
529- }
530- return false;
531- };
532-
533- var old = context.bonzo;
534- bonzo.noConflict = function () {
535- context.bonzo = old;
536- return this;
537- };
538- context.bonzo = bonzo;
539-
540-}(this);!function () {
541- var b = bonzo.noConflict();
542- $.ender(b);
543- $.ender(b(), true);
544- $.ender({
545- create: function (node) {
546- return $(b.create(node));
547- }
548- });
549-
550- function indexOf(ar, val) {
551- for (var i = 0; i < ar.length; i++) {
552- if ( ar[i] === val ) {
553- return i;
554- }
555- }
556- return -1;
557- }
558-
559- function uniq(ar) {
560- var a = [], i, j;
561- label:
562- for (i = 0; i < ar.length; i++) {
563- for (j = 0; j < a.length; j++) {
564- if (a[j] == ar[i]) {
565- continue label;
566- }
567- }
568- a[a.length] = ar[i];
569- }
570- return a;
571- }
572- $.ender({
573- parents: function (selector, closest) {
574- var collection = $(selector), j, k, p, r = [];
575- for (j = 0, k = this.length; j < k; j++) {
576- p = this[j];
577- while (p = p.parentNode) {
578- if (indexOf(collection, p) !== -1) {
579- r.push(p);
580- if (closest) break;
581- }
582- }
583- }
584- return $(uniq(r));
585- },
586-
587- closest: function (selector) {
588- return this.parents(selector, true);
589- },
590-
591- first: function () {
592- return $(this[0]);
593- },
594-
595- last: function () {
596- return $(this[this.length - 1]);
597- },
598-
599- next: function () {
600- return $(b(this).next());
601- },
602-
603- previous: function () {
604- return $(b(this).previous());
605- },
606-
607- siblings: function () {
608- var i, l, p, r = [];
609- for (i = 0, l = this.length; i < l; i++) {
610- p = this[i];
611- while (p = p.previousSibling) {
612- p.nodeType == 1 && r.push(p);
613- }
614- p = this[i];
615- while (p = p.nextSibling) {
616- p.nodeType == 1 && r.push(p);
617- }
618- }
619- return $(uniq(r));
620- }
621- }, true);
622-
623-}();
624-
625-/*!
626- * qwery.js - copyright @dedfat
627- * https://github.com/ded/qwery
628- * Follow our software http://twitter.com/dedfat
629- * MIT License
630- */
631-!function (context, doc) {
632-
633- var c, i, j, k, l, m, o, p, r, v,
634- el, node, len, found, classes, item, items, token, collection,
635- id = /#([\w\-]+)/,
636- clas = /\.[\w\-]+/g,
637- idOnly = /^#([\w\-]+$)/,
638- classOnly = /^\.([\w\-]+)$/,
639- tagOnly = /^([\w\-]+)$/,
640- tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/,
641- html = doc.documentElement,
642- tokenizr = /\s(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\])/,
643- simple = /^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,
644- attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,
645- chunker = new RegExp(simple.source + '(' + attr.source + ')?');
646-
647- function array(ar) {
648- r = [];
649- for (i = 0, len = ar.length; i < len; i++) {
650- r[i] = ar[i];
651- }
652- return r;
653- }
654-
655- var cache = function () {
656- this.c = {};
657- };
658- cache.prototype = {
659- g: function (k) {
660- return this.c[k] || undefined;
661- },
662- s: function (k, v) {
663- this.c[k] = v;
664- return v;
665- }
666- };
667-
668- var classCache = new cache(),
669- cleanCache = new cache(),
670- attrCache = new cache(),
671- tokenCache = new cache();
672-
673- function q(query) {
674- return query.match(chunker);
675- }
676-
677- function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value) {
678- var m, c, k;
679- if (tag && this.tagName.toLowerCase() !== tag) {
680- return false;
681- }
682- if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) {
683- return false;
684- }
685- if (idsAndClasses && (classes = idsAndClasses.match(clas))) {
686- for (i = classes.length; i--;) {
687- c = classes[i].slice(1);
688- if (!(classCache.g(c) || classCache.s(c, new RegExp('(^|\\s+)' + c + '(\\s+|$)'))).test(this.className)) {
689- return false;
690- }
691- }
692- }
693- if (wholeAttribute && !value) {
694- o = this.attributes;
695- for (k in o) {
696- if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) {
697- return this;
698- }
699- }
700- }
701- if (wholeAttribute && !checkAttr(qualifier, this.getAttribute(attribute) || '', value)) {
702- return false;
703- }
704- return this;
705- }
706-
707- function loopAll(tokens) {
708- var r = [], token = tokens.pop(), intr = q(token), tag = intr[1] || '*', i, l, els,
709- root = tokens.length && (m = tokens[0].match(idOnly)) ? doc.getElementById(m[1]) : doc;
710- if (!root) {
711- return r;
712- }
713- els = root.getElementsByTagName(tag);
714- for (i = 0, l = els.length; i < l; i++) {
715- el = els[i];
716- if (item = interpret.apply(el, intr)) {
717- r.push(item);
718- }
719- }
720- return r;
721- }
722-
723- function clean(s) {
724- return cleanCache.g(s) || cleanCache.s(s, s.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g, '\\$1'));
725- }
726-
727- function checkAttr(qualify, actual, val) {
728- switch (qualify) {
729- case '=':
730- return actual == val;
731- case '^=':
732- return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, new RegExp('^' + clean(val))));
733- case '$=':
734- return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, new RegExp(clean(val) + '$')));
735- case '*=':
736- return actual.match(attrCache.g(val) || attrCache.s(val, new RegExp(clean(val))));
737- case '~=':
738- return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, new RegExp('(?:^|\\s+)' + clean(val) + '(?:\\s+|$)')));
739- case '|=':
740- return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, new RegExp('^' + clean(val) + '(-|$)')));
741- }
742- return false;
743- }
744-
745- function _qwery(selector) {
746- var r = [], ret = [], i, l,
747- tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr));
Cut short: this commit's diff is over 1000 lines.
htdocs/js/libs/jquery.js+8866−0
Cut short: this commit's diff is over 1000 lines.
markdown/about.md+23−25
Cut short: this commit's diff is over 1000 lines.
server.js+1−1
Cut short: this commit's diff is over 1000 lines.
templates/about.dust+1−11
Cut short: this commit's diff is over 1000 lines.
templates/index.dust+3−13
Cut short: this commit's diff is over 1000 lines.