diff --git a/.gitmodules b/.gitmodules index 141555c2..f1073e21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ [submodule "support/cockpit"] path = support/cockpit - url = git://github.com/ajaxorg/cockpit.git + url = http://github.com/ajaxorg/cockpit.git [submodule "support/pilot"] path = support/pilot - url = git://github.com/ajaxorg/pilot.git + url = http://github.com/ajaxorg/pilot.git [submodule "support/dryice"] path = support/dryice - url = git://github.com/ajaxorg/dryice.git + url = http://github.com/ajaxorg/dryice.git [submodule "doc/wiki"] path = doc/wiki - url = git://github.com/ajaxorg/ace.wiki.git + url = http://github.com/ajaxorg/ace.wiki.git diff --git a/Makefile.dryice.js b/Makefile.dryice.js index ed4c75af..e9b042f4 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -80,7 +80,6 @@ console.log('# ace ---------'); var aceProject = [ aceHome + '/support/pilot/lib', - aceHome + '/support/cockpit/lib', aceHome + '/lib', aceHome ]; @@ -109,10 +108,7 @@ var project = copy.createCommonJsProject(aceProject); function filterTextPlugin(text) { - return text.replace(/(['"])text\!/g, "$1text/"); - /*return text - .replace(/define\(\s*['"]text\!\)/g, "text/") - .replace(/require\(\s*['"]text\!\)/g, "text/")*/ + return text.replace(/(['"])ace\/requirejs\/text\!/g, "$1text!"); } var ace = copy.createDataObject(); @@ -204,9 +200,9 @@ console.log('# ace modes ---------'); project.assumeAllFilesLoaded(); [ - "css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp", + "css", "html", "javascript", "php", "python", "lua", "xml", "ruby", "java", "c_cpp", "coffee", "perl", "csharp", "svg", "clojure", "scss", "json", "groovy", - "ocaml", "scala", "textile", "scad" + "ocaml", "scala", "textile", "scad", "markdown" ].forEach(function(mode) { console.log("mode " + mode); copy({ @@ -310,51 +306,6 @@ project.assumeAllFilesLoaded(); }); }); -console.log('# cockpit ---------'); - -project.assumeAllFilesLoaded(); - -var cockpit = copy.createDataObject(); -copy({ - source: [ - copy.source.commonjs({ - project: project, - require: [ 'cockpit/index' ] - }) - ], - filter: [ copy.filter.moduleDefines ], - dest: cockpit -}); -copy({ - source: { - root: aceHome + '/support/cockpit/lib', - include: /.*\.css$|.*\.html$/, - exclude: /tests?\// - }, - filter: [ copy.filter.addDefines ], - dest: cockpit -}); -copy({ - source: { - root: aceHome + '/support/cockpit/lib', - include: /.*\.png$|.*\.gif$/, - exclude: /tests?\// - }, - filter: [ copy.filter.base64 ], - dest: cockpit -}); - -// Create the compressed and uncompressed output files -copy({ - source: cockpit, - filter: copy.filter.uglifyjs, - dest: 'build/src/cockpit.js' -}); -copy({ - source: cockpit, - dest: 'build/src/cockpit-uncompressed.js' -}); - function demo() { console.log('# kitchen sink ---------'); @@ -382,12 +333,21 @@ function demo() { source: [ copy.source.commonjs({ project: project, - require: [ "cockpit/index", "pilot/index", "ace/defaults", "demo/boot" ] + require: [ "pilot/index", "ace/defaults", "demo/boot" ] }) ], filter: [ copy.filter.moduleDefines ], dest: demo }); + copy({ + source: { + root: project, + include: /demo\/docs\/.*$/, + exclude: /tests?\// + }, + filter: [ copy.filter.addDefines ], + dest: demo + }); copy({ source: { root: project, @@ -397,23 +357,15 @@ function demo() { filter: [ copy.filter.addDefines ], dest: demo }); - copy({ - source: { - root: aceHome + '/support/cockpit/lib', - include: /.*\.css$|.*\.html$/, - exclude: /tests?\// - }, - filter: [ copy.filter.addDefines ], - dest: demo - }); copy({ source: demo, - filter: copy.filter.uglifyjs, + filter: [ copy.filter.uglifyjs, filterTextPlugin ], dest: 'build/demo/kitchen-sink.js' }); copy({ source: demo, + filter: [ filterTextPlugin ], dest: 'build/demo/kitchen-sink-uncompressed.js' }); -} \ No newline at end of file +} diff --git a/Readme.md b/Readme.md index 93152ee2..6755f481 100644 --- a/Readme.md +++ b/Readme.md @@ -31,16 +31,18 @@ If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookma History ------- -Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace. +Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace. Getting the code ---------------- Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! +```bash git clone git://github.com/ajaxorg/ace.git cd ace git submodule update --init --recursive +``` Embedding Ace ------------- @@ -49,6 +51,7 @@ Ace can be easily embedded into any existing web page. The Ace git repository sh The easiest version is simply: +```html
We also record validity information where applicable. - *
For values, null and undefined have distinct definitions. null means
- * that a value has been provided, undefined means that it has not.
- * Thus, null is a valid default value, and common because it identifies an
- * parameter that is optional. undefined means there is no value from
- * the command line.
- * @constructor
- */
-function Assignment(param, requisition) {
- this.param = param;
- this.requisition = requisition;
- this.setValue(param.defaultValue);
-};
-Assignment.prototype = {
- /**
- * The parameter that we are assigning to
- * @readonly
- */
- param: undefined,
-
- /**
- * Report on the status of the last parse() conversion.
- * @see types.Conversion
- */
- conversion: undefined,
-
- /**
- * The current value in a type as specified by param.type
- */
- value: undefined,
-
- /**
- * The string version of the current value
- */
- arg: undefined,
-
- /**
- * The current value (i.e. not the string representation)
- * Use setValue() to mutate
- */
- value: undefined,
- setValue: function(value) {
- if (this.value === value) {
- return;
- }
-
- if (value === undefined) {
- this.value = this.param.defaultValue;
- this.conversion = this.param.getDefault ?
- this.param.getDefault() :
- this.param.type.getDefault();
- this.arg = undefined;
- } else {
- this.value = value;
- this.conversion = undefined;
- var text = (value == null) ? '' : this.param.type.stringify(value);
- if (this.arg) {
- this.arg.setText(text);
- }
- }
-
- this.requisition._assignmentChanged(this);
- },
-
- /**
- * The textual representation of the current value
- * Use setValue() to mutate
- */
- arg: undefined,
- setArgument: function(arg) {
- if (this.arg === arg) {
- return;
- }
- this.arg = arg;
- this.conversion = this.param.type.parse(arg.text);
- this.conversion.arg = arg; // TODO: make this automatic?
- this.value = this.conversion.value;
- this.requisition._assignmentChanged(this);
- },
-
- /**
- * Create a list of the hints associated with this parameter assignment.
- * Generally there will be only one hint generated because we're currently
- * only displaying one hint at a time, ordering by distance from cursor
- * and severity. Since distance from cursor will be the same for all hints
- * from this assignment all but the most severe will ever be used. It might
- * make sense with more experience to alter this to function to be getHint()
- */
- getHint: function() {
- // Allow the parameter to provide documentation
- if (this.param.getCustomHint && this.value && this.arg) {
- var hint = this.param.getCustomHint(this.value, this.arg);
- if (hint) {
- return hint;
- }
- }
-
- // If there is no argument, use the cursor position
- var message = '' + this.param.name + ': ';
- if (this.param.description) {
- // TODO: This should be a short description - do we need to trim?
- message += this.param.description.trim();
-
- // Ensure the help text ends with '. '
- if (message.charAt(message.length - 1) !== '.') {
- message += '.';
- }
- if (message.charAt(message.length - 1) !== ' ') {
- message += ' ';
- }
- }
- var status = Status.VALID;
- var start = this.arg ? this.arg.start : Argument.AT_CURSOR;
- var end = this.arg ? this.arg.end : Argument.AT_CURSOR;
- var predictions;
-
- // Non-valid conversions will have useful information to pass on
- if (this.conversion) {
- status = this.conversion.status;
- if (this.conversion.message) {
- message += this.conversion.message;
- }
- predictions = this.conversion.predictions;
- }
-
- // Hint if the param is required, but not provided
- var argProvided = this.arg && this.arg.text !== '';
- var dataProvided = this.value !== undefined || argProvided;
- if (this.param.defaultValue === undefined && !dataProvided) {
- status = Status.INVALID;
- message += 'Required<\strong>';
- }
-
- return new Hint(status, message, start, end, predictions);
- },
-
- /**
- * Basically setValue(conversion.predictions[0]) done in a safe
- * way.
- */
- complete: function() {
- if (this.conversion && this.conversion.predictions &&
- this.conversion.predictions.length > 0) {
- this.setValue(this.conversion.predictions[0]);
- }
- },
-
- /**
- * If the cursor is at 'position', do we have sufficient data to start
- * displaying the next hint. This is both complex and important.
- * For example, if the user has just typed: Note that the input for 2 and 4 is identical, only the configuration
- * has changed, so hint display is environmental.
- *
- * This function works out if the cursor is before the end of this
- * assignment (assuming that we've asked the same thing of the previous
- * assignment) and then attempts to work out if we should use the hint from
- * the next assignment even though technically the cursor is still inside
- * this one due to the rules above.
- */
- isPositionCaptured: function(position) {
- if (!this.arg) {
- return false;
- }
-
- // Note we don't check if position >= this.arg.start because that's
- // implied by the fact that we're asking the assignments in turn, and
- // we want to avoid thing falling between the cracks, but we do need
- // to check that the argument does have a position
- if (this.arg.start === -1) {
- return false;
- }
-
- // We're clearly done if the position is past the end of the text
- if (position > this.arg.end) {
- return false;
- }
-
- // If we're AT the end, the position is captured if either the status
- // is not valid or if there are other valid options including current
- if (position === this.arg.end) {
- return this.conversion.status !== Status.VALID ||
- this.conversion.predictions.length !== 0;
- }
-
- // Otherwise we're clearly inside
- return true;
- },
-
- /**
- * Replace the current value with the lower value if such a concept
- * exists.
- */
- decrement: function() {
- var replacement = this.param.type.decrement(this.value);
- if (replacement != null) {
- this.setValue(replacement);
- }
- },
-
- /**
- * Replace the current value with the higher value if such a concept
- * exists.
- */
- increment: function() {
- var replacement = this.param.type.increment(this.value);
- if (replacement != null) {
- this.setValue(replacement);
- }
- },
-
- /**
- * Helper when we're rebuilding command lines.
- */
- toString: function() {
- return this.arg ? this.arg.toString() : '';
- }
-};
-exports.Assignment = Assignment;
-
-
-/**
- * This is a special parameter to reflect the command itself.
- */
-var commandParam = {
- name: '__command',
- type: 'command',
- description: 'The command to execute',
-
- /**
- * Provide some documentation for a command.
- */
- getCustomHint: function(command, arg) {
- var docs = [];
- docs.push(' > ');
- docs.push(command.name);
- if (command.params && command.params.length > 0) {
- command.params.forEach(function(param) {
- if (param.defaultValue === undefined) {
- docs.push(' [' + param.name + ']');
- }
- else {
- docs.push(' [' + param.name + ']');
- }
- }, this);
- }
- docs.push(' The 'output' of the update is held in 2 objects: input.hints which is an
- * array of hints to display to the user. In the future this will become a
- * single value.
- * The other output value is input.requisition which gives access to an
- * args object for use in executing the final command.
- *
- * The majority of the functions in this class are called in sequence by the
- * constructor. Their task is to add to hints fill out the requisition.
- * The general sequence is: This takes #_command.params and #_unparsedArgs and creates a map of
- * param names to 'assignment' objects, which have the following properties:
- * "+e.description+" "+e.description+"
- *
- *
');
-
- docs.push(command.description ? command.description : '(No description)');
- docs.push('
');
-
- if (command.params && command.params.length > 0) {
- docs.push('');
- command.params.forEach(function(param) {
- docs.push('
');
- }
-
- return new Hint(Status.VALID, docs.join(''), arg);
- }
-};
-
-/**
- * A Requisition collects the information needed to execute a command.
- * There is no point in a requisition for parameter-less commands because there
- * is no information to collect. A Requisition is a collection of assignments
- * of values to parameters, each handled by an instance of Assignment.
- * CliRequisition adds functions for parsing input from a command line to this
- * class.
- * Events
- * We publish the following events:
- *
- *
- *
- * @param typed {string} The instruction as typed by the user so far
- * @param options {object} A list of optional named parameters. Can be any of:
- * flags: Flags for us to check against the predicates specified with the
- * commands. Defaulted to keyboard.buildFlags({ });
- * if not specified.
- * @constructor
- */
-function CliRequisition(env, options) {
- Requisition.call(this, env);
-
- if (options && options.flags) {
- /**
- * TODO: We were using a default of keyboard.buildFlags({ });
- * This allowed us to have commands that only existed in certain contexts
- * - i.e. Javascript specific commands.
- */
- this.flags = options.flags;
- }
-}
-oop.inherits(CliRequisition, Requisition);
-(function() {
- /**
- * Called by the UI when ever the user interacts with a command line input
- * @param input A structure that details the state of the input field.
- * It should look something like: { typed:a, cursor: { start:b, end:c } }
- * Where a is the contents of the input field, and b and c are the start
- * and end of the cursor/selection respectively.
- */
- CliRequisition.prototype.update = function(input) {
- this.input = input;
- this._hints = [];
-
- var args = this._tokenize(input.typed);
- this._split(args);
-
- if (this.commandAssignment.value) {
- this._assign(args);
- }
-
- this._updateHints();
- };
-
- /**
- * Return an array of Status scores so we can create a marked up
- * version of the command line input.
- */
- CliRequisition.prototype.getInputStatusMarkup = function() {
- // 'scores' is an array which tells us what chars are errors
- // Initialize with everything VALID
- var scores = this.toString().split('').map(function(ch) {
- return Status.VALID;
- });
- // For all chars in all hints, check and upgrade the score
- this._hints.forEach(function(hint) {
- for (var i = hint.start; i <= hint.end; i++) {
- if (hint.status > scores[i]) {
- scores[i] = hint.status;
- }
- }
- }, this);
- return scores;
- };
-
- /**
- * Reconstitute the input from the args
- */
- CliRequisition.prototype.toString = function() {
- return this.getAssignments(true).map(function(assignment) {
- return assignment.toString();
- }, this).join('');
- };
-
- var superUpdateHints = CliRequisition.prototype._updateHints;
- /**
- * Marks up hints in a number of ways:
- * - Makes INCOMPLETE hints that are not near the cursor INVALID since
- * they can't be completed by typing
- * - Finds the most severe hint, and annotates the array with it
- * - Finds the hint to display, and also annotates the array with it
- * TODO: I'm wondering if array annotation is evil and we should replace
- * this with an object. Need to find out more.
- */
- CliRequisition.prototype._updateHints = function() {
- superUpdateHints.call(this);
-
- // Not knowing about cursor positioning, the requisition and assignments
- // can't know this, but anything they mark as INCOMPLETE is actually
- // INVALID unless the cursor is actually inside that argument.
- var c = this.input.cursor;
- this._hints.forEach(function(hint) {
- var startInHint = c.start >= hint.start && c.start <= hint.end;
- var endInHint = c.end >= hint.start && c.end <= hint.end;
- var inHint = startInHint || endInHint;
- if (!inHint && hint.status === Status.INCOMPLETE) {
- hint.status = Status.INVALID;
- }
- }, this);
-
- Hint.sort(this._hints);
- };
-
- /**
- * Accessor for the hints array.
- * While we could just use the hints property, using getHints() is
- * preferred for symmetry with Requisition where it needs a function due to
- * lack of an atomic update system.
- */
- CliRequisition.prototype.getHints = function() {
- return this._hints;
- };
-
- /**
- * Look through the arguments attached to our assignments for the assignment
- * at the given position.
- */
- CliRequisition.prototype.getAssignmentAt = function(position) {
- var assignments = this.getAssignments(true);
- for (var i = 0; i < assignments.length; i++) {
- var assignment = assignments[i];
- if (!assignment.arg) {
- // There is no argument in this assignment, we've fallen off
- // the end of the obvious answers - it must be this one.
- return assignment;
- }
- if (assignment.isPositionCaptured(position)) {
- return assignment;
- }
- }
-
- return assignment;
- };
-
- /**
- * Split up the input taking into account ' and "
- */
- CliRequisition.prototype._tokenize = function(typed) {
- // For blank input, place a dummy empty argument into the list
- if (typed == null || typed.length === 0) {
- return [ new Argument(this, '', 0, 0, '', '') ];
- }
-
- var OUTSIDE = 1; // The last character was whitespace
- var IN_SIMPLE = 2; // The last character was part of a parameter
- var IN_SINGLE_Q = 3; // We're inside a single quote: '
- var IN_DOUBLE_Q = 4; // We're inside double quotes: "
-
- var mode = OUTSIDE;
-
- // First we un-escape. This list was taken from:
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Unicode
- // We are generally converting to their real values except for \', \"
- // and '\ ' which we are converting to unicode private characters so we
- // can distinguish them from ', " and ' ', which have special meaning.
- // They need swapping back post-split - see unescape2()
- typed = typed
- .replace(/\\\\/g, '\\')
- .replace(/\\b/g, '\b')
- .replace(/\\f/g, '\f')
- .replace(/\\n/g, '\n')
- .replace(/\\r/g, '\r')
- .replace(/\\t/g, '\t')
- .replace(/\\v/g, '\v')
- .replace(/\\n/g, '\n')
- .replace(/\\r/g, '\r')
- .replace(/\\ /g, '\uF000')
- .replace(/\\'/g, '\uF001')
- .replace(/\\"/g, '\uF002');
-
- function unescape2(str) {
- return str
- .replace(/\uF000/g, ' ')
- .replace(/\uF001/g, '\'')
- .replace(/\uF002/g, '"');
- }
-
- var i = 0;
- var start = 0; // Where did this section start?
- var prefix = '';
- var args = [];
-
- while (true) {
- if (i >= typed.length) {
- // There is nothing else to read - tidy up
- if (mode !== OUTSIDE) {
- var str = unescape2(typed.substring(start, i));
- args.push(new Argument(this, str, start, i, prefix, ''));
- }
- else {
- if (i !== start) {
- // There's a bunch of whitespace at the end of the
- // command add it to the last argument's suffix,
- // creating an empty argument if needed.
- var extra = typed.substring(start, i);
- var lastArg = args[args.length - 1];
- if (!lastArg) {
- lastArg = new Argument(this, '', i, i, extra, '');
- args.push(lastArg);
- }
- else {
- lastArg.suffix += extra;
- }
- }
- }
- break;
- }
-
- var c = typed[i];
- switch (mode) {
- case OUTSIDE:
- if (c === '\'') {
- prefix = typed.substring(start, i + 1);
- mode = IN_SINGLE_Q;
- start = i + 1;
- }
- else if (c === '"') {
- prefix = typed.substring(start, i + 1);
- mode = IN_DOUBLE_Q;
- start = i + 1;
- }
- else if (/ /.test(c)) {
- // Still whitespace, do nothing
- }
- else {
- prefix = typed.substring(start, i);
- mode = IN_SIMPLE;
- start = i;
- }
- break;
-
- case IN_SIMPLE:
- // There is an edge case of xx'xx which we are assuming to
- // be a single parameter (and same with ")
- if (c === ' ') {
- var str = unescape2(typed.substring(start, i));
- args.push(new Argument(this, str,
- start, i, prefix, ''));
- mode = OUTSIDE;
- start = i;
- prefix = '';
- }
- break;
-
- case IN_SINGLE_Q:
- if (c === '\'') {
- var str = unescape2(typed.substring(start, i));
- args.push(new Argument(this, str,
- start - 1, i + 1, prefix, c));
- mode = OUTSIDE;
- start = i + 1;
- prefix = '';
- }
- break;
-
- case IN_DOUBLE_Q:
- if (c === '"') {
- var str = unescape2(typed.substring(start, i));
- args.push(new Argument(this, str,
- start - 1, i + 1, prefix, c));
- mode = OUTSIDE;
- start = i + 1;
- prefix = '';
- }
- break;
- }
-
- i++;
- }
-
- return args;
- };
-
- /**
- * Looks in the canon for a command extension that matches what has been
- * typed at the command line.
- */
- CliRequisition.prototype._split = function(args) {
- var argsUsed = 1;
- var arg;
-
- while (argsUsed <= args.length) {
- var arg = Argument.merge(args, 0, argsUsed);
- this.commandAssignment.setArgument(arg);
-
- if (!this.commandAssignment.value) {
- // Not found. break with value == null
- break;
- }
-
- /*
- // Previously we needed a way to hide commands depending context.
- // We have not resurrected that feature yet.
- if (!keyboard.flagsMatch(command.predicates, this.flags)) {
- // If the predicates say 'no match' then go LA LA LA
- command = null;
- break;
- }
- */
-
- if (this.commandAssignment.value.exec) {
- // Valid command, break with command valid
- for (var i = 0; i < argsUsed; i++) {
- args.shift();
- }
- break;
- }
-
- argsUsed++;
- }
- };
-
- /**
- * Work out which arguments are applicable to which parameters.
- *
- *
- */
- CliRequisition.prototype._assign = function(args) {
- if (args.length === 0) {
- this.setDefaultValues();
- return;
- }
-
- // Create an error if the command does not take parameters, but we have
- // been given them ...
- if (this.assignmentCount === 0) {
- // TODO: previously we were doing some extra work to avoid this if
- // we determined that we had args that were all whitespace, but
- // probably given our tighter tokenize() this won't be an issue?
- this._hints.push(new Hint(Status.INVALID,
- this.commandAssignment.value.name +
- ' does not take any parameters',
- Argument.merge(args)));
- return;
- }
-
- // Special case: if there is only 1 parameter, and that's of type
- // text we put all the params into the first param
- if (this.assignmentCount === 1) {
- var assignment = this.getAssignment(0);
- if (assignment.param.type.name === 'text') {
- assignment.setArgument(Argument.merge(args));
- return;
- }
- }
-
- var assignments = this.cloneAssignments();
- var names = this.getParameterNames();
-
- // Extract all the named parameters
- var used = [];
- assignments.forEach(function(assignment) {
- var namedArgText = '--' + assignment.name;
-
- var i = 0;
- while (true) {
- var arg = args[i];
- if (namedArgText !== arg.text) {
- i++;
- if (i >= args.length) {
- break;
- }
- continue;
- }
-
- // boolean parameters don't have values, default to false
- if (assignment.param.type.name === 'boolean') {
- assignment.setValue(true);
- }
- else {
- if (i + 1 < args.length) {
- // Missing value portion of this named param
- this._hints.push(new Hint(Status.INCOMPLETE,
- 'Missing value for: ' + namedArgText,
- args[i]));
- }
- else {
- args.splice(i + 1, 1);
- assignment.setArgument(args[i + 1]);
- }
- }
-
- lang.arrayRemove(names, assignment.name);
- args.splice(i, 1);
- // We don't need to i++ if we splice
- }
- }, this);
-
- // What's left are positional parameters assign in order
- names.forEach(function(name) {
- var assignment = this.getAssignment(name);
- if (args.length === 0) {
- // No more values
- assignment.setValue(undefined); // i.e. default
- }
- else {
- var arg = args[0];
- args.splice(0, 1);
- assignment.setArgument(arg);
- }
- }, this);
-
- if (args.length > 0) {
- var remaining = Argument.merge(args);
- this._hints.push(new Hint(Status.INVALID,
- 'Input \'' + remaining.text + '\' makes no sense.',
- remaining));
- }
- };
-
-})();
-exports.CliRequisition = CliRequisition;
-
-
-});
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Skywriter.
- *
- * The Initial Developer of the Original Code is
- * Mozilla.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Joe Walker (jwalker@mozilla.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define('cockpit/ui/settings', ['require', 'exports', 'module' , 'pilot/types', 'pilot/types/basic'], function(require, exports, module) {
-
-
-var types = require("pilot/types");
-var SelectionType = require('pilot/types/basic').SelectionType;
-
-var direction = new SelectionType({
- name: 'direction',
- data: [ 'above', 'below' ]
-});
-
-var hintDirectionSetting = {
- name: "hintDirection",
- description: "Are hints shown above or below the command line?",
- type: "direction",
- defaultValue: "above"
-};
-
-var outputDirectionSetting = {
- name: "outputDirection",
- description: "Is the output window shown above or below the command line?",
- type: "direction",
- defaultValue: "above"
-};
-
-var outputHeightSetting = {
- name: "outputHeight",
- description: "What height should the output panel be?",
- type: "number",
- defaultValue: 300
-};
-
-exports.startup = function(data, reason) {
- types.registerType(direction);
- data.env.settings.addSetting(hintDirectionSetting);
- data.env.settings.addSetting(outputDirectionSetting);
- data.env.settings.addSetting(outputHeightSetting);
-};
-
-exports.shutdown = function(data, reason) {
- types.unregisterType(direction);
- data.env.settings.removeSetting(hintDirectionSetting);
- data.env.settings.removeSetting(outputDirectionSetting);
- data.env.settings.removeSetting(outputHeightSetting);
-};
-
-
-});
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Skywriter.
- *
- * The Initial Developer of the Original Code is
- * Mozilla.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Joe Walker (jwalker@mozilla.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define('cockpit/ui/cli_view', ['require', 'exports', 'module' , 'text!cockpit/ui/cli_view.css', 'pilot/event', 'pilot/dom', 'pilot/keys', 'pilot/canon', 'pilot/types', 'cockpit/cli', 'cockpit/ui/request_view'], function(require, exports, module) {
-
-
-var editorCss = require("text!cockpit/ui/cli_view.css");
-var event = require("pilot/event");
-var dom = require("pilot/dom");
-
-dom.importCssString(editorCss);
-
-var event = require("pilot/event");
-var keys = require("pilot/keys");
-var canon = require("pilot/canon");
-var Status = require('pilot/types').Status;
-
-var CliRequisition = require('cockpit/cli').CliRequisition;
-var Hint = require('cockpit/cli').Hint;
-var RequestView = require('cockpit/ui/request_view').RequestView;
-
-var NO_HINT = new Hint(Status.VALID, '', 0, 0);
-
-/**
- * On startup we need to:
- * 1. Add 3 sets of elements to the DOM for:
- * - command line output
- * - input hints
- * - completion
- * 2. Attach a set of events so the command line works
- */
-exports.startup = function(data, reason) {
- var cli = new CliRequisition(data.env);
- var cliView = new CliView(cli, data.env);
- data.env.cli = cli;
-};
-
-/**
- * A class to handle the simplest UI implementation
- */
-function CliView(cli, env) {
- cli.cliView = this;
- this.cli = cli;
- this.doc = document;
- this.win = dom.getParentWindow(this.doc);
- this.env = env;
-
- // TODO: we should have a better way to specify command lines???
- this.element = this.doc.getElementById('cockpitInput');
- if (!this.element) {
- // console.log('No element with an id of cockpit. Bailing on cli');
- return;
- }
-
- this.settings = env.settings;
- this.hintDirection = this.settings.getSetting('hintDirection');
- this.outputDirection = this.settings.getSetting('outputDirection');
- this.outputHeight = this.settings.getSetting('outputHeight');
-
- // If the requisition tells us something has changed, we use this to know
- // if we should ignore it
- this.isUpdating = false;
-
- this.createElements();
- this.update();
-}
-CliView.prototype = {
- /**
- * Create divs for completion, hints and output
- */
- createElements: function() {
- var input = this.element;
-
- this.element.spellcheck = false;
-
- this.output = this.doc.getElementById('cockpitOutput');
- this.popupOutput = (this.output == null);
- if (!this.output) {
- this.output = this.doc.createElement('div');
- this.output.id = 'cockpitOutput';
- this.output.className = 'cptOutput';
- input.parentNode.insertBefore(this.output, input.nextSibling);
-
- var setMaxOutputHeight = function() {
- this.output.style.maxHeight = this.outputHeight.get() + 'px';
- }.bind(this);
- this.outputHeight.addEventListener('change', setMaxOutputHeight);
- setMaxOutputHeight();
- }
-
- this.completer = this.doc.createElement('div');
- this.completer.className = 'cptCompletion VALID';
-
- this.completer.style.color = dom.computedStyle(input, "color");
- this.completer.style.fontSize = dom.computedStyle(input, "fontSize");
- this.completer.style.fontFamily = dom.computedStyle(input, "fontFamily");
- this.completer.style.fontWeight = dom.computedStyle(input, "fontWeight");
- this.completer.style.fontStyle = dom.computedStyle(input, "fontStyle");
- input.parentNode.insertBefore(this.completer, input.nextSibling);
-
- // Transfer background styling to the completer.
- this.completer.style.backgroundColor = input.style.backgroundColor;
- input.style.backgroundColor = 'transparent';
-
- this.hinter = this.doc.createElement('div');
- this.hinter.className = 'cptHints';
- input.parentNode.insertBefore(this.hinter, input.nextSibling);
-
- var resizer = this.resizer.bind(this);
- event.addListener(this.win, 'resize', resizer);
- this.hintDirection.addEventListener('change', resizer);
- this.outputDirection.addEventListener('change', resizer);
- resizer();
-
- canon.addEventListener('output', function(ev) {
- new RequestView(ev.request, this);
- }.bind(this));
- event.addCommandKeyListener(input, this.onCommandKey.bind(this));
- event.addListener(input, 'keyup', this.onKeyUp.bind(this));
-
- // cursor position affects hint severity. TODO: shortcuts for speed
- event.addListener(input, 'mouseup', function(ev) {
- this.isUpdating = true;
- this.update();
- this.isUpdating = false;
- }.bind(this));
-
- this.cli.addEventListener('argumentChange', this.onArgChange.bind(this));
-
- event.addListener(input, "focus", function() {
- dom.addCssClass(this.output, "cptFocusPopup");
- dom.addCssClass(this.hinter, "cptFocusPopup");
- }.bind(this));
-
- function hideOutput() {
- dom.removeCssClass(this.output, "cptFocusPopup");
- dom.removeCssClass(this.hinter, "cptFocusPopup");
- };
- event.addListener(input, "blur", hideOutput.bind(this));
- hideOutput.call(this);
- },
-
- /**
- * We need to see the output of the latest command entered
- */
- scrollOutputToBottom: function() {
- // Certain browsers have a bug such that scrollHeight is too small
- // when content does not fill the client area of the element
- var scrollHeight = Math.max(this.output.scrollHeight, this.output.clientHeight);
- this.output.scrollTop = scrollHeight - this.output.clientHeight;
- },
-
- /**
- * To be called on window resize or any time we want to align the elements
- * with the input box.
- */
- resizer: function() {
- var rect = this.element.getClientRects()[0];
-
- this.completer.style.top = rect.top + 'px';
- var height = rect.bottom - rect.top;
- this.completer.style.height = height + 'px';
- this.completer.style.lineHeight = height + 'px';
- this.completer.style.left = rect.left + 'px';
- var width = rect.right - rect.left;
- this.completer.style.width = width + 'px';
-
- if (this.hintDirection.get() === 'below') {
- this.hinter.style.top = rect.bottom + 'px';
- this.hinter.style.bottom = 'auto';
- }
- else {
- this.hinter.style.top = 'auto';
- this.hinter.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px';
- }
- this.hinter.style.left = (rect.left + 30) + 'px';
- this.hinter.style.maxWidth = (width - 110) + 'px';
-
- if (this.popupOutput) {
- if (this.outputDirection.get() === 'below') {
- this.output.style.top = rect.bottom + 'px';
- this.output.style.bottom = 'auto';
- }
- else {
- this.output.style.top = 'auto';
- this.output.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px';
- }
- this.output.style.left = rect.left + 'px';
- this.output.style.width = (width - 80) + 'px';
- }
- },
-
- /**
- * Ensure that TAB isn't handled by the browser
- */
-onCommandKey: function(ev, hashId, keyCode) {
- var stopEvent;
- if (keyCode === keys.TAB ||
- keyCode === keys.UP ||
- keyCode === keys.DOWN) {
- stopEvent = true;
- } else if (hashId != 0 || keyCode != 0) {
- stopEvent = canon.execKeyCommand(this.env, 'cli', hashId, keyCode);
- }
- stopEvent && event.stopEvent(ev);
- },
-
- /**
- * The main keyboard processing loop
- */
- onKeyUp: function(ev) {
- var handled;
- /*
- var handled = keyboardManager.processKeyEvent(ev, this, {
- isCommandLine: true, isKeyUp: true
- });
- */
-
- // RETURN does a special exec/highlight thing
- if (ev.keyCode === keys.RETURN) {
- var worst = this.cli.getWorstHint();
- // Deny RETURN unless the command might work
- if (worst.status === Status.VALID) {
- this.cli.exec();
- this.element.value = '';
- }
- else {
- // If we've denied RETURN because the command was not VALID,
- // select the part of the command line that is causing problems
- // TODO: if there are 2 errors are we picking the right one?
- dom.setSelectionStart(this.element, worst.start);
- dom.setSelectionEnd(this.element, worst.end);
- }
- }
-
- this.update();
-
- // Special actions which delegate to the assignment
- var current = this.cli.getAssignmentAt(dom.getSelectionStart(this.element));
- if (current) {
- // TAB does a special complete thing
- if (ev.keyCode === keys.TAB) {
- current.complete();
- this.update();
- }
-
- // UP/DOWN look for some history
- if (ev.keyCode === keys.UP) {
- current.increment();
- this.update();
- }
- if (ev.keyCode === keys.DOWN) {
- current.decrement();
- this.update();
- }
- }
-
- return handled;
- },
-
- /**
- * Actually parse the input and make sure we're all up to date
- */
- update: function() {
- this.isUpdating = true;
- var input = {
- typed: this.element.value,
- cursor: {
- start: dom.getSelectionStart(this.element),
- end: dom.getSelectionEnd(this.element.selectionEnd)
- }
- };
- this.cli.update(input);
-
- var display = this.cli.getAssignmentAt(input.cursor.start).getHint();
-
- // 1. Update the completer with prompt/error marker/TAB info
- dom.removeCssClass(this.completer, Status.VALID.toString());
- dom.removeCssClass(this.completer, Status.INCOMPLETE.toString());
- dom.removeCssClass(this.completer, Status.INVALID.toString());
-
- var completion = '> ';
- if (this.element.value.length > 0) {
- var scores = this.cli.getInputStatusMarkup();
- completion += this.markupStatusScore(scores);
- }
-
- // Display the "-> prediction" at the end of the completer
- if (this.element.value.length > 0 &&
- display.predictions && display.predictions.length > 0) {
- var tab = display.predictions[0];
- completion += ' ⇥ ' + (tab.name ? tab.name : tab);
- }
- this.completer.innerHTML = completion;
- dom.addCssClass(this.completer, this.cli.getWorstHint().status.toString());
-
- // 2. Update the hint element
- var hint = '';
- if (this.element.value.length !== 0) {
- hint += display.message;
- if (display.predictions && display.predictions.length > 0) {
- hint += ': [ ';
- display.predictions.forEach(function(prediction) {
- hint += (prediction.name ? prediction.name : prediction);
- hint += ' | ';
- }, this);
- hint = hint.replace(/\| $/, ']');
- }
- }
-
- this.hinter.innerHTML = hint;
- if (hint.length === 0) {
- dom.addCssClass(this.hinter, 'cptNoPopup');
- }
- else {
- dom.removeCssClass(this.hinter, 'cptNoPopup');
- }
-
- this.isUpdating = false;
- },
-
- /**
- * Markup an array of Status values with spans
- */
- markupStatusScore: function(scores) {
- var completion = '';
- // Create mark-up
- var i = 0;
- var lastStatus = -1;
- while (true) {
- if (lastStatus !== scores[i]) {
- completion += '';
- lastStatus = scores[i];
- }
- completion += this.element.value[i];
- i++;
- if (i === this.element.value.length) {
- completion += '';
- break;
- }
- if (lastStatus !== scores[i]) {
- completion += '';
- }
- }
-
- return completion;
- },
-
- /**
- * Update the input element to reflect the changed argument
- */
- onArgChange: function(ev) {
- if (this.isUpdating) {
- return;
- }
-
- var prefix = this.element.value.substring(0, ev.argument.start);
- var suffix = this.element.value.substring(ev.argument.end);
- var insert = typeof ev.text === 'string' ? ev.text : ev.text.name;
- this.element.value = prefix + insert + suffix;
- // Fix the cursor.
- var insertEnd = (prefix + insert).length;
- this.element.selectionStart = insertEnd;
- this.element.selectionEnd = insertEnd;
- }
-};
-exports.CliView = CliView;
-
-
-});
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Ajax.org Code Editor (ACE).
- *
- * The Initial Developer of the Original Code is
- * Ajax.org B.V.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Fabian Jakobs
- *
- * @param path An array of strings indicating the path through the data, or
- * a string to be cut into an array using split('.')
- * @param data An object to look in for the path argument
- * @param newValue (optional) If defined, this value will replace the
- * original value for the data at the path specified.
- * @return The value pointed to by path before any
- * newValue is applied.
- */
-Templater.prototype.property = function(path, data, newValue) {
- this.scope.push(path);
- try {
- if (typeof path === 'string') {
- path = path.split('.');
- }
- var value = data[path[0]];
- if (path.length === 1) {
- if (newValue !== undefined) {
- data[path[0]] = newValue;
- }
- if (typeof value === 'function') {
- return function() {
- return value.apply(data, arguments);
- };
- }
- return value;
- }
- if (!value) {
- this.handleError('Can\'t find path=' + path);
- return null;
- }
- return this.property(path.slice(1), value, newValue);
- } finally {
- this.scope.pop();
- }
-};
-
-/**
- * Like eval, but that creates a context of the variables in env in
- * which the script is evaluated.
- * WARNING: This script uses 'with' which is generally regarded to be evil.
- * The alternative is to create a Function at runtime that takes X parameters
- * according to the X keys in the env object, and then call that function using
- * the values in the env object. This is likely to be slow, but workable.
- * @param script The string to be evaluated.
- * @param env The environment in which to eval the script.
- * @param context Optional debugging string in case of failure
- * @return The return value of the script, or the error message if the script
- * execution failed.
- */
-Templater.prototype.envEval = function(script, env, context) {
- with (env) {
- try {
- this.scope.push(context);
- return eval(script);
- } catch (ex) {
- this.handleError('Template error evaluating \'' + script + '\'', ex);
- return script;
- } finally {
- this.scope.pop();
- }
- }
-};
-
-/**
- * A generic way of reporting errors, for easy overloading in different
- * environments.
- * @param message the error message to report.
- * @param ex optional associated exception.
- */
-Templater.prototype.handleError = function(message, ex) {
- this.logError(message);
- this.logError('In: ' + this.scope.join(' > '));
- if (ex) {
- this.logError(ex);
- }
-};
-
-
-/**
- * A generic way of reporting errors, for easy overloading in different
- * environments.
- * @param message the error message to report.
- */
-Templater.prototype.logError = function(message) {
- window.console && window.console.log && console.log(message);
-};
-
-exports.Templater = Templater;
-
-
-});
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Skywriter.
- *
- * The Initial Developer of the Original Code is
- * Mozilla.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Skywriter Team (skywriter@mozilla.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define('cockpit/commands/basic', ['require', 'exports', 'module' , 'pilot/canon'], function(require, exports, module) {
-
-
-var canon = require('pilot/canon');
-
-/**
- * '!' command
- */
-var bangCommandSpec = {
- name: 'sh',
- description: 'Execute a system command (requires server support)',
- params: [
- {
- name: 'command',
- type: 'text',
- description: 'The string to send to the os shell.'
- }
- ],
- exec: function(env, args, request) {
- var req = new XMLHttpRequest();
- req.open('GET', '/exec?args=' + args.command, true);
- req.onreadystatechange = function(ev) {
- if (req.readyState == 4) {
- if (req.status == 200) {
- request.done('' + req.responseText + '
');
- }
- }
- };
- req.send(null);
- }
-};
-
-var canon = require('pilot/canon');
-
-exports.startup = function(data, reason) {
- canon.addCommand(bangCommandSpec);
-};
-
-exports.shutdown = function(data, reason) {
- canon.removeCommand(bangCommandSpec);
-};
-
-
});
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
@@ -7503,19 +4733,17 @@ exports.shutdown = function shutdown(data, reason) {
*
* ***** END LICENSE BLOCK ***** */
-define('demo/boot', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/plugin_manager', 'pilot/settings', 'pilot/environment', 'demo/demo', 'pilot/index', 'cockpit/index', 'ace/defaults'], function(require, exports, module) {
+define('demo/boot', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/plugin_manager', 'pilot/environment', 'demo/demo', 'pilot/index', 'ace/defaults'], function(require, exports, module) {
require("pilot/fixoldbrowsers");
require("pilot/plugin_manager");
-require("pilot/settings");
require("pilot/environment");
require("demo/demo");
require("pilot/index");
-require("cockpit/index");
require("ace/defaults");
-var plugins = [ "pilot/index", "cockpit/index", "ace/defaults" ];
+var plugins = [ "pilot/index"];
var catalog = require("pilot/plugin_manager").catalog;
catalog.registerPlugins(plugins).then(function() {
var env = require("pilot/environment").create();
@@ -8041,45 +5269,49 @@ exports.create = create;
* ***** END LICENSE BLOCK ***** */
-define('demo/demo', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/event', 'ace/range', 'ace/editor', 'ace/virtual_renderer', 'ace/theme/textmate', 'ace/edit_session', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/scss', 'ace/mode/html', 'ace/mode/xml', 'ace/mode/python', 'ace/mode/php', 'ace/mode/java', 'ace/mode/csharp', 'ace/mode/ruby', 'ace/mode/c_cpp', 'ace/mode/coffee', 'ace/mode/json', 'ace/mode/perl', 'ace/mode/clojure', 'ace/mode/ocaml', 'ace/mode/svg', 'ace/mode/textile', 'ace/mode/text', 'ace/mode/groovy', 'ace/mode/scala', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'ace/split'], function(require, exports, module) {
+define('demo/demo', ['require', 'exports', 'module' , 'ace/lib/net', 'pilot/canon', 'pilot/event', 'ace/range', 'ace/editor', 'ace/virtual_renderer', 'ace/theme/textmate', 'ace/edit_session', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/scss', 'ace/mode/html', 'ace/mode/xml', 'ace/mode/lua', 'ace/mode/python', 'ace/mode/php', 'ace/mode/java', 'ace/mode/csharp', 'ace/mode/ruby', 'ace/mode/c_cpp', 'ace/mode/coffee', 'ace/mode/json', 'ace/mode/perl', 'ace/mode/clojure', 'ace/mode/ocaml', 'ace/mode/svg', 'ace/mode/markdown', 'ace/mode/textile', 'ace/mode/text', 'ace/mode/groovy', 'ace/mode/scala', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!demo/docs/plaintext.txt', 'text!demo/docs/javascript.js', 'text!demo/docs/css.css', 'text!demo/docs/scss.scss', 'text!demo/docs/html.html', 'text!demo/docs/lua.lua', 'text!demo/docs/python.py', 'text!demo/docs/php.php', 'text!demo/docs/java.java', 'text!demo/docs/ruby.rb', 'text!demo/docs/csharp.cs', 'text!demo/docs/cpp.cpp', 'text!demo/docs/coffeescript.coffee', 'text!demo/docs/json.json', 'text!demo/docs/perl.pl', 'text!demo/docs/clojure.clj', 'text!demo/docs/ocaml.ml', 'text!demo/docs/svg.svg', 'text!demo/docs/markdown.md', 'text!demo/docs/textile.textile', 'text!demo/docs/groovy.groovy', 'text!demo/docs/scala.scala', 'ace/split'], function(require, exports, module) {
+
+var net = require("ace/lib/net");
+var canon = require("pilot/canon");
+var event = require("pilot/event");
+var Range = require("ace/range").Range;
+var Editor = require("ace/editor").Editor;
+var Renderer = require("ace/virtual_renderer").VirtualRenderer;
+var theme = require("ace/theme/textmate");
+var EditSession = require("ace/edit_session").EditSession;
+
+var JavaScriptMode = require("ace/mode/javascript").Mode;
+var CssMode = require("ace/mode/css").Mode;
+var ScssMode = require("ace/mode/scss").Mode;
+var HtmlMode = require("ace/mode/html").Mode;
+var XmlMode = require("ace/mode/xml").Mode;
+var LuaMode = require("ace/mode/lua").Mode;
+var PythonMode = require("ace/mode/python").Mode;
+var PhpMode = require("ace/mode/php").Mode;
+var JavaMode = require("ace/mode/java").Mode;
+var CSharpMode = require("ace/mode/csharp").Mode;
+var RubyMode = require("ace/mode/ruby").Mode;
+var CCPPMode = require("ace/mode/c_cpp").Mode;
+var CoffeeMode = require("ace/mode/coffee").Mode;
+var JsonMode = require("ace/mode/json").Mode;
+var PerlMode = require("ace/mode/perl").Mode;
+var ClojureMode = require("ace/mode/clojure").Mode;
+var OcamlMode = require("ace/mode/ocaml").Mode;
+var SvgMode = require("ace/mode/svg").Mode;
+var MarkdownMode = require("ace/mode/markdown").Mode;
+var TextileMode = require("ace/mode/textile").Mode;
+var TextMode = require("ace/mode/text").Mode;
+var GroovyMode = require("ace/mode/groovy").Mode;
+var ScalaMode = require("ace/mode/scala").Mode;
+
+var UndoManager = require("ace/undomanager").UndoManager;
+
+var vim = require("ace/keyboard/keybinding/vim").Vim;
+var emacs = require("ace/keyboard/keybinding/emacs").Emacs;
+var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
exports.launch = function(env) {
- var canon = require("pilot/canon");
- var event = require("pilot/event");
- var Range = require("ace/range").Range;
- var Editor = require("ace/editor").Editor;
- var Renderer = require("ace/virtual_renderer").VirtualRenderer;
- var theme = require("ace/theme/textmate");
- var EditSession = require("ace/edit_session").EditSession;
-
- var JavaScriptMode = require("ace/mode/javascript").Mode;
- var CssMode = require("ace/mode/css").Mode;
- var ScssMode = require("ace/mode/scss").Mode;
- var HtmlMode = require("ace/mode/html").Mode;
- var XmlMode = require("ace/mode/xml").Mode;
- var PythonMode = require("ace/mode/python").Mode;
- var PhpMode = require("ace/mode/php").Mode;
- var JavaMode = require("ace/mode/java").Mode;
- var CSharpMode = require("ace/mode/csharp").Mode;
- var RubyMode = require("ace/mode/ruby").Mode;
- var CCPPMode = require("ace/mode/c_cpp").Mode;
- var CoffeeMode = require("ace/mode/coffee").Mode;
- var JsonMode = require("ace/mode/json").Mode;
- var PerlMode = require("ace/mode/perl").Mode;
- var ClojureMode = require("ace/mode/clojure").Mode;
- var OcamlMode = require("ace/mode/ocaml").Mode;
- var SvgMode = require("ace/mode/svg").Mode;
- var TextileMode = require("ace/mode/textile").Mode;
- var TextMode = require("ace/mode/text").Mode;
- var GroovyMode = require("ace/mode/groovy").Mode;
- var ScalaMode = require("ace/mode/scala").Mode;
-
- var UndoManager = require("ace/undomanager").UndoManager;
-
- var vim = require("ace/keyboard/keybinding/vim").Vim;
- var emacs = require("ace/keyboard/keybinding/emacs").Emacs;
- var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
-
+
var keybindings = {
// Null = use "default" keymapping
ace: null,
@@ -8098,7 +5330,7 @@ exports.launch = function(env) {
var docs = {};
// Make the lorem ipsum text a little bit longer.
- var loreIpsum = document.getElementById("plaintext").innerHTML;
+ var loreIpsum = require("text!demo/docs/plaintext.txt");
for (var i = 0; i < 5; i++) {
loreIpsum += loreIpsum;
}
@@ -8108,88 +5340,97 @@ exports.launch = function(env) {
docs.plain.setMode(new TextMode());
docs.plain.setUndoManager(new UndoManager());
- docs.js = new EditSession(document.getElementById("jstext").innerHTML);
+ docs.js = new EditSession(require("text!demo/docs/javascript.js"));
docs.js.setMode(new JavaScriptMode());
docs.js.setUndoManager(new UndoManager());
- docs.css = new EditSession(document.getElementById("csstext").innerHTML);
+ docs.css = new EditSession(require("text!demo/docs/css.css"));
docs.css.setMode(new CssMode());
docs.css.setUndoManager(new UndoManager());
- docs.scss = new EditSession(document.getElementById("scsstext").innerHTML);
+ docs.scss = new EditSession(require("text!demo/docs/scss.scss"));
docs.scss.setMode(new ScssMode());
docs.scss.setUndoManager(new UndoManager());
- docs.html = new EditSession(document.getElementById("htmltext").innerHTML);
+ docs.html = new EditSession(require("text!demo/docs/html.html"));
docs.html.setMode(new HtmlMode());
docs.html.setUndoManager(new UndoManager());
- docs.python = new EditSession(document.getElementById("pythontext").innerHTML);
+ docs.lua = new EditSession(require("text!demo/docs/lua.lua"));
+ docs.lua.setMode(new LuaMode());
+ docs.lua.setUndoManager(new UndoManager());
+
+ docs.python = new EditSession(require("text!demo/docs/python.py"));
docs.python.setMode(new PythonMode());
docs.python.setUndoManager(new UndoManager());
- docs.php = new EditSession(document.getElementById("phptext").innerHTML);
+
+ docs.php = new EditSession(require("text!demo/docs/php.php"));
docs.php.setMode(new PhpMode());
docs.php.setUndoManager(new UndoManager());
- docs.java = new EditSession(document.getElementById("javatext").innerHTML);
+ docs.java = new EditSession(require("text!demo/docs/java.java"));
docs.java.setMode(new JavaMode());
docs.java.setUndoManager(new UndoManager());
docs.java.addFold("...", new Range(8, 44, 13, 4));
- docs.ruby = new EditSession(document.getElementById("rubytext").innerHTML);
+ docs.ruby = new EditSession(require("text!demo/docs/ruby.rb"));
docs.ruby.setMode(new RubyMode());
docs.ruby.setUndoManager(new UndoManager());
- docs.csharp = new EditSession(document.getElementById("csharptext").innerHTML);
+ docs.csharp = new EditSession(require("text!demo/docs/csharp.cs"));
docs.csharp.setMode(new CSharpMode());
docs.csharp.setUndoManager(new UndoManager());
- docs.c_cpp = new EditSession(document.getElementById("cpptext").innerHTML);
+ docs.c_cpp = new EditSession(require("text!demo/docs/cpp.cpp"));
docs.c_cpp.setMode(new CCPPMode());
docs.c_cpp.setUndoManager(new UndoManager());
- docs.coffee = new EditSession(document.getElementById("coffeetext").innerHTML);
+ docs.coffee = new EditSession(require("text!demo/docs/coffeescript.coffee"));
docs.coffee.setMode(new CoffeeMode());
docs.coffee.setUndoManager(new UndoManager());
- docs.json = new EditSession(document.getElementById("jsontext").innerHTML);
+ docs.json = new EditSession(require("text!demo/docs/json.json"));
docs.json.setMode(new JsonMode());
docs.json.setUndoManager(new UndoManager());
- docs.perl = new EditSession(document.getElementById("perltext").innerHTML);
+ docs.perl = new EditSession(require("text!demo/docs/perl.pl"));
docs.perl.setMode(new PerlMode());
docs.perl.setUndoManager(new UndoManager());
- docs.clojure = new EditSession(document.getElementById("clojuretext").innerHTML);
+ docs.clojure = new EditSession(require("text!demo/docs/clojure.clj"));
docs.clojure.setMode(new ClojureMode());
docs.clojure.setUndoManager(new UndoManager());
- docs.ocaml = new EditSession(document.getElementById("ocamltext").innerHTML);
+ docs.ocaml = new EditSession(require("text!demo/docs/ocaml.ml"));
docs.ocaml.setMode(new OcamlMode());
docs.ocaml.setUndoManager(new UndoManager());
- docs.svg = new EditSession(document.getElementById("svgtext").innerHTML.replace("<", "<"));
+ docs.svg = new EditSession(require("text!demo/docs/svg.svg"));
docs.svg.setMode(new SvgMode());
docs.svg.setUndoManager(new UndoManager());
- docs.textile = new EditSession(document.getElementById("textiletext").innerHTML);
+ docs.markdown = new EditSession(require("text!demo/docs/markdown.md"));
+ docs.markdown.setMode(new MarkdownMode());
+ docs.markdown.setUseWrapMode(true);
+ docs.markdown.setWrapLimitRange(80, 80);
+ docs.markdown.setUndoManager(new UndoManager());
+
+ docs.textile = new EditSession(require("text!demo/docs/textile.textile"));
docs.textile.setMode(new TextileMode());
docs.textile.setUndoManager(new UndoManager());
- docs.groovy = new EditSession(document.getElementById("groovy").innerHTML);
+ docs.groovy = new EditSession(require("text!demo/docs/groovy.groovy"));
docs.groovy.setMode(new GroovyMode());
docs.groovy.setUndoManager(new UndoManager());
- docs.scala = new EditSession(document.getElementById("scala").innerHTML);
+ docs.scala = new EditSession(require("text!demo/docs/scala.scala"));
docs.scala.setMode(new ScalaMode());
docs.scala.setUndoManager(new UndoManager());
-
-
// Add a "name" property to all docs
- for (doc in docs) {
+ for (var doc in docs) {
docs[doc].name = doc;
}
@@ -8211,12 +5452,14 @@ exports.launch = function(env) {
var modes = {
text: new TextMode(),
textile: new TextileMode(),
+ markdown: new MarkdownMode(),
svg: new SvgMode(),
xml: new XmlMode(),
html: new HtmlMode(),
css: new CssMode(),
scss: new ScssMode(),
javascript: new JavaScriptMode(),
+ lua: new LuaMode(),
python: new PythonMode(),
php: new PhpMode(),
java: new JavaMode(),
@@ -8282,6 +5525,9 @@ exports.launch = function(env) {
else if (mode instanceof XmlMode) {
modeEl.value = "xml";
}
+ else if (mode instanceof LuaMode){
+ modeEl.value = "lua";
+ }
else if (mode instanceof PythonMode) {
modeEl.value = "python";
}
@@ -8318,6 +5564,9 @@ exports.launch = function(env) {
else if (mode instanceof SvgMode) {
modeEl.value = "svg";
}
+ else if (mode instanceof MarkdownMode) {
+ modeEl.value = "markdown";
+ }
else if (mode instanceof TextileMode) {
modeEl.value = "textile";
}
@@ -8464,7 +5713,7 @@ exports.launch = function(env) {
var onCheck = function() {
callback(!!el.checked);
};
- el.onclick = onCheck;
+ el.onCheckck = onCheck;
onCheck();
}
@@ -8480,8 +5729,7 @@ exports.launch = function(env) {
function onResize() {
var width = (document.documentElement.clientWidth - 280);
container.style.width = width + "px";
- cockpitInput.style.width = width + "px";
- container.style.height = (document.documentElement.clientHeight - 22) + "px";
+ container.style.height = document.documentElement.clientHeight + "px";
env.split.resize();
// env.editor.resize();
};
@@ -8489,9 +5737,6 @@ exports.launch = function(env) {
window.onresize = onResize;
onResize();
- // Call resize on the cli explizit. This is necessary for Firefox.
- env.cli.cliView.resizer()
-
event.addListener(container, "dragover", function(e) {
return event.preventDefault(e);
});
@@ -8520,6 +5765,8 @@ exports.launch = function(env) {
mode = "css";
} else if (/^.*\.scss$/i.test(file.name)) {
mode = "scss";
+ } else if (/^.*\.lua$/i.test(file.name)) {
+ mode = "lua";
} else if (/^.*\.py$/i.test(file.name)) {
mode = "python";
} else if (/^.*\.php$/i.test(file.name)) {
@@ -8563,39 +5810,13 @@ exports.launch = function(env) {
* This demonstrates how you can define commands and bind shortcuts to them.
*/
- // Command to focus the command line from the editor.
- canon.addCommand({
- name: "focuscli",
- bindKey: {
- win: "Ctrl-J",
- mac: "Command-J",
- sender: "editor"
- },
- exec: function() {
- env.cli.cliView.element.focus();
- }
- });
-
- // Command to focus the editor line from the command line.
- canon.addCommand({
- name: "focuseditor",
- bindKey: {
- win: "Ctrl-J",
- mac: "Command-J",
- sender: "cli"
- },
- exec: function() {
- env.editor.focus();
- }
- });
-
// Fake-Save, works from the editor and the command line.
canon.addCommand({
name: "save",
bindKey: {
win: "Ctrl-S",
mac: "Command-S",
- sender: "editor|cli"
+ sender: "editor"
},
exec: function() {
alert("Fake Save File");
@@ -8720,10 +5941,62 @@ function loadTheme(name, callback) {
themes[name] = 1;
var base = name.split("/").pop();
var fileName = "src/theme-" + base + ".js";
- loadScriptFile(fileName, callback)
+ net.loadScript(fileName, callback)
}
-function loadScriptFile(path, callback) {
+});
+
+/**
+ * based on code from:
+ *
+ * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+define('ace/lib/net', ['require', 'exports', 'module' ], function(require, exports, module) {
+
+exports.get = function (url, callback) {
+ var xhr = exports.createXhr();
+ xhr.open('GET', url, true);
+ xhr.onreadystatechange = function (evt) {
+ //Do not explicitly handle errors, those should be
+ //visible via console output in the browser.
+ if (xhr.readyState === 4) {
+ callback(xhr.responseText);
+ }
+ };
+ xhr.send(null);
+};
+
+var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
+
+exports.createXhr = function () {
+ //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
+ var xhr, i, progId;
+ if (typeof XMLHttpRequest !== "undefined") {
+ return new XMLHttpRequest();
+ } else {
+ for (i = 0; i < 3; i++) {
+ progId = progIds[i];
+ try {
+ xhr = new ActiveXObject(progId);
+ } catch (e) {}
+
+ if (xhr) {
+ progIds = [progId]; // so faster next time
+ break;
+ }
+ }
+ }
+
+ if (!xhr) {
+ throw new Error("createXhr(): XMLHttpRequest not available");
+ }
+
+ return xhr;
+};
+
+exports.loadScript = function(path, callback) {
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
@@ -8731,7 +6004,627 @@ function loadScriptFile(path, callback) {
head.appendChild(s);
s.onload = callback;
+};
+
+});/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Ajax.org Code Editor (ACE).
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Fabian Jakobs Juhu Kinners
\n" +
+ " \n" +
+ "");
+
+define("text!demo/docs/java.java", [], "public class InfiniteLoop {\n" +
+ "\n" +
+ " /*\n" +
+ " * This will cause the program to hang...\n" +
+ " *\n" +
+ " * Taken from:\n" +
+ " * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/\n" +
+ " */\n" +
+ " public static void main(String[] args) {\n" +
+ " double d = Double.parseDouble(\"2.2250738585072012e-308\");\n" +
+ "\n" +
+ " // unreachable code\n" +
+ " System.out.println(\"Value: \" + d);\n" +
+ " }\n" +
"}");
-define("text!doc/site/iphone.css", [], "#wrapper {" +
- " position:relative;" +
- " overflow:hidden;" +
- "}" +
- "" +
- "#wrapper .content .column1 {" +
- " margin:0 16px 0 15px;" +
- "}" +
- "" +
- "#header .content .signature {" +
- " font-size:18px;" +
- " bottom:0;" +
- "}" +
- "" +
- "UL.menu-list LI {" +
- " font-size:22px;" +
- "}" +
- "" +
- "UL.menu-footer LI {" +
- " font-size:22px;" +
- "}" +
- "" +
- "PRE{" +
- " font-size:22px;" +
- "}" +
- "");
-
-define("text!doc/site/style.css", [], "body {" +
- " margin:0;" +
- " padding:0;" +
- " background-color:#e6f5fc;" +
- " " +
- "}" +
- "" +
- "H2, H3, H4 {" +
- " font-family:Trebuchet MS;" +
- " font-weight:bold;" +
- " margin:0;" +
- " padding:0;" +
- "}" +
- "" +
- "H2 {" +
- " font-size:28px;" +
- " color:#263842;" +
- " padding-bottom:6px;" +
- "}" +
- "" +
- "H3 {" +
- " font-family:Trebuchet MS;" +
- " font-weight:bold;" +
- " font-size:22px;" +
- " color:#253741;" +
- " margin-top:43px;" +
- " margin-bottom:8px;" +
- "}" +
- "" +
- "H4 {" +
- " font-family:Trebuchet MS;" +
- " font-weight:bold;" +
- " font-size:21px;" +
- " color:#222222;" +
- " margin-bottom:4px;" +
- "}" +
- "" +
- "P {" +
- " padding:13px 0;" +
- " margin:0;" +
- " line-height:22px;" +
- "}" +
- "" +
- "UL{" +
- " line-height : 22px;" +
- "}" +
- "" +
- "PRE{" +
- " background : #333;" +
- " color : white;" +
- " padding : 10px;" +
- "}" +
- "" +
- "#header {" +
- " height : 227px;" +
- " position:relative;" +
- " overflow:hidden;" +
- " background: url(images/background.png) repeat-x 0 0;" +
- " border-bottom:1px solid #c9e8fa; " +
- "}" +
- "" +
- "#header .content .signature {" +
- " font-family:Trebuchet MS;" +
- " font-size:11px;" +
- " color:#ebe4d6;" +
- " position:absolute;" +
- " bottom:5px;" +
- " right:42px;" +
- " letter-spacing : 1px;" +
- "}" +
- "" +
- ".content {" +
- " width:970px;" +
- " position:relative;" +
- " overflow:hidden;" +
- " margin:0 auto;" +
- "}" +
- "" +
- "#header .content {" +
- " height:184px;" +
- " margin-top:22px;" +
- "}" +
- "" +
- "#header .content .logo {" +
- " width : 282px;" +
- " height : 184px;" +
- " background:url(images/logo.png) no-repeat 0 0;" +
- " position:absolute;" +
- " top:0;" +
- " left:0;" +
- "}" +
- "" +
- "#header .content .title {" +
- " width : 605px;" +
- " height : 58px;" +
- " background:url(images/ace.png) no-repeat 0 0;" +
- " position:absolute;" +
- " top:98px;" +
- " left:329px;" +
- "}" +
- "" +
- "#wrapper {" +
- " background:url(images/body_background.png) repeat-x 0 0;" +
- " min-height:250px;" +
- "}" +
- "" +
- "#wrapper .content {" +
- " font-family:Arial;" +
- " font-size:14px;" +
- " color:#222222;" +
- " width:1000px;" +
- "}" +
- "" +
- "#wrapper .content .column1 {" +
- " position:relative;" +
- " overflow:hidden;" +
- " float:left;" +
- " width:315px;" +
- " margin-right:31px;" +
- "}" +
- "" +
- "#wrapper .content .column2 {" +
- " position:relative;" +
- " overflow:hidden;" +
- " float:left;" +
- " width:600px;" +
- " padding-top:47px;" +
- "}" +
- "" +
- ".fork_on_github {" +
- " width:310px;" +
- " height:80px;" +
- " background:url(images/fork_on_github.png) no-repeat 0 0;" +
- " position:relative;" +
- " overflow:hidden;" +
- " margin-top:49px;" +
- " cursor:pointer;" +
- "}" +
- "" +
- ".fork_on_github:hover {" +
- " background-position:0 -80px;" +
- "}" +
- "" +
- ".divider {" +
- " height:3px;" +
- " background-color:#bedaea;" +
- " margin-bottom:3px;" +
- "}" +
- "" +
- ".menu {" +
- " padding:23px 0 0 24px;" +
- "}" +
- "" +
- "UL.content-list {" +
- " padding:15px;" +
- " margin:0;" +
- "}" +
- "" +
- "UL.menu-list {" +
- " padding:0;" +
- " margin:0 0 20px 0;" +
- " list-style-type:none;" +
- " line-height : 16px;" +
- "}" +
- "" +
- "UL.menu-list LI {" +
- " color:#2557b4;" +
- " font-family:Trebuchet MS;" +
- " font-size:14px;" +
- " padding:7px 0;" +
- " border-bottom:1px dotted #d6e2e7;" +
- "}" +
- "" +
- "UL.menu-list LI:last-child {" +
- " border-bottom:0;" +
- "}" +
- "" +
- "A {" +
- " color:#2557b4;" +
- " text-decoration:none;" +
- "}" +
- "" +
- "A:hover {" +
- " text-decoration:underline;" +
- "}" +
- "" +
- "P#first{" +
- " background : rgba(255,255,255,0.5);" +
- " padding : 20px;" +
- " font-size : 16px;" +
- " line-height : 24px;" +
- " margin : 0 0 20px 0;" +
- "}" +
- "" +
- "#footer {" +
- " height:40px;" +
- " position:relative;" +
- " overflow:hidden;" +
- " background:url(images/bottombar.png) repeat-x 0 0;" +
- " position:relative;" +
- " margin-top:40px;" +
- "}" +
- "" +
- "UL.menu-footer {" +
- " padding:0;" +
- " margin:8px 11px 0 0;" +
- " list-style-type:none;" +
- " float:right;" +
- "}" +
- "" +
- "UL.menu-footer LI {" +
- " color:white;" +
- " font-family:Arial;" +
- " font-size:12px;" +
- " display:inline-block;" +
- " margin:0 1px;" +
- "}" +
- "" +
- "UL.menu-footer LI A {" +
- " color:#8dd0ff;" +
- " text-decoration:none;" +
- "}" +
- "" +
- "UL.menu-footer LI A:hover {" +
- " text-decoration:underline;" +
- "}" +
- "" +
- "" +
- "" +
- "" +
- "");
-
-define("text!lib/ace/css/editor.css", [], ".ace_editor {" +
- " position: absolute;" +
- " overflow: hidden;" +
- " font-family: Monaco, \"Menlo\", \"Courier New\", monospace;" +
- " font-size: 12px;" +
- "}" +
- "" +
- ".ace_scroller {" +
- " position: absolute;" +
- " overflow-x: scroll;" +
- " overflow-y: hidden;" +
- "}" +
- "" +
- ".ace_content {" +
- " position: absolute;" +
- " box-sizing: border-box;" +
- " -moz-box-sizing: border-box;" +
- " -webkit-box-sizing: border-box;" +
- "}" +
- "" +
- ".ace_composition {" +
- " position: absolute;" +
- " background: #555;" +
- " color: #DDD;" +
- " z-index: 4;" +
- "}" +
- "" +
- ".ace_gutter {" +
- " position: absolute;" +
- " overflow-x: hidden;" +
- " overflow-y: hidden;" +
- " height: 100%;" +
- "}" +
- "" +
- ".ace_gutter-cell.ace_error {" +
- " background-image: url(\"data:image/gif,GIF89a%10%00%10%00%D5%00%00%F5or%F5%87%88%F5nr%F4ns%EBmq%F5z%7F%DDJT%DEKS%DFOW%F1Yc%F2ah%CE(7%CE)8%D18E%DD%40M%F2KZ%EBU%60%F4%60m%DCir%C8%16(%C8%19*%CE%255%F1%3FR%F1%3FS%E6%AB%B5%CA%5DI%CEn%5E%F7%A2%9A%C9G%3E%E0a%5B%F7%89%85%F5yy%F6%82%80%ED%82%80%FF%BF%BF%E3%C4%C4%FF%FF%FF%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%25%00%2C%00%00%00%00%10%00%10%00%00%06p%C0%92pH%2C%1A%8F%C8%D2H%93%E1d4%23%E4%88%D3%09mB%1DN%B48%F5%90%40%60%92G%5B%94%20%3E%22%D2%87%24%FA%20%24%C5%06A%00%20%B1%07%02B%A38%89X.v%17%82%11%13q%10%0Fi%24%0F%8B%10%7BD%12%0Ei%09%92%09%0EpD%18%15%24%0A%9Ci%05%0C%18F%18%0B%07%04%01%04%06%A0H%18%12%0D%14%0D%12%A1I%B3%B4%B5IA%00%3B\");" +
- " background-repeat: no-repeat;" +
- " background-position: 4px center;" +
- "}" +
- "" +
- ".ace_gutter-cell.ace_warning {" +
- " background-image: url(\"data:image/gif,GIF89a%10%00%10%00%D5%00%00%FF%DBr%FF%DE%81%FF%E2%8D%FF%E2%8F%FF%E4%96%FF%E3%97%FF%E5%9D%FF%E6%9E%FF%EE%C1%FF%C8Z%FF%CDk%FF%D0s%FF%D4%81%FF%D5%82%FF%D5%83%FF%DC%97%FF%DE%9D%FF%E7%B8%FF%CCl%7BQ%13%80U%15%82W%16%81U%16%89%5B%18%87%5B%18%8C%5E%1A%94d%1D%C5%83-%C9%87%2F%C6%84.%C6%85.%CD%8B2%C9%871%CB%8A3%CD%8B5%DC%98%3F%DF%9BB%E0%9CC%E1%A5U%CB%871%CF%8B5%D1%8D6%DB%97%40%DF%9AB%DD%99B%E3%B0p%E7%CC%AE%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%2F%00%2C%00%00%00%00%10%00%10%00%00%06a%C0%97pH%2C%1A%8FH%A1%ABTr%25%87%2B%04%82%F4%7C%B9X%91%08%CB%99%1C!%26%13%84*iJ9(%15G%CA%84%14%01%1A%97%0C%03%80%3A%9A%3E%81%84%3E%11%08%B1%8B%20%02%12%0F%18%1A%0F%0A%03'F%1C%04%0B%10%16%18%10%0B%05%1CF%1D-%06%07%9A%9A-%1EG%1B%A0%A1%A0U%A4%A5%A6BA%00%3B\");" +
- " background-repeat: no-repeat;" +
- " background-position: 4px center;" +
- "}" +
- "" +
- ".ace_editor .ace_sb {" +
- " position: absolute;" +
- " overflow-x: hidden;" +
- " overflow-y: scroll;" +
- " right: 0;" +
- "}" +
- "" +
- ".ace_editor .ace_sb div {" +
- " position: absolute;" +
- " width: 1px;" +
- " left: 0;" +
- "}" +
- "" +
- ".ace_editor .ace_print_margin_layer {" +
- " z-index: 0;" +
- " position: absolute;" +
- " overflow: hidden;" +
- " margin: 0;" +
- " left: 0;" +
- " height: 100%;" +
- " width: 100%;" +
- "}" +
- "" +
- ".ace_editor .ace_print_margin {" +
- " position: absolute;" +
- " height: 100%;" +
- "}" +
- "" +
- ".ace_editor textarea {" +
- " position: fixed;" +
- " z-index: -1;" +
- " width: 10px;" +
- " height: 30px;" +
- " opacity: 0;" +
- " background: transparent;" +
- " appearance: none;" +
- " -moz-appearance: none;" +
- " border: none;" +
- " resize: none;" +
- " outline: none;" +
- " overflow: hidden;" +
- "}" +
- "" +
- ".ace_layer {" +
- " z-index: 1;" +
- " position: absolute;" +
- " overflow: hidden;" +
- " white-space: nowrap;" +
- " height: 100%;" +
- " width: 100%;" +
- "}" +
- "" +
- ".ace_text-layer {" +
- " color: black;" +
- "}" +
- "" +
- ".ace_cjk {" +
- " display: inline-block;" +
- " text-align: center;" +
- "}" +
- "" +
- ".ace_cursor-layer {" +
- " z-index: 4;" +
- " cursor: text;" +
- " /* setting pointer-events: none; here will break mouse wheel scrolling in Safari */" +
- "}" +
- "" +
- ".ace_cursor {" +
- " z-index: 4;" +
- " position: absolute;" +
- "}" +
- "" +
- ".ace_cursor.ace_hidden {" +
- " opacity: 0.2;" +
- "}" +
- "" +
- ".ace_line {" +
- " white-space: nowrap;" +
- "}" +
- "" +
- ".ace_marker-layer {" +
- " cursor: text;" +
- " pointer-events: none;" +
- "}" +
- "" +
- ".ace_marker-layer .ace_step {" +
- " position: absolute;" +
- " z-index: 3;" +
- "}" +
- "" +
- ".ace_marker-layer .ace_selection {" +
- " position: absolute;" +
- " z-index: 4;" +
- "}" +
- "" +
- ".ace_marker-layer .ace_bracket {" +
- " position: absolute;" +
- " z-index: 5;" +
- "}" +
- "" +
- ".ace_marker-layer .ace_active_line {" +
- " position: absolute;" +
- " z-index: 2;" +
- "}" +
- "" +
- ".ace_marker-layer .ace_selected_word {" +
- " position: absolute;" +
- " z-index: 6;" +
- " box-sizing: border-box;" +
- " -moz-box-sizing: border-box;" +
- " -webkit-box-sizing: border-box;" +
- "}" +
- "" +
- ".ace_line .ace_fold {" +
- " cursor: pointer;" +
- "}" +
- "" +
- ".ace_dragging .ace_marker-layer, .ace_dragging .ace_text-layer {" +
- " cursor: move;" +
- "}" +
- "");
-
-define("text!node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }" +
- "body { max-width: 60em; }" +
- ".title { text-align: center; }" +
- ".todo { color: red; }" +
- ".done { color: green; }" +
- ".tag { background-color:lightblue; font-weight:normal }" +
- ".target { }" +
- ".timestamp { color: grey }" +
- ".timestamp-kwd { color: CadetBlue }" +
- "p.verse { margin-left: 3% }" +
- "pre {" +
- " border: 1pt solid #AEBDCC;" +
- " background-color: #F3F5F7;" +
- " padding: 5pt;" +
- " font-family: monospace;" +
- " font-size: 90%;" +
- " overflow:auto;" +
- "}" +
- "pre.src {" +
- " background-color: #eee; color: #112; border: 1px solid #000;" +
- "}" +
- "table { border-collapse: collapse; }" +
- "td, th { vertical-align: top; }" +
- "dt { font-weight: bold; }" +
- "div.figure { padding: 0.5em; }" +
- "div.figure p { text-align: center; }" +
- ".linenr { font-size:smaller }" +
- ".code-highlighted {background-color:#ffff00;}" +
- ".org-info-js_info-navigation { border-style:none; }" +
- "#org-info-js_console-label { font-size:10px; font-weight:bold;" +
- " white-space:nowrap; }" +
- ".org-info-js_search-highlight {background-color:#ffff00; color:#000000;" +
- " font-weight:bold; }" +
- "" +
- "sup {" +
- " vertical-align: baseline;" +
- " position: relative;" +
- " top: -0.5em;" +
- " font-size: 80%;" +
- "}" +
- "" +
- "sup a:link, sup a:visited {" +
- " text-decoration: none;" +
- " color: #c00;" +
- "}" +
- "" +
- "sup a:before { content: \"[\"; color: #999; }" +
- "sup a:after { content: \"]\"; color: #999; }" +
- "" +
- "h1.title { border-bottom: 4px solid #000; padding-bottom: 5px; margin-bottom: 2em; }" +
- "" +
- "#postamble {" +
- " color: #777;" +
- " font-size: 90%;" +
- " padding-top: 1em; padding-bottom: 1em; border-top: 1px solid #999;" +
- " margin-top: 2em;" +
- " padding-left: 2em;" +
- " padding-right: 2em;" +
- " text-align: right;" +
- "}" +
- "" +
- "#postamble p { margin: 0; }" +
- "" +
- "#footnotes { border-top: 1px solid #000; }" +
- "" +
- "h1 { font-size: 200% }" +
- "h2 { font-size: 175% }" +
- "h3 { font-size: 150% }" +
- "h4 { font-size: 125% }" +
- "" +
- "h1, h2, h3, h4 { font-family: \"Bookman\",Georgia,\"Times New Roman\",serif; font-weight: normal; }" +
- "" +
- "@media print {" +
- " html { font-size: 11pt; }" +
- "}" +
- "");
-
-define("text!support/cockpit/lib/cockpit/ui/cli_view.css", [], "" +
- "#cockpitInput { padding-left: 16px; }" +
- "" +
- ".cptOutput { overflow: auto; position: absolute; z-index: 999; display: none; }" +
- "" +
- ".cptCompletion { padding: 0; position: absolute; z-index: -1000; }" +
- ".cptCompletion.VALID { background: #FFF; }" +
- ".cptCompletion.INCOMPLETE { background: #DDD; }" +
- ".cptCompletion.INVALID { background: #DDD; }" +
- ".cptCompletion span { color: #FFF; }" +
- ".cptCompletion span.INCOMPLETE { color: #DDD; border-bottom: 2px dotted #F80; }" +
- ".cptCompletion span.INVALID { color: #DDD; border-bottom: 2px dotted #F00; }" +
- "span.cptPrompt { color: #66F; font-weight: bold; }" +
- "" +
- "" +
- ".cptHints {" +
- " color: #000;" +
- " position: absolute;" +
- " border: 1px solid rgba(230, 230, 230, 0.8);" +
- " background: rgba(250, 250, 250, 0.8);" +
- " -moz-border-radius-topleft: 10px;" +
- " -moz-border-radius-topright: 10px;" +
- " border-top-left-radius: 10px; border-top-right-radius: 10px;" +
- " z-index: 1000;" +
- " padding: 8px;" +
- " display: none;" +
- "}" +
- "" +
- ".cptFocusPopup { display: block; }" +
- ".cptFocusPopup.cptNoPopup { display: none; }" +
- "" +
- ".cptHints ul { margin: 0; padding: 0 15px; }" +
- "" +
- ".cptGt { font-weight: bold; font-size: 120%; }" +
- "");
-
-define("text!support/cockpit/lib/cockpit/ui/request_view.css", [], "" +
- ".cptRowIn {" +
- " display: box; display: -moz-box; display: -webkit-box;" +
- " box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal;" +
- " box-align: center; -moz-box-align: center; -webkit-box-align: center;" +
- " color: #333;" +
- " background-color: #EEE;" +
- " width: 100%;" +
- " font-family: consolas, courier, monospace;" +
- "}" +
- ".cptRowIn > * { padding-left: 2px; padding-right: 2px; }" +
- ".cptRowIn > img { cursor: pointer; }" +
- ".cptHover { display: none; }" +
- ".cptRowIn:hover > .cptHover { display: block; }" +
- ".cptRowIn:hover > .cptHover.cptHidden { display: none; }" +
- ".cptOutTyped {" +
- " box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1;" +
- " font-weight: bold; color: #000; font-size: 120%;" +
- "}" +
- ".cptRowOutput { padding-left: 10px; line-height: 1.2em; }" +
- ".cptRowOutput strong," +
- ".cptRowOutput b," +
- ".cptRowOutput th," +
- ".cptRowOutput h1," +
- ".cptRowOutput h2," +
- ".cptRowOutput h3 { color: #000; }" +
- ".cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; }" +
- ".cptRowOutput a: hover { text-decoration: underline; cursor: pointer; }" +
- ".cptRowOutput input[type=password]," +
- ".cptRowOutput input[type=text]," +
- ".cptRowOutput textarea {" +
- " color: #000; font-size: 120%;" +
- " background: transparent; padding: 3px;" +
- " border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;" +
- "}" +
- ".cptRowOutput table," +
- ".cptRowOutput td," +
- ".cptRowOutput th { border: 0; padding: 0 2px; }" +
- ".cptRowOutput .right { text-align: right; }" +
- "");
-
-define("text!tool/Theme.tmpl.css", [], ".%cssClass% .ace_editor {" +
- " border: 2px solid rgb(159, 159, 159);" +
- "}" +
- "" +
- ".%cssClass% .ace_editor.ace_focus {" +
- " border: 2px solid #327fbd;" +
- "}" +
- "" +
- ".%cssClass% .ace_gutter {" +
- " width: 50px;" +
- " background: #e8e8e8;" +
- " color: #333;" +
- " overflow : hidden;" +
- "}" +
- "" +
- ".%cssClass% .ace_gutter-layer {" +
- " width: 100%;" +
- " text-align: right;" +
- "}" +
- "" +
- ".%cssClass% .ace_gutter-layer .ace_gutter-cell {" +
- " padding-right: 6px;" +
- "}" +
- "" +
- ".%cssClass% .ace_print_margin {" +
- " width: 1px;" +
- " background: %printMargin%;" +
- "}" +
- "" +
- ".%cssClass% .ace_scroller {" +
- " background-color: %background%;" +
- "}" +
- "" +
- ".%cssClass% .ace_text-layer {" +
- " cursor: text;" +
- " color: %foreground%;" +
- "}" +
- "" +
- ".%cssClass% .ace_cursor {" +
- " border-left: 2px solid %cursor%;" +
- "}" +
- "" +
- ".%cssClass% .ace_cursor.ace_overwrite {" +
- " border-left: 0px;" +
- " border-bottom: 1px solid %overwrite%;" +
- "}" +
- " " +
- ".%cssClass% .ace_marker-layer .ace_selection {" +
- " background: %selection%;" +
- "}" +
- "" +
- ".%cssClass% .ace_marker-layer .ace_step {" +
- " background: %step%;" +
- "}" +
- "" +
- ".%cssClass% .ace_marker-layer .ace_bracket {" +
- " margin: -1px 0 0 -1px;" +
- " border: 1px solid %bracket%;" +
- "}" +
- "" +
- ".%cssClass% .ace_marker-layer .ace_active_line {" +
- " background: %active_line%;" +
- "}" +
- "" +
- " " +
- ".%cssClass% .ace_invisible {" +
- " %invisible%" +
- "}" +
- "" +
- ".%cssClass% .ace_keyword {" +
- " %keyword%" +
- "}" +
- "" +
- ".%cssClass% .ace_keyword.ace_operator {" +
- " %keyword.operator%" +
- "}" +
- "" +
- ".%cssClass% .ace_constant {" +
- " %constant%" +
- "}" +
- "" +
- ".%cssClass% .ace_constant.ace_language {" +
- " %constant.language%" +
- "}" +
- "" +
- ".%cssClass% .ace_constant.ace_library {" +
- " %constant.library%" +
- "}" +
- "" +
- ".%cssClass% .ace_constant.ace_numeric {" +
- " %constant.numeric%" +
- "}" +
- "" +
- ".%cssClass% .ace_invalid {" +
- " %invalid%" +
- "}" +
- "" +
- ".%cssClass% .ace_invalid.ace_illegal {" +
- " %invalid.illegal%" +
- "}" +
- "" +
- ".%cssClass% .ace_invalid.ace_deprecated {" +
- " %invalid.deprecated%" +
- "}" +
- "" +
- ".%cssClass% .ace_support {" +
- " %support%" +
- "}" +
- "" +
- ".%cssClass% .ace_support.ace_function {" +
- " %support.function%" +
- "}" +
- "" +
- ".%cssClass% .ace_function.ace_buildin {" +
- " %function.buildin%" +
- "}" +
- "" +
- ".%cssClass% .ace_string {" +
- " %string%" +
- "}" +
- "" +
- ".%cssClass% .ace_string.ace_regexp {" +
- " %string.regexp%" +
- "}" +
- "" +
- ".%cssClass% .ace_comment {" +
- " %comment%" +
- "}" +
- "" +
- ".%cssClass% .ace_comment.ace_doc {" +
- " %comment.doc%" +
- "}" +
- "" +
- ".%cssClass% .ace_comment.ace_doc.ace_tag {" +
- " %comment.doc.tag%" +
- "}" +
- "" +
- ".%cssClass% .ace_variable {" +
- " %variable%" +
- "}" +
- "" +
- ".%cssClass% .ace_variable.ace_language {" +
- " %variable.language%" +
- "}" +
- "" +
- ".%cssClass% .ace_xml_pe {" +
- " %xml_pe%" +
- "}" +
- "" +
- ".%cssClass% .ace_collab.ace_user1 {" +
- " %collab.user1% " +
+define("text!demo/docs/javascript.js", [], "function foo(items) {\n" +
+ " for (var i=0; i" +
- "
" +
- "
" +
- "" +
- "
" +
- "
"})}else b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());c.done(d)}},e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);d?(d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))):c.doneWithError("No setting with the name "+b.setting+".")}},f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/commands/basic",["require","exports","module","pilot/typecheck","pilot/canon"],function(require,exports,module){var checks=require("pilot/typecheck"),canon=require("pilot/canon"),helpCommandSpec={name:"help",params:[{name:"search",type:"text",description:"Search string to narrow the output.",defaultValue:null}],description:"Get help on the available commands.",exec:function(a,b,c){var d=[],e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=!1;e?(d.push("Sub-Commands of "+e.name+"
"),d.push("Commands starting with '"+b.search+"':
")):d.push("Available Commands:
");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h
")}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"'+e.name+" "),d.push(""+e.description+" "),d.push("")}d.push("
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"'"+" (type: "+type+"):
"+msg)}},canon=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec)}}),define("pilot/settings/canon",["require","exports","module"],function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("cockpit/cli",["require","exports","module","pilot/console","pilot/lang","pilot/oop","pilot/event_emitter","pilot/types","pilot/canon"],function(a,b,c){function r(a,b){q.call(this,a),b&&b.flags&&(this.flags=b.flags)}function q(a){this.env=a,this.commandAssignment=new o(p,this)}function o(a,b){this.param=a,this.requisition=b,this.setValue(a.defaultValue)}function n(a,b,c,d,e,f){this.emitter=a,this.setText(b),this.start=c,this.end=d,this.prefix=e,this.suffix=f}function m(a,b){this.status=a.status,this.message=a.message,b?(this.start=b.start,this.end=b.end):(this.start=0,this.end=0),this.predictions=a.predictions}function l(a,b,c,d,e){this.status=a,this.message=b;if(typeof c=="number")this.start=c,this.end=d,this.predictions=e;else{var f=c;this.start=f.start,this.end=f.end,this.predictions=f.predictions}}var d=a("pilot/console"),e=a("pilot/lang"),f=a("pilot/oop"),g=a("pilot/event_emitter").EventEmitter,h=a("pilot/types"),i=a("pilot/types").Status,j=a("pilot/types").Conversion,k=a("pilot/canon");b.startup=function(a,b){k.upgradeType("command",p)},l.prototype={},l.sort=function(a,b){b!==undefined&&a.forEach(function(a){a.start===n.AT_CURSOR?a.distance=0:b
"),c.push(a.description?a.description:"(No description)"),c.push("
"),a.params&&a.params.length>0&&(c.push(""),a.params.forEach(function(a){c.push("
"));return new l(i.VALID,c.join(""),b)}};q.prototype={commandAssignment:undefined,assignmentCount:undefined,_assignments:undefined,_hints:undefined,_assignmentChanged:function(a){a.param.name==="__command"&&(this._assignments={},a.value&&a.value.params.forEach(function(a){this._assignments[a.name]=new o(a,this)},this),this.assignmentCount=Object.keys(this._assignments).length,this._dispatchEvent("commandChange",{command:a.value}))},getAssignment:function(a){var b=typeof a=="string"?a:Object.keys(this._assignments)[a];return this._assignments[b]},getParameterNames:function(){return Object.keys(this._assignments)},cloneAssignments:function(){return Object.keys(this._assignments).map(function(a){return this._assignments[a]},this)},_updateHints:function(){this.getAssignments(!0).forEach(function(a){this._hints.push(a.getHint())},this),l.sort(this._hints)},getWorstHint:function(){return this._hints[0]},getArgsObject:function(){var a={};this.getAssignments().forEach(function(b){a[b.param.name]=b.value},this);return a},getAssignments:function(a){var b=[];a===!0&&b.push(this.commandAssignment),Object.keys(this._assignments).forEach(function(a){b.push(this.getAssignment(a))},this);return b},setDefaultValues:function(){this.getAssignments().forEach(function(a){a.setValue(undefined)},this)},exec:function(){k.exec(this.commandAssignment.value,this.env,"cli",this.getArgsObject(),this.toCanonicalString())},toCanonicalString:function(){var a=[];a.push(this.commandAssignment.value.name),Object.keys(this._assignments).forEach(function(b){var c=this._assignments[b],d=c.param.type;c.value!==c.param.defaultValue&&(a.push(" "),a.push(d.stringify(c.value)))},this);return a.join("")}},f.implement(q.prototype,g),b.Requisition=q,f.inherits(r,q),function(){r.prototype.update=function(a){this.input=a,this._hints=[];var b=this._tokenize(a.typed);this._split(b),this.commandAssignment.value&&this._assign(b),this._updateHints()},r.prototype.getInputStatusMarkup=function(){var a=this.toString().split("").map(function(a){return i.VALID});this._hints.forEach(function(b){for(var c=b.start;c<=b.end;c++)b.status>a[c]&&(a[c]=b.status)},this);return a},r.prototype.toString=function(){return this.getAssignments(!0).map(function(a){return a.toString()},this).join("")};var a=r.prototype._updateHints;r.prototype._updateHints=function(){a.call(this);var b=this.input.cursor;this._hints.forEach(function(a){var c=b.start>=a.start&&b.start<=a.end,d=b.end>=a.start&&b.end<=a.end,e=c||d;!e&&a.status===i.INCOMPLETE&&(a.status=i.INVALID)},this),l.sort(this._hints)},r.prototype.getHints=function(){return this._hints},r.prototype.getAssignmentAt=function(a){var b=this.getAssignments(!0);for(var c=0;c"+d.responseText+"
")},d.send(null)}},d=a("pilot/canon");b.startup=function(a,b){d.addCommand(e)},b.shutdown=function(a,b){d.removeCommand(e)}}),define("ace/defaults",["require","exports","module","ace/settings/default-settings"],function(a,b,c){var d=a("ace/settings/default-settings");b.startup=function(a,b){d.startup(a,b)},b.shutdown=function(a,b){d.shutdown(a,b)}}),define("ace/settings/default-settings",["require","exports","module","pilot/types","pilot/types/basic"],function(a,b,c){var d=a("pilot/types"),e=a("pilot/types/basic").SelectionType,f,g={selectionStyle:new e({data:["line","text"]})},h={printMargin:{description:"Position of the print margin column.",type:"number",defaultValue:80,onChange:function(a){f.editor&&f.editor.setPrintMarginColumn(a.value)}},showIvisibles:{description:"Whether or not to show invisible characters.",type:"bool",defaultValue:!1,onChange:function(a){f.editor&&f.editor.setShowInvisibles(a.value)}},highlightActiveLine:{description:"Whether or not highlight active line.",type:"bool",defaultValue:!0,onChange:function(a){f.editor&&f.editor.setHighlightActiveLine(a.value)}},selectionStyle:{description:"Type of text selection.",type:"selectionStyle",defaultValue:"line",onChange:function(a){f.editor&&f.editor.setSelectionStyle(a.value)}}};b.startup=function(a,b){f=a.env,d.registerTypes(g),a.env.settings.addSettings(h)},b.shutdown=function(a,b){a.env.settings.removeSettings(h)}}),define("demo/boot",["require","exports","module","pilot/fixoldbrowsers","pilot/plugin_manager","pilot/settings","pilot/environment","demo/demo","pilot/index","cockpit/index","ace/defaults"],function(a,b,c){a("pilot/fixoldbrowsers"),a("pilot/plugin_manager"),a("pilot/settings"),a("pilot/environment"),a("demo/demo"),a("pilot/index"),a("cockpit/index"),a("ace/defaults");var d=["pilot/index","cockpit/index","ace/defaults"],e=a("pilot/plugin_manager").catalog;e.registerPlugins(d).then(function(){var b=a("pilot/environment").create();e.startupPlugins({env:b}).then(function(){a("demo/demo").launch(b)})})}),define("pilot/plugin_manager",["require","exports","module","pilot/promise"],function(a,b,c){var d=a("pilot/promise").Promise;b.REASONS={APP_STARTUP:1,APP_SHUTDOWN:2,PLUGIN_ENABLE:3,PLUGIN_DISABLE:4,PLUGIN_INSTALL:5,PLUGIN_UNINSTALL:6,PLUGIN_UPGRADE:7,PLUGIN_DOWNGRADE:8},b.Plugin=function(a){this.name=a,this.status=this.INSTALLED},b.Plugin.prototype={NEW:0,INSTALLED:1,REGISTERED:2,STARTED:3,UNREGISTERED:4,SHUTDOWN:5,install:function(b,c){var e=new d;if(this.status>this.NEW){e.resolve(this);return e}a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this));return e},register:function(b,c){var e=new d;if(this.status!=this.INSTALLED){e.resolve(this);return e}a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this));return e},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;if(this.status!=this.REGISTERED){f.resolve(this);return f}a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this));return f},shutdown:function(b,c){this.status==this.STARTED&&(pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c))}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this));return d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",["require","exports","module","pilot/console","pilot/stacktrace"],function(a,b,c){var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=-1,g=0,h=1,i=0,j=!1,k=[],l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=!0,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){typeof a=="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b=="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b));return this},Promise.prototype.chainPromise=function(a){var b=new Promise;b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)});return b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g){d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd();return this}j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise,c=[],d=0,e=function(e){return function(g){c[e]=g,d++,b._status!==f&&d===a.length&&b.resolve(c)}};a.forEach(function(a,c){var d=e(c),f=b.reject.bind(b);a.then(d,f)});return b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/environment",["require","exports","module","pilot/settings"],function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("demo/demo",["require","exports","module","pilot/canon","pilot/event","ace/range","ace/editor","ace/virtual_renderer","ace/theme/textmate","ace/edit_session","ace/mode/javascript","ace/mode/css","ace/mode/scss","ace/mode/html","ace/mode/xml","ace/mode/python","ace/mode/php","ace/mode/java","ace/mode/csharp","ace/mode/ruby","ace/mode/c_cpp","ace/mode/coffee","ace/mode/json","ace/mode/perl","ace/mode/clojure","ace/mode/ocaml","ace/mode/svg","ace/mode/textile","ace/mode/text","ace/mode/groovy","ace/mode/scala","ace/undomanager","ace/keyboard/keybinding/vim","ace/keyboard/keybinding/emacs","ace/keyboard/hash_handler","ace/split"],function(a,b,c){function f(a,b){var c=document.getElementsByTagName("head")[0],d=document.createElement("script");d.src=a,c.appendChild(d),d.onload=b}function e(a,b){if(!d[a]){d[a]=1;var c=a.split("/").pop(),e="src/theme-"+c+".js";f(e,b)}}b.launch=function(b){function bk(a,b){var c=a.editor.session,d=a.editor.selection,e=d.getRange(),f;if(e.isEmpty()){var g=c.findMatchingBracket(e.start),h=c.getFoldAt(e.start.row,e.start.column),i;if(h)c.expandFold(h),d.setSelectionRange(h.range);else if(g)e.compare(g.row,g.column)==1?e.end=g:e.start=g,f=!0;else if((i=bj(e.start.row))!==!1){var j=e.start.row,k=e.start.row,l;while((l=bj(j-1))!==!1)j--,i=l;while(bj(k+1)!==!1)k++;e.start.row=j,e.start.column=i+2,e.end.row=k,e.end.column=c.getLine(k).length-1,f=!0}}else f=!0;if(f){var m=c.getTextRange(e);if(m.length<3)return;m=m.trim().substring(0,3).replace(" ","","g")+"...",c.addFold(m,e)}}function bj(a){var c=b.editor.session,d,e=c.getTokens(a,a)[0].tokens,f=0;for(var g=0;g
"})}else b.value===undefined?d=""+setting.name+" = "+setting.get():(b.setting.set(b.value),d="Setting: "+b.setting.name+" = "+b.setting.get());c.done(d)}},e={name:"unset",params:[{name:"setting",type:"setting",description:"The name of the setting to return to defaults"}],description:"unset a setting entirely",exec:function(a,b,c){var d=a.settings.get(b.setting);if(!d){c.doneWithError("No setting with the name "+b.setting+".");return}d.reset(),c.done("Reset "+d.name+" to default: "+a.settings.get(b.setting))}},f=a("pilot/canon");b.startup=function(a,b){f.addCommand(d),f.addCommand(e)},b.shutdown=function(a,b){f.removeCommand(d),f.removeCommand(e)}}),define("pilot/commands/basic",["require","exports","module","pilot/typecheck","pilot/canon"],function(require,exports,module){var checks=require("pilot/typecheck"),canon=require("pilot/canon"),helpCommandSpec={name:"help",params:[{name:"search",type:"text",description:"Search string to narrow the output.",defaultValue:null}],description:"Get help on the available commands.",exec:function(a,b,c){var d=[],e=canon.getCommand(b.search);if(e&&e.exec)d.push(e.description?e.description:"No description for "+b.search);else{var f=!1;e?(d.push("Sub-Commands of "+e.name+"
"),d.push("Commands starting with '"+b.search+"':
")):d.push("Available Commands:
");var g=canon.getCommandNames();g.sort(),d.push("");for(var h=0;h
")}c.done(d.join(""))}},evalCommandSpec={name:"eval",params:[{name:"javascript",type:"text",description:"The JavaScript to evaluate"}],description:"evals given js code and show the result",hidden:!0,exec:function(env,args,request){var result,javascript=args.javascript;try{result=eval(javascript)}catch(e){result="Error: "+e.message+""}var msg="",type="",x;if(checks.isFunction(result))msg=(result+"").replace(/\n/g,"'+e.name+" "),d.push(""+e.description+" "),d.push("")}d.push("
").replace(/ /g," "),type="function";else if(checks.isObject(result)){Array.isArray(result)?type="array":type="object";var items=[],value;for(x in result)result.hasOwnProperty(x)&&(checks.isFunction(result[x])?value="[function]":checks.isObject(result[x])?value="[object]":value=result[x],items.push({name:x,value:value}));items.sort(function(a,b){return a.name.toLowerCase()
"}else msg=result,type=typeof result;request.done("Result for eval '"+javascript+"'"+" (type: "+type+"):
"+msg)}},canon=require("pilot/canon");exports.startup=function(a,b){canon.addCommand(helpCommandSpec),canon.addCommand(evalCommandSpec)},exports.shutdown=function(a,b){canon.removeCommand(helpCommandSpec),canon.removeCommand(evalCommandSpec)}}),define("pilot/settings/canon",["require","exports","module"],function(a,b,c){var d={name:"historyLength",description:"How many typed commands do we recall for reference?",type:"number",defaultValue:50};b.startup=function(a,b){a.env.settings.addSetting(d)},b.shutdown=function(a,b){a.env.settings.removeSetting(d)}}),define("ace/defaults",["require","exports","module","ace/settings/default-settings"],function(a,b,c){var d=a("ace/settings/default-settings");b.startup=function(a,b){d.startup(a,b)},b.shutdown=function(a,b){d.shutdown(a,b)}}),define("ace/settings/default-settings",["require","exports","module","pilot/types","pilot/types/basic"],function(a,b,c){var d=a("pilot/types"),e=a("pilot/types/basic").SelectionType,f,g={selectionStyle:new e({data:["line","text"]})},h={printMargin:{description:"Position of the print margin column.",type:"number",defaultValue:80,onChange:function(a){f.editor&&f.editor.setPrintMarginColumn(a.value)}},showIvisibles:{description:"Whether or not to show invisible characters.",type:"bool",defaultValue:!1,onChange:function(a){f.editor&&f.editor.setShowInvisibles(a.value)}},highlightActiveLine:{description:"Whether or not highlight active line.",type:"bool",defaultValue:!0,onChange:function(a){f.editor&&f.editor.setHighlightActiveLine(a.value)}},selectionStyle:{description:"Type of text selection.",type:"selectionStyle",defaultValue:"line",onChange:function(a){f.editor&&f.editor.setSelectionStyle(a.value)}}};b.startup=function(a,b){f=a.env,d.registerTypes(g),a.env.settings.addSettings(h)},b.shutdown=function(a,b){a.env.settings.removeSettings(h)}}),define("demo/boot",["require","exports","module","pilot/fixoldbrowsers","pilot/plugin_manager","pilot/environment","demo/demo","pilot/index","ace/defaults"],function(a,b,c){a("pilot/fixoldbrowsers"),a("pilot/plugin_manager"),a("pilot/environment"),a("demo/demo"),a("pilot/index"),a("ace/defaults");var d=["pilot/index"],e=a("pilot/plugin_manager").catalog;e.registerPlugins(d).then(function(){var b=a("pilot/environment").create();e.startupPlugins({env:b}).then(function(){a("demo/demo").launch(b)})})}),define("pilot/plugin_manager",["require","exports","module","pilot/promise"],function(a,b,c){var d=a("pilot/promise").Promise;b.REASONS={APP_STARTUP:1,APP_SHUTDOWN:2,PLUGIN_ENABLE:3,PLUGIN_DISABLE:4,PLUGIN_INSTALL:5,PLUGIN_UNINSTALL:6,PLUGIN_UPGRADE:7,PLUGIN_DOWNGRADE:8},b.Plugin=function(a){this.name=a,this.status=this.INSTALLED},b.Plugin.prototype={NEW:0,INSTALLED:1,REGISTERED:2,STARTED:3,UNREGISTERED:4,SHUTDOWN:5,install:function(b,c){var e=new d;return this.status>this.NEW?(e.resolve(this),e):(a([this.name],function(a){a.install&&a.install(b,c),this.status=this.INSTALLED,e.resolve(this)}.bind(this)),e)},register:function(b,c){var e=new d;return this.status!=this.INSTALLED?(e.resolve(this),e):(a([this.name],function(a){a.register&&a.register(b,c),this.status=this.REGISTERED,e.resolve(this)}.bind(this)),e)},startup:function(c,e){e=e||b.REASONS.APP_STARTUP;var f=new d;return this.status!=this.REGISTERED?(f.resolve(this),f):(a([this.name],function(a){a.startup&&a.startup(c,e),this.status=this.STARTED,f.resolve(this)}.bind(this)),f)},shutdown:function(b,c){if(this.status!=this.STARTED)return;pluginModule=a(this.name),pluginModule.shutdown&&pluginModule.shutdown(b,c)}},b.PluginCatalog=function(){this.plugins={}},b.PluginCatalog.prototype={registerPlugins:function(a,c,e){var f=[];return a.forEach(function(a){var d=this.plugins[a];d===undefined&&(d=new b.Plugin(a),this.plugins[a]=d,f.push(d.register(c,e)))}.bind(this)),d.group(f)},startupPlugins:function(a,b){var c=[];for(var e in this.plugins){var f=this.plugins[e];c.push(f.startup(a,b))}return d.group(c)}},b.catalog=new b.PluginCatalog}),define("pilot/promise",["require","exports","module","pilot/console","pilot/stacktrace"],function(a,b,c){var d=a("pilot/console"),e=a("pilot/stacktrace").Trace,f=-1,g=0,h=1,i=0,j=!1,k=[],l=[];Promise=function(){this._status=g,this._value=undefined,this._onSuccessHandlers=[],this._onErrorHandlers=[],this._id=i++,k[this._id]=this},Promise.prototype.isPromise=!0,Promise.prototype.isComplete=function(){return this._status!=g},Promise.prototype.isResolved=function(){return this._status==h},Promise.prototype.isRejected=function(){return this._status==f},Promise.prototype.then=function(a,b){return typeof a=="function"&&(this._status===h?a.call(null,this._value):this._status===g&&this._onSuccessHandlers.push(a)),typeof b=="function"&&(this._status===f?b.call(null,this._value):this._status===g&&this._onErrorHandlers.push(b)),this},Promise.prototype.chainPromise=function(a){var b=new Promise;return b._chainedFrom=this,this.then(function(c){try{b.resolve(a(c))}catch(d){b.reject(d)}},function(a){b.reject(a)}),b},Promise.prototype.resolve=function(a){return this._complete(this._onSuccessHandlers,h,a,"resolve")},Promise.prototype.reject=function(a){return this._complete(this._onErrorHandlers,f,a,"reject")},Promise.prototype._complete=function(a,b,c,f){if(this._status!=g)return d.group("Promise already closed"),d.error("Attempted "+f+"() with ",c),d.error("Previous status = ",this._status,", previous value = ",this._value),d.trace(),this._completeTrace&&(d.error("Trace of previous completion:"),this._completeTrace.log(5)),d.groupEnd(),this;j&&(this._completeTrace=new e(new Error)),this._status=b,this._value=c,a.forEach(function(a){a.call(null,this._value)},this),this._onSuccessHandlers.length=0,this._onErrorHandlers.length=0,delete k[this._id],l.push(this);while(l.length>20)l.shift();return this},Promise.group=function(a){a instanceof Array||(a=Array.prototype.slice.call(arguments));if(a.length===0)return(new Promise).resolve([]);var b=new Promise,c=[],d=0,e=function(e){return function(g){c[e]=g,d++,b._status!==f&&d===a.length&&b.resolve(c)}};return a.forEach(function(a,c){var d=e(c),f=b.reject.bind(b);a.then(d,f)}),b},b.Promise=Promise,b._outstanding=k,b._recent=l}),define("pilot/environment",["require","exports","module","pilot/settings"],function(a,b,c){function e(){return{settings:d}}var d=a("pilot/settings").settings;b.create=e}),define("demo/demo",["require","exports","module","ace/lib/net","pilot/canon","pilot/event","ace/range","ace/editor","ace/virtual_renderer","ace/theme/textmate","ace/edit_session","ace/mode/javascript","ace/mode/css","ace/mode/scss","ace/mode/html","ace/mode/xml","ace/mode/lua","ace/mode/python","ace/mode/php","ace/mode/java","ace/mode/csharp","ace/mode/ruby","ace/mode/c_cpp","ace/mode/coffee","ace/mode/json","ace/mode/perl","ace/mode/clojure","ace/mode/ocaml","ace/mode/svg","ace/mode/markdown","ace/mode/textile","ace/mode/text","ace/mode/groovy","ace/mode/scala","ace/undomanager","ace/keyboard/keybinding/vim","ace/keyboard/keybinding/emacs","ace/keyboard/hash_handler","text!demo/docs/plaintext.txt","text!demo/docs/javascript.js","text!demo/docs/css.css","text!demo/docs/scss.scss","text!demo/docs/html.html","text!demo/docs/lua.lua","text!demo/docs/python.py","text!demo/docs/php.php","text!demo/docs/java.java","text!demo/docs/ruby.rb","text!demo/docs/csharp.cs","text!demo/docs/cpp.cpp","text!demo/docs/coffeescript.coffee","text!demo/docs/json.json","text!demo/docs/perl.pl","text!demo/docs/clojure.clj","text!demo/docs/ocaml.ml","text!demo/docs/svg.svg","text!demo/docs/markdown.md","text!demo/docs/textile.textile","text!demo/docs/groovy.groovy","text!demo/docs/scala.scala","ace/split"],function(a,b,c){function N(a,b){if(M[a])return;M[a]=1;var c=a.split("/").pop(),e="src/theme-"+c+".js";d.loadScript(e,b)}var d=a("ace/lib/net"),e=a("pilot/canon"),f=a("pilot/event"),g=a("ace/range").Range,h=a("ace/editor").Editor,i=a("ace/virtual_renderer").VirtualRenderer,j=a("ace/theme/textmate"),k=a("ace/edit_session").EditSession,l=a("ace/mode/javascript").Mode,m=a("ace/mode/css").Mode,n=a("ace/mode/scss").Mode,o=a("ace/mode/html").Mode,p=a("ace/mode/xml").Mode,q=a("ace/mode/lua").Mode,r=a("ace/mode/python").Mode,s=a("ace/mode/php").Mode,t=a("ace/mode/java").Mode,u=a("ace/mode/csharp").Mode,v=a("ace/mode/ruby").Mode,w=a("ace/mode/c_cpp").Mode,x=a("ace/mode/coffee").Mode,y=a("ace/mode/json").Mode,z=a("ace/mode/perl").Mode,A=a("ace/mode/clojure").Mode,B=a("ace/mode/ocaml").Mode,C=a("ace/mode/svg").Mode,D=a("ace/mode/markdown").Mode,E=a("ace/mode/textile").Mode,F=a("ace/mode/text").Mode,G=a("ace/mode/groovy").Mode,H=a("ace/mode/scala").Mode,I=a("ace/undomanager").UndoManager,J=a("ace/keyboard/keybinding/vim").Vim,K=a("ace/keyboard/keybinding/emacs").Emacs,L=a("ace/keyboard/hash_handler").HashHandler;b.launch=function(b){function T(){return S[V.value]}function bf(){var a=b.editor,c=a.session;U.value=c.name;var d=c.getMode();d instanceof l?V.value="javascript":d instanceof m?V.value="css":d instanceof n?V.value="scss":d instanceof o?V.value="html":d instanceof p?V.value="xml":d instanceof q?V.value="lua":d instanceof r?V.value="python":d instanceof s?V.value="php":d instanceof t?V.value="java":d instanceof v?V.value="ruby":d instanceof w?V.value="c_cpp":d instanceof x?V.value="coffee":d instanceof y?V.value="json":d instanceof z?V.value="perl":d instanceof A?V.value="clojure":d instanceof B?V.value="ocaml":d instanceof u?V.value="csharp":d instanceof C?V.value="svg":d instanceof D?V.value="markdown":d instanceof E?V.value="textile":d instanceof G?V.value="groovy":d instanceof H?V.value="scala":V.value="text",c.getUseWrapMode()?W.value=c.getWrapLimitRange().min||"free":W.value="off",Y.checked=a.getSelectionStyle()=="line",X.value=a.getTheme(),Z.checked=a.getHighlightActiveLine(),$.checked=a.getShowInvisibles(),_.checked=a.renderer.getShowGutter(),ba.checked=a.renderer.getShowPrintMargin(),bb.checked=a.getHighlightSelectedWord(),bc.checked=a.renderer.getHScrollBarAlwaysVisible(),bd.checked=c.getUseSoftTabs(),be.checked=a.getBehavioursEnabled()}function bh(a,b){var c=document.getElementById(a),d=function(){b(!!c.checked)};c.onCheckck=d,d()}function bi(a,b){var c=document.getElementById(a),d=function(){b(c.value)};c.onchange=d,d()}function bj(){var a=document.documentElement.clientWidth-280;O.style.width=a+"px",O.style.height=document.documentElement.clientHeight+"px",b.split.resize()}function bk(a){var c=b.editor.session,d,e=c.getTokens(a,a)[0].tokens,f=0;for(var g=0;gJuhu Kinners
\n \n'),define("text!demo/docs/java.java",[],'public class InfiniteLoop {\n\n /*\n * This will cause the program to hang...\n *\n * Taken from:\n * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/\n */\n public static void main(String[] args) {\n double d = Double.parseDouble("2.2250738585072012e-308");\n\n // unreachable code\n System.out.println("Value: " + d);\n }\n}'),define("text!demo/docs/javascript.js",[],'function foo(items) {\n for (var i=0; i" +
- "
" +
- "
" +
- "" +
- "
" +
- "
"),c.push(a.description?a.description:"(No description)"),c.push("
"),a.params&&a.params.length>0&&(c.push(""),a.params.forEach(function(a){c.push("
"));return new l(i.VALID,c.join(""),b)}};q.prototype={commandAssignment:undefined,assignmentCount:undefined,_assignments:undefined,_hints:undefined,_assignmentChanged:function(a){a.param.name==="__command"&&(this._assignments={},a.value&&a.value.params.forEach(function(a){this._assignments[a.name]=new o(a,this)},this),this.assignmentCount=Object.keys(this._assignments).length,this._dispatchEvent("commandChange",{command:a.value}))},getAssignment:function(a){var b=typeof a=="string"?a:Object.keys(this._assignments)[a];return this._assignments[b]},getParameterNames:function(){return Object.keys(this._assignments)},cloneAssignments:function(){return Object.keys(this._assignments).map(function(a){return this._assignments[a]},this)},_updateHints:function(){this.getAssignments(!0).forEach(function(a){this._hints.push(a.getHint())},this),l.sort(this._hints)},getWorstHint:function(){return this._hints[0]},getArgsObject:function(){var a={};this.getAssignments().forEach(function(b){a[b.param.name]=b.value},this);return a},getAssignments:function(a){var b=[];a===!0&&b.push(this.commandAssignment),Object.keys(this._assignments).forEach(function(a){b.push(this.getAssignment(a))},this);return b},setDefaultValues:function(){this.getAssignments().forEach(function(a){a.setValue(undefined)},this)},exec:function(){k.exec(this.commandAssignment.value,this.env,"cli",this.getArgsObject(),this.toCanonicalString())},toCanonicalString:function(){var a=[];a.push(this.commandAssignment.value.name),Object.keys(this._assignments).forEach(function(b){var c=this._assignments[b],d=c.param.type;c.value!==c.param.defaultValue&&(a.push(" "),a.push(d.stringify(c.value)))},this);return a.join("")}},f.implement(q.prototype,g),b.Requisition=q,f.inherits(r,q),function(){r.prototype.update=function(a){this.input=a,this._hints=[];var b=this._tokenize(a.typed);this._split(b),this.commandAssignment.value&&this._assign(b),this._updateHints()},r.prototype.getInputStatusMarkup=function(){var a=this.toString().split("").map(function(a){return i.VALID});this._hints.forEach(function(b){for(var c=b.start;c<=b.end;c++)b.status>a[c]&&(a[c]=b.status)},this);return a},r.prototype.toString=function(){return this.getAssignments(!0).map(function(a){return a.toString()},this).join("")};var a=r.prototype._updateHints;r.prototype._updateHints=function(){a.call(this);var b=this.input.cursor;this._hints.forEach(function(a){var c=b.start>=a.start&&b.start<=a.end,d=b.end>=a.start&&b.end<=a.end,e=c||d;!e&&a.status===i.INCOMPLETE&&(a.status=i.INVALID)},this),l.sort(this._hints)},r.prototype.getHints=function(){return this._hints},r.prototype.getAssignmentAt=function(a){var b=this.getAssignments(!0);for(var c=0;c"+d.responseText+"
")},d.send(null)}},d=a("pilot/canon");b.startup=function(a,b){d.addCommand(e)},b.shutdown=function(a,b){d.removeCommand(e)}}),define("text!cockpit/ui/cli_view.css",[],"#cockpitInput { padding-left: 16px; }.cptOutput { overflow: auto; position: absolute; z-index: 999; display: none; }.cptCompletion { padding: 0; position: absolute; z-index: -1000; }.cptCompletion.VALID { background: #FFF; }.cptCompletion.INCOMPLETE { background: #DDD; }.cptCompletion.INVALID { background: #DDD; }.cptCompletion span { color: #FFF; }.cptCompletion span.INCOMPLETE { color: #DDD; border-bottom: 2px dotted #F80; }.cptCompletion span.INVALID { color: #DDD; border-bottom: 2px dotted #F00; }span.cptPrompt { color: #66F; font-weight: bold; }.cptHints { color: #000; position: absolute; border: 1px solid rgba(230, 230, 230, 0.8); background: rgba(250, 250, 250, 0.8); -moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; z-index: 1000; padding: 8px; display: none;}.cptFocusPopup { display: block; }.cptFocusPopup.cptNoPopup { display: none; }.cptHints ul { margin: 0; padding: 0 15px; }.cptGt { font-weight: bold; font-size: 120%; }"),define("text!cockpit/ui/request_view.css",[],".cptRowIn { display: box; display: -moz-box; display: -webkit-box; box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal; box-align: center; -moz-box-align: center; -webkit-box-align: center; color: #333; background-color: #EEE; width: 100%; font-family: consolas, courier, monospace;}.cptRowIn > * { padding-left: 2px; padding-right: 2px; }.cptRowIn > img { cursor: pointer; }.cptHover { display: none; }.cptRowIn:hover > .cptHover { display: block; }.cptRowIn:hover > .cptHover.cptHidden { display: none; }.cptOutTyped { box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1; font-weight: bold; color: #000; font-size: 120%;}.cptRowOutput { padding-left: 10px; line-height: 1.2em; }.cptRowOutput strong,.cptRowOutput b,.cptRowOutput th,.cptRowOutput h1,.cptRowOutput h2,.cptRowOutput h3 { color: #000; }.cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; }.cptRowOutput a: hover { text-decoration: underline; cursor: pointer; }.cptRowOutput input[type=password],.cptRowOutput input[type=text],.cptRowOutput textarea { color: #000; font-size: 120%; background: transparent; padding: 3px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;}.cptRowOutput table,.cptRowOutput td,.cptRowOutput th { border: 0; padding: 0 2px; }.cptRowOutput .right { text-align: right; }"),define("text!cockpit/ui/request_view.html",[],'
|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/,R=/^[^\n\S]+/,k=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/,g=/^[-=]>/,D=/^(?:\n[^\n\S]*)+/,O=/^'[^\\']*(?:\\.[^\\']*)*'/,u=/^`[^\\`]*(?:\\.[^\\`]*)*`/,J=/^\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4}(?!\w)/,q=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,r=/\s+(?:#.*)?/g,C=/\n/g,p=/\n+([^\n\S]*)/g,o=/\*\//,d=/^\s*@?([$A-Za-z_][$\w\x7f-\uffff]*|['"].*['"])[^\n\S]*?[:=][^:=>]/,y=/^\s*(?:,|\??\.(?![.\d])|::)/,P=/\s+$/,G=/^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|n(?:ot|ew)|delete|typeof|instanceof)$/,m=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|="],Q=["!","~","NEW","TYPEOF","DELETE","DO"],z=["&&","||","&","|","^"],N=["<<",">>",">>>"],l=["==","!=","<",">","<=",">="],B=["*","/","%"],K=["IN","OF","INSTANCEOF"],e=["TRUE","FALSE","NULL","UNDEFINED"],E=["NUMBER","REGEX","BOOL","++","--","]"],F=E.concat(")","}","THIS","IDENTIFIER","STRING"),f=["IDENTIFIER","STRING","REGEX",")","]","}","?","::","@","THIS","SUPER"],t=f.concat("NUMBER","BOOL"),x=["INDENT","OUTDENT","TERMINATOR"]}),define("ace/mode/coffee/rewriter",["require","exports","module"],function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b
|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/,R=/^[^\n\S]+/,k=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/,g=/^[-=]>/,D=/^(?:\n[^\n\S]*)+/,O=/^'[^\\']*(?:\\.[^\\']*)*'/,u=/^`[^\\`]*(?:\\.[^\\`]*)*`/,J=/^\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4}(?!\w)/,q=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,r=/\s+(?:#.*)?/g,C=/\n/g,p=/\n+([^\n\S]*)/g,o=/\*\//,d=/^\s*@?([$A-Za-z_][$\w\x7f-\uffff]*|['"].*['"])[^\n\S]*?[:=][^:=>]/,y=/^\s*(?:,|\??\.(?![.\d])|::)/,P=/\s+$/,G=/^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|n(?:ot|ew)|delete|typeof|instanceof)$/,m=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|="],Q=["!","~","NEW","TYPEOF","DELETE","DO"],z=["&&","||","&","|","^"],N=["<<",">>",">>>"],l=["==","!=","<",">","<=",">="],B=["*","/","%"],K=["IN","OF","INSTANCEOF"],e=["TRUE","FALSE","NULL","UNDEFINED"],E=["NUMBER","REGEX","BOOL","++","--","]"],F=E.concat(")","}","THIS","IDENTIFIER","STRING"),f=["IDENTIFIER","STRING","REGEX",")","]","}","?","::","@","THIS","SUPER"],t=f.concat("NUMBER","BOOL"),x=["INDENT","OUTDENT","TERMINATOR"]}),define("ace/mode/coffee/rewriter",["require","exports","module"],function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b