This commit is contained in:
Fabian Jakobs 2011-08-16 13:49:47 +02:00
commit b02541a98b
15 changed files with 6210 additions and 10746 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -40,25 +40,4 @@ body {
#controls td + td {
text-align: left;
}
#cockpitInput {
position: absolute;
left: 280px;
right: 0px;
bottom: 0;
border: none; outline: none;
font-family: consolas, courier, monospace;
font-size: 120%;
}
#cockpitOutput {
padding: 10px;
margin: 0 15px;
border: 1px solid #AAA;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 4px; border-top-right-radius: 4px;
background: #DDD; color: #000;
}

View file

@ -213,477 +213,6 @@
<div id="editor">
</div>
<script type="text/editor" id="csharptext">public void HelloWorld() {
//Say Hello!
Console.WriteLine("Hello World");
}</script>
<script type="text/editor" id="jstext">function foo(items) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu");
} // Real Tab.
}</script>
<script type="text/editor" id="csstext">.text-layer {
font-family: Monaco, "Courier New", monospace;
font-size: 12px;
cursor: text;
}</script>
<script type="text/editor" id="scsstext">/* 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%);
}
}
}</script>
<script type="text/editor" id="htmltext"><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></script>
<script type="text/editor" id="javatext">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);
}
}</script>
<script type="text/editor" id="pythontext">#!/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))</script>
<script type="text/editor" id="phptext"><?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;
?></script>
<script type="text/editor" id="plaintext">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
</script>
<script type="text/editor" id="rubytext">#!/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)
</script>
<script type="text/editor" id="cpptext">// 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;
}
</script>
<script type="text/editor" id="coffeetext">#!/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</script>
<script type="text/editor" id="jsontext">{
"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"
}
]
}
}
}</script>
<script type="text/editor" id="perltext">#!/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";
</script>
<script type="text/editor" id="ocamltext">(*
* 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))
</script>
<script type="text/editor" id="clojuretext">(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</script>
<script type="text/editor" id="svgtext"><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
]]>&lt;/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></script>
<script type="text/editor" id="textiletext">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..!
</script>
<script type="text/editor" id="groovy">
//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
</script>
<script type="text/editor" id="scala">//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))
}</script>
<input id="cockpitInput" type="text"/>
<!--
<script type="text/javascript">
@ -700,7 +229,7 @@ object implicits extends Application {
-->
<script src="demo/kitchen-sink.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
<script src="demo/kitchen-sink-uncompressed.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
require("demo/boot");
</script>

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -140,7 +140,9 @@ window.__ace_shadowed__ = {
MIT License. http://github.com/280north/narwhal/blob/master/README.md
*/
__ace_shadowed__.define('pilot/fixoldbrowsers', ['require', 'exports', 'module' ], function(require, exports, module) {
__ace_shadowed__.define('pilot/fixoldbrowsers', ['require', 'exports', 'module' , 'pilot/regexp'], function(require, exports, module) {
require("pilot/regexp");
/**
* Brings an environment as close to ECMAScript 5 compliance
@ -965,6 +967,112 @@ if (!String.prototype.trim) {
};
}
});__ace_shadowed__.define('pilot/regexp', ['require', 'exports', 'module' ], function(require, exports, module) {
// Based on code from:
//
// XRegExp 1.5.0
// (c) 2007-2010 Steven Levithan
// MIT License
// <http://xregexp.com>
// Provides an augmented, extensible, cross-browser implementation of regular expressions,
// including support for additional syntax, flags, and methods
//---------------------------------
// Private variables
//---------------------------------
var real = {
exec: RegExp.prototype.exec,
test: RegExp.prototype.test,
match: String.prototype.match,
replace: String.prototype.replace,
split: String.prototype.split
},
compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
compliantLastIndexIncrement = function () {
var x = /^/g;
real.test.call(x, "");
return !x.lastIndex;
}();
//---------------------------------
// Overriden native methods
//---------------------------------
// Adds named capture support (with backreferences returned as `result.name`), and fixes two
// cross-browser issues per ES3:
// - Captured values for nonparticipating capturing groups should be returned as `undefined`,
// rather than the empty string.
// - `lastIndex` should not be incremented after zero-length matches.
RegExp.prototype.exec = function (str) {
var match = real.exec.apply(this, arguments),
name, r2;
if (match) {
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
// Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
// matching due to characters outside the match
real.replace.call(str.slice(match.index), r2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined)
match[i] = undefined;
}
});
}
// Attach named capture properties
if (this._xregexp && this._xregexp.captureNames) {
for (var i = 1; i < match.length; i++) {
name = this._xregexp.captureNames[i - 1];
if (name)
match[name] = match[i];
}
}
// Fix browsers that increment `lastIndex` after zero-length matches
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
}
return match;
};
// Don't override `test` if it won't change anything
if (!compliantLastIndexIncrement) {
// Fix browser bug in native method
RegExp.prototype.test = function (str) {
// Use the native `exec` to skip some processing overhead, even though the overriden
// `exec` would take care of the `lastIndex` fix
var match = real.exec.call(this, str);
// Fix browsers that increment `lastIndex` after zero-length matches
if (match && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
return !!match;
};
}
//---------------------------------
// Private helper functions
//---------------------------------
function getNativeFlags (regex) {
return (regex.global ? "g" : "") +
(regex.ignoreCase ? "i" : "") +
(regex.multiline ? "m" : "") +
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
(regex.sticky ? "y" : "");
};
function indexOf (array, item, from) {
if (Array.prototype.indexOf) // Use the native array method if available
return array.indexOf(item, from);
for (var i = from || 0; i < array.length; i++) {
if (array[i] === item)
return i;
}
return -1;
};
});/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -2940,6 +3048,8 @@ exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
/**
* I hate doing this, but we need some way to determine if the user is on a Mac
* The reason is that users have different expectations of their key combinations.
@ -5253,9 +5363,14 @@ if (document.documentElement.setCapture) {
return exports.stopPropagation(e);
}
var called = false;
function onReleaseCapture(e) {
eventHandler && eventHandler(e);
releaseCaptureHandler && releaseCaptureHandler();
eventHandler(e);
if (!called) {
called = true;
releaseCaptureHandler();
}
exports.removeListener(el, "mousemove", eventHandler);
exports.removeListener(el, "mouseup", onReleaseCapture);
@ -5293,14 +5408,26 @@ else {
}
exports.addMouseWheelListener = function(el, callback) {
var max = 0;
var listener = function(e) {
if (e.wheelDelta !== undefined) {
// some versions of Safari (e.g. 5.0.5) report insanely high
// scroll values. These browsers require a higher factor
if (e.wheelDeltaY > max)
max = e.wheelDeltaY
if (max > 1000)
factor = 400;
else
factor = 8;
if (e.wheelDeltaX !== undefined) {
e.wheelX = -e.wheelDeltaX / 8;
e.wheelY = -e.wheelDeltaY / 8;
e.wheelX = -e.wheelDeltaX / factor;
e.wheelY = -e.wheelDeltaY / factor;
} else {
e.wheelX = 0;
e.wheelY = -e.wheelDelta / 8;
e.wheelY = -e.wheelDelta / factor;
}
}
else {
@ -5696,13 +5823,10 @@ var Editor =function(renderer, session) {
// Safari needs the timeout
// iOS and Firefox need it called immediately
// to be on the save side we do both
// except for IE
var _self = this;
if (!useragent.isIE) {
setTimeout(function() {
_self.textInput.focus();
});
}
setTimeout(function() {
_self.textInput.focus();
});
this.textInput.focus();
};
@ -6722,6 +6846,12 @@ var TextInput = function(parentNode, host) {
var pasted = false;
var tempStyle = '';
function select() {
try {
text.select();
} catch (e) {}
};
function sendText(valueToSend) {
if (!copied) {
var value = valueToSend || text.value;
@ -6747,7 +6877,7 @@ var TextInput = function(parentNode, host) {
// Safari doesn't fire copy events if no text is selected
text.value = PLACEHOLDER;
text.select();
select();
}
var onTextInput = function(e) {
@ -6757,7 +6887,7 @@ var TextInput = function(parentNode, host) {
}, 0);
};
var onKeyPress = function(e) {
var onPropertyChange = function(e) {
if (useragent.isIE && text.value.charCodeAt(0) > 128) return;
setTimeout(function() {
if (!inCompostion)
@ -6788,12 +6918,12 @@ var TextInput = function(parentNode, host) {
text.value = copyText;
else
e.preventDefault();
text.select();
select();
setTimeout(function () {
sendText();
}, 0);
};
var onCut = function(e) {
copied = true;
var copyText = host.getCopyText();
@ -6802,7 +6932,7 @@ var TextInput = function(parentNode, host) {
host.onCut();
} else
e.preventDefault();
text.select();
select();
setTimeout(function () {
sendText();
}, 0);
@ -6820,22 +6950,11 @@ var TextInput = function(parentNode, host) {
inCompostion ? onCompositionUpdate() : onCompositionStart();
});
};
if (text.attachEvent) {
// Old IE + Opera
event.addListener(text, "propertychange", onKeyPress);
}
else {
if (useragent.isChrome || useragent.isSafari)
event.addListener(text, "textInput", onTextInput);
else if (useragent.isIE)
// IE9
event.addListener(text, "textinput", onTextInput);
else
// All browsers except old IE
event.addListener(text, "input", onTextInput);
}
if ("onpropertychange" in text && !("oninput" in text))
event.addListener(text, "propertychange", onPropertyChange);
else
event.addListener(text, "input", onTextInput);
event.addListener(text, "paste", function(e) {
// Mark that the next input text comes from past.
@ -6849,7 +6968,7 @@ var TextInput = function(parentNode, host) {
else {
// If a browser doesn't support any of the things above, use the regular
// method to detect the pasted input.
onKeyPress();
onPropertyChange();
}
});
@ -6892,12 +7011,12 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "focus", function() {
host.onFocus();
text.select();
select();
});
this.focus = function() {
host.onFocus();
text.select();
select();
text.focus();
};
@ -7035,24 +7154,33 @@ var MouseHandler = function(editor) {
};
this.onMouseDown = function(e) {
// if this click caused the editor to be focused ignore the click
// for selection and cursor placement
if (
!this.browserFocus.isFocused()
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|| !this.editor.isFocused()
)
return;
var pageX = event.getDocumentX(e);
var pageY = event.getDocumentY(e);
var pos = this.$getEventPosition(e);
var editor = this.editor;
var self = this;
var selectionRange = editor.getSelectionRange();
var selectionEmpty = selectionRange.isEmpty();
var inSelection = !editor.getReadOnly()
&& !selectionEmpty
&& selectionRange.contains(pos.row, pos.column);
var state = STATE_UNKNOWN;
var inSelection = false;
// if this click caused the editor to be focused should not clear the
// selection
if (
inSelection && (
!this.browserFocus.isFocused()
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|| !this.editor.isFocused()
)
) {
this.editor.focus();
return;
}
var button = event.getButton(e);
if (button !== 0) {
@ -7071,10 +7199,6 @@ var MouseHandler = function(editor) {
editor.selection.setSelectionRange(fold.range);
return;
}
inSelection = !editor.getReadOnly()
&& !selectionEmpty
&& selectionRange.contains(pos.row, pos.column);
}
if (!inSelection) {
@ -7202,8 +7326,7 @@ var MouseHandler = function(editor) {
var onDragSelectionInterval = function() {
dragCursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
dragCursor.row = Math.max(0, Math.min(dragCursor.row,
editor.session.getLength() - 1));
dragCursor.row = Math.max(0, Math.min(dragCursor.row, editor.session.getLength() - 1));
editor.moveCursorToPosition(dragCursor);
};
@ -7311,13 +7434,26 @@ var BrowserFocus = function(win) {
this._isFocused = true;
var _self = this;
event.addListener(win, "blur", function(e) {
_self._setFocused(false);
});
event.addListener(win, "focus", function(e) {
_self._setFocused(true);
});
// IE < 9 supports focusin and focusout events
if ("onfocusin" in win.document) {
event.addListener(win.document, "focusin", function(e) {
_self._setFocused(true);
});
event.addListener(win.document, "focusout", function(e) {
_self._setFocused(!!e.toElement);
});
}
else {
event.addListener(win, "blur", function(e) {
_self._setFocused(false);
});
event.addListener(win, "focus", function(e) {
_self._setFocused(true);
});
}
};
(function(){
@ -15417,87 +15553,13 @@ exports.create = create;
});
__ace_shadowed__.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; }" +
__ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);" +
"" +
"" +
".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%; }" +
"");
__ace_shadowed__.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; }" +
"");
__ace_shadowed__.define("text!ace/css/editor.css", [], ".ace_editor {" +
".ace_editor {" +
" position: absolute;" +
" overflow: hidden;" +
" font-family: Monaco, \"Menlo\", \"Courier New\", monospace;" +
" font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;" +
" font-size: 12px;" +
"}" +
"" +
@ -15704,27 +15766,6 @@ __ace_shadowed__.define("text!build/demo/styles.css", [], "html {" +
"" +
"#controls td + td {" +
" text-align: left;" +
"}" +
"" +
"#cockpitInput {" +
" position: absolute;" +
" left: 280px;" +
" right: 0px;" +
" bottom: 0;" +
"" +
" border: none; outline: none;" +
" font-family: consolas, courier, monospace;" +
" font-size: 120%;" +
"}" +
"" +
"#cockpitOutput {" +
" padding: 10px;" +
" margin: 0 15px;" +
" border: 1px solid #AAA;" +
" -moz-border-radius-topleft: 10px;" +
" -moz-border-radius-topright: 10px;" +
" border-top-left-radius: 4px; border-top-right-radius: 4px;" +
" background: #DDD; color: #000;" +
"}");
__ace_shadowed__.define("text!build/textarea/style.css", [], "body {" +
@ -16191,6 +16232,12 @@ __ace_shadowed__.define("text!build_support/style.css", [], "body {" +
"" +
"");
__ace_shadowed__.define("text!demo/docs/css.css", [], ".text-layer {" +
" font-family: Monaco, \"Courier New\", monospace;" +
" font-size: 12px;" +
" cursor: text;" +
"}");
__ace_shadowed__.define("text!demo/styles.css", [], "html {" +
" height: 100%;" +
" width: 100%;" +
@ -16233,27 +16280,6 @@ __ace_shadowed__.define("text!demo/styles.css", [], "html {" +
"" +
"#controls td + td {" +
" text-align: left;" +
"}" +
"" +
"#cockpitInput {" +
" position: absolute;" +
" left: 280px;" +
" right: 0px;" +
" bottom: 0;" +
"" +
" border: none; outline: none;" +
" font-family: consolas, courier, monospace;" +
" font-size: 120%;" +
"}" +
"" +
"#cockpitOutput {" +
" padding: 10px;" +
" margin: 0 15px;" +
" border: 1px solid #AAA;" +
" -moz-border-radius-topleft: 10px;" +
" -moz-border-radius-topright: 10px;" +
" border-top-left-radius: 4px; border-top-right-radius: 4px;" +
" background: #DDD; color: #000;" +
"}");
__ace_shadowed__.define("text!deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";" +
@ -17257,10 +17283,13 @@ __ace_shadowed__.define("text!doc/site/style.css", [], "body {" +
"" +
"");
__ace_shadowed__.define("text!lib/ace/css/editor.css", [], ".ace_editor {" +
__ace_shadowed__.define("text!lib/ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);" +
"" +
"" +
".ace_editor {" +
" position: absolute;" +
" overflow: hidden;" +
" font-family: Monaco, \"Menlo\", \"Courier New\", monospace;" +
" font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;" +
" font-size: 12px;" +
"}" +
"" +

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long