First dump of doc stuff
3
doc/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.DS_Store
|
||||
out/
|
||||
node_modules/
|
||||
15
doc/README.md
Normal 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
|
|
@ -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
|
|
@ -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": {}
|
||||
}
|
||||
2471
doc/resources/ace/skins/skeleton/csses/bootstrap.css
vendored
Normal file
52
doc/resources/ace/skins/skeleton/csses/prettify.css
Normal 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 }
|
||||
1031
doc/resources/ace/skins/skeleton/csses/refguide_overrides.css
Normal file
BIN
doc/resources/ace/skins/skeleton/images/arrow-footer.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
BIN
doc/resources/ace/skins/skeleton/images/c9-log-footer.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
doc/resources/ace/skins/skeleton/images/c9-sponsor.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
doc/resources/ace/skins/skeleton/images/cloud9-logo.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
doc/resources/ace/skins/skeleton/images/content-bg.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
doc/resources/ace/skins/skeleton/images/content-top-bg.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
doc/resources/ace/skins/skeleton/images/content-top.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
doc/resources/ace/skins/skeleton/images/footer-bg.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
doc/resources/ace/skins/skeleton/images/main-bg.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
doc/resources/ace/skins/skeleton/images/member-sprites.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
doc/resources/ace/skins/skeleton/images/menu_disc.png
Normal file
|
After Width: | Height: | Size: 556 B |
BIN
doc/resources/ace/skins/skeleton/images/method-bg.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
BIN
doc/resources/ace/skins/skeleton/images/sidebar-border.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
doc/resources/ace/skins/skeleton/images/sidebar-top-bg.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
60
doc/resources/ace/skins/skeleton/javascripts/bootstrap-dropdown.js
vendored
Normal 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 );
|
||||
72
doc/resources/ace/skins/skeleton/javascripts/clicker.js
Normal 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];
|
||||
});
|
||||
});
|
||||
|
||||
12
doc/resources/ace/skins/skeleton/javascripts/disqus-ext.js
Normal 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);
|
||||
})();
|
||||
10
doc/resources/ace/skins/skeleton/javascripts/ga.js
Normal 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);
|
||||
|
||||
})();
|
||||
151
doc/resources/ace/skins/skeleton/javascripts/jquery.collapse.js
Normal 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);
|
||||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
4
doc/resources/ace/skins/skeleton/javascripts/jquery.js
vendored
Normal file
13
doc/resources/ace/skins/skeleton/javascripts/plugins.js
Normal 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);
|
||||
|
|
@ -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() }
|
||||
}
|
||||
28
doc/resources/ace/skins/skeleton/javascripts/prettify.js
Normal 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"}})();
|
||||
439
doc/resources/ace/skins/skeleton/javascripts/script.js
Normal 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"
|
||||
});
|
||||
}
|
||||
}
|
||||
53
doc/resources/ace/skins/templates/ace_menu.jade
Executable 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
|
||||
57
doc/resources/ace/skins/templates/layout.jade
Normal 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>
|
||||
286
doc/resources/ace/skins/templates/lib.jade
Normal 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
|
||||
| (since #{obj.deprecated.from})
|
||||
if obj.deprecated.off
|
||||
| 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')
|
||||
|
||||
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
|
||||
134
doc/resources/common_layout.jade
Normal 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/)
|
||||
34
doc/resources/landing/layout.jade
Normal 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>
|
||||
|
|
@ -35,6 +35,14 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* class Ace
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
|
|
@ -48,6 +56,13 @@ var EditSession = require("./edit_session").EditSession;
|
|||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||
|
||||
/**
|
||||
* Ace.edit(el) -> Editor
|
||||
* - el (String | Element): Either the id of an element to edit, or the element itself
|
||||
*
|
||||
* Edits an element. TODO.
|
||||
*
|
||||
**/
|
||||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
|
|
@ -74,4 +89,4 @@ exports.edit = function(el) {
|
|||
return editor;
|
||||
};
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,9 +42,22 @@ var oop = require("./lib/oop");
|
|||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* An Anchor is a floating pointer in the document. Whenever text is inserted or
|
||||
* deleted before the cursor, the position of the cursor is updated
|
||||
*/
|
||||
* class Anchor
|
||||
*
|
||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Anchor(doc, row, column)
|
||||
* - doc (Document): The document to associate with the anchor
|
||||
* - row (Number): The starting row position
|
||||
* - column (Number): The starting column position
|
||||
*
|
||||
* Creates a new `Anchor` and associates it with a document.
|
||||
*
|
||||
**/
|
||||
|
||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
this.document = doc;
|
||||
|
||||
|
|
@ -61,14 +74,36 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Anchor.getPosition() -> Object
|
||||
*
|
||||
* Returns an object identifying the `row` and `column` position of the current anchor.
|
||||
*
|
||||
**/
|
||||
|
||||
this.getPosition = function() {
|
||||
return this.$clipPositionToDocument(this.row, this.column);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Anchor.getDocument() -> Document
|
||||
*
|
||||
* Returns the current document.
|
||||
*
|
||||
**/
|
||||
|
||||
this.getDocument = function() {
|
||||
return this.document;
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor@onChange(e)
|
||||
* - e (Event): TODO
|
||||
*
|
||||
* Fires whenever the anchor position changes.
|
||||
*
|
||||
**/
|
||||
|
||||
this.onChange = function(e) {
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
|
|
@ -134,6 +169,16 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
this.setPosition(row, column, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.setPosition(row, column, noClip) -> Void
|
||||
* - row (Number): The row index to move the anchor to
|
||||
* - column (Number): The column index to move the anchor to
|
||||
* - noClip (Boolean): Identifies if you want the position to be clipped
|
||||
*
|
||||
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
|
||||
*
|
||||
**/
|
||||
|
||||
this.setPosition = function(row, column, noClip) {
|
||||
var pos;
|
||||
if (noClip) {
|
||||
|
|
@ -162,10 +207,26 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.detach()
|
||||
*
|
||||
* When called, the `'change'` event listener is removed.
|
||||
*
|
||||
**/
|
||||
|
||||
this.detach = function() {
|
||||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.clipPositionToDocument(row, column) -> Void
|
||||
* - row (Number): The row index to clip the anchor to
|
||||
* - column (Number): The column index to clip the anchor to
|
||||
*
|
||||
* Clips the anchor position to the specified row and column. TODO
|
||||
*
|
||||
**/
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,24 @@ define(function(require, exports, module) {
|
|||
var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class Background_Tokenizer
|
||||
*
|
||||
* Tokenizes items..in the background? TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Background_Tokenizer(tokenizer, editor)
|
||||
* - tokenizer (Tokenizer): The tokenizer to use
|
||||
* - editor (Editor): The editor to associate with
|
||||
*
|
||||
* Creates a new `BackgroundTokenizer` object.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.running = false;
|
||||
this.lines = [];
|
||||
|
|
@ -82,6 +100,14 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.setTokenizer(tokenizer) -> Void
|
||||
* - tokenizer (Tokenizier): The new tokenizer to use
|
||||
*
|
||||
* Sets a new tokenizer for this object.
|
||||
*
|
||||
**/
|
||||
|
||||
this.setTokenizer = function(tokenizer) {
|
||||
this.tokenizer = tokenizer;
|
||||
this.lines = [];
|
||||
|
|
@ -89,6 +115,14 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this.start(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.setDocument(doc) -> Void
|
||||
* - doc (Document): The new document to associate with
|
||||
*
|
||||
* Sets a new document to associate with this object.
|
||||
*
|
||||
**/
|
||||
|
||||
this.setDocument = function(doc) {
|
||||
this.doc = doc;
|
||||
this.lines = [];
|
||||
|
|
@ -96,6 +130,15 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this.stop();
|
||||
};
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.fireUpdateEvent(firstRow, lastRow) -> Void
|
||||
* - firstRow (Number): The starting row region
|
||||
* - lastRow (Number): The final row region
|
||||
*
|
||||
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
||||
*
|
||||
**/
|
||||
|
||||
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||
var data = {
|
||||
first: firstRow,
|
||||
|
|
@ -104,6 +147,15 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this._emit("update", {data: data});
|
||||
};
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.start(startRow, lastRow) -> Void
|
||||
* - startRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
*
|
||||
* Starts tokenizing at the row indicated. TODO
|
||||
*
|
||||
**/
|
||||
|
||||
this.start = function(startRow) {
|
||||
this.currentLine = Math.min(startRow || 0, this.currentLine,
|
||||
this.doc.getLength());
|
||||
|
|
@ -116,20 +168,56 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this.running = setTimeout(this.$worker, 700);
|
||||
};
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.stop() -> Void
|
||||
*
|
||||
* Stops tokenizing.
|
||||
*
|
||||
**/
|
||||
|
||||
this.stop = function() {
|
||||
if (this.running)
|
||||
clearTimeout(this.running);
|
||||
this.running = false;
|
||||
};
|
||||
|
||||
/** related to: BackgroundTokenizer.$tokenizeRows
|
||||
* Background_Tokenizer.getTokens(firstRow, lastRow) -> Array
|
||||
* - firstRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
*
|
||||
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
|
||||
*
|
||||
**/
|
||||
|
||||
this.getTokens = function(firstRow, lastRow) {
|
||||
return this.$tokenizeRows(firstRow, lastRow);
|
||||
};
|
||||
|
||||
/** related to: BackgroundTokenizer.$tokenizeRows
|
||||
* Background_Tokenizer.getState(row) -> Array
|
||||
* - row (Number): The row to start at
|
||||
*
|
||||
* Retrieves the state of tokenization for a row. Returns the tokenized row.
|
||||
*
|
||||
**/
|
||||
|
||||
this.getState = function(row) {
|
||||
return this.$tokenizeRows(row, row)[0].state;
|
||||
};
|
||||
|
||||
/**
|
||||
* Background_Tokenizer.$tokenizeRows(firstRow, lastRow) -> Array
|
||||
* - startRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
*
|
||||
* Tokenizes all the rows within the specified region.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns a list of the tokenized rows. Each item in the list is an object with two properties, `state` and `start`.
|
||||
*
|
||||
**/
|
||||
this.$tokenizeRows = function(firstRow, lastRow) {
|
||||
if (!this.doc || isNaN(firstRow) || isNaN(lastRow))
|
||||
return [{'state':'start','tokens':[]}];
|
||||
|
|
|
|||
|
|
@ -43,6 +43,21 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
var Range = require("./range").Range;
|
||||
var Anchor = require("./anchor").Anchor;
|
||||
|
||||
/**
|
||||
* class Document
|
||||
*
|
||||
* Documentation about Document. Is this recursion? TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Document(text)
|
||||
* - text (String | Array): The starting text
|
||||
*
|
||||
* Creates a new `Document`. TODO
|
||||
*
|
||||
**/
|
||||
var Document = function(text) {
|
||||
this.$lines = [];
|
||||
|
||||
|
|
@ -62,20 +77,48 @@ var Document = function(text) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.setValue = function(text) {
|
||||
/**
|
||||
* Document.setValue(text) -> Void
|
||||
* - text (String): The value to set
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.setValue = function(text) {
|
||||
var len = this.getLength();
|
||||
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
|
||||
this.insert({row: 0, column:0}, text);
|
||||
};
|
||||
|
||||
this.getValue = function() {
|
||||
/**
|
||||
* Document.getValue() -> String
|
||||
*
|
||||
* Returns all the lines in the document, split by the new line character.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
return this.getAllLines().join(this.getNewLineCharacter());
|
||||
};
|
||||
|
||||
this.createAnchor = function(row, column) {
|
||||
/**
|
||||
* Document.createAnchor(row, column) -> Anchor
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.createAnchor = function(row, column) {
|
||||
return new Anchor(this, row, column);
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.$split(text) -> Array
|
||||
* - text (String): The text to work with
|
||||
*
|
||||
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
**/
|
||||
|
||||
// check for IE split bug
|
||||
if ("aaa".split(/a/).length == 0)
|
||||
this.$split = function(text) {
|
||||
|
|
@ -87,7 +130,12 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
/**
|
||||
* Document.$detectNewLine(text) -> Void
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r\n|\r|\n)/m);
|
||||
if (match) {
|
||||
this.$autoNewLine = match[1];
|
||||
|
|
@ -96,7 +144,20 @@ var Document = function(text) {
|
|||
}
|
||||
};
|
||||
|
||||
this.getNewLineCharacter = function() {
|
||||
/**
|
||||
* Document.getNewLineCharacter() -> String
|
||||
*
|
||||
* Returns the new line character that's being used, depending on the value of `newLineMode`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `newLineMode == windows`, `\r\n` is returned.
|
||||
* If `newLineMode == unix`, `\n` is returned.
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getNewLineCharacter = function() {
|
||||
switch (this.$newLineMode) {
|
||||
case "windows":
|
||||
return "\r\n";
|
||||
|
|
@ -111,45 +172,88 @@ var Document = function(text) {
|
|||
|
||||
this.$autoNewLine = "\n";
|
||||
this.$newLineMode = "auto";
|
||||
this.setNewLineMode = function(newLineMode) {
|
||||
/**
|
||||
* Document.setNewLineMode(newLineMode) -> Void
|
||||
* - newLineMode(String): The newline mode to use; can be either `windows`, `unix`, or `auto`
|
||||
*
|
||||
* Sets the new line mode.
|
||||
**/
|
||||
this.setNewLineMode = function(newLineMode) {
|
||||
if (this.$newLineMode === newLineMode)
|
||||
return;
|
||||
|
||||
this.$newLineMode = newLineMode;
|
||||
};
|
||||
|
||||
this.getNewLineMode = function() {
|
||||
/**
|
||||
* Document.getNewLineMode() -> String
|
||||
*
|
||||
* Returns the type of newlines being used; either `windows`, `unix`, or `auto`
|
||||
*
|
||||
**/
|
||||
this.getNewLineMode = function() {
|
||||
return this.$newLineMode;
|
||||
};
|
||||
|
||||
this.isNewLine = function(text) {
|
||||
/**
|
||||
* Document.isNewLine(text) -> Boolean
|
||||
* - text (String): The text to check
|
||||
*
|
||||
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
||||
*
|
||||
**/
|
||||
this.isNewLine = function(text) {
|
||||
return (text == "\r\n" || text == "\r" || text == "\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
* Document.getLine(row) -> String
|
||||
* - row (Number): The row index to retrieve
|
||||
*
|
||||
* Returns a verbatim copy of the given line as it is in the document
|
||||
*
|
||||
**/
|
||||
this.getLine = function(row) {
|
||||
return this.$lines[row] || "";
|
||||
};
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
/**
|
||||
* Document.getLines(firstRow, lastRow) -> Array
|
||||
* - firstRow (Number): The first row index to retrieve
|
||||
* - lastRow (Number): The final row index to retrieve
|
||||
*
|
||||
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
||||
*
|
||||
**/
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.$lines.slice(firstRow, lastRow + 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all lines in the document as string array. Warning: The caller
|
||||
* should not modify this array!
|
||||
*/
|
||||
this.getAllLines = function() {
|
||||
* Document.getAllLines() -> Array
|
||||
*
|
||||
* Returns all lines in the document as string array. <Warning>The caller should not modify this array!</Warning>
|
||||
**/
|
||||
this.getAllLines = function() {
|
||||
return this.getLines(0, this.getLength());
|
||||
};
|
||||
|
||||
this.getLength = function() {
|
||||
/**
|
||||
* Document.getLength() -> Number
|
||||
*
|
||||
* Returns the number of rows in the document.
|
||||
**/
|
||||
this.getLength = function() {
|
||||
return this.$lines.length;
|
||||
};
|
||||
|
||||
this.getTextRange = function(range) {
|
||||
/**
|
||||
* Document.getTextRange(range) -> Array
|
||||
* - range (String): blah
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.getTextRange = function(range) {
|
||||
if (range.start.row == range.end.row) {
|
||||
return this.$lines[range.start.row].substring(range.start.column,
|
||||
range.end.column);
|
||||
|
|
@ -163,7 +267,13 @@ var Document = function(text) {
|
|||
}
|
||||
};
|
||||
|
||||
this.$clipPosition = function(position) {
|
||||
/**
|
||||
* Document.$clipPosition(position) -> Number
|
||||
* - position (Number): blah
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.$clipPosition = function(position) {
|
||||
var length = this.getLength();
|
||||
if (position.row >= length) {
|
||||
position.row = Math.max(0, length - 1);
|
||||
|
|
@ -172,7 +282,19 @@ var Document = function(text) {
|
|||
return position;
|
||||
};
|
||||
|
||||
this.insert = function(position, text) {
|
||||
/**
|
||||
* Document.insert(position, text) -> Number
|
||||
* - position (Number): The position to start inserting at
|
||||
* - text (String): A chunk of text to insert
|
||||
*
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
if (text.length == 0)
|
||||
return position;
|
||||
|
||||
|
|
@ -194,7 +316,25 @@ var Document = function(text) {
|
|||
return position;
|
||||
};
|
||||
|
||||
this.insertLines = function(row, lines) {
|
||||
/**
|
||||
* Document.insertLines(row, lines) -> Object
|
||||
* - row (Number): The index of the row to insert at
|
||||
* - lines (Array): An array of strings
|
||||
*
|
||||
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
|
||||
*
|
||||
* {row: row, column: 0}
|
||||
*
|
||||
**/
|
||||
this.insertLines = function(row, lines) {
|
||||
if (lines.length == 0)
|
||||
return {row: row, column: 0};
|
||||
|
||||
|
|
@ -212,7 +352,20 @@ var Document = function(text) {
|
|||
return range.end;
|
||||
};
|
||||
|
||||
this.insertNewLine = function(position) {
|
||||
/**
|
||||
* Document.insertNewLine(position) -> Object
|
||||
* - position (String): The position to insert at
|
||||
*
|
||||
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
**/
|
||||
this.insertNewLine = function(position) {
|
||||
position = this.$clipPosition(position);
|
||||
var line = this.$lines[position.row] || "";
|
||||
|
||||
|
|
@ -234,7 +387,23 @@ var Document = function(text) {
|
|||
return end;
|
||||
};
|
||||
|
||||
this.insertInLine = function(position, text) {
|
||||
/**
|
||||
* Document.insertInLine(position, text) -> Object | Integer
|
||||
* - position (Number): The position to insert at
|
||||
* - text (String): A chunk of text
|
||||
*
|
||||
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
* If `text` is empty, this function returns the value of `position`.
|
||||
*
|
||||
**/
|
||||
this.insertInLine = function(position, text) {
|
||||
if (text.length == 0)
|
||||
return position;
|
||||
|
||||
|
|
@ -258,7 +427,17 @@ var Document = function(text) {
|
|||
return end;
|
||||
};
|
||||
|
||||
this.remove = function(range) {
|
||||
/**
|
||||
* Document.remove(range) -> Object
|
||||
* - range (Range): A specified Range to remove
|
||||
*
|
||||
* Removes the `range` from the document.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
|
||||
**/
|
||||
this.remove = function(range) {
|
||||
// clip to document
|
||||
range.start = this.$clipPosition(range.start);
|
||||
range.end = this.$clipPosition(range.end);
|
||||
|
|
@ -290,7 +469,19 @@ var Document = function(text) {
|
|||
return range.start;
|
||||
};
|
||||
|
||||
this.removeInLine = function(row, startColumn, endColumn) {
|
||||
/**
|
||||
* Document.removeInLine(row, startColumn, endColumn) -> Object | Void
|
||||
* - row (Number): The row to remove from
|
||||
* - startColumn (Number): The column to start removing at
|
||||
* - endColumn (Number): The column to stop removing at
|
||||
*
|
||||
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing `startRow` and `startColumn`, indicating the new row and column values. If `startColumn` is equal to `endColumn`, this function returns nothing.
|
||||
**/
|
||||
this.removeInLine = function(row, startColumn, endColumn) {
|
||||
if (startColumn == endColumn)
|
||||
return;
|
||||
|
||||
|
|
@ -310,13 +501,19 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Removes a range of full lines
|
||||
*
|
||||
* @param firstRow {Integer} The first row to be removed
|
||||
* @param lastRow {Integer} The last row to be removed
|
||||
* @return {String[]} The removed lines
|
||||
*/
|
||||
this.removeLines = function(firstRow, lastRow) {
|
||||
* Document.removeLines(firstRow, lastRow) -> Array
|
||||
* - firstRow (Number): The first row to be removed
|
||||
* - lastRow (Number): The last row to be removed
|
||||
*
|
||||
* Removes a range of full lines. This method also triggers the `'change'` event.
|
||||
*
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns all the removed lines.
|
||||
*
|
||||
**/
|
||||
this.removeLines = function(firstRow, lastRow) {
|
||||
var range = new Range(firstRow, 0, lastRow + 1, 0);
|
||||
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
|
||||
|
||||
|
|
@ -330,7 +527,14 @@ var Document = function(text) {
|
|||
return removed;
|
||||
};
|
||||
|
||||
this.removeNewLine = function(row) {
|
||||
/**
|
||||
* Document.removeNewLine(row) -> Void
|
||||
* - row (Number): The row to be removed
|
||||
*
|
||||
* TODO Removes the row from the document. This method also triggers the `'change'` event.
|
||||
*
|
||||
**/
|
||||
this.removeNewLine = function(row) {
|
||||
var firstLine = this.getLine(row);
|
||||
var secondLine = this.getLine(row+1);
|
||||
|
||||
|
|
@ -347,7 +551,25 @@ var Document = function(text) {
|
|||
this._emit("change", { data: delta });
|
||||
};
|
||||
|
||||
this.replace = function(range, text) {
|
||||
/**
|
||||
* Document.replace(range, text) -> Object
|
||||
* - range (Range): A specified Range to replace
|
||||
* - text (String): The new text to use as a replacement
|
||||
*
|
||||
* Replaces a range in the document with the new `text`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
* If the text and range are empty, this function returns an object containing the current `range.start` value.
|
||||
*
|
||||
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
**/
|
||||
this.replace = function(range, text) {
|
||||
if (text.length == 0 && range.isEmpty())
|
||||
return range.start;
|
||||
|
||||
|
|
@ -367,7 +589,12 @@ var Document = function(text) {
|
|||
return end;
|
||||
};
|
||||
|
||||
this.applyDeltas = function(deltas) {
|
||||
/**
|
||||
* Document.applyDeltas(deltas) -> Void
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.applyDeltas = function(deltas) {
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
var delta = deltas[i];
|
||||
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
||||
|
|
@ -383,7 +610,12 @@ var Document = function(text) {
|
|||
}
|
||||
};
|
||||
|
||||
this.revertDeltas = function(deltas) {
|
||||
/**
|
||||
* Document.revertDeltas(deltas) -> Void
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.revertDeltas = function(deltas) {
|
||||
for (var i=deltas.length-1; i>=0; i--) {
|
||||
var delta = deltas[i];
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
/*
|
||||
* Simple fold-data struct.
|
||||
**/
|
||||
var Fold = exports.Fold = function(range, placeholder) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
/**
|
||||
/*
|
||||
* If an array is passed in, the folds are expected to be sorted already.
|
||||
*/
|
||||
function FoldLine(foldData, folds) {
|
||||
|
|
@ -64,7 +64,7 @@ function FoldLine(foldData, folds) {
|
|||
}
|
||||
|
||||
(function() {
|
||||
/**
|
||||
/*
|
||||
* Note: This doesn't update wrapData!
|
||||
*/
|
||||
this.shiftRow = function(shift) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var Fold = require("./fold").Fold;
|
|||
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||
|
||||
function Folding() {
|
||||
/**
|
||||
/*
|
||||
* Looks up a fold at a given row/column. Possible values for side:
|
||||
* -1: ignore a fold if fold.start = row/column
|
||||
* +1: ignore a fold if fold.end = row/column
|
||||
|
|
@ -69,7 +69,7 @@ function Folding() {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns all folds in the given range. Note, that this will return folds
|
||||
*
|
||||
*/
|
||||
|
|
@ -115,7 +115,7 @@ function Folding() {
|
|||
return foundFolds;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns all folds in the document
|
||||
*/
|
||||
this.getAllFolds = function() {
|
||||
|
|
@ -138,7 +138,7 @@ function Folding() {
|
|||
return folds;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the string between folds at the given position.
|
||||
* E.g.
|
||||
* foo<fold>b|ar<fold>wolrd -> "bar"
|
||||
|
|
@ -257,7 +257,7 @@ function Folding() {
|
|||
return foldLine;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Adds a new fold.
|
||||
*
|
||||
* @returns
|
||||
|
|
@ -457,7 +457,7 @@ function Folding() {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Checks if a given documentRow is folded. This is true if there are some
|
||||
* folded parts such that some parts of the line is still visible.
|
||||
**/
|
||||
|
|
|
|||
1010
lib/ace/editor.js
|
|
@ -44,7 +44,7 @@ var EditSession = require("../edit_session").EditSession;
|
|||
var TextLayer = require("../layer/text").Text;
|
||||
var baseStyles = require("../requirejs/text!./static.css");
|
||||
|
||||
/** Transforms a given input code snippet into HTML using the given mode
|
||||
/* Transforms a given input code snippet into HTML using the given mode
|
||||
*
|
||||
* @param {string} input Code snippet
|
||||
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ var ace = require("../ace");
|
|||
|
||||
require("ace/theme/textmate");
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the CSS property of element.
|
||||
* 1) If the CSS property is on the style object of the element, use it, OR
|
||||
* 2) Compute the CSS property
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ function HashHandler(config) {
|
|||
this.$config.reverse = objectReverse.call(this, this.$config, "|");
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* This function is called by keyBinding.
|
||||
*/
|
||||
this.handleKeyboard = function(data, hashId, textOrKey, keyCode) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ function StateHandler(keymapping) {
|
|||
}
|
||||
|
||||
StateHandler.prototype = {
|
||||
/**
|
||||
/*
|
||||
* Build the RegExp from the keymapping as RegExp can't stored directly
|
||||
* in the metadata JSON and as the RegExp used to match the keys/buffer
|
||||
* need to be adapted.
|
||||
|
|
@ -198,7 +198,7 @@ StateHandler.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* This function is called by keyBinding.
|
||||
*/
|
||||
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
||||
|
|
@ -224,7 +224,7 @@ StateHandler.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This is a useful matching function and therefore is defined here so that
|
||||
* users of KeyboardStateMapper can use it.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ var Marker = function(parentEl) {
|
|||
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Draws a marker, which spans a range of text in a single line
|
||||
*/
|
||||
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||
|
|
@ -137,7 +137,7 @@ var Marker = function(parentEl) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Draws a multi line marker, where lines span the full width
|
||||
*/
|
||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
|
||||
|
|
@ -186,7 +186,7 @@ var Marker = function(parentEl) {
|
|||
);
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Draws a marker which covers one single full line
|
||||
*/
|
||||
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var oop = require("./oop");
|
|||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
/*
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ exports.hasCssClass = function(el, name) {
|
|||
return classes.indexOf(name) !== -1;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Add a CSS class to the list of classes on the given node
|
||||
*/
|
||||
exports.addCssClass = function(el, name) {
|
||||
|
|
@ -72,7 +72,7 @@ exports.addCssClass = function(el, name) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Remove a CSS class from the list of classes on the given node
|
||||
*/
|
||||
exports.removeCssClass = function(el, name) {
|
||||
|
|
@ -104,7 +104,7 @@ exports.toggleCssClass = function(el, name) {
|
|||
return add;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Add or remove a CSS class from the list of classes on the given node
|
||||
* depending on the value of <tt>include</tt>
|
||||
*/
|
||||
|
|
@ -255,7 +255,7 @@ exports.scrollbarWidth = function(document) {
|
|||
return noScrollbar-withScrollbar;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Optimized set innerHTML. This is faster than plain innerHTML if the element
|
||||
* already contains a lot of child elements.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
/**
|
||||
/*
|
||||
* Brings an environment as close to ECMAScript 5 compliance
|
||||
* as is possible with the facilities of erstwhile engines.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ exports.removeListener = function(elem, type, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Prevents propagation and clobbers the default action of the passed event
|
||||
*/
|
||||
exports.stopEvent = function(e) {
|
||||
|
|
@ -103,7 +103,7 @@ exports.getDocumentY = function(e) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
*/
|
||||
exports.getButton = function(e) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("./oop");
|
||||
|
||||
/**
|
||||
/*
|
||||
* Helper functions and hashes for key handling.
|
||||
*/
|
||||
var Keys = (function() {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ exports.arrayToMap = function(arr) {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* splice out of 'array' anything that === 'value'
|
||||
*/
|
||||
exports.arrayRemove = function(array, value) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* based on code from:
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Based on code from:
|
||||
*
|
||||
* XRegExp 1.5.0
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ define(function(require, exports, module) {
|
|||
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||
var ua = navigator.userAgent;
|
||||
|
||||
/** Is the user using a browser that identifies itself as Windows */
|
||||
// Is the user using a browser that identifies itself as Windows
|
||||
exports.isWin = (os == "win");
|
||||
|
||||
/** Is the user using a browser that identifies itself as Mac OS */
|
||||
// Is the user using a browser that identifies itself as Mac OS
|
||||
exports.isMac = (os == "mac");
|
||||
|
||||
/** Is the user using a browser that identifies itself as Linux */
|
||||
// Is the user using a browser that identifies itself as Linux
|
||||
exports.isLinux = (os == "linux");
|
||||
|
||||
exports.isIE =
|
||||
|
|
@ -56,16 +56,16 @@ exports.isIE =
|
|||
|
||||
exports.isOldIE = exports.isIE && exports.isIE < 9;
|
||||
|
||||
/** Is this Firefox or related? */
|
||||
// Is this Firefox or related?
|
||||
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
|
||||
|
||||
/** oldGecko == rev < 2.0 **/
|
||||
// oldGecko == rev < 2.0
|
||||
exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
|
||||
|
||||
/** Is this Opera */
|
||||
// Is this Opera
|
||||
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
|
||||
|
||||
/** Is the user using a browser that identifies itself as WebKit */
|
||||
// Is the user using a browser that identifies itself as WebKit
|
||||
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
|
||||
|
||||
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
|
||||
|
|
@ -76,7 +76,7 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
|
|||
|
||||
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
||||
|
||||
/**
|
||||
/*
|
||||
* I hate doing this, but we need some way to determine if the user is on a Mac
|
||||
* The reason is that users have different expectations of their key combinations.
|
||||
*
|
||||
|
|
@ -89,7 +89,7 @@ exports.OS = {
|
|||
WINDOWS: "WINDOWS"
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Return an exports.OS constant
|
||||
*/
|
||||
exports.getOS = function() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ THE SOFTWARE.
|
|||
var parserlib = {};
|
||||
(function(){
|
||||
|
||||
/**
|
||||
/*
|
||||
* A generic base to inherit from for any object
|
||||
* that needs event handling.
|
||||
* @class EventTarget
|
||||
|
|
@ -57,7 +57,7 @@ var parserlib = {};
|
|||
*/
|
||||
function EventTarget(){
|
||||
|
||||
/**
|
||||
/*
|
||||
* The array of listeners for various events.
|
||||
* @type Object
|
||||
* @property _listeners
|
||||
|
|
@ -71,7 +71,7 @@ EventTarget.prototype = {
|
|||
//restore constructor
|
||||
constructor: EventTarget,
|
||||
|
||||
/**
|
||||
/*
|
||||
* Adds a listener for a given event type.
|
||||
* @param {String} type The type of event to add a listener for.
|
||||
* @param {Function} listener The function to call when the event occurs.
|
||||
|
|
@ -86,7 +86,7 @@ EventTarget.prototype = {
|
|||
this._listeners[type].push(listener);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Fires an event based on the passed-in object.
|
||||
* @param {Object|String} event An object with at least a 'type' attribute
|
||||
* or a string indicating the event name.
|
||||
|
|
@ -115,7 +115,7 @@ EventTarget.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Removes a listener for a given event type.
|
||||
* @param {String} type The type of event to remove a listener from.
|
||||
* @param {Function} listener The function to remove from the event.
|
||||
|
|
@ -136,7 +136,7 @@ EventTarget.prototype = {
|
|||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Convenient way to read through strings.
|
||||
* @namespace parserlib.util
|
||||
* @class StringReader
|
||||
|
|
@ -145,7 +145,7 @@ EventTarget.prototype = {
|
|||
*/
|
||||
function StringReader(text){
|
||||
|
||||
/**
|
||||
/*
|
||||
* The input text with line endings normalized.
|
||||
* @property _input
|
||||
* @type String
|
||||
|
|
@ -154,7 +154,7 @@ function StringReader(text){
|
|||
this._input = text.replace(/\n\r?/g, "\n");
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* The row for the character to be read next.
|
||||
* @property _line
|
||||
* @type int
|
||||
|
|
@ -163,7 +163,7 @@ function StringReader(text){
|
|||
this._line = 1;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* The column for the character to be read next.
|
||||
* @property _col
|
||||
* @type int
|
||||
|
|
@ -171,7 +171,7 @@ function StringReader(text){
|
|||
*/
|
||||
this._col = 1;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The index of the character in the input to be read next.
|
||||
* @property _cursor
|
||||
* @type int
|
||||
|
|
@ -189,7 +189,7 @@ StringReader.prototype = {
|
|||
// Position info
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the column of the character to be read next.
|
||||
* @return {int} The column of the character to be read next.
|
||||
* @method getCol
|
||||
|
|
@ -198,7 +198,7 @@ StringReader.prototype = {
|
|||
return this._col;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the row of the character to be read next.
|
||||
* @return {int} The row of the character to be read next.
|
||||
* @method getLine
|
||||
|
|
@ -207,7 +207,7 @@ StringReader.prototype = {
|
|||
return this._line ;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Determines if you're at the end of the input.
|
||||
* @return {Boolean} True if there's no more input, false otherwise.
|
||||
* @method eof
|
||||
|
|
@ -220,7 +220,7 @@ StringReader.prototype = {
|
|||
// Basic reading
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads the next character without advancing the cursor.
|
||||
* @param {int} count How many characters to look ahead (default is 1).
|
||||
* @return {String} The next character or null if there is no next character.
|
||||
|
|
@ -240,7 +240,7 @@ StringReader.prototype = {
|
|||
return c;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads the next character from the input and adjusts the row and column
|
||||
* accordingly.
|
||||
* @return {String} The next character or null if there is no next character.
|
||||
|
|
@ -272,7 +272,7 @@ StringReader.prototype = {
|
|||
// Misc
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Saves the current location so it can be returned to later.
|
||||
* @method mark
|
||||
* @return {void}
|
||||
|
|
@ -298,7 +298,7 @@ StringReader.prototype = {
|
|||
// Advanced reading
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads up to and including the given string. Throws an error if that
|
||||
* string is not found.
|
||||
* @param {String} pattern The string to read.
|
||||
|
|
@ -329,7 +329,7 @@ StringReader.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads characters while each character causes the given
|
||||
* filter function to return true. The function is passed
|
||||
* in each character and either returns true to continue
|
||||
|
|
@ -353,7 +353,7 @@ StringReader.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads characters that match either text or a regular expression and
|
||||
* returns those characters. If a match is found, the row and column
|
||||
* are adjusted; if no match is found, the reader's state is unchanged.
|
||||
|
|
@ -385,7 +385,7 @@ StringReader.prototype = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads a given number of characters. If the end of the input is reached,
|
||||
* it reads only the remaining characters and does not throw an error.
|
||||
* @param {int} count The number of characters to read.
|
||||
|
|
@ -403,7 +403,7 @@ StringReader.prototype = {
|
|||
}
|
||||
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Type to use when a syntax error occurs.
|
||||
* @class SyntaxError
|
||||
* @namespace parserlib.util
|
||||
|
|
@ -414,21 +414,21 @@ StringReader.prototype = {
|
|||
*/
|
||||
function SyntaxError(message, line, col){
|
||||
|
||||
/**
|
||||
/*
|
||||
* The column at which the error occurred.
|
||||
* @type int
|
||||
* @property col
|
||||
*/
|
||||
this.col = col;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The line at which the error occurred.
|
||||
* @type int
|
||||
* @property line
|
||||
*/
|
||||
this.line = line;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The text representation of the unit.
|
||||
* @type String
|
||||
* @property text
|
||||
|
|
@ -439,7 +439,7 @@ function SyntaxError(message, line, col){
|
|||
|
||||
//inherit from Error
|
||||
SyntaxError.prototype = new Error();
|
||||
/**
|
||||
/*
|
||||
* Base type to represent a single syntactic unit.
|
||||
* @class SyntaxUnit
|
||||
* @namespace parserlib.util
|
||||
|
|
@ -451,21 +451,21 @@ SyntaxError.prototype = new Error();
|
|||
function SyntaxUnit(text, line, col){
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* The column of text on which the unit resides.
|
||||
* @type int
|
||||
* @property col
|
||||
*/
|
||||
this.col = col;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The line of text on which the unit resides.
|
||||
* @type int
|
||||
* @property line
|
||||
*/
|
||||
this.line = line;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The text representation of the unit.
|
||||
* @type String
|
||||
* @property text
|
||||
|
|
@ -474,7 +474,7 @@ function SyntaxUnit(text, line, col){
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Create a new syntax unit based solely on the given token.
|
||||
* Convenience method for creating a new syntax unit when
|
||||
* it represents a single token instead of multiple.
|
||||
|
|
@ -492,7 +492,7 @@ SyntaxUnit.prototype = {
|
|||
//restore constructor
|
||||
constructor: SyntaxUnit,
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the text representation of the unit.
|
||||
* @return {String} The text representation of the unit.
|
||||
* @method valueOf
|
||||
|
|
@ -501,7 +501,7 @@ SyntaxUnit.prototype = {
|
|||
return this.toString();
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the text representation of the unit.
|
||||
* @return {String} The text representation of the unit.
|
||||
* @method toString
|
||||
|
|
@ -511,7 +511,7 @@ SyntaxUnit.prototype = {
|
|||
}
|
||||
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Generic TokenStream providing base functionality.
|
||||
* @class TokenStreamBase
|
||||
* @namespace parserlib.util
|
||||
|
|
@ -521,7 +521,7 @@ SyntaxUnit.prototype = {
|
|||
*/
|
||||
function TokenStreamBase(input, tokenData){
|
||||
|
||||
/**
|
||||
/*
|
||||
* The string reader for easy access to the text.
|
||||
* @type StringReader
|
||||
* @property _reader
|
||||
|
|
@ -530,7 +530,7 @@ function TokenStreamBase(input, tokenData){
|
|||
//this._reader = (typeof input == "string") ? new StringReader(input) : input;
|
||||
this._reader = input ? new StringReader(input.toString()) : null;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Token object for the last consumed token.
|
||||
* @type Token
|
||||
* @property _token
|
||||
|
|
@ -538,7 +538,7 @@ function TokenStreamBase(input, tokenData){
|
|||
*/
|
||||
this._token = null;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The array of token information.
|
||||
* @type Array
|
||||
* @property _tokenData
|
||||
|
|
@ -546,7 +546,7 @@ function TokenStreamBase(input, tokenData){
|
|||
*/
|
||||
this._tokenData = tokenData;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Lookahead token buffer.
|
||||
* @type Array
|
||||
* @property _lt
|
||||
|
|
@ -554,7 +554,7 @@ function TokenStreamBase(input, tokenData){
|
|||
*/
|
||||
this._lt = [];
|
||||
|
||||
/**
|
||||
/*
|
||||
* Lookahead token buffer index.
|
||||
* @type int
|
||||
* @property _ltIndex
|
||||
|
|
@ -565,7 +565,7 @@ function TokenStreamBase(input, tokenData){
|
|||
this._ltIndexCache = [];
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Accepts an array of token information and outputs
|
||||
* an array of token data containing key-value mappings
|
||||
* and matching functions that the TokenStream needs.
|
||||
|
|
@ -613,7 +613,7 @@ TokenStreamBase.prototype = {
|
|||
// Matching methods
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Determines if the next token matches the given token type.
|
||||
* If so, that token is consumed; if not, the token is placed
|
||||
* back onto the token stream. You can pass in any number of
|
||||
|
|
@ -649,7 +649,7 @@ TokenStreamBase.prototype = {
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Determines if the next token matches the given token type.
|
||||
* If so, that token is consumed; if not, an error is thrown.
|
||||
* @param {int|int[]} tokenTypes Either a single token type or an array of
|
||||
|
|
@ -678,7 +678,7 @@ TokenStreamBase.prototype = {
|
|||
// Consuming methods
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Keeps reading from the token stream until either one of the specified
|
||||
* token types is found or until the end of the input is reached.
|
||||
* @param {int|int[]} tokenTypes Either a single token type or an array of
|
||||
|
|
@ -698,7 +698,7 @@ TokenStreamBase.prototype = {
|
|||
return this.LA(0);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Consumes the next token from the token stream.
|
||||
* @return {int} The token type of the token that was just consumed.
|
||||
* @method get
|
||||
|
|
@ -783,7 +783,7 @@ TokenStreamBase.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Looks ahead a certain number of tokens and returns the token type at
|
||||
* that position. This will throw an error if you lookahead past the
|
||||
* end of input, past the size of the lookahead buffer, or back past
|
||||
|
|
@ -829,7 +829,7 @@ TokenStreamBase.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Looks ahead a certain number of tokens and returns the token at
|
||||
* that position. This will throw an error if you lookahead past the
|
||||
* end of input, past the size of the lookahead buffer, or back past
|
||||
|
|
@ -848,7 +848,7 @@ TokenStreamBase.prototype = {
|
|||
return this._lt[this._ltIndex+index-1];
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the token type for the next token in the stream without
|
||||
* consuming it.
|
||||
* @return {int} The token type of the next token in the stream.
|
||||
|
|
@ -858,7 +858,7 @@ TokenStreamBase.prototype = {
|
|||
return this.LA(1);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the actual token object for the last consumed token.
|
||||
* @return {Token} The token object for the last consumed token.
|
||||
* @method token
|
||||
|
|
@ -867,7 +867,7 @@ TokenStreamBase.prototype = {
|
|||
return this._token;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the name of the token for the given token type.
|
||||
* @param {int} tokenType The type of token to get the name of.
|
||||
* @return {String} The name of the token or "UNKNOWN_TOKEN" for any
|
||||
|
|
@ -882,7 +882,7 @@ TokenStreamBase.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the token type value for the given token name.
|
||||
* @param {String} tokenName The name of the token whose value should be returned.
|
||||
* @return {int} The token type value for the given token name or -1
|
||||
|
|
@ -893,7 +893,7 @@ TokenStreamBase.prototype = {
|
|||
return this._tokenData[tokenName] || -1;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the last consumed token to the token stream.
|
||||
* @method unget
|
||||
*/
|
||||
|
|
@ -1093,7 +1093,7 @@ var Colors = {
|
|||
yellow :"#ffff00",
|
||||
yellowgreen :"#9acd32"
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Represents a selector combinator (whitespace, +, >).
|
||||
* @namespace parserlib.css
|
||||
* @class Combinator
|
||||
|
|
@ -1107,7 +1107,7 @@ function Combinator(text, line, col){
|
|||
|
||||
SyntaxUnit.call(this, text, line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The type of modifier.
|
||||
* @type String
|
||||
* @property type
|
||||
|
|
@ -1307,7 +1307,7 @@ var Level2Properties = {
|
|||
"word-spacing": 1,
|
||||
"z-index": 1
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Represents a media feature, such as max-width:500.
|
||||
* @namespace parserlib.css
|
||||
* @class MediaFeature
|
||||
|
|
@ -1320,14 +1320,14 @@ function MediaFeature(name, value){
|
|||
|
||||
SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The name of the media feature
|
||||
* @type String
|
||||
* @property name
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The value for the feature or null if there is none.
|
||||
* @type SyntaxUnit
|
||||
* @property value
|
||||
|
|
@ -1339,7 +1339,7 @@ MediaFeature.prototype = new SyntaxUnit();
|
|||
MediaFeature.prototype.constructor = MediaFeature;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Represents an individual media query.
|
||||
* @namespace parserlib.css
|
||||
* @class MediaQuery
|
||||
|
|
@ -1355,21 +1355,21 @@ function MediaQuery(modifier, mediaType, features, line, col){
|
|||
|
||||
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType + " " : "") + features.join(" and "), line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The media modifier ("not" or "only")
|
||||
* @type String
|
||||
* @property modifier
|
||||
*/
|
||||
this.modifier = modifier;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The mediaType (i.e., "print")
|
||||
* @type String
|
||||
* @property mediaType
|
||||
*/
|
||||
this.mediaType = mediaType;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The parts that make up the selector.
|
||||
* @type Array
|
||||
* @property features
|
||||
|
|
@ -1382,7 +1382,7 @@ MediaQuery.prototype = new SyntaxUnit();
|
|||
MediaQuery.prototype.constructor = MediaQuery;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* A CSS3 parser.
|
||||
* @namespace parserlib.css
|
||||
* @class Parser
|
||||
|
|
@ -1799,7 +1799,7 @@ Parser.prototype = function(){
|
|||
return this._media_feature();
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Note: in CSS3 Media Queries, this is called "expression".
|
||||
* Renamed here to avoid conflict with CSS3 Selectors
|
||||
* definition of "expression". Also note that "expr" in the
|
||||
|
|
@ -3210,7 +3210,7 @@ Parser.prototype = function(){
|
|||
// Helper methods
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Not part of CSS grammar, but useful for skipping over
|
||||
* combination of white space and HTML-style comments.
|
||||
* @return {void}
|
||||
|
|
@ -3223,7 +3223,7 @@ Parser.prototype = function(){
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Not part of CSS grammar, but this pattern occurs frequently
|
||||
* in the official CSS grammar. Split out here to eliminate
|
||||
* duplicate code.
|
||||
|
|
@ -3312,7 +3312,7 @@ Parser.prototype = function(){
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* In some cases, you can end up with two white space tokens in a
|
||||
* row. Instead of making a change in every function that looks for
|
||||
* white space, this function is used to match as much white space
|
||||
|
|
@ -3334,7 +3334,7 @@ Parser.prototype = function(){
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Throws an error when an unexpected token is found.
|
||||
* @param {Object} token The token that was found.
|
||||
* @method _unexpectedToken
|
||||
|
|
@ -3345,7 +3345,7 @@ Parser.prototype = function(){
|
|||
throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Helper method used for parsing subparts of a style sheet.
|
||||
* @return {void}
|
||||
* @method _verifyEnd
|
||||
|
|
@ -3382,7 +3382,7 @@ Parser.prototype = function(){
|
|||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Parses a property value (everything after the semicolon).
|
||||
* @return {parserlib.css.PropertyValue} The property value.
|
||||
* @throws parserlib.util.SyntaxError If an unexpected token is found.
|
||||
|
|
@ -3405,7 +3405,7 @@ Parser.prototype = function(){
|
|||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Parses a complete CSS rule, including selectors and
|
||||
* properties.
|
||||
* @param {String} input The text to parser.
|
||||
|
|
@ -3430,7 +3430,7 @@ Parser.prototype = function(){
|
|||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Parses a single CSS selector (no comma)
|
||||
* @param {String} input The text to parse as a CSS selector.
|
||||
* @return {Selector} An object representing the selector.
|
||||
|
|
@ -3473,7 +3473,7 @@ nth
|
|||
['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
|
||||
;
|
||||
*/
|
||||
/**
|
||||
/*
|
||||
* Represents a selector combinator (whitespace, +, >).
|
||||
* @namespace parserlib.css
|
||||
* @class PropertyName
|
||||
|
|
@ -3488,7 +3488,7 @@ function PropertyName(text, hack, line, col){
|
|||
|
||||
SyntaxUnit.call(this, (hack||"") + text, line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The type of IE hack applied ("*", "_", or null).
|
||||
* @type String
|
||||
* @property hack
|
||||
|
|
@ -3501,7 +3501,7 @@ PropertyName.prototype = new SyntaxUnit();
|
|||
PropertyName.prototype.constructor = PropertyName;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Represents a single part of a CSS property value, meaning that it represents
|
||||
* just everything single part between ":" and ";". If there are multiple values
|
||||
* separated by commas, this type represents just one of the values.
|
||||
|
|
@ -3517,7 +3517,7 @@ function PropertyValue(parts, line, col){
|
|||
|
||||
SyntaxUnit.call(this, parts.join(" "), line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The parts that make up the selector.
|
||||
* @type Array
|
||||
* @property parts
|
||||
|
|
@ -3530,7 +3530,7 @@ PropertyValue.prototype = new SyntaxUnit();
|
|||
PropertyValue.prototype.constructor = PropertyValue;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Represents a single part of a CSS property value, meaning that it represents
|
||||
* just one part of the data between ":" and ";".
|
||||
* @param {String} text The text representation of the unit.
|
||||
|
|
@ -3545,7 +3545,7 @@ function PropertyValuePart(text, line, col){
|
|||
|
||||
SyntaxUnit.apply(this,arguments);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Indicates the type of value unit.
|
||||
* @type String
|
||||
* @property type
|
||||
|
|
@ -3662,7 +3662,7 @@ function PropertyValuePart(text, line, col){
|
|||
PropertyValuePart.prototype = new SyntaxUnit();
|
||||
PropertyValuePart.prototype.constructor = PropertyValue;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Create a new syntax unit based solely on the given token.
|
||||
* Convenience method for creating a new syntax unit when
|
||||
* it represents a single token instead of multiple.
|
||||
|
|
@ -3674,7 +3674,7 @@ PropertyValuePart.prototype.constructor = PropertyValue;
|
|||
PropertyValuePart.fromToken = function(token){
|
||||
return new PropertyValuePart(token.value, token.startLine, token.startCol);
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* Represents an entire single selector, including all parts but not
|
||||
* including multiple selectors (those separated by commas).
|
||||
* @namespace parserlib.css
|
||||
|
|
@ -3689,7 +3689,7 @@ function Selector(parts, line, col){
|
|||
|
||||
SyntaxUnit.call(this, parts.join(" "), line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The parts that make up the selector.
|
||||
* @type Array
|
||||
* @property parts
|
||||
|
|
@ -3702,7 +3702,7 @@ Selector.prototype = new SyntaxUnit();
|
|||
Selector.prototype.constructor = Selector;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Represents a single part of a selector string, meaning a single set of
|
||||
* element name and modifiers. This does not include combinators such as
|
||||
* spaces, +, >, etc.
|
||||
|
|
@ -3722,7 +3722,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
|
|||
|
||||
SyntaxUnit.call(this, text, line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The tag name of the element to which this part
|
||||
* of the selector affects.
|
||||
* @type String
|
||||
|
|
@ -3730,7 +3730,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
|
|||
*/
|
||||
this.elementName = elementName;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The parts that come after the element name, such as class names, IDs,
|
||||
* pseudo classes/elements, etc.
|
||||
* @type Array
|
||||
|
|
@ -3744,7 +3744,7 @@ SelectorPart.prototype = new SyntaxUnit();
|
|||
SelectorPart.prototype.constructor = SelectorPart;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Represents a selector modifier string, meaning a class name, element name,
|
||||
* element ID, pseudo rule, etc.
|
||||
* @namespace parserlib.css
|
||||
|
|
@ -3760,14 +3760,14 @@ function SelectorSubPart(text, type, line, col){
|
|||
|
||||
SyntaxUnit.call(this, text, line, col);
|
||||
|
||||
/**
|
||||
/*
|
||||
* The type of modifier.
|
||||
* @type String
|
||||
* @property type
|
||||
*/
|
||||
this.type = type;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Some subparts have arguments, this represents them.
|
||||
* @type Array
|
||||
* @property args
|
||||
|
|
@ -3833,7 +3833,7 @@ function mix(receiver, supplier){
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* A token stream that produces CSS tokens.
|
||||
* @param {String|Reader} input The source of text to tokenize.
|
||||
* @constructor
|
||||
|
|
@ -3846,7 +3846,7 @@ function TokenStream(input){
|
|||
|
||||
TokenStream.prototype = mix(new TokenStreamBase(), {
|
||||
|
||||
/**
|
||||
/*
|
||||
* Overrides the TokenStreamBase method of the same name
|
||||
* to produce CSS tokens.
|
||||
* @param {variant} channel The name of the channel to use
|
||||
|
|
@ -4076,7 +4076,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
// Methods to create tokens
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a token based on available data and the current
|
||||
* reader position information. This method is called by other
|
||||
* private methods to create tokens and is never called directly.
|
||||
|
|
@ -4111,7 +4111,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
// Methods to create specific tokens
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a token for any at-rule. If the at-rule is unknown, then
|
||||
* the token is for a single "@" character.
|
||||
* @param {String} first The first character for the token.
|
||||
|
|
@ -4152,7 +4152,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, rule, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a character token based on the given character
|
||||
* and location in the stream. If there's a special (non-standard)
|
||||
* token name, this is used; otherwise CHAR is used.
|
||||
|
|
@ -4172,7 +4172,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, c, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a character token based on the given character
|
||||
* and location in the stream. If there's a special (non-standard)
|
||||
* token name, this is used; otherwise CHAR is used.
|
||||
|
|
@ -4189,7 +4189,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a comparison token based on the given character
|
||||
* and location in the stream. The next character must be
|
||||
* read and is already known to be an equals sign.
|
||||
|
|
@ -4207,7 +4207,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, comparison, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a hash token based on the specified information. The
|
||||
* first character provided is the pound sign (#) and then this
|
||||
* method reads a name afterward.
|
||||
|
|
@ -4224,7 +4224,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(Tokens.HASH, name, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a CDO or CHAR token based on the specified information. The
|
||||
* first character is provided and the rest is read by the function to determine
|
||||
* the correct token to create.
|
||||
|
|
@ -4249,7 +4249,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a CDC or CHAR token based on the specified information. The
|
||||
* first character is provided and the rest is read by the function to determine
|
||||
* the correct token to create.
|
||||
|
|
@ -4274,7 +4274,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces an IDENT or FUNCTION token based on the specified information. The
|
||||
* first character is provided and the rest is read by the function to determine
|
||||
* the correct token to create.
|
||||
|
|
@ -4315,7 +4315,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, ident, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces an IMPORTANT_SYM or CHAR token based on the specified information. The
|
||||
* first character is provided and the rest is read by the function to determine
|
||||
* the correct token to create.
|
||||
|
|
@ -4376,7 +4376,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a NOT or CHAR token based on the specified information. The
|
||||
* first character is provided and the rest is read by the function to determine
|
||||
* the correct token to create.
|
||||
|
|
@ -4401,7 +4401,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a number token based on the given character
|
||||
* and location in the stream. This may return a token of
|
||||
* NUMBER, EMS, EXS, LENGTH, ANGLE, TIME, FREQ, DIMENSION,
|
||||
|
|
@ -4445,7 +4445,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, value, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a string token based on the given character
|
||||
* and location in the stream. Since strings may be indicated
|
||||
* by single or double quotes, a failure to match starting
|
||||
|
|
@ -4535,7 +4535,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
|
|||
return this.createToken(tt, value, startLine, startCol);
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Produces a S token based on the specified information. Since whitespace
|
||||
* may have multiple characters, this consumes all whitespace characters
|
||||
* into a single token.
|
||||
|
|
@ -5005,7 +5005,7 @@ Tokens :Tokens
|
|||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
/*
|
||||
* Main CSSLint object.
|
||||
* @class CSSLint
|
||||
* @static
|
||||
|
|
@ -5023,7 +5023,7 @@ var CSSLint = (function(){
|
|||
// Rule Management
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Adds a new rule to the engine.
|
||||
* @param {Object} rule The rule to add.
|
||||
* @method addRule
|
||||
|
|
@ -5033,7 +5033,7 @@ var CSSLint = (function(){
|
|||
rules[rule.id] = rule;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Clears all rule from the engine.
|
||||
* @method clearRules
|
||||
*/
|
||||
|
|
@ -5045,7 +5045,7 @@ var CSSLint = (function(){
|
|||
// Formatters
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Adds a new formatter to the engine.
|
||||
* @param {Object} formatter The formatter to add.
|
||||
* @method addFormatter
|
||||
|
|
@ -5055,7 +5055,7 @@ var CSSLint = (function(){
|
|||
formatters[formatter.id] = formatter;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Retrieves a formatter for use.
|
||||
* @param {String} formatId The name of the format to retrieve.
|
||||
* @return {Object} The formatter or undefined.
|
||||
|
|
@ -5065,7 +5065,7 @@ var CSSLint = (function(){
|
|||
return formatters[formatId];
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Formats the results in a particular format for a single file.
|
||||
* @param {Object} result The results returned from CSSLint.verify().
|
||||
* @param {String} filename The filename for which the results apply.
|
||||
|
|
@ -5086,7 +5086,7 @@ var CSSLint = (function(){
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Indicates if the given format is supported.
|
||||
* @param {String} formatId The ID of the format to check.
|
||||
* @return {Boolean} True if the format exists, false if not.
|
||||
|
|
@ -5100,7 +5100,7 @@ var CSSLint = (function(){
|
|||
// Verification
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/*
|
||||
* Starts the verification process for the given CSS text.
|
||||
* @param {String} text The CSS text to verify.
|
||||
* @param {Object} ruleset (Optional) List of rules to apply. If null, then
|
||||
|
|
@ -5155,7 +5155,7 @@ var CSSLint = (function(){
|
|||
return api;
|
||||
|
||||
})();
|
||||
/**
|
||||
/*
|
||||
* An instance of Report is used to report results of the
|
||||
* verification back to the main API.
|
||||
* @class Reporter
|
||||
|
|
@ -5164,21 +5164,21 @@ var CSSLint = (function(){
|
|||
*/
|
||||
function Reporter(lines){
|
||||
|
||||
/**
|
||||
/*
|
||||
* List of messages being reported.
|
||||
* @property messages
|
||||
* @type String[]
|
||||
*/
|
||||
this.messages = [];
|
||||
|
||||
/**
|
||||
/*
|
||||
* List of statistics being reported.
|
||||
* @property stats
|
||||
* @type String[]
|
||||
*/
|
||||
this.stats = [];
|
||||
|
||||
/**
|
||||
/*
|
||||
* Lines of code being reported on. Used to provide contextual information
|
||||
* for messages.
|
||||
* @property lines
|
||||
|
|
@ -5192,7 +5192,7 @@ Reporter.prototype = {
|
|||
//restore constructor
|
||||
constructor: Reporter,
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report an error.
|
||||
* @param {String} message The message to store.
|
||||
* @param {int} line The line number.
|
||||
|
|
@ -5211,7 +5211,7 @@ Reporter.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report an warning.
|
||||
* @param {String} message The message to store.
|
||||
* @param {int} line The line number.
|
||||
|
|
@ -5230,7 +5230,7 @@ Reporter.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report some informational text.
|
||||
* @param {String} message The message to store.
|
||||
* @param {int} line The line number.
|
||||
|
|
@ -5249,7 +5249,7 @@ Reporter.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report some rollup error information.
|
||||
* @param {String} message The message to store.
|
||||
* @param {Object} rule The rule this message relates to.
|
||||
|
|
@ -5264,7 +5264,7 @@ Reporter.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report some rollup warning information.
|
||||
* @param {String} message The message to store.
|
||||
* @param {Object} rule The rule this message relates to.
|
||||
|
|
@ -5279,7 +5279,7 @@ Reporter.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report a statistic.
|
||||
* @param {String} name The name of the stat to store.
|
||||
* @param {Variant} value The value of the stat.
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* reads a full tag and places the iterator after the tag
|
||||
*/
|
||||
this._readTagForward = function(iterator) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ define(function(require, exports, module) {
|
|||
|
||||
var event = require("../lib/event");
|
||||
|
||||
/**
|
||||
/*
|
||||
* Custom Ace mouse event
|
||||
*/
|
||||
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
||||
|
|
@ -78,7 +78,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
this.preventDefault();
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the document position below the mouse cursor
|
||||
*
|
||||
* @return {Object} 'row' and 'column' of the document position
|
||||
|
|
@ -94,7 +94,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
return this.$pos;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Check if the mouse cursor is inside of the text selection
|
||||
*
|
||||
* @return {Boolean} whether the mouse cursor is inside of the selection
|
||||
|
|
@ -120,7 +120,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
return this.$inSelection;
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the clicked mouse button
|
||||
*
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
|
|
@ -129,7 +129,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
|||
return event.getButton(this.domEvent);
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* @return {Boolean} whether the shift key was pressed when the event was emitted
|
||||
*/
|
||||
this.getShiftKey = function() {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,26 @@ var Range = require('./range').Range;
|
|||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var oop = require("./lib/oop");
|
||||
|
||||
/**
|
||||
* class PlaceHolder
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new PlaceHolder(session, length, pos, others, mainClass, othersClass)
|
||||
* - session (Document): The document to associate with the anchor
|
||||
* - length (Number): The starting row position
|
||||
* - pos (Number): The starting column position
|
||||
* - others (String):
|
||||
* - mainClass (String):
|
||||
* - othersClass (String):
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
|
||||
var _self = this;
|
||||
this.length = length;
|
||||
|
|
@ -70,6 +90,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* PlaceHolder.setup() -> Void
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.setup = function() {
|
||||
var _self = this;
|
||||
var doc = this.doc;
|
||||
|
|
@ -90,6 +116,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
session.setUndoSelect(false);
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder.showOtherMarkers() -> Void
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.showOtherMarkers = function() {
|
||||
if(this.othersActive) return;
|
||||
var session = this.session;
|
||||
|
|
@ -104,6 +136,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder.hideOtherMarkers() -> Void
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.hideOtherMarkers = function() {
|
||||
if(!this.othersActive) return;
|
||||
this.othersActive = false;
|
||||
|
|
@ -112,6 +150,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder@onUpdate(e)
|
||||
*
|
||||
* Emitted when the place holder updates.
|
||||
*
|
||||
**/
|
||||
this.onUpdate = function(event) {
|
||||
var delta = event.data;
|
||||
var range = delta.range;
|
||||
|
|
@ -174,6 +218,13 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
this.$updating = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder@onCursorChange(e)
|
||||
*
|
||||
* Emitted when the cursor changes.
|
||||
*
|
||||
**/
|
||||
|
||||
this.onCursorChange = function(event) {
|
||||
if (this.$updating) return;
|
||||
var pos = this.session.selection.getCursor();
|
||||
|
|
@ -186,6 +237,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder.detach()
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.detach = function() {
|
||||
this.session.removeMarker(this.markerId);
|
||||
this.hideOtherMarkers();
|
||||
|
|
@ -198,6 +255,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
this.session.setUndoSelect(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* PlaceHolder.cancel()
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.cancel = function() {
|
||||
if(this.$undoStackDepth === -1)
|
||||
throw Error("Canceling placeholders only supported with undo manager attached to session.");
|
||||
|
|
|
|||
298
lib/ace/range.js
|
|
@ -38,6 +38,23 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* class Range
|
||||
*
|
||||
* This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Range(startRow, startColumn, endRow, endColumn)
|
||||
* - startRow (Number): The starting row
|
||||
* - startColumn (Number): The starting column
|
||||
* - endRow (Number): The ending row
|
||||
* - endColumn (Number): The ending column
|
||||
*
|
||||
* Creates a new `Range` object with the given starting and ending row and column points.
|
||||
*
|
||||
**/
|
||||
var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||
this.start = {
|
||||
row: startRow,
|
||||
|
|
@ -51,6 +68,13 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
};
|
||||
|
||||
(function() {
|
||||
/**
|
||||
* Range.isEequal(range) -> Boolean
|
||||
* - range (Range): A range to check against
|
||||
*
|
||||
* Returns `true` if and only if the starting row and column, and ending tow and column, are equivalent to those given by `range`.
|
||||
*
|
||||
**/
|
||||
this.isEequal = function(range) {
|
||||
return this.start.row == range.start.row &&
|
||||
this.end.row == range.end.row &&
|
||||
|
|
@ -58,28 +82,54 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
this.end.column == range.end.column
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.toString() -> String
|
||||
*
|
||||
* Returns a string containing the range's row and column information, given like this:
|
||||
*
|
||||
* [start.row/start.column] -> [end.row/end.column]
|
||||
*
|
||||
**/
|
||||
|
||||
this.toString = function() {
|
||||
return ("Range: [" + this.start.row + "/" + this.start.column +
|
||||
"] -> [" + this.end.row + "/" + this.end.column + "]");
|
||||
};
|
||||
|
||||
/** related to: Range.compare
|
||||
* Range.contains(row, column) -> Boolean
|
||||
* - row (Number): A row to check for
|
||||
* - column (Number): A column to check for
|
||||
*
|
||||
* Returns `true` if the `row` and `column` provided are within the given range. This can better be expressed as returning `true` if:
|
||||
*
|
||||
* this.start.row <= row <= this.end.row &&
|
||||
* this.start.column <= column <= this.end.column
|
||||
*
|
||||
**/
|
||||
|
||||
this.contains = function(row, column) {
|
||||
return this.compare(row, column) == 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compares this range (A) with another range (B), where B is the passed in
|
||||
* range.
|
||||
/** related to: Range.compare
|
||||
* Range.compareRange(range) -> Number
|
||||
* - range (Range): A range to compare with
|
||||
*
|
||||
* Return values:
|
||||
* -2: (B) is infront of (A) and doesn't intersect with (A)
|
||||
* -1: (B) begins before (A) but ends inside of (A)
|
||||
* 0: (B) is completly inside of (A) OR (A) is complety inside of (B)
|
||||
* +1: (B) begins inside of (A) but ends outside of (A)
|
||||
* +2: (B) is after (A) and doesn't intersect with (A)
|
||||
* Compares `this` range (A) with another range (B).
|
||||
*
|
||||
* 42: FTW state: (B) ends in (A) but starts outside of (A)
|
||||
*/
|
||||
* #### Returns
|
||||
*
|
||||
* This method returns one of the following numbers:
|
||||
*
|
||||
* * -2: (B) is in front of (A), and doesn't intersect with (A)
|
||||
* * -1: (B) begins before (A) but ends inside of (A)
|
||||
* * 0: (B) is completely inside of (A) OR (A) is completely inside of (B)
|
||||
* * +1: (B) begins inside of (A) but ends outside of (A)
|
||||
* * +2: (B) is after (A) and doesn't intersect with (A)
|
||||
* * 42: FTW state: (B) ends in (A) but starts outside of (A)
|
||||
*
|
||||
**/
|
||||
this.compareRange = function(range) {
|
||||
var cmp,
|
||||
end = range.end,
|
||||
|
|
@ -109,22 +159,74 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/** related to: Range.compare
|
||||
* Range.comparePoint(p) -> Number
|
||||
* - p (Range): A point to compare with
|
||||
*
|
||||
* Checks the row and column points of `p` with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.comparePoint = function(p) {
|
||||
return this.compare(p.row, p.column);
|
||||
}
|
||||
|
||||
/** related to: Range.comparePoint
|
||||
* Range.containsRange(range) -> Boolean
|
||||
* - range (Range): A range to compare with
|
||||
*
|
||||
* Checks the start and end points of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range.
|
||||
*
|
||||
**/
|
||||
this.containsRange = function(range) {
|
||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.isEnd(row, column) -> Boolean
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Returns `true` if the caller's ending row point is the same as `row`, and if the caller's ending column is the same as `column`.
|
||||
*
|
||||
**/
|
||||
this.isEnd = function(row, column) {
|
||||
return this.end.row == row && this.end.column == column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.isStart(row, column) -> Boolean
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Returns `true` if the caller's starting row point is the same as `row`, and if the caller's starting column is the same as `column`.
|
||||
*
|
||||
**/
|
||||
this.isStart = function(row, column) {
|
||||
return this.start.row == row && this.start.column == column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.setStart(row, column) -> Void
|
||||
* - row (Number): A row point to set
|
||||
* - column (Number): A column point to set
|
||||
*
|
||||
* Sets the starting row and column for the range.
|
||||
*
|
||||
**/
|
||||
this.setStart = function(row, column) {
|
||||
if (typeof row == "object") {
|
||||
this.start.column = row.column;
|
||||
|
|
@ -135,6 +237,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.setEnd(row, column) -> Void
|
||||
* - row (Number): A row point to set
|
||||
* - column (Number): A column point to set
|
||||
*
|
||||
* Sets the starting row and column for the range.
|
||||
*
|
||||
**/
|
||||
this.setEnd = function(row, column) {
|
||||
if (typeof row == "object") {
|
||||
this.end.column = row.column;
|
||||
|
|
@ -145,6 +255,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/** related to: Range.compare
|
||||
* Range.inside(row, column) -> Boolean
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Returns `true` if the `row` and `column` are within the given range.
|
||||
*
|
||||
**/
|
||||
this.inside = function(row, column) {
|
||||
if (this.compare(row, column) == 0) {
|
||||
if (this.isEnd(row, column) || this.isStart(row, column)) {
|
||||
|
|
@ -156,6 +274,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/** related to: Range.compare
|
||||
* Range.insideStart(row, column) -> Boolean
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Returns `true` if the `row` and `column` are within the given range's starting points.
|
||||
*
|
||||
**/
|
||||
this.insideStart = function(row, column) {
|
||||
if (this.compare(row, column) == 0) {
|
||||
if (this.isEnd(row, column)) {
|
||||
|
|
@ -167,6 +293,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/** related to: Range.compare
|
||||
* Range.insideEnd(row, column) -> Boolean
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Returns `true` if the `row` and `column` are within the given range's ending points.
|
||||
*
|
||||
**/
|
||||
this.insideEnd = function(row, column) {
|
||||
if (this.compare(row, column) == 0) {
|
||||
if (this.isStart(row, column)) {
|
||||
|
|
@ -178,6 +312,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.compare(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compare = function(row, column) {
|
||||
if (!this.isMultiLine()) {
|
||||
if (row === this.start.row) {
|
||||
|
|
@ -200,9 +356,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Like .compare(), but if isStart is true, return -1;
|
||||
*/
|
||||
/**
|
||||
* Range.compareStart(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isStart` is `true.
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compareStart = function(row, column) {
|
||||
if (this.start.row == row && this.start.column == column) {
|
||||
return -1;
|
||||
|
|
@ -211,9 +386,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like .compare(), but if isEnd is true, return 1;
|
||||
*/
|
||||
/**
|
||||
* Range.compareEnd(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compareEnd = function(row, column) {
|
||||
if (this.end.row == row && this.end.column == column) {
|
||||
return 1;
|
||||
|
|
@ -222,6 +416,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.compareInside(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`
|
||||
* * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`
|
||||
*
|
||||
* Otherwise, it returns the value after calling [[Range.compare `compare()`]].
|
||||
*
|
||||
**/
|
||||
this.compareInside = function(row, column) {
|
||||
if (this.end.row == row && this.end.column == column) {
|
||||
return 1;
|
||||
|
|
@ -232,6 +441,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Range.clipRows(firstRow, lastRow) -> Range
|
||||
* - firstRow (Number):
|
||||
* - lastRow (Number):
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.clipRows = function(firstRow, lastRow) {
|
||||
if (this.end.row > lastRow) {
|
||||
var end = {
|
||||
|
|
@ -263,6 +480,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return Range.fromPoints(start || this.start, end || this.end);
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.extend(row, column) -> Range
|
||||
* - row (Number): A new row to extend to
|
||||
* - column (Number): A new column to extend to
|
||||
*
|
||||
* Changes the row and column points for the calling range for both the starting and ending points. This method returns that range with a new row.
|
||||
*
|
||||
**/
|
||||
this.extend = function(row, column) {
|
||||
var cmp = this.compare(row, column);
|
||||
|
||||
|
|
@ -276,18 +501,42 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return Range.fromPoints(start || this.start, end || this.end);
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.isEmpty() -> Boolean
|
||||
*
|
||||
* Checks if the range is empty; that is, the starting and ending points for row and column are equivalent. Returns `true` if the range is indeed empty.
|
||||
*
|
||||
**/
|
||||
this.isEmpty = function() {
|
||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.isMultiLine() -> Boolean
|
||||
*
|
||||
* Returns true if the range spans across multiple lines.
|
||||
*
|
||||
**/
|
||||
this.isMultiLine = function() {
|
||||
return (this.start.row !== this.end.row);
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.clone() -> Range
|
||||
*
|
||||
* Returns a duplicate of the calling range.
|
||||
*
|
||||
**/
|
||||
this.clone = function() {
|
||||
return Range.fromPoints(this.start, this.end);
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.collapseRows() -> Range
|
||||
*
|
||||
* Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
|
||||
*
|
||||
**/
|
||||
this.collapseRows = function() {
|
||||
if (this.end.column == 0)
|
||||
return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
|
||||
|
|
@ -295,6 +544,12 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return new Range(this.start.row, 0, this.end.row, 0)
|
||||
};
|
||||
|
||||
/**
|
||||
* Range.toScreenRange() -> Range
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.toScreenRange = function(session) {
|
||||
var screenPosStart =
|
||||
session.documentToScreenPosition(this.start);
|
||||
|
|
@ -309,7 +564,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
|
||||
}).call(Range.prototype);
|
||||
|
||||
|
||||
/**
|
||||
* Range#fromPoints(start, end) -> Range
|
||||
* - start (Range): A starting point to use
|
||||
* - end (Range): An ending point to use
|
||||
*
|
||||
* Creates and returns a new `Range` based on the row and column of the given parameters.
|
||||
*
|
||||
**/
|
||||
Range.fromPoints = function(start, end) {
|
||||
return new Range(start.row, start.column, end.row, end.column);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,6 +41,19 @@ define(function(require, exports, module) {
|
|||
|
||||
var event = require("./lib/event");
|
||||
|
||||
/**
|
||||
* class RenderLoop
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new RenderLoop(onRender, win)
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
var RenderLoop = function(onRender, win) {
|
||||
this.onRender = onRender;
|
||||
this.pending = false;
|
||||
|
|
@ -50,6 +63,12 @@ var RenderLoop = function(onRender, win) {
|
|||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* RenderLoop.schedule(change) -> Void
|
||||
* - change (Array):
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.schedule = function(change) {
|
||||
//this.onRender(change);
|
||||
//return;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
/*
|
||||
* Extremely simplified version of the requireJS text plugin
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,20 @@ var dom = require("./lib/dom");
|
|||
var event = require("./lib/event");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class ScrollBar
|
||||
*
|
||||
* A set of methods for setting and retrieving the editor's scrollbar.
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new ScrollBar(parent)
|
||||
* - parent (TODO)
|
||||
*
|
||||
* Creates a new `ScrollBar`.
|
||||
*
|
||||
**/
|
||||
var ScrollBar = function(parent) {
|
||||
this.element = dom.createElement("div");
|
||||
this.element.className = "ace_sb";
|
||||
|
|
@ -67,22 +81,55 @@ var ScrollBar = function(parent) {
|
|||
(function() {
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* ScrollBar@onScroll
|
||||
*
|
||||
* Emitted when the scroll bar, well, scrolls.
|
||||
*
|
||||
**/
|
||||
this.onScroll = function() {
|
||||
this._emit("scroll", {data: this.element.scrollTop});
|
||||
};
|
||||
|
||||
/**
|
||||
* ScrollBar.getWidth() -> Number
|
||||
*
|
||||
* Returns the width of the scroll bar.
|
||||
*
|
||||
**/
|
||||
this.getWidth = function() {
|
||||
return this.width;
|
||||
};
|
||||
|
||||
/**
|
||||
* ScrollBar.setHeight(height) -> Void
|
||||
* - height (Number): The new height
|
||||
*
|
||||
* Sets the height of the scroll bar, in pixels.
|
||||
*
|
||||
**/
|
||||
this.setHeight = function(height) {
|
||||
this.element.style.height = height + "px";
|
||||
};
|
||||
|
||||
/**
|
||||
* ScrollBar.setInnerHeight(height) -> Void
|
||||
* - height (Number): The new inner height
|
||||
*
|
||||
* Sets the inner height of the scroll bar, in pixels.
|
||||
*
|
||||
**/
|
||||
this.setInnerHeight = function(height) {
|
||||
this.inner.style.height = height + "px";
|
||||
};
|
||||
|
||||
/**
|
||||
* ScrollBar.setScrollTop(scrollTop) -> Void
|
||||
* - scrollTop (Number): The new scroll top
|
||||
*
|
||||
* Sets the scroll top of the scroll bar.
|
||||
*
|
||||
**/
|
||||
this.setScrollTop = function(scrollTop) {
|
||||
this.element.scrollTop = scrollTop;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,6 +44,28 @@ var lang = require("./lib/lang");
|
|||
var oop = require("./lib/oop");
|
||||
var Range = require("./range").Range;
|
||||
|
||||
/**
|
||||
* class Search
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Search()
|
||||
*
|
||||
* Creates a new `Search` object. The search options contain the following defaults:
|
||||
*
|
||||
* * `needle`: `""`
|
||||
* * `backwards`: `false`
|
||||
* * `wrap`: `false`
|
||||
* * `caseSensitive`: `false`
|
||||
* * `wholeWord`: `false`
|
||||
* * `scope`: `ALL`
|
||||
* * `regExp`: `false`
|
||||
*
|
||||
**/
|
||||
|
||||
var Search = function() {
|
||||
this.$options = {
|
||||
needle: "",
|
||||
|
|
@ -61,15 +83,35 @@ Search.SELECTION = 2;
|
|||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Search.set(options) -> Search
|
||||
* - options (Object): An object containing all the new search properties
|
||||
*
|
||||
* Sets the search options via the `options` parameter.
|
||||
*
|
||||
**/
|
||||
this.set = function(options) {
|
||||
oop.mixin(this.$options, options);
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Search.getOptions() -> Object
|
||||
*
|
||||
* [Returns an object containing all the search options.](~Search.getOptions)
|
||||
*
|
||||
**/
|
||||
this.getOptions = function() {
|
||||
return lang.copyObject(this.$options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Search.find(session) -> Range | null
|
||||
* - session (EditSession): The session to search with
|
||||
*
|
||||
* Searches for `options.needle`. If found, this method returns the [[Range `Range`]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
|
||||
*
|
||||
**/
|
||||
this.find = function(session) {
|
||||
if (!this.$options.needle)
|
||||
return null;
|
||||
|
|
@ -89,6 +131,13 @@ Search.SELECTION = 2;
|
|||
return firstRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* Search.findAll(session) -> Array | null
|
||||
* - session (EditSession): The session to search with
|
||||
*
|
||||
* Searches for all occurances `options.needle`. If found, this method returns an array of [[Range `Range`s]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
|
||||
*
|
||||
**/
|
||||
this.findAll = function(session) {
|
||||
var options = this.$options;
|
||||
if (!options.needle)
|
||||
|
|
@ -115,6 +164,20 @@ Search.SELECTION = 2;
|
|||
return ranges;
|
||||
};
|
||||
|
||||
/**
|
||||
* Search.replace(input, replacement) -> String | null
|
||||
* - input (String): The text to search in
|
||||
* - replacement (String): The replacing text
|
||||
*
|
||||
* Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `options.regExp` is `true`, this function returns `input` with the replacement already made. Otherwise, this function just returns `replacement`.
|
||||
*
|
||||
* If `options.needle` was not found, this function returns `null`.
|
||||
*
|
||||
**/
|
||||
this.replace = function(input, replacement) {
|
||||
var re = this.$assembleRegExp();
|
||||
var match = re.exec(input);
|
||||
|
|
@ -129,6 +192,13 @@ Search.SELECTION = 2;
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Search.$forwardMatchIterator(session) -> String | Boolean
|
||||
* - session (EditSession): The session to search with
|
||||
*
|
||||
* TODO--not doing the below $ signs, they look internal
|
||||
*
|
||||
**/
|
||||
this.$forwardMatchIterator = function(session) {
|
||||
var re = this.$assembleRegExp();
|
||||
var self = this;
|
||||
|
|
@ -163,6 +233,13 @@ Search.SELECTION = 2;
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Search.$backwardMatchIterator(session) -> String | null
|
||||
* - session (EditSession): The session to search with
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.$backwardMatchIterator = function(session) {
|
||||
var re = this.$assembleRegExp();
|
||||
var self = this;
|
||||
|
|
|
|||
|
|
@ -45,12 +45,20 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
var Range = require("./range").Range;
|
||||
|
||||
/**
|
||||
* Keeps cursor position and the text selection of an edit session.
|
||||
* class Selection
|
||||
*
|
||||
* The row/columns used in the selection are in document coordinates
|
||||
* representing ths coordinates as thez appear in the document
|
||||
* before applying soft wrap and folding.
|
||||
*/
|
||||
* Contains the cursor position and the text selection of an edit session.
|
||||
*
|
||||
* The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Selection(session)
|
||||
* - session (EditSession): The session to use
|
||||
*
|
||||
* Creates a new `Selection` object.
|
||||
*
|
||||
**/
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
|
@ -78,14 +86,24 @@ var Selection = function(session) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isEmpty = function() {
|
||||
/**
|
||||
* Selection.isEmpty() -> Boolean
|
||||
*
|
||||
* Returns `true` if the selection is empty.
|
||||
**/
|
||||
this.isEmpty = function() {
|
||||
return (this.$isEmpty || (
|
||||
this.selectionAnchor.row == this.selectionLead.row &&
|
||||
this.selectionAnchor.column == this.selectionLead.column
|
||||
));
|
||||
};
|
||||
|
||||
this.isMultiLine = function() {
|
||||
/**
|
||||
* Selection.isMultiLine() -> Boolean
|
||||
*
|
||||
* Returns `true` if the selection is a multi-line.
|
||||
**/
|
||||
this.isMultiLine = function() {
|
||||
if (this.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -93,11 +111,23 @@ var Selection = function(session) {
|
|||
return this.getRange().isMultiLine();
|
||||
};
|
||||
|
||||
this.getCursor = function() {
|
||||
/**
|
||||
* Selection.getCursor() -> Number
|
||||
*
|
||||
* Gets the current position of the cursor.
|
||||
**/
|
||||
this.getCursor = function() {
|
||||
return this.selectionLead.getPosition();
|
||||
};
|
||||
|
||||
this.setSelectionAnchor = function(row, column) {
|
||||
/**
|
||||
* Selection.setSelectionAnchor(row, column) -> Void
|
||||
* - row (Number): The new row
|
||||
* - column (Number): The new column
|
||||
*
|
||||
* Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event.
|
||||
**/
|
||||
this.setSelectionAnchor = function(row, column) {
|
||||
this.selectionAnchor.setPosition(row, column);
|
||||
|
||||
if (this.$isEmpty) {
|
||||
|
|
@ -106,18 +136,36 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.getSelectionAnchor = function() {
|
||||
/** related to: Anchor.getPosition
|
||||
* Selection.getSelectionAnchor() -> Object
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection anchor.
|
||||
*
|
||||
**/
|
||||
this.getSelectionAnchor = function() {
|
||||
if (this.$isEmpty)
|
||||
return this.getSelectionLead()
|
||||
else
|
||||
return this.selectionAnchor.getPosition();
|
||||
};
|
||||
|
||||
this.getSelectionLead = function() {
|
||||
/** related to: Lead.getPosition
|
||||
* Selection.getSelectionLead() -> Object
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection lead.
|
||||
**/
|
||||
this.getSelectionLead = function() {
|
||||
return this.selectionLead.getPosition();
|
||||
};
|
||||
|
||||
this.shiftSelection = function(columns) {
|
||||
/**
|
||||
* Selection.shiftSelection(columns) -> Void
|
||||
* - columns (Number): The number of columns to shift by
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.shiftSelection = function(columns) {
|
||||
if (this.$isEmpty) {
|
||||
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
||||
return;
|
||||
|
|
@ -138,13 +186,23 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.isBackwards = function() {
|
||||
/**
|
||||
* Selection.isBackwards() -> Boolean
|
||||
*
|
||||
* Returns `true` if the selection is going backwards in the document.
|
||||
**/
|
||||
this.isBackwards = function() {
|
||||
var anchor = this.selectionAnchor;
|
||||
var lead = this.selectionLead;
|
||||
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
|
||||
};
|
||||
|
||||
this.getRange = function() {
|
||||
/**
|
||||
* Selection.getRange() -> Range
|
||||
*
|
||||
* [Returns the [[Range `Range`]] for the selected text.](~Selection.getRange)
|
||||
**/
|
||||
this.getRange = function() {
|
||||
var anchor = this.selectionAnchor;
|
||||
var lead = this.selectionLead;
|
||||
|
||||
|
|
@ -159,20 +217,38 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.clearSelection = function() {
|
||||
/**
|
||||
* Selection.clearSelection() -> Void
|
||||
*
|
||||
* [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.](~Selection.clearSelection)
|
||||
**/
|
||||
this.clearSelection = function() {
|
||||
if (!this.$isEmpty) {
|
||||
this.$isEmpty = true;
|
||||
this._emit("changeSelection");
|
||||
}
|
||||
};
|
||||
|
||||
this.selectAll = function() {
|
||||
/**
|
||||
* Selection.selectAll() -> Void
|
||||
*
|
||||
* Selects all the text in the document.
|
||||
**/
|
||||
this.selectAll = function() {
|
||||
var lastRow = this.doc.getLength() - 1;
|
||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||
this.moveCursorTo(0, 0);
|
||||
};
|
||||
|
||||
this.setSelectionRange = function(range, reverse) {
|
||||
/**
|
||||
* Selection.setSelectionRange(range, reverse) -> Void
|
||||
* - range (Range): The range of text to select
|
||||
* - reverse (Boolean): Indicates if the range should go backwards (`true`) or not
|
||||
*
|
||||
* Sets the selection to the provided range.
|
||||
*
|
||||
**/
|
||||
this.setSelectionRange = function(range, reverse) {
|
||||
if (reverse) {
|
||||
this.setSelectionAnchor(range.end.row, range.end.column);
|
||||
this.selectTo(range.start.row, range.start.column);
|
||||
|
|
@ -196,72 +272,151 @@ var Selection = function(session) {
|
|||
mover.call(this);
|
||||
};
|
||||
|
||||
this.selectTo = function(row, column) {
|
||||
/**
|
||||
* Selection.selectTo(row, column) -> Void
|
||||
* - row (Number): The row to select to
|
||||
* - column (Number): The column to select to
|
||||
*
|
||||
* Moves the selection cursor to the indicated row and column.
|
||||
*
|
||||
**/
|
||||
this.selectTo = function(row, column) {
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(row, column);
|
||||
});
|
||||
};
|
||||
|
||||
this.selectToPosition = function(pos) {
|
||||
/**
|
||||
* Selection.selectToPosition(pos) -> Void
|
||||
* - pos (Object): An object containing the row and column
|
||||
*
|
||||
* Moves the selection cursor to the row and column indicated by `pos`.
|
||||
*
|
||||
**/
|
||||
this.selectToPosition = function(pos) {
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorToPosition(pos);
|
||||
});
|
||||
};
|
||||
|
||||
this.selectUp = function() {
|
||||
/**
|
||||
* Selection.selectUp() -> Void
|
||||
*
|
||||
* Moves the selection up one row.
|
||||
**/
|
||||
this.selectUp = function() {
|
||||
this.$moveSelection(this.moveCursorUp);
|
||||
};
|
||||
|
||||
this.selectDown = function() {
|
||||
/**
|
||||
* Selection.selectDown() -> Void
|
||||
*
|
||||
* Moves the selection down one row.
|
||||
**/
|
||||
this.selectDown = function() {
|
||||
this.$moveSelection(this.moveCursorDown);
|
||||
};
|
||||
|
||||
this.selectRight = function() {
|
||||
/**
|
||||
* Selection.selectRight() -> Void
|
||||
*
|
||||
* Moves the selection right one column.
|
||||
**/
|
||||
this.selectRight = function() {
|
||||
this.$moveSelection(this.moveCursorRight);
|
||||
};
|
||||
|
||||
this.selectLeft = function() {
|
||||
/**
|
||||
* Selection.selectLeft() -> Void
|
||||
*
|
||||
* Moves the selection left one column.
|
||||
**/
|
||||
this.selectLeft = function() {
|
||||
this.$moveSelection(this.moveCursorLeft);
|
||||
};
|
||||
|
||||
this.selectLineStart = function() {
|
||||
/**
|
||||
* Selection.selectLineStart() -> Void
|
||||
*
|
||||
* Moves the selection to the beginning of the current line.
|
||||
**/
|
||||
this.selectLineStart = function() {
|
||||
this.$moveSelection(this.moveCursorLineStart);
|
||||
};
|
||||
|
||||
this.selectLineEnd = function() {
|
||||
/**
|
||||
* Selection.selectLineEnd() -> Void
|
||||
*
|
||||
* Moves the selection to the end of the current line.
|
||||
**/
|
||||
this.selectLineEnd = function() {
|
||||
this.$moveSelection(this.moveCursorLineEnd);
|
||||
};
|
||||
|
||||
this.selectFileEnd = function() {
|
||||
/**
|
||||
* Selection.selectFileEnd() -> Void
|
||||
*
|
||||
* Moves the selection to the end of the file.
|
||||
**/
|
||||
this.selectFileEnd = function() {
|
||||
this.$moveSelection(this.moveCursorFileEnd);
|
||||
};
|
||||
|
||||
this.selectFileStart = function() {
|
||||
/**
|
||||
* Selection.selectFileStart() -> Void
|
||||
*
|
||||
* Moves the selection to the start of the file.
|
||||
**/
|
||||
this.selectFileStart = function() {
|
||||
this.$moveSelection(this.moveCursorFileStart);
|
||||
};
|
||||
|
||||
this.selectWordRight = function() {
|
||||
/**
|
||||
* Selection.selectWordRight() -> Void
|
||||
*
|
||||
* Moves the selection to the first word on the right.
|
||||
**/
|
||||
this.selectWordRight = function() {
|
||||
this.$moveSelection(this.moveCursorWordRight);
|
||||
};
|
||||
|
||||
this.selectWordLeft = function() {
|
||||
/**
|
||||
* Selection.selectWordLeft() -> Void
|
||||
*
|
||||
* Moves the selection to the first word on the left.
|
||||
**/
|
||||
this.selectWordLeft = function() {
|
||||
this.$moveSelection(this.moveCursorWordLeft);
|
||||
};
|
||||
|
||||
this.selectWord = function() {
|
||||
/** related to: EditSession.getWordRange
|
||||
* Selection.selectWord() -> Void
|
||||
*
|
||||
* Moves the selection to highlight the entire word.
|
||||
**/
|
||||
this.selectWord = function() {
|
||||
var cursor = this.getCursor();
|
||||
var range = this.session.getWordRange(cursor.row, cursor.column);
|
||||
this.setSelectionRange(range);
|
||||
};
|
||||
|
||||
// Selects a word including its right whitespace
|
||||
this.selectAWord = function() {
|
||||
/** related to: EditSession.getAWordRange
|
||||
* Selection.selectAWord() -> Void
|
||||
*
|
||||
* Selects a word, including its right whitespace.
|
||||
**/
|
||||
this.selectAWord = function() {
|
||||
var cursor = this.getCursor();
|
||||
var range = this.session.getAWordRange(cursor.row, cursor.column);
|
||||
this.setSelectionRange(range);
|
||||
};
|
||||
|
||||
this.selectLine = function() {
|
||||
/**
|
||||
* Selection.selectLine() -> Void
|
||||
*
|
||||
* Selects the entire line.
|
||||
**/
|
||||
this.selectLine = function() {
|
||||
var rowStart = this.selectionLead.row;
|
||||
var rowEnd;
|
||||
|
||||
|
|
@ -278,15 +433,30 @@ var Selection = function(session) {
|
|||
});
|
||||
};
|
||||
|
||||
this.moveCursorUp = function() {
|
||||
/**
|
||||
* Selection.moveCursorUp() -> Void
|
||||
*
|
||||
* Moves the cursor up one row.
|
||||
**/
|
||||
this.moveCursorUp = function() {
|
||||
this.moveCursorBy(-1, 0);
|
||||
};
|
||||
|
||||
this.moveCursorDown = function() {
|
||||
/**
|
||||
* Selection.moveCursorDown() -> Void
|
||||
*
|
||||
* Moves the cursor down one row.
|
||||
**/
|
||||
this.moveCursorDown = function() {
|
||||
this.moveCursorBy(1, 0);
|
||||
};
|
||||
|
||||
this.moveCursorLeft = function() {
|
||||
/**
|
||||
* Selection.moveCursorLeft() -> Void
|
||||
*
|
||||
* Moves the cursor left one column.
|
||||
**/
|
||||
this.moveCursorLeft = function() {
|
||||
var cursor = this.selectionLead.getPosition(),
|
||||
fold;
|
||||
|
||||
|
|
@ -307,7 +477,12 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.moveCursorRight = function() {
|
||||
/**
|
||||
* Selection.moveCursorRight() -> Void
|
||||
*
|
||||
* Moves the cursor right one column.
|
||||
**/
|
||||
this.moveCursorRight = function() {
|
||||
var cursor = this.selectionLead.getPosition(),
|
||||
fold;
|
||||
if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
|
||||
|
|
@ -328,7 +503,12 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.moveCursorLineStart = function() {
|
||||
/**
|
||||
* Selection.moveCursorLineStart() -> Void
|
||||
*
|
||||
* Moves the cursor to the start of the line.
|
||||
**/
|
||||
this.moveCursorLineStart = function() {
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
var screenRow = this.session.documentToScreenRow(row, column);
|
||||
|
|
@ -356,7 +536,12 @@ var Selection = function(session) {
|
|||
}
|
||||
};
|
||||
|
||||
this.moveCursorLineEnd = function() {
|
||||
/**
|
||||
* Selection.moveCursorLineEnd() -> Void
|
||||
*
|
||||
* Moves the cursor to the end of the line.
|
||||
**/
|
||||
this.moveCursorLineEnd = function() {
|
||||
var lead = this.selectionLead;
|
||||
var lastRowColumnPosition =
|
||||
this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
|
||||
|
|
@ -366,17 +551,32 @@ var Selection = function(session) {
|
|||
);
|
||||
};
|
||||
|
||||
this.moveCursorFileEnd = function() {
|
||||
/**
|
||||
* Selection.moveCursorFileEnd() -> Void
|
||||
*
|
||||
* Moves the cursor to the end of the file.
|
||||
**/
|
||||
this.moveCursorFileEnd = function() {
|
||||
var row = this.doc.getLength() - 1;
|
||||
var column = this.doc.getLine(row).length;
|
||||
this.moveCursorTo(row, column);
|
||||
};
|
||||
|
||||
this.moveCursorFileStart = function() {
|
||||
/**
|
||||
* Selection.moveCursorFileStart() -> Void
|
||||
*
|
||||
* Moves the cursor to the start of the file.
|
||||
**/
|
||||
this.moveCursorFileStart = function() {
|
||||
this.moveCursorTo(0, 0);
|
||||
};
|
||||
|
||||
this.moveCursorWordRight = function() {
|
||||
/**
|
||||
* Selection.moveCursorWordRight() -> Void
|
||||
*
|
||||
* Moves the cursor to the word on the right.
|
||||
**/
|
||||
this.moveCursorWordRight = function() {
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
var line = this.doc.getLine(row);
|
||||
|
|
@ -418,7 +618,12 @@ var Selection = function(session) {
|
|||
this.moveCursorTo(row, column);
|
||||
};
|
||||
|
||||
this.moveCursorWordLeft = function() {
|
||||
/**
|
||||
* Selection.moveCursorWordLeft() -> Void
|
||||
*
|
||||
* Moves the cursor to the word on the left.
|
||||
**/
|
||||
this.moveCursorWordLeft = function() {
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
|
||||
|
|
@ -464,7 +669,14 @@ var Selection = function(session) {
|
|||
this.moveCursorTo(row, column);
|
||||
};
|
||||
|
||||
this.moveCursorBy = function(rows, chars) {
|
||||
/** related to: EditSession.documentToScreenPosition
|
||||
* Selection.moveCursorBy(rows, chars) -> Void
|
||||
* - rows (Number): The number of rows to move by
|
||||
* - chars (Number): The number of characters to move by
|
||||
*
|
||||
* Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.
|
||||
**/
|
||||
this.moveCursorBy = function(rows, chars) {
|
||||
var screenPos = this.session.documentToScreenPosition(
|
||||
this.selectionLead.row,
|
||||
this.selectionLead.column
|
||||
|
|
@ -477,11 +689,25 @@ var Selection = function(session) {
|
|||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
};
|
||||
|
||||
this.moveCursorToPosition = function(position) {
|
||||
/**
|
||||
* Selection.moveCursorToPosition(position) -> Void
|
||||
* - position (Object): The position to move to
|
||||
*
|
||||
* Moves the selection to the position indicated by its `row` and `column`.
|
||||
**/
|
||||
this.moveCursorToPosition = function(position) {
|
||||
this.moveCursorTo(position.row, position.column);
|
||||
};
|
||||
|
||||
this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
|
||||
/**
|
||||
* Selection.moveCursorTo(row, column, preventUpdateDesiredColumn) -> Void
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - preventUpdateDesiredColumn (Boolean): Indicates if the column should be updated (`true`) or not (`false`)
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
|
||||
// Ensure the row/column is not inside of a fold.
|
||||
var fold = this.session.getFoldAt(row, column, 1);
|
||||
if (fold) {
|
||||
|
|
@ -497,7 +723,15 @@ var Selection = function(session) {
|
|||
this.$updateDesiredColumn(this.selectionLead.column);
|
||||
};
|
||||
|
||||
this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
|
||||
/**
|
||||
* Selection.moveCursorToScreen(row, column, preventUpdateDesiredColumn) -> Void
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - preventUpdateDesiredColumn (Boolean): Indicates if the column should be updated (`true`) or not (`false`)
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
|
||||
var pos = this.session.screenToDocumentPosition(row, column);
|
||||
row = pos.row;
|
||||
column = pos.column;
|
||||
|
|
|
|||
115
lib/ace/split.js
|
|
@ -47,6 +47,23 @@ var Editor = require("./editor").Editor;
|
|||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
|
||||
/**
|
||||
* class Split
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Split(container, theme, splits)
|
||||
* - container (Document): The document to associate with the anchor
|
||||
* - theme (Number): The starting row position
|
||||
* - splits (Number): The starting column position
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
var Split = function(container, theme, splits) {
|
||||
this.BELOW = 1;
|
||||
this.BESIDE = 0;
|
||||
|
|
@ -87,6 +104,13 @@ var Split = function(container, theme, splits) {
|
|||
return editor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.setSplits(splits) -> Void
|
||||
* - splits (Number): The new number of splits
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.setSplits = function(splits) {
|
||||
var editor;
|
||||
if (splits < 1) {
|
||||
|
|
@ -116,42 +140,100 @@ var Split = function(container, theme, splits) {
|
|||
this.resize();
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.getSplits() -> Number
|
||||
*
|
||||
* Returns the number of splits.
|
||||
*
|
||||
**/
|
||||
this.getSplits = function() {
|
||||
return this.$splits;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.getEditor(idx) -> Editor
|
||||
* -idx (Number): The index of the editor you want
|
||||
*
|
||||
* Returns the editor identified by the index `idx`.
|
||||
*
|
||||
**/
|
||||
this.getEditor = function(idx) {
|
||||
return this.$editors[idx];
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.getCurrentEditor() -> Editor
|
||||
*
|
||||
* Returns the current editor.
|
||||
*
|
||||
**/
|
||||
this.getCurrentEditor = function() {
|
||||
return this.$cEditor;
|
||||
};
|
||||
|
||||
/** related to: Editor.focus
|
||||
* Split.focus() -> Void
|
||||
*
|
||||
* Focuses the current editor.
|
||||
*
|
||||
**/
|
||||
this.focus = function() {
|
||||
this.$cEditor.focus();
|
||||
};
|
||||
|
||||
/** related to: Editor.blur
|
||||
* Split.blur() -> Void
|
||||
*
|
||||
* Blurs the current editor.
|
||||
*
|
||||
**/
|
||||
this.blur = function() {
|
||||
this.$cEditor.blur();
|
||||
};
|
||||
|
||||
/** related to: Editor.setTheme
|
||||
* Split.setTheme(theme) -> Void
|
||||
* - theme (String):
|
||||
*
|
||||
* Sets a theme for each of the available editors.
|
||||
**/
|
||||
this.setTheme = function(theme) {
|
||||
this.$editors.forEach(function(editor) {
|
||||
editor.setTheme(theme);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.setKeyboardHandler(keybinding) -> Void
|
||||
* - keybinding (String):
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.setKeyboardHandler = function(keybinding) {
|
||||
this.$editors.forEach(function(editor) {
|
||||
editor.setKeyboardHandler(keybinding);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.forEach(callback, scope) -> Void
|
||||
* - callback (Function): A callback function to execute
|
||||
* - scope (String): TODO
|
||||
*
|
||||
* Executes `callback` on all of the available editors. TODO
|
||||
*
|
||||
**/
|
||||
this.forEach = function(callback, scope) {
|
||||
this.$editors.forEach(callback, scope);
|
||||
};
|
||||
|
||||
/** related to: editor.setFontSize
|
||||
* Split.setFontSize(size) -> Void
|
||||
* - size (Number): The new font size
|
||||
*
|
||||
* Sets the font size, in pixels, for all the available editors.
|
||||
*
|
||||
**/
|
||||
this.$fontSize = "";
|
||||
this.setFontSize = function(size) {
|
||||
this.$fontSize = size;
|
||||
|
|
@ -187,6 +269,14 @@ var Split = function(container, theme, splits) {
|
|||
return s;
|
||||
};
|
||||
|
||||
/** related to: editor.setSession
|
||||
* Split.setSession(session, idx) -> Void
|
||||
* - session (EditSession): The new edit session
|
||||
* - idx (Number): The editor's index you're interested in
|
||||
*
|
||||
* Sets a new [[EditSession `EditSession`]] for the indicated editor.
|
||||
*
|
||||
**/
|
||||
this.setSession = function(session, idx) {
|
||||
var editor;
|
||||
if (idx == null) {
|
||||
|
|
@ -213,10 +303,23 @@ var Split = function(container, theme, splits) {
|
|||
return session;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.getOriantation() -> Number
|
||||
*
|
||||
* Returns the orientation. TODO
|
||||
*
|
||||
**/
|
||||
this.getOriantation = function() {
|
||||
return this.$oriantation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.setOriantation(oriantation) -> Void
|
||||
* - oriantation (Number):
|
||||
*
|
||||
* Sets the orientation. TODO
|
||||
*
|
||||
**/
|
||||
this.setOriantation = function(oriantation) {
|
||||
if (this.$oriantation == oriantation) {
|
||||
return;
|
||||
|
|
@ -225,6 +328,12 @@ var Split = function(container, theme, splits) {
|
|||
this.resize();
|
||||
};
|
||||
|
||||
/**
|
||||
* Split.resize() -> Void
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
this.resize = function() {
|
||||
var width = this.$container.clientWidth;
|
||||
var height = this.$container.clientHeight;
|
||||
|
|
@ -255,6 +364,12 @@ var Split = function(container, theme, splits) {
|
|||
|
||||
}).call(Split.prototype);
|
||||
|
||||
/**
|
||||
* Split.UndoManagerProxy() -> Void
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
function UndoManagerProxy(undoManager, session) {
|
||||
this.$u = undoManager;
|
||||
this.$doc = session;
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ exports.keys = function(map, construct) {
|
|||
return exports.list(keys, construct)
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* range([start,] stop[, step]) -> generator of integers
|
||||
*
|
||||
* Return a generator containing an arithmetic progression of integers.
|
||||
|
|
|
|||
|
|
@ -39,6 +39,22 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* class Token_Iterator
|
||||
*
|
||||
* This class handles all sorts of token iterizing. Is that even a word? TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Token_Iterator(session, initialRow, initialColumn)
|
||||
* - session (EditSession): The session to associate with
|
||||
* - initialRow (Number): The row to start the tokenizing at
|
||||
* - initialColumn (Number): The column to start the tokenizing at
|
||||
*
|
||||
* Creates a new token iterator object. The inital token index is set to the row and column coordinates.
|
||||
*
|
||||
**/
|
||||
var TokenIterator = function(session, initialRow, initialColumn) {
|
||||
this.$session = session;
|
||||
this.$row = initialRow;
|
||||
|
|
@ -49,7 +65,12 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
|||
};
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
/**
|
||||
* Token_Iterator.stepBackward() -> Array | null
|
||||
*
|
||||
* Tokenizes all the items from the current point to the row prior in the document. If the current point is at the top of the file, this function returns `null`. Otherwise, it returns an array of the tokenized strings.
|
||||
**/
|
||||
this.stepBackward = function() {
|
||||
this.$tokenIndex -= 1;
|
||||
|
||||
|
|
@ -66,7 +87,12 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
|||
|
||||
return this.$rowTokens[this.$tokenIndex];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Token_Iterator.stepForward() -> String | null
|
||||
*
|
||||
* Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns `null`. Otherwise, it returns the tokenized string.
|
||||
**/
|
||||
this.stepForward = function() {
|
||||
var rowCount = this.$session.getLength();
|
||||
this.$tokenIndex += 1;
|
||||
|
|
@ -84,15 +110,33 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
|||
|
||||
return this.$rowTokens[this.$tokenIndex];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Token_Iterator.getCurrentToken() -> String
|
||||
*
|
||||
* Returns the current tokenized string.
|
||||
*
|
||||
**/
|
||||
this.getCurrentToken = function () {
|
||||
return this.$rowTokens[this.$tokenIndex];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Token_Iterator.getCurrentTokenRow() -> Number
|
||||
*
|
||||
* Returns the current row.
|
||||
*
|
||||
**/
|
||||
this.getCurrentTokenRow = function () {
|
||||
return this.$row;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Token_Iterator.getCurrentTokenColumn() -> Number
|
||||
*
|
||||
* Returns the current column.
|
||||
*
|
||||
**/
|
||||
this.getCurrentTokenColumn = function() {
|
||||
var rowTokens = this.$rowTokens;
|
||||
var tokenIndex = this.$tokenIndex;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,21 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* class Tokenizer
|
||||
*
|
||||
* This object handles all sorts of tokenizing? TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Tokenizer(rules, flag)
|
||||
* - rules (String):
|
||||
* - flag (String):
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
var Tokenizer = function(rules, flag) {
|
||||
flag = flag ? "g" + flag : "g";
|
||||
this.rules = rules;
|
||||
|
|
@ -76,6 +91,11 @@ var Tokenizer = function(rules, flag) {
|
|||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Tokenizer.getLineTokens() -> Object
|
||||
*
|
||||
* TODO. Returns an object containing two properties: `tokens`, all the tokens; and `state`, the current state.
|
||||
**/
|
||||
this.getLineTokens = function(line, startState) {
|
||||
var currentState = startState;
|
||||
var state = this.rules[currentState];
|
||||
|
|
|
|||
|
|
@ -40,12 +40,30 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* class UndoManager
|
||||
*
|
||||
* This object controls all the undoing that needs to be done. TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new UndoManager()
|
||||
*
|
||||
* Resets the current undo state and creates a new `UndoManager`.
|
||||
**/
|
||||
var UndoManager = function() {
|
||||
this.reset();
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* UndoManager.execute(options) -> Void
|
||||
* - options (Object):
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.execute = function(options) {
|
||||
var deltas = options.args[0];
|
||||
this.$doc = options.args[1];
|
||||
|
|
@ -53,6 +71,12 @@ var UndoManager = function() {
|
|||
this.$redoStack = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.undo(dontSelect) -> Range
|
||||
* - dontSelect (Boolean): TODO
|
||||
*
|
||||
* [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.](~UndoManager.undo)
|
||||
**/
|
||||
this.undo = function(dontSelect) {
|
||||
var deltas = this.$undoStack.pop();
|
||||
var undoSelectionRange = null;
|
||||
|
|
@ -64,6 +88,12 @@ var UndoManager = function() {
|
|||
return undoSelectionRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.redo(dontSelect) -> Void
|
||||
* - dontSelect (Boolean): TODO
|
||||
*
|
||||
* [Perform a redo operation on the document, reimplementing the last change.](~UndoManager.redo)
|
||||
**/
|
||||
this.redo = function(dontSelect) {
|
||||
var deltas = this.$redoStack.pop();
|
||||
var redoSelectionRange = null;
|
||||
|
|
@ -75,15 +105,30 @@ var UndoManager = function() {
|
|||
return redoSelectionRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.reset() -> Void
|
||||
*
|
||||
* Destroys the stack of undo and redo redo operations.
|
||||
**/
|
||||
this.reset = function() {
|
||||
this.$undoStack = [];
|
||||
this.$redoStack = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.hasUndo() -> Boolean
|
||||
*
|
||||
* Returns `true` if there are undo operations left to perform.
|
||||
**/
|
||||
this.hasUndo = function() {
|
||||
return this.$undoStack.length > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* UndoManager.hasRedo() -> Boolean
|
||||
*
|
||||
* Returns `true` if there are redo operations left to perform.
|
||||
**/
|
||||
this.hasRedo = function() {
|
||||
return this.$redoStack.length > 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -56,6 +56,22 @@ var editorCss = require("ace/requirejs/text!./css/editor.css");
|
|||
|
||||
dom.importCssString(editorCss, "ace_editor");
|
||||
|
||||
/**
|
||||
* class Virtual_Renderer
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Virtual_Renderer(container, theme)
|
||||
* - container (Editor):
|
||||
* - theme (String): The starting theme
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
**/
|
||||
|
||||
var VirtualRenderer = function(container, theme) {
|
||||
var _self = this;
|
||||
|
||||
|
|
@ -175,6 +191,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setSession(session) -> Void
|
||||
*
|
||||
* Associates an [[EditSession `EditSession`]].
|
||||
**/
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
this.$cursorLayer.setSession(session);
|
||||
|
|
@ -186,8 +207,12 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Triggers partial update of the text layer
|
||||
*/
|
||||
* Virtual_Renderer.updateLines(firstRow, lastRow) -> Void
|
||||
* - firstRow (Number): The first row to update
|
||||
* - lastRow (Number): The last row to update
|
||||
*
|
||||
* Triggers a partial update of the text, from the range given by the two parameters.
|
||||
**/
|
||||
this.updateLines = function(firstRow, lastRow) {
|
||||
if (lastRow === undefined)
|
||||
lastRow = Infinity;
|
||||
|
|
@ -210,26 +235,38 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Triggers full update of the text layer
|
||||
*/
|
||||
* Virtual_Renderer.updateText() -> Void
|
||||
*
|
||||
* Triggers a full update of the text, for all the rows.
|
||||
**/
|
||||
this.updateText = function() {
|
||||
this.$loop.schedule(this.CHANGE_TEXT);
|
||||
};
|
||||
|
||||
/**
|
||||
* Triggers a full update of all layers
|
||||
*/
|
||||
* Virtual_Renderer.updateFull() -> Void
|
||||
*
|
||||
* Triggers a full update of all the layers, for all the rows.
|
||||
**/
|
||||
this.updateFull = function() {
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.updateFontSize() -> Void
|
||||
*
|
||||
* Updates the font size.
|
||||
**/
|
||||
this.updateFontSize = function() {
|
||||
this.$textLayer.checkForSizeChanges();
|
||||
};
|
||||
|
||||
/**
|
||||
* Triggers resize of the editor
|
||||
*/
|
||||
* Virtual_Renderer.onResize(force) -> Void
|
||||
* - force (Boolean): TODO
|
||||
*
|
||||
* Triggers a resize of the editor.
|
||||
**/
|
||||
this.onResize = function(force) {
|
||||
var changes = this.CHANGE_SIZE;
|
||||
var size = this.$size;
|
||||
|
|
@ -264,45 +301,99 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$loop.schedule(changes);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.adjustWrapLimit() -> Void
|
||||
*
|
||||
* Adjusts the wrap limits. TODO.
|
||||
**/
|
||||
this.adjustWrapLimit = function() {
|
||||
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth);
|
||||
return this.session.adjustWrapLimit(limit);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setShowInvisibles(showInvisibles) -> Void
|
||||
* - showInvisibles (Boolean): Set to `true` to show invisibles
|
||||
*
|
||||
* Identifies whether you want to show invisible characters or not.
|
||||
*
|
||||
**/
|
||||
this.setShowInvisibles = function(showInvisibles) {
|
||||
if (this.$textLayer.setShowInvisibles(showInvisibles))
|
||||
this.$loop.schedule(this.CHANGE_TEXT);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getShowInvisibles() -> Boolean
|
||||
*
|
||||
* Returns whether or not invisible characters are being shown or not.
|
||||
**/
|
||||
this.getShowInvisibles = function() {
|
||||
return this.$textLayer.showInvisibles;
|
||||
};
|
||||
|
||||
this.$showPrintMargin = true;
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setShowPrintMargin(showPrintMargin)
|
||||
* - showPrintMargin (Boolean): Set to `true` to show the print margin
|
||||
*
|
||||
* Identifies whether you want to show the print margin or not.
|
||||
*
|
||||
**/
|
||||
this.setShowPrintMargin = function(showPrintMargin) {
|
||||
this.$showPrintMargin = showPrintMargin;
|
||||
this.$updatePrintMargin();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getShowPrintMargin() -> Boolean
|
||||
*
|
||||
* Returns whether or not the print margin is being shown or not.
|
||||
**/
|
||||
this.getShowPrintMargin = function() {
|
||||
return this.$showPrintMargin;
|
||||
};
|
||||
|
||||
this.$printMarginColumn = 80;
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setPrintMarginColumn(showPrintMargin)
|
||||
* - showPrintMargin (Boolean): Set to `true` to show the print margin column
|
||||
*
|
||||
* Identifies whether you want to show the print margin column or not.
|
||||
*
|
||||
**/
|
||||
this.setPrintMarginColumn = function(showPrintMargin) {
|
||||
this.$printMarginColumn = showPrintMargin;
|
||||
this.$updatePrintMargin();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getPrintMarginColumn() -> Boolean
|
||||
*
|
||||
* Returns whether or not the print margin column is being shown or not.
|
||||
**/
|
||||
this.getPrintMarginColumn = function() {
|
||||
return this.$printMarginColumn;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getShowGutter() -> Boolean
|
||||
*
|
||||
* Returns `true` if the gutter is being shown.
|
||||
**/
|
||||
this.getShowGutter = function(){
|
||||
return this.showGutter;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setShowGutter(show) -> Void
|
||||
* - show (Boolean): Set to `true` to show the gutter
|
||||
*
|
||||
* Identifies whether you want to show the gutter or not.
|
||||
**/
|
||||
this.setShowGutter = function(show){
|
||||
if(this.showGutter === show)
|
||||
return;
|
||||
|
|
@ -331,18 +422,39 @@ var VirtualRenderer = function(container, theme) {
|
|||
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getContainerElement() -> TODO
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.getContainerElement = function() {
|
||||
return this.container;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getMouseEventTarget() -> TODO
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.getMouseEventTarget = function() {
|
||||
return this.content;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getTextAreaContainer() -> TODO
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.getTextAreaContainer = function() {
|
||||
return this.container;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.moveTextAreaToCursor(textarea) -> Void
|
||||
* - textarea (Element): A text area to work with
|
||||
*
|
||||
* Changes the position of `textarea` to where the cursor is pointing.
|
||||
**/
|
||||
this.moveTextAreaToCursor = function(textarea) {
|
||||
// in IE the native cursor always shines through
|
||||
// this persists in IE9
|
||||
|
|
@ -363,24 +475,52 @@ var VirtualRenderer = function(container, theme) {
|
|||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getFirstVisibleRow() -> Number
|
||||
*
|
||||
* [Returns the index of the first visible row.](~VirtualRenderer.getFirstVisibleRow)
|
||||
**/
|
||||
this.getFirstVisibleRow = function() {
|
||||
return this.layerConfig.firstRow;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getFirstFullyVisibleRow() -> Number
|
||||
*
|
||||
* Returns the index of the first fully visible row. "Fully" here means TODO
|
||||
**/
|
||||
this.getFirstFullyVisibleRow = function() {
|
||||
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getLastFullyVisibleRow() -> Number
|
||||
*
|
||||
* Returns the index of the last fully visible row. "Fully" here means TODO
|
||||
**/
|
||||
this.getLastFullyVisibleRow = function() {
|
||||
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
||||
return this.layerConfig.firstRow - 1 + flint;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getLastVisibleRow() -> Number
|
||||
*
|
||||
* [Returns the index of the last visible row.](~VirtualRenderer.getLastVisibleRow)
|
||||
**/
|
||||
this.getLastVisibleRow = function() {
|
||||
return this.layerConfig.lastRow;
|
||||
};
|
||||
|
||||
this.$padding = null;
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setPadding(padding) -> Void
|
||||
* - padding (Number): A new padding value (in pixels)
|
||||
*
|
||||
* Sets the padding for all the layers.
|
||||
*
|
||||
**/
|
||||
this.setPadding = function(padding) {
|
||||
this.$padding = padding;
|
||||
this.$textLayer.setPadding(padding);
|
||||
|
|
@ -391,10 +531,21 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$updatePrintMargin();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getHScrollBarAlwaysVisible() -> Boolean
|
||||
*
|
||||
* Returns whether or not the horizontal scrollbar is set to be always visible.
|
||||
**/
|
||||
this.getHScrollBarAlwaysVisible = function() {
|
||||
return this.$horizScrollAlwaysVisible;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setHScrollBarAlwaysVisible(alwaysVisible) -> Void
|
||||
* - alwaysVisible (Boolean): Set to `true` to make the horizontal scroll bar visible
|
||||
*
|
||||
* Identifies whether you want to show the horizontal scrollbar or not.
|
||||
**/
|
||||
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
|
||||
if (this.$horizScrollAlwaysVisible != alwaysVisible) {
|
||||
this.$horizScrollAlwaysVisible = alwaysVisible;
|
||||
|
|
@ -588,48 +739,104 @@ var VirtualRenderer = function(container, theme) {
|
|||
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.updateFrontMarkers() -> Void
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.updateFrontMarkers = function() {
|
||||
this.$markerFront.setMarkers(this.session.getMarkers(true));
|
||||
this.$loop.schedule(this.CHANGE_MARKER_FRONT);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.updateBackMarkers() -> Void
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.updateBackMarkers = function() {
|
||||
this.$markerBack.setMarkers(this.session.getMarkers());
|
||||
this.$loop.schedule(this.CHANGE_MARKER_BACK);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.addGutterDecoration(row, className) -> Void
|
||||
* - row (Number): The row number
|
||||
* - className (String): The class to add
|
||||
*
|
||||
* Adds `className` to the `row`, to be used for CSS stylings and whatnot.
|
||||
**/
|
||||
this.addGutterDecoration = function(row, className){
|
||||
this.$gutterLayer.addGutterDecoration(row, className);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.removeGutterDecoration(row, className)-> Void
|
||||
* - row (Number): The row number
|
||||
* - className (String): The class to add
|
||||
*
|
||||
* Removes `className` from the `row`.
|
||||
**/
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$gutterLayer.removeGutterDecoration(row, className);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setBreakpoints(rows) -> Void
|
||||
* - rows (Array): An array containg row numbers
|
||||
*
|
||||
* Sets a breakpoint for every row number indicated on `rows`.
|
||||
**/
|
||||
this.setBreakpoints = function(rows) {
|
||||
this.$gutterLayer.setBreakpoints(rows);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setAnnotations(annotations) -> Void
|
||||
* - annotations (Array): An array containing annotation
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.setAnnotations = function(annotations) {
|
||||
this.$gutterLayer.setAnnotations(annotations);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.updateCursor() -> Void
|
||||
*
|
||||
* Updates the cursor icon.
|
||||
**/
|
||||
this.updateCursor = function() {
|
||||
this.$loop.schedule(this.CHANGE_CURSOR);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.hideCursor() -> Void
|
||||
*
|
||||
* Hides the cursor icon.
|
||||
**/
|
||||
this.hideCursor = function() {
|
||||
this.$cursorLayer.hideCursor();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.showCursor() -> Void
|
||||
*
|
||||
* Shows the cursor icon.
|
||||
**/
|
||||
this.showCursor = function() {
|
||||
this.$cursorLayer.showCursor();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.scrollCursorIntoView() -> VOid
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.scrollCursorIntoView = function() {
|
||||
// the editor is not visible
|
||||
if (this.$size.scrollerHeight === 0)
|
||||
|
|
@ -661,26 +868,60 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
};
|
||||
|
||||
/** related to: EditSession.getScrollTop
|
||||
* Virtual_Renderer.getScrollTop() -> Number
|
||||
*
|
||||
* (~EditSession.getScrollTop)
|
||||
**/
|
||||
this.getScrollTop = function() {
|
||||
return this.session.getScrollTop();
|
||||
};
|
||||
|
||||
/** related to: EditSession.getScrollLeft
|
||||
* Virtual_Renderer.getScrollLeft() -> Number
|
||||
*
|
||||
* (~EditSession.getScrollLeft)
|
||||
**/
|
||||
this.getScrollLeft = function() {
|
||||
return this.session.getScrollTop();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getScrollTopRow() -> Number
|
||||
*
|
||||
* Returns the size of the first row, in pixels. TODO
|
||||
**/
|
||||
this.getScrollTopRow = function() {
|
||||
return this.scrollTop / this.lineHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getScrollBottomRow() -> Number
|
||||
*
|
||||
* Returns the size of the last row, in pixels.
|
||||
**/
|
||||
this.getScrollBottomRow = function() {
|
||||
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
|
||||
};
|
||||
|
||||
/** related to: EditSession.setScrollTop
|
||||
* Virtual_Renderer.scrollToRow(row) -> Void
|
||||
* - row (Number): A row id
|
||||
*
|
||||
* Sets the top of the editor to the row indicated.
|
||||
**/
|
||||
this.scrollToRow = function(row) {
|
||||
this.session.setScrollTop(row * this.lineHeight);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.scrollToLine(line, center)
|
||||
* - line (Number): The line to go to
|
||||
* - center (Boolean): Identifies whether you want the cursor centered or not
|
||||
*
|
||||
* Scrolls the editor to the `line` indicated.
|
||||
*
|
||||
**/
|
||||
this.scrollToLine = function(line, center) {
|
||||
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
|
||||
var offset = pos.top;
|
||||
|
|
@ -690,6 +931,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.session.setScrollTop(offset);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.scrollToY(scrollTop) -> Number
|
||||
* - scrollTop (Number): The position to scroll to
|
||||
*
|
||||
* Scrolls the editor to the y pixel indicated.
|
||||
*
|
||||
**/
|
||||
this.scrollToY = function(scrollTop) {
|
||||
// after calling scrollBar.setScrollTop
|
||||
// scrollbar sends us event with same scrollTop. ignore it
|
||||
|
|
@ -699,6 +947,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.scrollToX(scrollLeft) -> Number
|
||||
* - scrollLeft (Number): The position to scroll to
|
||||
*
|
||||
* Scrolls the editor to the x pixel indicated.
|
||||
*
|
||||
**/
|
||||
this.scrollToX = function(scrollLeft) {
|
||||
if (scrollLeft <= this.$padding)
|
||||
scrollLeft = 0;
|
||||
|
|
@ -709,11 +964,25 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.scrollBy(deltaX, deltaY) -> Void
|
||||
* - deltaX (Number): The x value to scroll by
|
||||
* - deltaY (Number): The y value to scroll by
|
||||
*
|
||||
* Scrolls the editor across both x- and y-axes.
|
||||
**/
|
||||
this.scrollBy = function(deltaX, deltaY) {
|
||||
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
|
||||
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.isScrollableBy(deltaX, deltaY) -> Boolean
|
||||
* - deltaX (Number): The x value to scroll by
|
||||
* - deltaY (Number): The y value to scroll by
|
||||
*
|
||||
* Returns `true` if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line.
|
||||
**/
|
||||
this.isScrollableBy = function(deltaX, deltaY) {
|
||||
if (deltaY < 0 && this.session.getScrollTop() > 0)
|
||||
return true;
|
||||
|
|
@ -722,6 +991,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
// todo: handle horizontal scrolling
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.screenToTextCoordinates(pageX, pageY) -> Number
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||
var canvasPos = this.scroller.getBoundingClientRect();
|
||||
|
||||
|
|
@ -735,6 +1009,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.textToScreenCoordinates(row, column) -> Object
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.textToScreenCoordinates = function(row, column) {
|
||||
var canvasPos = this.scroller.getBoundingClientRect();
|
||||
var pos = this.session.documentToScreenPosition(row, column);
|
||||
|
|
@ -748,14 +1027,29 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.visualizeFocus() -> Void
|
||||
*
|
||||
* Focuses the current container.
|
||||
**/
|
||||
this.visualizeFocus = function() {
|
||||
dom.addCssClass(this.container, "ace_focus");
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.visualizeBlur() -> Void
|
||||
*
|
||||
* Blurs the current container.
|
||||
**/
|
||||
this.visualizeBlur = function() {
|
||||
dom.removeCssClass(this.container, "ace_focus");
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.showComposition(position) -> Void
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.showComposition = function(position) {
|
||||
if (!this.$composition) {
|
||||
this.$composition = dom.createElement("div");
|
||||
|
|
@ -774,10 +1068,21 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.hideCursor();
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setCompositionText(text) -> Void
|
||||
* - text (String): A string of text to use
|
||||
*
|
||||
* Sets the inner text of the current composition to `text`.
|
||||
**/
|
||||
this.setCompositionText = function(text) {
|
||||
dom.setInnerText(this.$composition, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.hideComposition() -> Void
|
||||
*
|
||||
* Hides the current composition.
|
||||
**/
|
||||
this.hideComposition = function() {
|
||||
this.showCursor();
|
||||
|
||||
|
|
@ -789,6 +1094,12 @@ var VirtualRenderer = function(container, theme) {
|
|||
style.left = "-10000px";
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setTheme(theme) -> Void
|
||||
* - theme (String): The path to a theme
|
||||
*
|
||||
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.](~VirtualRenderer.setTheme)
|
||||
**/
|
||||
this.setTheme = function(theme) {
|
||||
var _self = this;
|
||||
|
||||
|
|
@ -830,6 +1141,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.getTheme() -> String
|
||||
*
|
||||
* [Returns the path of the current theme.](~VirtualRenderer.getTheme)
|
||||
**/
|
||||
this.getTheme = function() {
|
||||
return this.$themeValue;
|
||||
};
|
||||
|
|
@ -838,14 +1154,31 @@ var VirtualRenderer = function(container, theme) {
|
|||
// This feature can be used by plug-ins to provide a visual indication of
|
||||
// a certain mode that editor is in.
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.setStyle(style) -> Void
|
||||
* - style (String): A class name
|
||||
*
|
||||
* [Adds a new class, `style`, to the editor.](~VirtualRenderer.setStyle)
|
||||
**/
|
||||
this.setStyle = function setStyle(style) {
|
||||
dom.addCssClass(this.container, style);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.unsetStyle(style) -> Void
|
||||
* - style (String): A class name
|
||||
*
|
||||
* [Removes the class `style` from the editor.](~VirtualRenderer.unsetStyle)
|
||||
**/
|
||||
this.unsetStyle = function unsetStyle(style) {
|
||||
dom.removeCssClass(this.container, style);
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual_Renderer.destroy()
|
||||
*
|
||||
* TODO
|
||||
**/
|
||||
this.destroy = function() {
|
||||
this.$textLayer.destroy();
|
||||
this.$cursorLayer.destroy();
|
||||
|
|
|
|||