move kitchen-sink demo into a separate directory
This commit is contained in:
parent
760074ee41
commit
606963f424
39 changed files with 47 additions and 49 deletions
57
demo/kitchen-sink/boot.js
Normal file
57
demo/kitchen-sink/boot.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* ***** 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):
|
||||
* Kevin Dangoor (kdangoor@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(function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
require("pilot/plugin_manager");
|
||||
require("pilot/environment");
|
||||
require("demo/kitchen-sink/demo");
|
||||
|
||||
require("pilot/index");
|
||||
require("ace/defaults");
|
||||
|
||||
var plugins = [ "pilot/index"];
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins(plugins).then(function() {
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
require("demo/kitchen-sink/demo").launch(env);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
653
demo/kitchen-sink/demo.js
Normal file
653
demo/kitchen-sink/demo.js
Normal file
|
|
@ -0,0 +1,653 @@
|
|||
/* ***** 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):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT 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(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 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 modesByName;
|
||||
|
||||
var Doc = function(name, desc, file) {
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
this.doc = new EditSession(file);
|
||||
this.doc.setMode(modesByName[name].mode);
|
||||
this.doc.setUndoManager(new UndoManager());
|
||||
};
|
||||
|
||||
var WrappedDoc = function(name, desc, file) {
|
||||
Doc.apply(this, arguments);
|
||||
|
||||
this.doc.setUseWrapMode(true);
|
||||
this.doc.setWrapLimitRange(80, 80);
|
||||
};
|
||||
|
||||
var Mode = function(name, desc, clazz, extensions) {
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
this.clazz = clazz;
|
||||
this.mode = new clazz();
|
||||
this.mode.name = name;
|
||||
|
||||
this.extRe = new RegExp("^.*\\.(" + extensions.join("|") + ")$", "g");
|
||||
};
|
||||
|
||||
Mode.prototype.supportsFile = function(filename) {
|
||||
return filename.match(this.extRe);
|
||||
};
|
||||
|
||||
|
||||
|
||||
exports.launch = function(env) {
|
||||
|
||||
var modes = [
|
||||
new Mode("c_cpp", "C/C++", require("ace/mode/c_cpp").Mode, ["c", "cpp", "cxx", "h", "hpp"]),
|
||||
new Mode("clojure", "Clojure", require("ace/mode/clojure").Mode, ["clj"]),
|
||||
new Mode("coffee", "CoffeeScript", require("ace/mode/coffee").Mode, ["coffee"]),
|
||||
new Mode("coldfusion", "ColdFusion", require("ace/mode/coldfusion").Mode, ["cfm"]),
|
||||
new Mode("csharp", "C#", require("ace/mode/csharp").Mode, ["cs"]),
|
||||
new Mode("css", "CSS", require("ace/mode/css").Mode, ["css"]),
|
||||
new Mode("groovy", "Groovy", require("ace/mode/groovy").Mode, ["groovy"]),
|
||||
new Mode("html", "HTML", require("ace/mode/html").Mode, ["html", "htm"]),
|
||||
new Mode("java", "Java", require("ace/mode/java").Mode, ["java"]),
|
||||
new Mode("javascript", "JavaScript", require("ace/mode/javascript").Mode, ["js"]),
|
||||
new Mode("json", "JSON", require("ace/mode/json").Mode, ["json"]),
|
||||
new Mode("latex", "LaTeX", require("ace/mode/latex").Mode, ["tex"]),
|
||||
new Mode("lua", "Lua", require("ace/mode/lua").Mode, ["lua"]),
|
||||
new Mode("markdown", "MarkDown", require("ace/mode/markdown").Mode, ["md", "markdown"]),
|
||||
new Mode("ocaml", "OCaml", require("ace/mode/ocaml").Mode, ["ml", "mli"]),
|
||||
new Mode("perl", "Perl", require("ace/mode/perl").Mode, ["pl", "pm"]),
|
||||
new Mode("php", "PHP",require("ace/mode/php").Mode, ["php"]),
|
||||
new Mode("powershell", "Powershell", require("ace/mode/powershell").Mode, ["ps1"]),
|
||||
new Mode("python", "Python", require("ace/mode/python").Mode, ["py"]),
|
||||
new Mode("scala", "Scala", require("ace/mode/scala").Mode, ["scala"]),
|
||||
new Mode("scss", "SCSS", require("ace/mode/scss").Mode, ["scss"]),
|
||||
new Mode("ruby", "Ruby", require("ace/mode/ruby").Mode, ["rb"]),
|
||||
new Mode("sql", "SQL", require("ace/mode/sql").Mode, ["sql"]),
|
||||
new Mode("svg", "SVG", require("ace/mode/SVG").Mode, ["svg"]),
|
||||
new Mode("text", "Text", require("ace/mode/text").Mode, ["txt"]),
|
||||
new Mode("textile", "Textile", require("ace/mode/textile").Mode, ["textile"]),
|
||||
new Mode("xml", "XML", require("ace/mode/xml").Mode, ["xml"])
|
||||
];
|
||||
|
||||
modesByName = {};
|
||||
modes.forEach(function(m) {
|
||||
modesByName[m.name] = m;
|
||||
});
|
||||
|
||||
var loreIpsum = require("ace/requirejs/text!demo/kitchen-sink/docs/plaintext.txt");
|
||||
for (var i = 0; i < 5; i++) {
|
||||
loreIpsum += loreIpsum;
|
||||
}
|
||||
|
||||
var docs = [
|
||||
new Doc(
|
||||
"javascript", "JavaScript",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/javascript.js")
|
||||
),
|
||||
new WrappedDoc("text", "Plain Text", loreIpsum),
|
||||
new Doc(
|
||||
"coffee", "Coffeescript",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/coffeescript.coffee")
|
||||
),
|
||||
new Doc(
|
||||
"json", "JSON",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/json.json")
|
||||
),
|
||||
new Doc(
|
||||
"css", "CSS",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/css.css")
|
||||
),
|
||||
new Doc(
|
||||
"scss", "SCSS",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/scss.scss")
|
||||
),
|
||||
new Doc(
|
||||
"html", "HTML",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/html.html")
|
||||
),
|
||||
new Doc(
|
||||
"xml", "XML",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/xml.xml")
|
||||
),
|
||||
new Doc(
|
||||
"svg", "SVG",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/svg.svg")
|
||||
),
|
||||
new Doc(
|
||||
"php", "PHP",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/php.php")
|
||||
),
|
||||
new Doc(
|
||||
"coldfusion", "ColdFusion",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/coldfusion.cfm")
|
||||
),
|
||||
new Doc(
|
||||
"python", "Python",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/python.py")
|
||||
),
|
||||
new Doc(
|
||||
"ruby", "Ruby",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/ruby.rb")
|
||||
),
|
||||
new Doc(
|
||||
"perl", "Perl",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/perl.pl")
|
||||
),
|
||||
new Doc(
|
||||
"ocaml", "OCaml",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/ocaml.ml")
|
||||
),
|
||||
new Doc(
|
||||
"lua", "Lua",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/lua.lua")
|
||||
),
|
||||
new Doc(
|
||||
"java", "Java",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/java.java")
|
||||
),
|
||||
new Doc(
|
||||
"clojure", "Clojure",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/clojure.clj")
|
||||
),
|
||||
new Doc(
|
||||
"groovy", "Groovy",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/groovy.groovy")
|
||||
),
|
||||
new Doc(
|
||||
"scala", "Scala",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/scala.scala")
|
||||
),
|
||||
new Doc(
|
||||
"csharp", "C#",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/csharp.cs")
|
||||
),
|
||||
new Doc(
|
||||
"powershell", "Powershell",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/powershell.ps1")
|
||||
),
|
||||
new Doc(
|
||||
"c_cpp", "C/C++",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/cpp.cpp")
|
||||
),
|
||||
new Doc(
|
||||
"markdown", "Markdown",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/markdown.md")
|
||||
),
|
||||
new WrappedDoc(
|
||||
"markdown", "Markdown",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/markdown.md")
|
||||
),
|
||||
new WrappedDoc(
|
||||
"textile", "Textile",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/textile.textile")
|
||||
),
|
||||
new WrappedDoc(
|
||||
"latex", "LaTeX",
|
||||
require("ace/requirejs/text!demo/kitchen-sink/docs/latex.tex")
|
||||
)
|
||||
];
|
||||
|
||||
var docsByName = {};
|
||||
docs.forEach(function(d) {
|
||||
docsByName[d.name] = d;
|
||||
});
|
||||
|
||||
var keybindings = {
|
||||
// Null = use "default" keymapping
|
||||
ace: null,
|
||||
vim: vim,
|
||||
emacs: emacs,
|
||||
// This is a way to define simple keyboard remappings
|
||||
custom: new HashHandler({
|
||||
"gotoright": "Tab",
|
||||
"indent": "]",
|
||||
"outdent": "[",
|
||||
"gotolinestart": "^",
|
||||
"gotolineend": "$"
|
||||
})
|
||||
};
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
var cockpitInput = document.getElementById("cockpitInput");
|
||||
|
||||
// Splitting.
|
||||
var Split = require("ace/split").Split;
|
||||
var split = new Split(container, theme, 1);
|
||||
env.editor = split.getEditor(0);
|
||||
split.on("focus", function(editor) {
|
||||
env.editor = editor;
|
||||
updateUIEditorOptions();
|
||||
});
|
||||
env.split = split;
|
||||
window.env = env;
|
||||
window.ace = env.editor;
|
||||
|
||||
var docEl = document.getElementById("doc");
|
||||
var modeEl = document.getElementById("mode");
|
||||
var wrapModeEl = document.getElementById("soft_wrap");
|
||||
var themeEl = document.getElementById("theme");
|
||||
var selectStyleEl = document.getElementById("select_style");
|
||||
var highlightActiveEl = document.getElementById("highlight_active");
|
||||
var showHiddenEl = document.getElementById("show_hidden");
|
||||
var showGutterEl = document.getElementById("show_gutter");
|
||||
var showPrintMarginEl = document.getElementById("show_print_margin");
|
||||
var highlightSelectedWordE = document.getElementById("highlight_selected_word");
|
||||
var showHScrollEl = document.getElementById("show_hscroll");
|
||||
var softTabEl = document.getElementById("soft_tab");
|
||||
var behavioursEl = document.getElementById("enable_behaviours");
|
||||
|
||||
docs.forEach(function(doc) {
|
||||
var option = document.createElement("option");
|
||||
option.setAttribute("value", doc.name);
|
||||
option.innerHTML = doc.desc;
|
||||
docEl.appendChild(option);
|
||||
});
|
||||
|
||||
modes.forEach(function(mode) {
|
||||
var option = document.createElement("option");
|
||||
option.setAttribute("value", mode.name);
|
||||
option.innerHTML = mode.desc;
|
||||
modeEl.appendChild(option);
|
||||
});
|
||||
|
||||
bindDropdown("doc", function(value) {
|
||||
var doc = docsByName[value].doc;
|
||||
var session = env.split.setSession(doc);
|
||||
session.name = doc.name;
|
||||
|
||||
updateUIEditorOptions();
|
||||
|
||||
env.editor.focus();
|
||||
});
|
||||
|
||||
function updateUIEditorOptions() {
|
||||
var editor = env.editor;
|
||||
var session = editor.session;
|
||||
|
||||
docEl.value = session.name;
|
||||
modeEl.value = session.getMode().name || "text";
|
||||
|
||||
if (!session.getUseWrapMode()) {
|
||||
wrapModeEl.value = "off";
|
||||
} else {
|
||||
wrapModeEl.value = session.getWrapLimitRange().min || "free";
|
||||
}
|
||||
|
||||
selectStyleEl.checked = editor.getSelectionStyle() == "line";
|
||||
themeEl.value = editor.getTheme();
|
||||
highlightActiveEl.checked = editor.getHighlightActiveLine();
|
||||
showHiddenEl.checked = editor.getShowInvisibles();
|
||||
showGutterEl.checked = editor.renderer.getShowGutter();
|
||||
showPrintMarginEl.checked = editor.renderer.getShowPrintMargin();
|
||||
highlightSelectedWordE.checked = editor.getHighlightSelectedWord();
|
||||
showHScrollEl.checked = editor.renderer.getHScrollBarAlwaysVisible();
|
||||
softTabEl.checked = session.getUseSoftTabs();
|
||||
behavioursEl.checked = editor.getBehavioursEnabled();
|
||||
}
|
||||
|
||||
bindDropdown("mode", function(value) {
|
||||
env.editor.getSession().setMode(modesByName[value].mode || modesByName.text.mode);
|
||||
});
|
||||
|
||||
bindDropdown("theme", function(value) {
|
||||
if (require.packaged) {
|
||||
loadTheme(value, function() {
|
||||
env.editor.setTheme(value);
|
||||
});
|
||||
}
|
||||
else {
|
||||
env.editor.setTheme(value);
|
||||
}
|
||||
});
|
||||
|
||||
bindDropdown("keybinding", function(value) {
|
||||
env.editor.setKeyboardHandler(keybindings[value]);
|
||||
});
|
||||
|
||||
bindDropdown("fontsize", function(value) {
|
||||
env.split.setFontSize(value);
|
||||
});
|
||||
|
||||
bindDropdown("soft_wrap", function(value) {
|
||||
var session = env.editor.getSession();
|
||||
var renderer = env.editor.renderer;
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
bindCheckbox("select_style", function(checked) {
|
||||
env.editor.setSelectionStyle(checked ? "line" : "text");
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_active", function(checked) {
|
||||
env.editor.setHighlightActiveLine(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_hidden", function(checked) {
|
||||
env.editor.setShowInvisibles(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_gutter", function(checked) {
|
||||
env.editor.renderer.setShowGutter(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_print_margin", function(checked) {
|
||||
env.editor.renderer.setShowPrintMargin(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_selected_word", function(checked) {
|
||||
env.editor.setHighlightSelectedWord(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_hscroll", function(checked) {
|
||||
env.editor.renderer.setHScrollBarAlwaysVisible(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("soft_tab", function(checked) {
|
||||
env.editor.getSession().setUseSoftTabs(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("enable_behaviours", function(checked) {
|
||||
env.editor.setBehavioursEnabled(checked);
|
||||
});
|
||||
|
||||
var secondSession = null;
|
||||
bindDropdown("split", function(value) {
|
||||
var sp = env.split;
|
||||
if (value == "none") {
|
||||
if (sp.getSplits() == 2) {
|
||||
secondSession = sp.getEditor(1).session;
|
||||
}
|
||||
sp.setSplits(1);
|
||||
} else {
|
||||
var newEditor = (sp.getSplits() == 1);
|
||||
if (value == "below") {
|
||||
sp.setOriantation(sp.BELOW);
|
||||
} else {
|
||||
sp.setOriantation(sp.BESIDE);
|
||||
}
|
||||
sp.setSplits(2);
|
||||
|
||||
if (newEditor) {
|
||||
var session = secondSession || sp.getEditor(0).session;
|
||||
var newSession = sp.setSession(session, 1);
|
||||
newSession.name = session.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function bindCheckbox(id, callback) {
|
||||
var el = document.getElementById(id);
|
||||
var onCheck = function() {
|
||||
callback(!!el.checked);
|
||||
};
|
||||
el.onclick = onCheck;
|
||||
onCheck();
|
||||
}
|
||||
|
||||
function bindDropdown(id, callback) {
|
||||
var el = document.getElementById(id);
|
||||
var onChange = function() {
|
||||
callback(el.value);
|
||||
};
|
||||
el.onchange = onChange;
|
||||
onChange();
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
var left = env.split.$container.offsetLeft;
|
||||
var width = document.documentElement.clientWidth - left;
|
||||
container.style.width = width + "px";
|
||||
container.style.height = document.documentElement.clientHeight + "px";
|
||||
env.split.resize();
|
||||
// env.editor.resize();
|
||||
}
|
||||
|
||||
window.onresize = onResize;
|
||||
env.editor.renderer.onResize(true);
|
||||
|
||||
event.addListener(container, "dragover", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
event.addListener(container, "drop", function(e) {
|
||||
var file;
|
||||
try {
|
||||
file = e.dataTransfer.files[0];
|
||||
} catch(err) {
|
||||
return event.stopEvent();
|
||||
}
|
||||
|
||||
if (window.FileReader) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
env.editor.getSelection().selectAll();
|
||||
|
||||
var mode = modesByName.text;
|
||||
for (var i = 0; i < modes.length; i++) {
|
||||
if (modes[i].supportsFile(file.name)) {
|
||||
mode = modes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
env.editor.onTextInput(reader.result);
|
||||
|
||||
modeEl.value = mode.name;
|
||||
env.editor.getSession().setMode(mode.mode);
|
||||
};
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
/**
|
||||
* This demonstrates how you can define commands and bind shortcuts to them.
|
||||
*/
|
||||
|
||||
// Fake-Save, works from the editor and the command line.
|
||||
canon.addCommand({
|
||||
name: "save",
|
||||
bindKey: {
|
||||
win: "Ctrl-S",
|
||||
mac: "Command-S",
|
||||
sender: "editor"
|
||||
},
|
||||
exec: function() {
|
||||
alert("Fake Save File");
|
||||
}
|
||||
});
|
||||
|
||||
// Fake-Print with custom lookup-sender-match function.
|
||||
canon.addCommand({
|
||||
name: "print",
|
||||
bindKey: {
|
||||
win: "Ctrl-P",
|
||||
mac: "Command-P",
|
||||
sender: function(env, sender, hashId, keyString) {
|
||||
if (sender == "editor") {
|
||||
return true;
|
||||
} else {
|
||||
alert("Sorry, can only print from the editor");
|
||||
}
|
||||
}
|
||||
},
|
||||
exec: function() {
|
||||
alert("Fake Print File");
|
||||
}
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
name: "fold",
|
||||
bindKey: {
|
||||
win: "Alt-L",
|
||||
mac: "Alt-L",
|
||||
sender: "editor"
|
||||
},
|
||||
exec: function(env) {
|
||||
toggleFold(env, false);
|
||||
}
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
name: "unfold",
|
||||
bindKey: {
|
||||
win: "Alt-Shift-L",
|
||||
mac: "Alt-Shift-L",
|
||||
sender: "editor"
|
||||
},
|
||||
exec: function(env) {
|
||||
toggleFold(env, true);
|
||||
}
|
||||
});
|
||||
|
||||
function isCommentRow(row) {
|
||||
var session = env.editor.session;
|
||||
var token;
|
||||
var tokens = session.getTokens(row, row)[0].tokens;
|
||||
var c = 0;
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
token = tokens[i];
|
||||
if (/^comment/.test(token.type)) {
|
||||
return c;
|
||||
} else if (!/^text/.test(token.type)) {
|
||||
return false;
|
||||
}
|
||||
c += token.value.length;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function toggleFold(env, tryToUnfold) {
|
||||
var session = env.editor.session;
|
||||
var selection = env.editor.selection;
|
||||
var range = selection.getRange();
|
||||
var addFold;
|
||||
|
||||
if(range.isEmpty()) {
|
||||
var br = session.findMatchingBracket(range.start);
|
||||
var fold = session.getFoldAt(range.start.row, range.start.column);
|
||||
var column;
|
||||
|
||||
if (fold) {
|
||||
session.expandFold(fold);
|
||||
selection.setSelectionRange(fold.range);
|
||||
} else if (br) {
|
||||
if (range.compare(br.row, br.column) == 1)
|
||||
range.end = br;
|
||||
else
|
||||
range.start = br;
|
||||
addFold = true;
|
||||
} else if ((column = isCommentRow(range.start.row)) !== false) {
|
||||
var firstCommentRow = range.start.row;
|
||||
var lastCommentRow = range.start.row;
|
||||
var t;
|
||||
while ((t = isCommentRow(firstCommentRow - 1)) !== false) {
|
||||
firstCommentRow --;
|
||||
column = t;
|
||||
}
|
||||
while (isCommentRow(lastCommentRow + 1) !== false) {
|
||||
lastCommentRow ++;
|
||||
}
|
||||
range.start.row = firstCommentRow;
|
||||
range.start.column = column + 2;
|
||||
range.end.row = lastCommentRow;
|
||||
range.end.column = session.getLine(lastCommentRow).length - 1;
|
||||
addFold = true;
|
||||
}
|
||||
} else {
|
||||
addFold = true;
|
||||
}
|
||||
if (addFold) {
|
||||
var placeHolder = session.getTextRange(range);
|
||||
if(placeHolder.length < 3)
|
||||
return;
|
||||
placeHolder = placeHolder.trim().substring(0, 3).replace(' ','','g') + "...";
|
||||
session.addFold(placeHolder, range);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var themes = {};
|
||||
function loadTheme(name, callback) {
|
||||
if (themes[name])
|
||||
return callback();
|
||||
|
||||
themes[name] = 1;
|
||||
var base = name.split("/").pop();
|
||||
var fileName = "src/theme-" + base + ".js";
|
||||
net.loadScript(fileName, callback);
|
||||
}
|
||||
|
||||
});
|
||||
19
demo/kitchen-sink/docs/clojure.clj
Normal file
19
demo/kitchen-sink/docs/clojure.clj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(defn parting
|
||||
"returns a String parting in a given language"
|
||||
([] (parting "World"))
|
||||
([name] (parting name "en"))
|
||||
([name language]
|
||||
; condp is similar to a case statement in other languages.
|
||||
; It is described in more detail later.
|
||||
; It is used here to take different actions based on whether the
|
||||
; parameter "language" is set to "en", "es" or something else.
|
||||
(condp = language
|
||||
"en" (str "Goodbye, " name)
|
||||
"es" (str "Adios, " name)
|
||||
(throw (IllegalArgumentException.
|
||||
(str "unsupported language " language))))))
|
||||
|
||||
(println (parting)) ; -> Goodbye, World
|
||||
(println (parting "Mark")) ; -> Goodbye, Mark
|
||||
(println (parting "Mark" "es")) ; -> Adios, Mark
|
||||
(println (parting "Mark", "xy")) ; -> java.lang.IllegalArgumentException: unsupported language xy
|
||||
20
demo/kitchen-sink/docs/coffeescript.coffee
Normal file
20
demo/kitchen-sink/docs/coffeescript.coffee
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env coffee
|
||||
|
||||
try
|
||||
throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
|
||||
catch e
|
||||
console.log 'qstring' + "qqstring" + '''
|
||||
qdoc
|
||||
''' + """
|
||||
qqdoc
|
||||
"""
|
||||
|
||||
do ->
|
||||
###
|
||||
herecomment
|
||||
###
|
||||
re = /regex/imgy.test ///
|
||||
heregex # comment
|
||||
///imgy
|
||||
this isnt: `just JavaScript`
|
||||
undefined
|
||||
5
demo/kitchen-sink/docs/coldfusion.cfm
Normal file
5
demo/kitchen-sink/docs/coldfusion.cfm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<!--- hello world --->
|
||||
|
||||
<cfset welcome="Hello World!">
|
||||
|
||||
<cfoutput>#welcome#</cfoutput>
|
||||
13
demo/kitchen-sink/docs/cpp.cpp
Normal file
13
demo/kitchen-sink/docs/cpp.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
return 0;
|
||||
}
|
||||
4
demo/kitchen-sink/docs/csharp.cs
Normal file
4
demo/kitchen-sink/docs/csharp.cs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
public void HelloWorld() {
|
||||
//Say Hello!
|
||||
Console.WriteLine("Hello World");
|
||||
}
|
||||
5
demo/kitchen-sink/docs/css.css
Normal file
5
demo/kitchen-sink/docs/css.css
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
26
demo/kitchen-sink/docs/groovy.groovy
Normal file
26
demo/kitchen-sink/docs/groovy.groovy
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//http://groovy.codehaus.org/Concurrency+with+Groovy
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
def counter = new AtomicInteger()
|
||||
|
||||
synchronized out(message) {
|
||||
println(message)
|
||||
}
|
||||
|
||||
def th = Thread.start {
|
||||
for( i in 1..8 ) {
|
||||
sleep 30
|
||||
out "thread loop $i"
|
||||
counter.incrementAndGet()
|
||||
}
|
||||
}
|
||||
|
||||
for( j in 1..4 ) {
|
||||
sleep 50
|
||||
out "main loop $j"
|
||||
counter.incrementAndGet()
|
||||
}
|
||||
|
||||
th.join()
|
||||
|
||||
assert counter.get() == 12
|
||||
16
demo/kitchen-sink/docs/html.html
Normal file
16
demo/kitchen-sink/docs/html.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html>
|
||||
15
demo/kitchen-sink/docs/java.java
Normal file
15
demo/kitchen-sink/docs/java.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
public class InfiniteLoop {
|
||||
|
||||
/*
|
||||
* This will cause the program to hang...
|
||||
*
|
||||
* Taken from:
|
||||
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
double d = Double.parseDouble("2.2250738585072012e-308");
|
||||
|
||||
// unreachable code
|
||||
System.out.println("Value: " + d);
|
||||
}
|
||||
}
|
||||
5
demo/kitchen-sink/docs/javascript.js
Normal file
5
demo/kitchen-sink/docs/javascript.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
} // Real Tab.
|
||||
}
|
||||
66
demo/kitchen-sink/docs/json.json
Normal file
66
demo/kitchen-sink/docs/json.json
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"query": {
|
||||
"count": 10,
|
||||
"created": "2011-06-21T08:10:46Z",
|
||||
"lang": "en-US",
|
||||
"results": {
|
||||
"photo": [
|
||||
{
|
||||
"farm": "6",
|
||||
"id": "5855620975",
|
||||
"isfamily": "0",
|
||||
"isfriend": "0",
|
||||
"ispublic": "1",
|
||||
"owner": "32021554@N04",
|
||||
"secret": "f1f5e8515d",
|
||||
"server": "5110",
|
||||
"title": "7087 bandit cat"
|
||||
},
|
||||
{
|
||||
"farm": "4",
|
||||
"id": "5856170534",
|
||||
"isfamily": "0",
|
||||
"isfriend": "0",
|
||||
"ispublic": "1",
|
||||
"owner": "32021554@N04",
|
||||
"secret": "ff1efb2a6f",
|
||||
"server": "3217",
|
||||
"title": "6975 rusty cat"
|
||||
},
|
||||
{
|
||||
"farm": "6",
|
||||
"id": "5856172972",
|
||||
"isfamily": "0",
|
||||
"isfriend": "0",
|
||||
"ispublic": "1",
|
||||
"owner": "51249875@N03",
|
||||
"secret": "6c6887347c",
|
||||
"server": "5192",
|
||||
"title": "watermarked-cats"
|
||||
},
|
||||
{
|
||||
"farm": "6",
|
||||
"id": "5856168328",
|
||||
"isfamily": "0",
|
||||
"isfriend": "0",
|
||||
"ispublic": "1",
|
||||
"owner": "32021554@N04",
|
||||
"secret": "0c1cfdf64c",
|
||||
"server": "5078",
|
||||
"title": "7020 mandy cat"
|
||||
},
|
||||
{
|
||||
"farm": "3",
|
||||
"id": "5856171774",
|
||||
"isfamily": "0",
|
||||
"isfriend": "0",
|
||||
"ispublic": "1",
|
||||
"owner": "32021554@N04",
|
||||
"secret": "7f5a3180ab",
|
||||
"server": "2696",
|
||||
"title": "7448 bobby cat"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
22
demo/kitchen-sink/docs/latex.tex
Normal file
22
demo/kitchen-sink/docs/latex.tex
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
\usepackage{amsmath}
|
||||
\title{\LaTeX}
|
||||
\date{}
|
||||
\begin{document}
|
||||
\maketitle
|
||||
\LaTeX{} is a document preparation system for the \TeX{}
|
||||
typesetting program. It offers programmable desktop publishing
|
||||
features and extensive facilities for automating most aspects of
|
||||
typesetting and desktop publishing, including numbering and
|
||||
cross-referencing, tables and figures, page layout, bibliographies,
|
||||
and much more. \LaTeX{} was originally written in 1984 by Leslie
|
||||
Lamport and has become the dominant method for using \TeX; few
|
||||
people write in plain \TeX{} anymore. The current version is
|
||||
\LaTeXe.
|
||||
|
||||
% This is a comment; it will not be shown in the final output.
|
||||
% The following shows a little of the typesetting power of LaTeX:
|
||||
\begin{align}
|
||||
E &= mc^2 \\
|
||||
m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}
|
||||
\end{align}
|
||||
\end{document}
|
||||
36
demo/kitchen-sink/docs/lua.lua
Normal file
36
demo/kitchen-sink/docs/lua.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
--[[--
|
||||
num_args takes in 5.1 byte code and extracts the number of arguments
|
||||
from its function header.
|
||||
--]]--
|
||||
|
||||
function int(t)
|
||||
return t:byte(1)+t:byte(2)*0x100+t:byte(3)*0x10000+t:byte(4)*0x1000000
|
||||
end
|
||||
|
||||
function num_args(func)
|
||||
local dump = string.dump(func)
|
||||
local offset, cursor = int(dump:sub(13)), offset + 26
|
||||
--Get the params and var flag (whether there's a ... in the param)
|
||||
return dump:sub(cursor):byte(), dump:sub(cursor+1):byte()
|
||||
end
|
||||
|
||||
-- Usage:
|
||||
num_args(function(a,b,c,d, ...) end) -- return 4, 7
|
||||
|
||||
-- Python styled string format operator
|
||||
local gm = debug.getmetatable("")
|
||||
|
||||
gm.__mod=function(self, other)
|
||||
if type(other) ~= "table" then other = {other} end
|
||||
for i,v in ipairs(other) do other[i] = tostring(v) end
|
||||
return self:format(unpack(other))
|
||||
end
|
||||
|
||||
print([===[
|
||||
blah blah %s, (%d %d)
|
||||
]===]%{"blah", num_args(int)})
|
||||
|
||||
--[=[--
|
||||
table.maxn is deprecated, use # instead.
|
||||
--]=]--
|
||||
print(table.maxn{1,2,[4]=4,[8]=8) -- outputs 8 instead of 2
|
||||
186
demo/kitchen-sink/docs/markdown.md
Normal file
186
demo/kitchen-sink/docs/markdown.md
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
Ace (Ajax.org Cloud9 Editor)
|
||||
============================
|
||||
|
||||
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Syntax highlighting
|
||||
* Automatic indent and outdent
|
||||
* An optional command line
|
||||
* Handles huge documents (100,000 lines and more are no problem)
|
||||
* Fully customizable key bindings including VI and Emacs modes
|
||||
* Themes (TextMate themes can be imported)
|
||||
* Search and replace with regular expressions
|
||||
* Highlight matching parentheses
|
||||
* Toggle between soft tabs and real tabs
|
||||
* Displays hidden characters
|
||||
* Drag and drop text using the mouse
|
||||
* Line wrapping
|
||||
* Unstructured / user code folding
|
||||
* Live syntax checker (currently JavaScript/CoffeeScript)
|
||||
|
||||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
-------------
|
||||
|
||||
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
|
||||
|
||||
The easiest version is simply:
|
||||
|
||||
```html
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
|
||||
|
||||
```css
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
```
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
```html
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
```javascript
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
```
|
||||
|
||||
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
|
||||
|
||||
```html
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
Then the mode can be used like this:
|
||||
|
||||
```javascript
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js).
|
||||
|
||||
There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki).
|
||||
|
||||
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss).
|
||||
|
||||
Running Ace
|
||||
-----------
|
||||
|
||||
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
```bash
|
||||
./static.py
|
||||
```
|
||||
|
||||
Or using Node.JS
|
||||
|
||||
```bash
|
||||
./static.js
|
||||
```
|
||||
|
||||
The editor can then be opened at http://localhost:8888/index.html.
|
||||
|
||||
Package Ace
|
||||
-----------
|
||||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Afterwards Ace can be built by calling
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js normal
|
||||
```
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
To build the bookmarklet version execute
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js bm
|
||||
```
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
|
||||
|
||||
```bash
|
||||
npm link .
|
||||
```
|
||||
|
||||
To run the tests call:
|
||||
|
||||
```bash
|
||||
node lib/ace/test/all.js
|
||||
```
|
||||
|
||||
You can also run the tests in your browser by serving:
|
||||
|
||||
http://localhost:8888/lib/ace/test/tests.html
|
||||
|
||||
This makes debugging failing tests way more easier.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
|
||||
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
|
||||
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
|
||||
|
||||
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
|
||||
|
||||
Email: fabian.jakobs@web.de
|
||||
|
||||
Fax: +31 (0) 206388953
|
||||
|
||||
Address: Ajax.org B.V.
|
||||
Keizersgracht 241
|
||||
1016 EA, Amsterdam
|
||||
the Netherlands
|
||||
18
demo/kitchen-sink/docs/ocaml.ml
Normal file
18
demo/kitchen-sink/docs/ocaml.ml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(*
|
||||
* Example of early return implementation taken from
|
||||
* http://ocaml.janestreet.com/?q=node/91
|
||||
*)
|
||||
|
||||
let with_return (type t) (f : _ -> t) =
|
||||
let module M =
|
||||
struct exception Return of t end
|
||||
in
|
||||
let return = { return = (fun x -> raise (M.Return x)); } in
|
||||
try f return with M.Return x -> x
|
||||
|
||||
|
||||
(* Function that uses the 'early return' functionality provided by `with_return` *)
|
||||
let sum_until_first_negative list =
|
||||
with_return (fun r ->
|
||||
List.fold list ~init:0 ~f:(fun acc x ->
|
||||
if x >= 0 then acc + x else r.return acc))
|
||||
32
demo/kitchen-sink/docs/perl.pl
Normal file
32
demo/kitchen-sink/docs/perl.pl
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
my $num_primes = 0;
|
||||
my @primes;
|
||||
|
||||
# Put 2 as the first prime so we won't have an empty array
|
||||
$primes[$num_primes] = 2;
|
||||
$num_primes++;
|
||||
|
||||
MAIN_LOOP:
|
||||
for my $number_to_check (3 .. 200)
|
||||
{
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
if ($number_to_check % $primes[$p] == 0)
|
||||
{
|
||||
next MAIN_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
# If we reached this point it means $number_to_check is not
|
||||
# divisable by any prime number that came before it.
|
||||
$primes[$num_primes] = $number_to_check;
|
||||
$num_primes++;
|
||||
}
|
||||
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
print $primes[$p], ", ";
|
||||
}
|
||||
print "\n";
|
||||
19
demo/kitchen-sink/docs/php.php
Normal file
19
demo/kitchen-sink/docs/php.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?>
|
||||
11
demo/kitchen-sink/docs/plaintext.txt
Normal file
11
demo/kitchen-sink/docs/plaintext.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
|
||||
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
|
||||
|
||||
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
|
||||
|
||||
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
|
||||
24
demo/kitchen-sink/docs/powershell.ps1
Normal file
24
demo/kitchen-sink/docs/powershell.ps1
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# This is a simple comment
|
||||
function Hello($name) {
|
||||
Write-host "Hello $name"
|
||||
}
|
||||
|
||||
function add($left, $right=4) {
|
||||
if ($right -ne 4) {
|
||||
return $left
|
||||
} elseif ($left -eq $null -and $right -eq 2) {
|
||||
return 3
|
||||
} else {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
|
||||
$number = 1 + 2;
|
||||
$number += 3
|
||||
|
||||
Write-Host Hello -name "World"
|
||||
|
||||
$an_array = @(1, 2, 3)
|
||||
$a_hash = @{"something" = "something else"}
|
||||
|
||||
& notepad .\readme.md
|
||||
19
demo/kitchen-sink/docs/python.py
Normal file
19
demo/kitchen-sink/docs/python.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print '''Usage:
|
||||
celsius temp1 temp2 ...'''
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
12
demo/kitchen-sink/docs/ruby.rb
Normal file
12
demo/kitchen-sink/docs/ruby.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
1
|
||||
else
|
||||
n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
12
demo/kitchen-sink/docs/scala.scala
Normal file
12
demo/kitchen-sink/docs/scala.scala
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//http://www.scala-lang.org/node/227
|
||||
/* Defines a new method 'sort' for array objects */
|
||||
object implicits extends Application {
|
||||
implicit def arrayWrapper[A : ClassManifest](x: Array[A]) =
|
||||
new {
|
||||
def sort(p: (A, A) => Boolean) = {
|
||||
util.Sorting.stableSort(x, p); x
|
||||
}
|
||||
}
|
||||
val x = Array(2, 3, 1, 4)
|
||||
println("x = "+ x.sort((x: Int, y: Int) => x < y))
|
||||
}
|
||||
20
demo/kitchen-sink/docs/scss.scss
Normal file
20
demo/kitchen-sink/docs/scss.scss
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* style.scss */
|
||||
|
||||
#navbar {
|
||||
$navbar-width: 800px;
|
||||
$items: 5;
|
||||
$navbar-color: #ce4dd6;
|
||||
|
||||
width: $navbar-width;
|
||||
border-bottom: 2px solid $navbar-color;
|
||||
|
||||
li {
|
||||
float: left;
|
||||
width: $navbar-width/$items - 10px;
|
||||
|
||||
background-color: lighten($navbar-color, 20%);
|
||||
&:hover {
|
||||
background-color: lighten($navbar-color, 10%);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
demo/kitchen-sink/docs/sql.sql
Normal file
6
demo/kitchen-sink/docs/sql.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
SELECT city, COUNT(id) AS users_count
|
||||
FROM users
|
||||
WHERE group_name = 'salesman'
|
||||
AND created > '2011-05-21'
|
||||
GROUP BY 1
|
||||
ORDER BY 2 DESC
|
||||
83
demo/kitchen-sink/docs/svg.svg
Normal file
83
demo/kitchen-sink/docs/svg.svg
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<svg
|
||||
width="800" height="600"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
onload="StartAnimation(evt)">
|
||||
|
||||
<title>Test Tube Progress Bar</title>
|
||||
<desc>Created for the Web Directions SVG competition</desc>
|
||||
|
||||
<script type="text/ecmascript"><![CDATA[
|
||||
var timevalue = 0;
|
||||
var timer_increment = 1;
|
||||
var max_time = 100;
|
||||
var hickory;
|
||||
var dickory;
|
||||
var dock;
|
||||
var i;
|
||||
|
||||
function StartAnimation(evt) {
|
||||
hickory = evt.target.ownerDocument.getElementById("hickory");
|
||||
dickory = evt.target.ownerDocument.getElementById("dickory");
|
||||
dock = evt.target.ownerDocument.getElementById("dock");
|
||||
|
||||
ShowAndGrowElement();
|
||||
}
|
||||
function ShowAndGrowElement() {
|
||||
timevalue = timevalue + timer_increment;
|
||||
if (timevalue > max_time)
|
||||
return;
|
||||
// Scale the text string gradually until it is 20 times larger
|
||||
scalefactor = (timevalue * 650) / max_time;
|
||||
|
||||
if (timevalue < 30) {
|
||||
hickory.setAttribute("display", "");
|
||||
hickory.setAttribute("transform", "translate(" + (600+scalefactor*3*-1 ) + ", -144 )");
|
||||
}
|
||||
|
||||
if (timevalue > 30 && timevalue < 66) {
|
||||
dickory.setAttribute("display", "");
|
||||
dickory.setAttribute("transform", "translate(" + (-795+scalefactor*2) + ", 0 )");
|
||||
}
|
||||
if (timevalue > 66) {
|
||||
dock.setAttribute("display", "");
|
||||
dock.setAttribute("transform", "translate(" + (1450+scalefactor*2*-1) + ", 144 )");
|
||||
}
|
||||
|
||||
// Call ShowAndGrowElement again <timer_increment> milliseconds later.
|
||||
setTimeout("ShowAndGrowElement()", timer_increment)
|
||||
}
|
||||
window.ShowAndGrowElement = ShowAndGrowElement
|
||||
]]</script>
|
||||
|
||||
<rect
|
||||
fill="#2e3436"
|
||||
fill-rule="nonzero"
|
||||
stroke-width="3"
|
||||
y="0"
|
||||
x="0"
|
||||
height="600"
|
||||
width="800"
|
||||
id="rect3590"/>
|
||||
|
||||
<text
|
||||
style="font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
||||
x="50"
|
||||
y="350"
|
||||
id="hickory"
|
||||
display="none">
|
||||
Hickory,</text>
|
||||
<text
|
||||
style="font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
||||
x="50"
|
||||
y="350"
|
||||
id="dickory"
|
||||
display="none">
|
||||
dickory,</text>
|
||||
<text
|
||||
style="font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
||||
x="50"
|
||||
y="350"
|
||||
id="dock"
|
||||
display="none">
|
||||
dock!</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
29
demo/kitchen-sink/docs/textile.textile
Normal file
29
demo/kitchen-sink/docs/textile.textile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
h1. Textile document
|
||||
|
||||
h2. Heading Two
|
||||
|
||||
h3. A two-line
|
||||
header
|
||||
|
||||
h2. Another two-line
|
||||
header
|
||||
|
||||
Paragraph:
|
||||
one, two,
|
||||
thee lines!
|
||||
|
||||
p(classone two three). This is a paragraph with classes
|
||||
|
||||
p(#id). (one with an id)
|
||||
|
||||
p(one two three#my_id). ..classes + id
|
||||
|
||||
* Unordered list
|
||||
** sublist
|
||||
* back again!
|
||||
** sublist again..
|
||||
|
||||
# ordered
|
||||
|
||||
bg. Blockquote!
|
||||
This is a two-list blockquote..!
|
||||
55
demo/kitchen-sink/docs/xml.xml
Normal file
55
demo/kitchen-sink/docs/xml.xml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
|
||||
yahoo:count="7" yahoo:created="2011-10-11T08:40:23Z" yahoo:lang="en-US">
|
||||
<diagnostics>
|
||||
<publiclyCallable>true</publiclyCallable>
|
||||
<url execution-start-time="0" execution-stop-time="25" execution-time="25"><![CDATA[http://where.yahooapis.com/v1/continents;start=0;count=10]]></url>
|
||||
<user-time>26</user-time>
|
||||
<service-time>25</service-time>
|
||||
<build-version>21978</build-version>
|
||||
</diagnostics>
|
||||
<results>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/24865670">
|
||||
<woeid>24865670</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>Africa</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/24865675">
|
||||
<woeid>24865675</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>Europe</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/24865673">
|
||||
<woeid>24865673</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>South America</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/28289421">
|
||||
<woeid>28289421</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>Antarctic</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/24865671">
|
||||
<woeid>24865671</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>Asia</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/24865672">
|
||||
<woeid>24865672</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>North America</name>
|
||||
</place>
|
||||
<place xmlns="http://where.yahooapis.com/v1/schema.rng"
|
||||
xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/55949070">
|
||||
<woeid>55949070</woeid>
|
||||
<placeTypeName code="29">Continent</placeTypeName>
|
||||
<name>Australia</name>
|
||||
</place>
|
||||
</results>
|
||||
</query>
|
||||
1
demo/kitchen-sink/icons/Readme.txt
Normal file
1
demo/kitchen-sink/icons/Readme.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
The icons in this folder are from the Eclipse project and licensed under the Eclipse public license version 1.0 (EPL).
|
||||
260
demo/kitchen-sink/icons/epl.html
Normal file
260
demo/kitchen-sink/icons/epl.html
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!-- saved from url=(0049)http://www.eclipse.org/org/documents/epl-v10.html -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Eclipse Public License - Version 1.0</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
size: 8.5in 11.0in;
|
||||
margin: 0.25in 0.5in 0.25in 0.5in;
|
||||
tab-interval: 0.5in;
|
||||
}
|
||||
p {
|
||||
margin-left: auto;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
p.list {
|
||||
margin-left: 0.5in;
|
||||
margin-top: 0.05em;
|
||||
margin-bottom: 0.05em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="chrome-extension://jgghnecdoiloelcogfmgjgcacadpaejf/inject.js"></script></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
|
||||
<h2>Eclipse Public License - v 1.0</h2>
|
||||
|
||||
<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
||||
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
|
||||
DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
|
||||
AGREEMENT.</p>
|
||||
|
||||
<p><b>1. DEFINITIONS</b></p>
|
||||
|
||||
<p>"Contribution" means:</p>
|
||||
|
||||
<p class="list">a) in the case of the initial Contributor, the initial
|
||||
code and documentation distributed under this Agreement, and</p>
|
||||
<p class="list">b) in the case of each subsequent Contributor:</p>
|
||||
<p class="list">i) changes to the Program, and</p>
|
||||
<p class="list">ii) additions to the Program;</p>
|
||||
<p class="list">where such changes and/or additions to the Program
|
||||
originate from and are distributed by that particular Contributor. A
|
||||
Contribution 'originates' from a Contributor if it was added to the
|
||||
Program by such Contributor itself or anyone acting on such
|
||||
Contributor's behalf. Contributions do not include additions to the
|
||||
Program which: (i) are separate modules of software distributed in
|
||||
conjunction with the Program under their own license agreement, and (ii)
|
||||
are not derivative works of the Program.</p>
|
||||
|
||||
<p>"Contributor" means any person or entity that distributes
|
||||
the Program.</p>
|
||||
|
||||
<p>"Licensed Patents" mean patent claims licensable by a
|
||||
Contributor which are necessarily infringed by the use or sale of its
|
||||
Contribution alone or when combined with the Program.</p>
|
||||
|
||||
<p>"Program" means the Contributions distributed in accordance
|
||||
with this Agreement.</p>
|
||||
|
||||
<p>"Recipient" means anyone who receives the Program under
|
||||
this Agreement, including all Contributors.</p>
|
||||
|
||||
<p><b>2. GRANT OF RIGHTS</b></p>
|
||||
|
||||
<p class="list">a) Subject to the terms of this Agreement, each
|
||||
Contributor hereby grants Recipient a non-exclusive, worldwide,
|
||||
royalty-free copyright license to reproduce, prepare derivative works
|
||||
of, publicly display, publicly perform, distribute and sublicense the
|
||||
Contribution of such Contributor, if any, and such derivative works, in
|
||||
source code and object code form.</p>
|
||||
|
||||
<p class="list">b) Subject to the terms of this Agreement, each
|
||||
Contributor hereby grants Recipient a non-exclusive, worldwide,
|
||||
royalty-free patent license under Licensed Patents to make, use, sell,
|
||||
offer to sell, import and otherwise transfer the Contribution of such
|
||||
Contributor, if any, in source code and object code form. This patent
|
||||
license shall apply to the combination of the Contribution and the
|
||||
Program if, at the time the Contribution is added by the Contributor,
|
||||
such addition of the Contribution causes such combination to be covered
|
||||
by the Licensed Patents. The patent license shall not apply to any other
|
||||
combinations which include the Contribution. No hardware per se is
|
||||
licensed hereunder.</p>
|
||||
|
||||
<p class="list">c) Recipient understands that although each Contributor
|
||||
grants the licenses to its Contributions set forth herein, no assurances
|
||||
are provided by any Contributor that the Program does not infringe the
|
||||
patent or other intellectual property rights of any other entity. Each
|
||||
Contributor disclaims any liability to Recipient for claims brought by
|
||||
any other entity based on infringement of intellectual property rights
|
||||
or otherwise. As a condition to exercising the rights and licenses
|
||||
granted hereunder, each Recipient hereby assumes sole responsibility to
|
||||
secure any other intellectual property rights needed, if any. For
|
||||
example, if a third party patent license is required to allow Recipient
|
||||
to distribute the Program, it is Recipient's responsibility to acquire
|
||||
that license before distributing the Program.</p>
|
||||
|
||||
<p class="list">d) Each Contributor represents that to its knowledge it
|
||||
has sufficient copyright rights in its Contribution, if any, to grant
|
||||
the copyright license set forth in this Agreement.</p>
|
||||
|
||||
<p><b>3. REQUIREMENTS</b></p>
|
||||
|
||||
<p>A Contributor may choose to distribute the Program in object code
|
||||
form under its own license agreement, provided that:</p>
|
||||
|
||||
<p class="list">a) it complies with the terms and conditions of this
|
||||
Agreement; and</p>
|
||||
|
||||
<p class="list">b) its license agreement:</p>
|
||||
|
||||
<p class="list">i) effectively disclaims on behalf of all Contributors
|
||||
all warranties and conditions, express and implied, including warranties
|
||||
or conditions of title and non-infringement, and implied warranties or
|
||||
conditions of merchantability and fitness for a particular purpose;</p>
|
||||
|
||||
<p class="list">ii) effectively excludes on behalf of all Contributors
|
||||
all liability for damages, including direct, indirect, special,
|
||||
incidental and consequential damages, such as lost profits;</p>
|
||||
|
||||
<p class="list">iii) states that any provisions which differ from this
|
||||
Agreement are offered by that Contributor alone and not by any other
|
||||
party; and</p>
|
||||
|
||||
<p class="list">iv) states that source code for the Program is available
|
||||
from such Contributor, and informs licensees how to obtain it in a
|
||||
reasonable manner on or through a medium customarily used for software
|
||||
exchange.</p>
|
||||
|
||||
<p>When the Program is made available in source code form:</p>
|
||||
|
||||
<p class="list">a) it must be made available under this Agreement; and</p>
|
||||
|
||||
<p class="list">b) a copy of this Agreement must be included with each
|
||||
copy of the Program.</p>
|
||||
|
||||
<p>Contributors may not remove or alter any copyright notices contained
|
||||
within the Program.</p>
|
||||
|
||||
<p>Each Contributor must identify itself as the originator of its
|
||||
Contribution, if any, in a manner that reasonably allows subsequent
|
||||
Recipients to identify the originator of the Contribution.</p>
|
||||
|
||||
<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
|
||||
|
||||
<p>Commercial distributors of software may accept certain
|
||||
responsibilities with respect to end users, business partners and the
|
||||
like. While this license is intended to facilitate the commercial use of
|
||||
the Program, the Contributor who includes the Program in a commercial
|
||||
product offering should do so in a manner which does not create
|
||||
potential liability for other Contributors. Therefore, if a Contributor
|
||||
includes the Program in a commercial product offering, such Contributor
|
||||
("Commercial Contributor") hereby agrees to defend and
|
||||
indemnify every other Contributor ("Indemnified Contributor")
|
||||
against any losses, damages and costs (collectively "Losses")
|
||||
arising from claims, lawsuits and other legal actions brought by a third
|
||||
party against the Indemnified Contributor to the extent caused by the
|
||||
acts or omissions of such Commercial Contributor in connection with its
|
||||
distribution of the Program in a commercial product offering. The
|
||||
obligations in this section do not apply to any claims or Losses
|
||||
relating to any actual or alleged intellectual property infringement. In
|
||||
order to qualify, an Indemnified Contributor must: a) promptly notify
|
||||
the Commercial Contributor in writing of such claim, and b) allow the
|
||||
Commercial Contributor to control, and cooperate with the Commercial
|
||||
Contributor in, the defense and any related settlement negotiations. The
|
||||
Indemnified Contributor may participate in any such claim at its own
|
||||
expense.</p>
|
||||
|
||||
<p>For example, a Contributor might include the Program in a commercial
|
||||
product offering, Product X. That Contributor is then a Commercial
|
||||
Contributor. If that Commercial Contributor then makes performance
|
||||
claims, or offers warranties related to Product X, those performance
|
||||
claims and warranties are such Commercial Contributor's responsibility
|
||||
alone. Under this section, the Commercial Contributor would have to
|
||||
defend claims against the other Contributors related to those
|
||||
performance claims and warranties, and if a court requires any other
|
||||
Contributor to pay any damages as a result, the Commercial Contributor
|
||||
must pay those damages.</p>
|
||||
|
||||
<p><b>5. NO WARRANTY</b></p>
|
||||
|
||||
<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
|
||||
PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
|
||||
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
|
||||
OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
|
||||
responsible for determining the appropriateness of using and
|
||||
distributing the Program and assumes all risks associated with its
|
||||
exercise of rights under this Agreement , including but not limited to
|
||||
the risks and costs of program errors, compliance with applicable laws,
|
||||
damage to or loss of data, programs or equipment, and unavailability or
|
||||
interruption of operations.</p>
|
||||
|
||||
<p><b>6. DISCLAIMER OF LIABILITY</b></p>
|
||||
|
||||
<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
|
||||
NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
|
||||
WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
|
||||
DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
|
||||
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
|
||||
|
||||
<p><b>7. GENERAL</b></p>
|
||||
|
||||
<p>If any provision of this Agreement is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this Agreement, and without further action
|
||||
by the parties hereto, such provision shall be reformed to the minimum
|
||||
extent necessary to make such provision valid and enforceable.</p>
|
||||
|
||||
<p>If Recipient institutes patent litigation against any entity
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that the
|
||||
Program itself (excluding combinations of the Program with other
|
||||
software or hardware) infringes such Recipient's patent(s), then such
|
||||
Recipient's rights granted under Section 2(b) shall terminate as of the
|
||||
date such litigation is filed.</p>
|
||||
|
||||
<p>All Recipient's rights under this Agreement shall terminate if it
|
||||
fails to comply with any of the material terms or conditions of this
|
||||
Agreement and does not cure such failure in a reasonable period of time
|
||||
after becoming aware of such noncompliance. If all Recipient's rights
|
||||
under this Agreement terminate, Recipient agrees to cease use and
|
||||
distribution of the Program as soon as reasonably practicable. However,
|
||||
Recipient's obligations under this Agreement and any licenses granted by
|
||||
Recipient relating to the Program shall continue and survive.</p>
|
||||
|
||||
<p>Everyone is permitted to copy and distribute copies of this
|
||||
Agreement, but in order to avoid inconsistency the Agreement is
|
||||
copyrighted and may only be modified in the following manner. The
|
||||
Agreement Steward reserves the right to publish new versions (including
|
||||
revisions) of this Agreement from time to time. No one other than the
|
||||
Agreement Steward has the right to modify this Agreement. The Eclipse
|
||||
Foundation is the initial Agreement Steward. The Eclipse Foundation may
|
||||
assign the responsibility to serve as the Agreement Steward to a
|
||||
suitable separate entity. Each new version of the Agreement will be
|
||||
given a distinguishing version number. The Program (including
|
||||
Contributions) may always be distributed subject to the version of the
|
||||
Agreement under which it was received. In addition, after a new version
|
||||
of the Agreement is published, Contributor may elect to distribute the
|
||||
Program (including its Contributions) under the new version. Except as
|
||||
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
|
||||
rights or licenses to the intellectual property of any Contributor under
|
||||
this Agreement, whether expressly, by implication, estoppel or
|
||||
otherwise. All rights in the Program not expressly granted under this
|
||||
Agreement are reserved.</p>
|
||||
|
||||
<p>This Agreement is governed by the laws of the State of New York and
|
||||
the intellectual property laws of the United States of America. No party
|
||||
to this Agreement will bring a legal action under this Agreement more
|
||||
than one year after the cause of action arose. Each party waives its
|
||||
rights to a jury trial in any resulting litigation.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
BIN
demo/kitchen-sink/icons/error_obj.gif
Normal file
BIN
demo/kitchen-sink/icons/error_obj.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 339 B |
BIN
demo/kitchen-sink/icons/warning_obj.gif
Normal file
BIN
demo/kitchen-sink/icons/warning_obj.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
BIN
demo/kitchen-sink/logo.png
Normal file
BIN
demo/kitchen-sink/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
1998
demo/kitchen-sink/require.js
Normal file
1998
demo/kitchen-sink/require.js
Normal file
File diff suppressed because it is too large
Load diff
43
demo/kitchen-sink/styles.css
Normal file
43
demo/kitchen-sink/styles.css
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#logo {
|
||||
padding: 15px;
|
||||
margin-left: 70px;
|
||||
}
|
||||
|
||||
#editor {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 300px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#controls td {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#controls td + td {
|
||||
text-align: left;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue