Permalink
Browse files

update

  • Loading branch information...
paulrouget committed Jul 18, 2012
1 parent b24af9f commit ce6b1a12ed57c9b660bf6b9fa9511e9ef34c9800
Showing with 46 additions and 25 deletions.
  1. +8 −1 bootstrap.js
  2. +1 −1 chrome/jsterm.css
  3. +31 −17 chrome/jsterm.js
  4. +0 −1 chrome/jsterm.xul
  5. +6 −5 chrome/orion.css
  6. BIN jsterm.xpi
View
@@ -118,7 +118,7 @@ let JSTermManager = {
},
}
-function JSTerm(aBrowser) {
+function JSTerm(aBrowser, aManager) {
this.browser = aBrowser;
this.chromeDoc = aBrowser.ownerDocument;
this.chromeWin = this.chromeDoc.defaultView;
@@ -144,6 +144,13 @@ JSTerm.prototype = {
container.appendChild(iframe);
nbox.appendChild(splitter);
nbox.appendChild(container);
+
+ iframe.contentWindow.onload = function() {
+ iframe.contentWindow.JSTermUI.init(JSTermManager,
+ this.browser,
+ this.browser.contentWindow,
+ this.chromeWin);
+ }.bind(this);
},
destroy: function() {
let nbox = this.chromeWin.gBrowser.getNotificationBox(this.browser);
View
@@ -2,7 +2,7 @@ window {
background: #131c26;
color: white;
font-family: Monaco, monospace;
- font-weight: lighter;
+ font-size: 12px;
}
#object-inspector > tree {
View
@@ -8,12 +8,8 @@ Cu.import("resource:///modules/WebConsoleUtils.jsm");
* . ctrl-c should copy the output selection if any
* . delete listeners & map
* . checkbox status
- * . Complete on keywords (function)
* . highlight common DOM keywords
* . save history and share it
- * . better enter/shift-enter thing
- * . prevent-default for ctrl-l
- * . implement close / ctrl-D
* . make tree width persistent
*/
@@ -24,16 +20,22 @@ let JSTermUI = {
output: new SourceEditor(),
objects: new Map(),
+ close: function() {
+ this.manager.closeForBrowser(this.browser);
+ },
+
registerCommands: function() {
this.commands = [
- {name: ":chrome", help: "switch to Chrome mode",
- exec: this.switchToChromeMode.bind(this)},
- {name: ":content", help: "switch to Content mode",
- exec: this.switchToContentMode.bind(this)},
+ {name: ":close", help: "close terminal",
+ exec: this.close.bind(this)},
{name: ":clear", help: "clear screen",
exec: this.clear.bind(this)},
{name: ":help", help: "show this help",
exec: this.help.bind(this)},
+ {name: ":content", help: "switch to Content mode",
+ exec: this.switchToContentMode.bind(this)},
+ {name: ":chrome", help: "switch to Chrome mode",
+ exec: this.switchToChromeMode.bind(this)},
];
},
@@ -52,9 +54,11 @@ let JSTermUI = {
this.input.focus();
},
- init: function() {
- this.content = window.parent.gBrowser.contentWindow;
- this.chrome = window.parent;
+ init: function(aManager, aBrowser, aContent, aChrome) {
+ this.manager = aManager;
+ this.browser = aBrowser;
+ this.content = aContent;
+ this.chrome = aChrome;
this.registerCommands();
@@ -74,10 +78,6 @@ let JSTermUI = {
this.input.init(this.inputContainer, {
mode: SourceEditor.MODES.JAVASCRIPT,
- keys: [{action: "Clear output",
- code: Ci.nsIDOMKeyEvent.DOM_VK_L,
- callback: this.clear.bind(this),
- ctrl: true}],
theme: "chrome://jsterm/content/orion.css",
}, this.initInput.bind(this));
@@ -274,7 +274,7 @@ let JSTermUI = {
}
if (isAnObject) {
- resultStr += " (click to inspect)";
+ resultStr += " [+]";
}
if (code == resultStr) {
@@ -318,10 +318,13 @@ let JSTermUI = {
let text = "\n/**";
text += "\n * 'Return' to evaluate entry,";
text += "\n * 'Tab' for autocompletion,";
+ text += "\n * 'Ctrl-l' clear screen,";
+ text += "\n * 'Ctrl-d' close term,";
text += "\n * 'up/down' to browser history,";
text += "\n * 'Shift+Return' to switch to multiline editing,";
text += "\n * 'Shift+Return' to evaluate multiline entry,";
- text += "\n * use 'print(aString)' to dump text in the terminal,";
+ text += "\n * ";
+ text += "\n * Use 'print(aString)' to dump text in the terminal,";
text += "\n * ";
text += "\n * Commands:";
for (let cmd of this.commands) {
@@ -354,6 +357,17 @@ let JSTermUI = {
}
}
+ if (e.keyCode == 68 && e.ctrlKey) {
+ e.stopPropagation();
+ e.preventDefault();
+ this.close();
+ }
+ if (e.keyCode == 76 && e.ctrlKey) {
+ e.stopPropagation();
+ e.preventDefault();
+ this.clear();
+ }
+
if (e.keyCode == 38) {
if (!this.history.browsing && this.multiline) {
return;
View
@@ -9,7 +9,6 @@
macanimationtype="document"
screenX="4" screenY="4"
width="640" height="480"
- onload="JSTermUI.init()"
persist="screenX screenY width height sizemode">
<script type="application/javascript" src="jsterm.js"/>
View
@@ -10,6 +10,7 @@
.viewContainer {
font-family: Monaco, monospace;
font-weight: lighter;
+ font-size: 12px;
}
.view {
@@ -25,6 +26,7 @@
width: 15px;
padding-left: 4px;
}
+
.ruler.lines {
border-right: 1px solid #303b47;
min-width: 1.4em;
@@ -45,14 +47,13 @@
}
.annotationLine.object {
- /*
- text-decoration: underline;
- -moz-text-decoration-color: grey;
- -moz-text-decoration-style: dotted;
- */
cursor: pointer;
}
+.annotationLine.object:hover > * {
+ color: white!important;
+}
+
.token_doc_comment,
.token_singleline_comment,
.token_multiline_comment {
View
Binary file not shown.

0 comments on commit ce6b1a1

Please sign in to comment.