First dump of doc stuff

This commit is contained in:
Garen Torikian 2012-02-02 17:00:18 -08:00
commit 79886c3e07
83 changed files with 8598 additions and 554 deletions

3
doc/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.DS_Store
out/
node_modules/

15
doc/README.md Normal file
View file

@ -0,0 +1,15 @@
# Introduction
The beginnings of an API documentation set for Ace.
This documentation can't be build without [C9's version of ndoc](https://github.com/c9/ndoc), so you should clone that repo somewhere, too. Note to self: since there's a billion people following this project, should I just make this ndoc a submodule, similair to NodeManual? I'd rather not.
# Building
In this directory, just run
node build.js [path_to_ndoc]
`[path_to_ndoc]` is a required argument, indicating the location of your ndoc install, relative to the `build.js` file. By default, this will point to `./build/ndoc/bin/ndoc`.
Right now, yes, we're using the [NodeManual.org](http://www.nodemanual.org) theme. A real style is pending. Also there are a lot of *TODO* items so you should really be more concerned about that.

15
doc/build.js Normal file
View file

@ -0,0 +1,15 @@
require("colors");
var argv = require("optimist").argv,
ndoc = require(argv._[0] || "./build/ndoc/bin/ndoc");
console.log("GENERATING DOCUMENTATION".green);
var srcPath = process.cwd() + "/../lib/ace";
ndoc.main(["--path=" + srcPath, "-o", "./out/", "-t", "ACE API", "--skin", "./resources/ace/skins"], function(err) {
if (err) {
console.error(err);
process.exit(-1);
}
});

21
doc/package.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "ace_docs",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/ajaxorg/ace.git"
},
"engines": {
"node": "~0.6.0"
},
"dependencies": {
"colors": "~0.6.0",
"optimist": "~0.3.1",
"nomnom": "~1.5.1",
"jade": "~0.20.0",
"marked": "~0.1.5",
"fs-tools": "~0.1.0",
"markdown_conrefs": "1.0.2"
},
"devDependencies": {}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,52 @@
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln { color: #000 } /* plain text */
@media screen {
.str { color: #2e6a40 } /* string content */
.kwd { color: #214afc } /* a keyword */
.com { color: #4c886b } /* a comment */
.typ { color: #1130ad } /* a type name */
.lit { color: #1130ad } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #2d0603 }
.tag { color: #008 } /* a markup tag name */
.atn { color: #606 } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #606 } /* a declaration; a variable name */
.fun { color: #1130ad } /* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str { color: #060 }
.kwd { color: #006; font-weight: bold }
.com { color: #600; font-style: italic }
.typ { color: #404; font-weight: bold }
.lit { color: #044 }
.pun, .opn, .clo { color: #440 }
.tag { color: #006; font-weight: bold }
.atn { color: #404 }
.atv { color: #060 }
}
/* Put a border around prettyprinted code snippets. */
/*pre.prettyprint { padding: 2px; }*/
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */`
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,60 @@
/* ============================================================
* bootstrap-dropdown.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#dropdown
* ============================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function ( selector ) {
return this.each(function () {
$(this).delegate(selector || d, 'click', function (e) {
if(!$(this).hasClass('brand')){
var li = $(this).parent('li'),
isActive = li.hasClass('open');
clearMenus();
!isActive && li.toggleClass('open');
return false;
}
});
})
};
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
var d = 'a.menu, .dropdown-toggle'
function clearMenus() {
$(d).parent('li').each(function(){
$(this).removeClass('open')
});
}
$(function () {
$('html').bind("click", clearMenus)
$('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' );
})
}( window.jQuery || window.ender );

View file

@ -0,0 +1,72 @@
$(function() {
// $(".sideToggler").collapse();
// var documentURL = location.href;
// var lastSlashPos = documentURL.lastIndexOf("/") + 1;
// var filenamePos = documentURL.lastIndexOf(".html");
// var objName = documentURL.substring(lastSlashPos, filenamePos);
// var menuUl = "menu_" + objName;
// resize the sidebar/content based on window height;
// this enables us to have "inner" scroll bars
/*var h = $(window).height();
$("#sidebar").css('height', h - 80);
$("#content").css('height', h - 100);
$(window).resize(function(){
var h = $(window).height();
var w = $(window).width();
$("#sidebar").css('height', h - 80);
$("#content").css('height', h - 100);
}); */
// clicking on the member title should launch open the
// description
// $('.member-name').click(function() {
// var id = this.id.substring(this.id.indexOf("_") + 1);
//
// $("h3[id='" + id + "']").trigger('click');
// });
/*$('.memberLink').click(function() {
var id = this.id.substring(this.id.indexOf("_") + 1);
$("h3[data-id='" + id + "']").trigger('click');
}); */
// when hovering over arrow, add highlight (only if inactive)
$("h3.methodToggle").hover(function () {
if (!$("h3.methodToggle").hasClass('active'))
$(this).addClass("methodToggleHover");
},
function () {
$(this).removeClass("methodToggleHover");
}
);
// after expanding the hidden description, hide the ellipsis
$('.signature-call, .signature-returns', '.signature').click(function() {
var $article = $(this).closest('.article'),
$arrow = $('h3.methodClicker', $article);
if (!$article.hasClass('methodToggleOpen') || this.force) {
$article.addClass('methodToggleOpen');
$arrow.removeClass('inactive').addClass('active');
var data = location.hash = $arrow[0].id.replace(/^js_/, "");
scrollTo(null, data);
}
else {
$article.removeClass('methodToggleOpen');
$arrow.removeClass('active').addClass('inactive');
}
});
$('.related-to', '.metaInfo').click(function(){
location.hash = $(this).find('a').attr('href').split('#')[1];
});
});

View file

@ -0,0 +1,12 @@
var disqus_shortname = 'nodemanual';
var paths = window.location.pathname.split("/");
var fileName = paths[paths.length - 2] + "/" + paths[paths.length - 1];
var disqus_identifier = fileName;
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

View file

@ -0,0 +1,10 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28566244-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

View file

@ -0,0 +1,151 @@
/*!
* Collapse plugin for jQuery
* http://github.com/danielstocks/jQuery-Collapse/
*
* @author Daniel Stocks (http://webcloud.se)
* @version 0.9.1
* @updated 17-AUG-2010
*
* Copyright 2010, Daniel Stocks
* Released under the MIT, BSD, and GPL Licenses.
*/
(function($) {
// Use a cookie counter to allow multiple instances of the plugin
var cookieCounter = 0;
$.fn.extend({
collapse: function(options) {
var defaults = {
head : "h3",
group : "div, ul",
cookieName : "collapse",
// Default function for showing content
show: function() {
this.show();
},
// Default function for hiding content
hide: function() {
this.hide();
}
};
var op = $.extend(defaults, options);
// Default CSS classes
var active = "active",
inactive = "inactive";
return this.each(function() {
// Increment coookie counter to ensure cookie name integrity
cookieCounter++;
var obj = $(this),
// Find all headers and wrap them in <a> for accessibility.
sections = obj.find(op.head).wrapInner('<a href="#"></a>'),
l = sections.length,
cookie = op.cookieName + "_" + cookieCounter;
// Locate all panels directly following a header
var panel = obj.find(op.head).map(function() {
var head = $(this)
if(!head.hasClass(active)) {
return head.next(op.group).hide()[0];
}
return head.next(op.group)[0];
});
// Bind event for showing content
obj.bind("show", function(e, bypass) {
var obj = $(e.target);
// ARIA attribute
obj.attr('aria-hidden', false)
.prev()
.removeClass(inactive)
.addClass(active);
// Bypass method for instant display
if(bypass) {
obj.show();
} else {
op.show.call(obj);
}
});
// Bind event for hiding content
obj.bind("hide", function(e, bypass) {
var obj = $(e.target);
obj.attr('aria-hidden', true)
.prev()
.removeClass(active)
.addClass(inactive);
if(bypass) {
obj.hide();
} else {
op.hide.call(obj);
}
});
// Look for existing cookies
if(cookieSupport) {
for (var c=0;c<=l;c++) {
var val = $.cookie(cookie + c);
// Show content if associating cookie is found
if ( val == c + "open" ) {
panel.eq(c).trigger('show', [true]);
// Hide content
} else if ( val == c + "closed") {
panel.eq(c).trigger('hide', [true]);
}
}
}
// Delegate click event to show/hide content.
obj.bind("click", function(e) {
var t = $(e.target);
// Check if header was clicked
if(!t.is(op.head)) {
// What about link inside header.
if ( t.parent().is(op.head) ) {
t = t.parent();
} else {
return;
}
e.preventDefault();
}
// Figure out what position the clicked header has.
var num = sections.index(t),
cookieName = cookie + num,
cookieVal = num,
content = t.next(op.group);
// If content is already active, hide it.
if(t.hasClass(active)) {
content.trigger('hide');
cookieVal += 'closed';
if(cookieSupport) {
$.cookie(cookieName, cookieVal, { path: '/', expires: 10 });
}
return;
}
// Otherwise show it.
content.trigger('show');
cookieVal += 'open';
if(cookieSupport) {
$.cookie(cookieName, cookieVal, { path: '/', expires: 10 });
}
});
});
}
});
// Make sure can we eat cookies without getting into trouble.
var cookieSupport = (function() {
try {
$.cookie('x', 'x', { path: '/', expires: 10 });
$.cookie('x', null);
}
catch(e) {
return false;
}
return true;
})();
})(jQuery);

View file

@ -0,0 +1,96 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,13 @@
window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());
/*
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);

View file

@ -0,0 +1,24 @@
// Stolen from StackOverflow. Find all </code><pre><code>
// elements on the page and add the "prettyprint" style. If at least one
// prettyprint element was found, call the Google Prettify prettyPrint() API.
//http://sstatic.net/so/js/master.js?v=6523
function styleCode()
{
if (typeof disableStyleCode != "undefined")
{
return;
}
var a = false;
$("pre code").parent().each(function()
{
if (!$(this).hasClass("prettyprint"))
{
$(this).addClass("prettyprint");
a = true
}
});
if (a) { prettyPrint() }
}

View file

@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

View file

@ -0,0 +1,439 @@
$(function () {
'use strict';
var baseTitle = document.title, // base (general) part of title
pathName = window.location.pathname,
fileName = pathName.substring(window.location.pathname.lastIndexOf("/") + 1);
if(window.addEventListener)
window.addEventListener('load', loadCallback, true);
else
window.attachEvent('load', loadCallback, true);
if (pathName.indexOf("nodejs_ref_guide") >= 0)
$('li#node_js_ref').addClass("active");
else if (pathName.indexOf("nodejs_dev_guide") >= 0)
$('li#nodejs_dev_guide').addClass("active");
else if (pathName.indexOf("js_doc") >= 0)
$('li#js_doc').addClass("active");
function loadCallback(evt){
var form = document.getElementById("searchbox");
var input = form.query;
form.onsubmit = function (evt) {
var query = input.value;
if (query) {
input.value = "";
input.blur();
var currentVersion = $('#currentVersion').text();
var url = "https://www.google.com/search?q=" + encodeURIComponent("site:nodemanual.org/" + currentVersion + " " + query);
window.open(url);
}
return false;
};
}
var fileNameRE = new RegExp("^" + fileName, "i");
$('a.menuLink').each(function(index) {
if ($(this).attr("href").match(fileNameRE))
{
$(this).addClass("currentItem");
return false;
}
});
// function getTitle($article) {
// var title = [baseTitle];
//
// if ($article.data('title')) {
// title.push($article.data('title'));
// }
//
// return title.join(' | ');
// }
// function eachParent($item, callback) {
// var $parent = $item.data('ndoc.parent');
// if ($parent && $parent.length) {
// eachParent($parent, callback);
// callback($parent);
// }
// }
// activates item (used upon scrolling)
// function activate($article, expandParents) {
// var $item;
//
// if ($active) {
// $item = $active.data('ndoc.item') || $empty;
// $item.removeClass('current');
// eachParent($item, function ($parent) {
// $parent.removeClass('current-parent');
// });
// }
//
// // set new active article
// $active = $article;
//
// // update title
// document.title = getTitle($article);
//
// $item = $active.data('ndoc.item') || $empty;
// $item.addClass('current');
// eachParent($item, function ($parent) {
// $parent.addClass('current-parent');
// if (expandParents) {
// $parent.data('ndoc.childs')
// .data('ndoc.collapsed', false)
// .animate({
// height: 'show',
// opacity: 'show'
// });
// }
// });
// }
// function processScroll(evt, expandParents) {
// var scrollTop = $window.scrollTop() + 10,
// i = targets.length;
//
// while (i--) {
// if ($active !== targets[i].article && scrollTop >= targets[i].offset
// && (!targets[i + 1] || scrollTop <= targets[i + 1].offset)) {
// activate(targets[i].article, expandParents)
// return;
// }
// }
// }
// init articles
// $('article.article').each(function () {
// var $article = $(this);
//
// targets.push({
// article: $article,
// offset: $article.offset().top
// });
// });
// init menu items
// $items.each(function () {
// var $item = $(this),
// $childs = $item.parent().next(),
// $parent = $item.parents('ul').eq(0).prev().children(),
// $article = $('[id="' + $item.attr('href').slice(1) + '"]');
//
// // cross-refs
// $item.data('ndoc.parent', $parent);
// $item.data('ndoc.childs', $childs);
// $article.data('ndoc.item', $item);
//
// // bind activator
// $item.on('click', function () {
// if ($item.hasClass('current') && !$childs.data('ndoc.collapsed')) {
// $childs.data('ndoc.collapsed', true).animate({
// height: 'hide',
// opacity: 'hide'
// });
// return false;
// }
//
// activate($article);
//
// $item.data('ndoc.childs').data('ndoc.collapsed', false).animate({
// height: 'show',
// opacity: 'show'
// });
// });
//
// // collapse all 2nd levels
// if (0 != $parent.length) {
// $childs.data('ndoc.collapsed', true).hide();
// }
// });
// function updateSearchResults() {
// $results.empty();
//
// if ('' == this.value) {
// $results.hide();
// return;
// }
//
// $results.show();
//
// $items.filter('[data-id*="' + this.value + '"]').each(function () {
// var $item = $(this);
// $('<div class="menu-item">').append(
// $item.clone(false)
// .text($item.data('id'))
// .on('click', function () {
// $item.trigger('click');
// })
// ).appendTo($results);
// });
// }
// init search
$('#search')
// prevent from form submit
.on('submit', function () {
return false;
})
.find('input')
//.on('keyup', $.throttle(250, updateSearchResults))
// click - cuz i don't know what event fied on input clear in Chrome
//.on('change click', updateSearchResults);
// init scrollspy
//$window.on('scroll', $.throttle(250, processScroll));
// initial jump (required for FF only - Chrome don't need it)
//processScroll(null, true);
// init prettyprint
$('pre > code').addClass('prettyprint');
prettyPrint();
//set the height of the sidebar
// var sidebarHeight = $('#sidebar').height(),
// contentHeight = $('.container .content .span11').height();
// if(contentHeight > sidebarHeight)
// $('#sidebar').height(contentHeight);
// else
// $('#sidebar').height(sidebarHeight + 10);
// function isScrolledIntoView(elem) {
// var docViewTop = $(window).scrollTop();
// var docViewBottom = docViewTop + $(window).height();
//
// var elemTop = $(elem).offset().top;
// var elemBottom = elemTop + $(elem).height() -60;
//
// return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
// }
//
// $('#sidebar').height($(window).height() - $('#overview').outerHeight() - 25 + ($('html').scrollTop() <= 85 ? $('html').scrollTop() : 85 ))
var bgHeightSet = false,
// $sidebar = $('#sidebar'),
$pagination = $('.members'),
// $paginationBackground = $('.membersBackground'),
$paginationContent = $('.membersContent'),
$tabs = $('.tabs'),
$topSection = $('#topSection');
function handleScroll() {
var s, sx;
// scrolling offset calculation via www.quirksmode.org
if (window.pageYOffset || window.pageXOffset) {
s = window.pageYOffset;
sx = window.pageXOffset;
}
else if (document.documentElement
&& (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
s = document.documentElement.scrollTop;
sx = document.documentElement.scrollLeft;
}
else if (document.body) {
s = document.body.scrollTop;
sx = document.body.scrollLeft;
}
if (document.documentElement.offsetWidth < 1010) {
if (sx <= 0) sx = 0;
else if (sx + document.documentElement.offsetWidth > 1010)
sx = 1010 - document.documentElement.offsetWidth;
}
else
sx = 0;
$topSection.css({'left': -1 * sx});
if (s > 163) { //header_offset - 35) {
$paginationContent.css('left', -1 * sx);
if (bgHeightSet)
return;
// $sidebar.css({
// 'position': 'fixed',
// 'top': 41,
// 'padding':0
// });
// if(!bgHeightSet) {
// $paginationBackground.css('display', 'block')//.stop().animate({'height': 44, 'opacity':1}, 'normal', 'linear');
// }
// var leftPos = $paginationContent.outerWidth() + $paginationContent.position().left > $(window).width()
// ? $(window).width()- $paginationContent.outerWidth()
// : $paginationContent.offset().left - $('html').scrollLeft()
// $paginationContent.css('left', leftPos);
$paginationContent.css('top', 0);
//$paginationContent.stop().animate({'top': 0}, 300);
$pagination
// .css({'background': 'white'})
.addClass('shadow')
.stop().css({height: 31})
/*animate({'height': 31}, {
duration : 300,
complete : function(){
// $pagination.css({'background': ''});
}
})*/
// .next().css({'padding-top': $pagination.outerHeight()})
.closest('.content').addClass('srolled')
// setTimeout(function(){
// $pagination.css({'background': ''});
// }, 300);
$tabs.addClass('tabsSansBorder');
bgHeightSet = true;
}
else {
if (!bgHeightSet)
return;
// $sidebar.css({
// 'position': 'relative',
// 'top': 0,
// 'padding-top':25
// });
$paginationContent.stop().css({top:11});//animate({'top': 11}, 300);
$pagination.css({'position': 'absolute', 'top': 193});
$pagination.stop()
.removeClass('shadow')
.css({height: 42})
//.animate({'background': 'transparant'}, 300);
$paginationContent.css('left', 0);
setTimeout(function(){
$pagination
// .animate({'height': 42}, {
// 'complete' : function(){
$paginationContent.css({'top': ''});
$pagination.css({'position': '', 'top': ''});
$paginationContent.css('left', 0);
$pagination.closest('.content').removeClass('srolled')
$tabs.removeClass('tabsSansBorder');
// }
// }, 300);
}, 300);
bgHeightSet = false;
// $paginationBackground.stop().css({'display': 'none'});
}
}
// function handleWinSize(){
// if($(window).width() < 1000)
// $('body').addClass('small_win');
// else
// $('body').removeClass('small_win');
// }
$(window)
.scroll(function(){//auto kanei to header na metakinhtai kai na einai panta visible;
handleScroll();
}).resize(function(){
//handleWinSize();
});
handleScroll();
//handleWinSize();
});
$(document).ready(function(){
var d = 'a.menu, .dropdown-toggle'
function clearMenus() {
$(d).parent('li').each(function(){
$(this).removeClass('open')
});
}
$('span.methodClicker, article.article, h3.methodClicker').each(function(){
var a = $(this);
var constructorPos = a.attr("id").indexOf("new ");
var objName = a.attr("id");
if (constructorPos >= 0)
{
objName = objName.substring(constructorPos + 4);
objName += ".new";
}
a.attr("id", "js_" + objName);
});
$('.brand').parent('.dropdown').hover(
function(){
$(this).addClass('open');
},
function(){
clearMenus();
});
$('.versions').hover(
function(){
$(this).addClass('open');
},
function(){
clearMenus();
});
function showMethodContent(){
if(!location.hash)
return;
var $clickerEl = $('span#js_' + location.hash.replace(/^#/,'').replace(/\./g, '\\.'));
if ($clickerEl.length > 0 && $clickerEl.hasClass('methodClicker')) {
var p = $clickerEl.parent();
p[0].force = true;
p.trigger('click');
p[0].force = false;
}
}
if (location.hash) {
showMethodContent();
var data = location.hash;
scrollTo(null, data.substr(1));
}
window.onhashchange = function(){
showMethodContent();
}
//$('#content article:last').css('padding-bottom', 50);
});
function scrollTo(el, data){
if (!data) {
data = el.getAttribute("data-id");
location.hash = data;
}
var el = $("span#js_" + data.replace(/\./g, "\\."))[0];
if (!el) return;
var article = $(el).closest('.article')[0];
var top = article.offsetTop - 100;
if (document.body.scrollTop > top
|| document.body.scrollTop != top && document.body.scrollTop
+ (window.innerHeight || document.documentElement.offsetHeight) <
top + article.offsetHeight) {
//document.body.scrollTop = top;
$('body').animate({scrollTop : top}, {
duration: 200,
easing : "swing"
});
}
}

View file

@ -0,0 +1,53 @@
div#well
h3 Core
ul.menu
li
div.menu-item
a(class="menuLink namespace", href="ace.html") Ace
li
div.menu-item
a(class="menuLink namespace", href="anchor.html") Anchor
li
div.menu-item
a(class="menuLink namespace", href="background.tokenizer.html") BackgroundTokenizer
li
div.menu-item
a(class="menuLink namespace", href="edit.session.html") EditSession
li
div.menu-item
a(class="menuLink namespace", href="editor.html") Editor
li
div.menu-item
a(class="menuLink namespace", href="placeholder.html") PlaceHolder
li
div.menu-item
a(class="menuLink namespace", href="range.html") Range
li
div.menu-item
a(class="menuLink namespace", href="renderloop.html") RenderLoop
li
div.menu-item
a(class="menuLink namespace", href="scrollbar.html") Scrollbar
li
div.menu-item
a(class="menuLink namespace", href="search.html") Search
li
div.menu-item
a(class="menuLink namespace", href="selection.html") Selection
li
div.menu-item
a(class="menuLink namespace", href="split.html") Split
li
div.menu-item
a(class="menuLink namespace", href="token.iterator.html") TokenIterator
li
div.menu-item
a(class="menuLink namespace", href="tokenizer.html") Tokenizer
li
div.menu-item
a(class="menuLink namespace", href="undomanager.html") UndoManager
li
div.menu-item
a(class="menuLink namespace", href="virtual.renderer.html") VirtualRenderer

View file

@ -0,0 +1,57 @@
include ../../../common_layout
include lib
mixin identifyBuild(tree)
mixin doctype
mixin head('Ace API Reference')
body(onload="styleCode()")
mixin topBar("Ace")
mixin header
.container
.content
.row.container
.span5.offset4.sidebarContainer
#sidebar
include ace_menu.jade
.span11
for obj in tree.children
.membersBackground
.members
.membersContent
h1.memberHeader
-var heading = obj.path.replace('_', '')
span.name #{heading}
span.editInC9
mixin formatGHHref(obj.href, 'nodejs_ref_guide')
-if (true || obj.filename.indexOf("index") < 0)
if obj.type == 'class' || obj.type == 'namespace' || obj.type == 'section'
ul(class='tabs', data-tabs='tabs')
for selector, title in {'Events': ['event', 'events'], 'Constructors': ['constructor', 'constructors'], 'Class methods': ['class method', 'class_methods'], 'Class properties': ['class property', 'class_properties'], 'Instance methods': ['instance method', 'instance_methods'], 'Instance properties': ['instance property', 'instance_properties'], 'Constants': ['constant', 'constants']}
methods = obj.children.filter(function(x){return x.type === selector[0]})
li(class="dropdown", data-dropdown="dropdown")
if methods.length
a(href="\#", class="dropdown-toggle")!= renameMemberTitle(title, methods.length)
ul.dropdown-menu
for m in methods
li(data-id='#{m.id}', class='memberLink')
mixin link(m, true)
else
ul(class='tabs', data-tabs='tabs')
-console.log("I did not create a menu for: { obj.id: " + obj.id + ", obj.name: " + obj.name + " }, which is a " + obj.type)
#content
mixin api()
div(id="disqus_thread")
mixin footer
mixin endingScripts
</html>

View file

@ -0,0 +1,286 @@
- var methodSection = constructorSection = propertySection = eventSection = false;
mixin argument(arg, reqOptObj)
td
p
i
#{arg.name}
if arg.types
td
p
for type, i in arg.types
- if (i == arg.types.length - 1)
mixin link(type)
- else
mixin link(type) |
td
-var argStatus = "Required. "
if reqOptObj.length > 0
for argInfo in reqOptObj
- if (argInfo !== undefined && arg.name === argInfo.name && argInfo.optional)
-argStatus = "Optional. "
mixin markdown(argStatus + arg.description)
-function renameMemberTitle(title, count)
if title.indexOf("ethods") >= 0
span Functions (#{count})
else if title.indexOf("ropert") >= 0
span Properties (#{count})
else
span #{title} (#{count})
mixin article(obj, parents, memberType)
if typeof obj === 'string'
obj = list[obj]
title = obj.id + (obj.type ? ' (' + obj.type + ')' : '')
article.article(id=obj.path, data-title=title)
if obj.type === 'section' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin'
if obj.description
.section.description
.memberContent
mixin markdown(obj.description)
collection = obj.children.filter(function(x){return x.type === 'namespace'});
if collection.length
.section.namespaces
//
h3 Namespaces
.memberContent
mixin short_description_list(collection)
collection = obj.children.filter(function(x){return x.type === 'mixin'});
if collection.length
.section.mixins
//
h3 Mixins
.memberContent
mixin short_description_list(collection)
if obj.type === 'class'
if obj.superclass
.section.superclass
// h3
Superclass
.memberContent
mixin link(obj.superclass)
if obj.subclasses.length
.section.subclasses
// h3
Subclasses
.memberContent
mixin links(obj.subclasses)
if obj.included_mixins
.section.mixins
// h3
Includes
.memberContent
mixin links(obj.included_mixins)
collection = obj.children.filter(function(x){return x.type === 'utility'})
if collection.length
.section.utilities
// h3
Utilities
.memberContent
mixin links(collection)
else
-var reqOptObj = [];
.section.method
.memberContent
if obj.signatures
div.title
ul.signatures
-var loops = 0;
for sig in obj.signatures
if sig.args
for arg in sig.args
-reqOptObj.push({name: arg.name, optional: arg.optional}) // only sig object has "optional" information; store for later use
li.signature
ul
li.signature-call!= sanitize_link(signature(obj, sig, memberType, obj.id))
if sig.returns
li.signature-returns
ul.argument-types
for ret in sig.returns
non_link = obj.type == 'constant' || ret.type == 'Void' || ret.type == 'null'
//- N.B: type can be array. E.g. [ Element... ]
//- N.B: type can be array. E.g. [ Element1, Element2 ]
text = ''
if (typeof ret.type !== 'string')
- text = ret.type.map(function(r){ return link(r || '?', true, ['link-short']);}).join(', ');
else
if non_link
text = ret.type
else
text = link(ret.type || '?', true, ['link-short'], "ret")
if ret.ellipsis
text = text + '...'
if ret.array
text = '[ ' + text + ' ]'
li.argument-type!= sanitize_link(text)
-if (loops == 0)
-loops = 1 // ensure that we only print ONE meta info UL per signature (some methods have multiple forms)
ul.metaInfo
if obj.readonly
li
span.label.read-only Read-Only
if obj.chainable
li
span.label.chainable Chainable
if obj.internal
li
span.label.internal Internal
if obj.deprecated
li
span.label.deprecated
| Deprecated
if obj.deprecated.from
| &nbsp; (since #{obj.deprecated.from})
if obj.deprecated.off
| &nbsp;and will be removed on #{obj.deprecated.off}
if obj.aliases && obj.aliases.length
li
span.label.alias
| Aliased as:
ul.alias
for alias in obj.aliases
li
mixin link(alias)
if obj.related_to
li
span.label.related-to
| Related to
mixin link(obj.related_to)
div.sideToggler
if obj.ellipsis_description
div(id='ellipsis_#{obj.id}', class='ellipsis_description')
mixin markdown(obj.short_description)
div(id='short_#{obj.id}', class='short_description hiddenSpan')
mixin markdown(obj.short_description)
h3(id='#{obj.id}', class='methodToggle methodClicker inactive')
&nbsp;&nbsp;&nbsp;
div.description
-description = obj.description.substring(obj.short_description.length) // cut the short_desc out
descArray = description.split("\n#### ")
if obj.arguments
h4 Arguments
table.argument-list.zebra-striped.bordered-table
tbody
-for (var a = 0; a < obj.arguments.length; a++)
tr
mixin argument(obj.arguments[a], reqOptObj)
if descArray[0].length && descArray[0] !== '' && descArray[0] !== '\n'
h4 Description
mixin markdown(descArray[0])
if obj.bound && ~obj.bound.indexOf('#')
p.note.methodized
| This method can be called <em>either</em> as an
!= link(obj.bound, 'instance method', ['link-short'])
| <em>or</em> as a generic method. If calling as generic, pass the instance in as the first argument.
else if obj.bound && !~obj.bound.indexOf('#')
p.note.functionalized
| This method can be called <em>either</em> as an instance method <em>or</em> as a
!= link(obj.bound, 'generic method', ['link-short'])
|. If calling as generic, pass the instance in as the first argument.
- var r; // Probably inefficient; we want the Returns section under the Arguments, no matter where in source it's defined
- for (var a = 1; a < descArray.length; a++)
if (descArray[a].indexOf("Returns") >= 0)
mixin markdown("\n#### " + descArray[a])
r = a
- for (var a = 1; a < descArray.length; a++)
if (a != r)
mixin markdown("\n#### " + descArray[a])
//- children
for child in obj.children.filter(function(x){return x.type === 'section'})
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'utility'})
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'constructor'})
- if (!constructorSection)
- constructorSection = true
h3.sectionHeader Constructors
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'event'})
- if (!eventSection)
- eventSection = true
h3.sectionHeader Events
mixin article(child, parents.concat(obj), 'event')
for child in obj.children.filter(function(x){return x.type === 'class method'})
- if (!methodSection)
- methodSection = true
h3.sectionHeader Methods
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'class property'})
- if (!propertySection)
- propertySection = true
h3.sectionHeader Properties
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'instance method'})
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'instance property'})
mixin article(child, parents.concat(obj))
for child in obj.children.filter(function(x){return x.type === 'constant'})
mixin article(child, parents.concat(obj))
mixin api()
for obj in tree.children
mixin article(obj, [])
mixin short_description_list(collection)
ul.method-details-list
for obj in collection
if typeof obj === 'string'
obj = list[obj]
li.method-description
h4
mixin link(obj)
if obj.short_description
mixin markdown(obj.short_description)
mixin link(obj, short, classes)
l = link(obj, short, classes)
!= sanitize_link(l)
mixin links(collection)
ul.method-list
for obj in collection
li
mixin link(obj)
//- we want to force these links to lowercase;
//- our Linux server doesn't distinguish between case. TODO: fix that?
-function sanitize_link(l)
!= l

View file

@ -0,0 +1,134 @@
-var dirPrefix = "./../";
-var landingPage = 'false'
-var versions = []
mixin doctype
!!! 5
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
mixin head(guideTitle, additionalCSS)
meta(charset="utf-8")
//- N.B. http://blog.yjl.im/2011/01/bad-value-x-ua-compatible-for-attribute.html
meta(http-equiv="X-UA-Compatible", content="IE=edge,chrome=1")
title #{guideTitle}
meta(name="generator", content="c9-doc-build")
meta(name="description", content="A complete and community-driven resource for learning and developing Node.js applications.")
meta(name="author", content="Garen J. Torikian")
meta(name="viewport", content="width=device-width,initial-scale=1")
link(rel="stylesheet", href="#{dirPrefix}resources/csses/bootstrap.css")
link(rel="stylesheet", href="#{dirPrefix}resources/csses/prettify.css")
link(rel="stylesheet", href="#{dirPrefix}resources/csses/refguide_overrides.css")
link(href="#{dirPrefix}resources/images/favicon.ico", rel="icon", type="image/x-icon")
if additionalCSS
link(rel="stylesheet", href="#{additionalCSS}")
script(src="#{dirPrefix}resources/javascripts/jquery.js")
script(src="#{dirPrefix}resources/javascripts/clicker.js")
script(src="#{dirPrefix}resources/javascripts/jquery.collapse.js")
script(src="#{dirPrefix}resources/javascripts/jquery.cookie.js")
script(src="#{dirPrefix}resources/javascripts/bootstrap-dropdown.js")
mixin topBar(fullPath)
div.topbar
div.fill
div.container#topSection
ul.nav(class="leftnav")
li(class="dropdown", data-dropdown="dropdown")
a(class="dropdown-toggle", href="/")
//div(class="arrow-down")
ul(class="dropdown-menu")
li(class="dropdown versions")
ul.nav
form(id='searchbox', action='', class='pull-right')
input(class='span3', name='query', type='text', placeholder="Search Documentation", title="Search across all the documentation types")
span(id='currentVersion', style='display: none')
mixin makeVersionLabel(fullPath, true)
mixin header
header.jumbotron.masthead#overview
//- a(class="c9-sponsor", href="http://c9.io/", title="cloud9 ide", target="_blank")
div.inner
div.container
h1 Ace API Reference
p.lead
mixin footer
footer#footer
.container
.footer-text
mixin endingScripts
// scripts concatenated and minified via ant build script
<script defer src="#{dirPrefix}resources/javascripts/plugins.js"></script>
<script defer src="#{dirPrefix}resources/javascripts/prettify.js"></script>
<script defer src="#{dirPrefix}resources/javascripts/prettify-extension.js"></script>
<script defer src="#{dirPrefix}resources/javascripts/script.js"></script>
<script defer src="#{dirPrefix}resources/javascripts/disqus-ext.js"></script>
<script defer src="#{dirPrefix}resources/javascripts/ga.js"></script>
//-<script defer src="tree.js"></script>
// end scripts
//if lt IE 7
script(src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js")
script
window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})
mixin identifyBuild(tree, type)
landingPage = 'true'
-dirPrefix = './'
mixin markdown(text, inline)
html = markdown(text, inline)
!= restoreNotes(html)
-function restoreNotes(html)
-var noteORegex = new RegExp('<note>', "ig")
-var noteCRegex = new RegExp('</note>', "ig")
-var warningORegex = new RegExp('<warning>', "ig")
-var warningCRegex = new RegExp('</warning>', "ig")
if (html.match(noteORegex))
-html = html.replace(noteORegex, "<div class='alert-message block-message warning'>")
if (html.match(warningORegex))
-html = html.replace(warningORegex, "<div class='alert-message block-message error'>")
if (html.match(noteCRegex))
-html = html.replace(noteCRegex, "</div>")
if (html.match(warningCRegex))
-html = html.replace(warningCRegex, "</div>")
!= html
mixin formatGHHref(url, type)
url = url.substring(url.indexOf("src/") + 4)
if type == 'nodejs_ref_guide'
url = url.substring(0, url.lastIndexOf("#"))
url = 'src/' + url
else if type == 'nodejs_dev_guide'
url = 'src/' + url
-url = url.replace(/\/{2,}/g, "/").replace(/\//g,"%2F")
<a href='http://c9.io/open/git/?url=git%3A%2F%2Fgithub.com%2Fc9%2Fnodemanual.org.git&file=#{url}&line_start=3&line_end=0' title='Edit in Cloud9 IDE'>[edit]</a>
mixin makeVersionLabel(fullPath, showText)
-if (fullPath.indexOf("latest") >= 0)
-if (!showText)
!= '0.6.9'
else
!= 'latest'
-else
!= fullPath.match(/\d\.\d\.\d/)

View file

@ -0,0 +1,34 @@
include ../common_layout
mixin identifyBuild('','')
mixin doctype
mixin head('Ace API Reference')
body(onload="styleCode()")
mixin topBar(whoAmI)
mixin header
.container
.content
.row.container
.span5.offset4.sidebarContainer
#sidebar
.span11
div.title
h1.pageTitle #{title}
.dev_guide#content
mixin markdown(data)
div#disqus_thread
mixin footer
mixin endingScripts
</html>