Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e83070c

Browse filesBrowse files
committed
moving the sample shell inside the page
1 parent 9088029 commit e83070c
Copy full SHA for e83070c

File tree

Expand file treeCollapse file tree

2 files changed

+21
-63
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-63
lines changed

‎index.html

Copy file name to clipboardExpand all lines: index.html
+16-30Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,19 @@
2828
<script src="javascripts/example.js"></script>
2929
<style type="text/css">
3030
#shell-panel {
31-
display: none;
32-
height: 400px;
33-
width: 97.0%;
34-
opacity: 0.9;
31+
height: 200px;
32+
width: 100%;
3533
background-color: #002f05;
3634
color: #00fe00;
37-
position: fixed;
3835
padding: 20px 20px 20px 20px;
39-
top: 0;
40-
left: 0;
41-
z-index: 1000;
42-
font-family: 'Source Code Pro', sans-serif;
43-
font-size: 0.9em;
36+
font-family: 'Source Code Pro';
4437
overflow: scroll;
4538
overflow-x: hidden;
4639
overflow-y: scroll;
40+
border: 1px dashed #E6EBE0;
4741
}</style>
4842
</head>
4943
<body>
50-
<div id="shell-panel">
51-
<div>Type <code>help</code> or hit <code>TAB</code> for a list of commands. Hit
52-
<code>Ctrl-C</code> to hide the shell
53-
</div>
54-
<div id="shell-view"></div>
55-
</div>
5644
<div id="header">
5745
<nav>
5846
<li class="fork"><a href="https://github.com/sdether/josh.js">View On GitHub</a></li>
@@ -89,7 +77,7 @@ <h1>josh.js 0.2</h1>
8977
<code>shell.js</code> - visual presentation of the shell and command handling
9078
</li>
9179
<li>
92-
<code>pathhandler.js</code> - provide cd, ls, pwd and path completion toolikit
80+
<code>pathhandler.js</code> - provide cd, ls, pwd and path completion toolkit
9381
</li>
9482
<li>
9583
<code>history.js</code> - localStorage backed command history
@@ -100,8 +88,14 @@ <h1>josh.js 0.2</h1>
10088
</ul>
10189

10290
<h2>Live Demo</h2>
91+
Drag bottom of shell to change size.
92+
<div id="shell-panel">
93+
<div>Type <code>help</code> or hit <code>TAB</code> for a list of commands.
94+
</div>
95+
<div id="shell-view"></div>
96+
</div>
10397

104-
<p id="demo"><em>Hit the <span style="color: #ffcc00; font-weight: bold; font-size: 1.2em">~</span> key to show a demo console ( <a href="docs/example.html">Annotated source of demo</a>)</em></p>
98+
<p><em><a href="docs/example.html">Annotated source of demo</a></em></p>
10599

106100
<h2>Tutorials</h2>
107101
<ul>
@@ -125,15 +119,7 @@ <h2>
125119
<li>needs minified versions of complete toolkit and just readline.js</li>
126120
<li>needs code documentation and documentation site</li>
127121
<li>would like to add AMD support</li>
128-
<li>base shell UI should get some basic behaviors
129-
130-
<ul>
131-
<li>
132-
<code>more</code>-like handling for output that exceeds the shell viewport size
133-
</li>
134-
<li>resizing and close chrome</li>
135-
</ul>
136-
</li>
122+
<li>implement <em>NCurses</em> for better UI control</li>
137123
<li>Readline has not been tested with non-ascii.</li>
138124
</ul>
139125
<h2>
@@ -268,9 +254,9 @@ <h3>
268254
<code>shell.js</code> provides the following commands:</p>
269255

270256
<ul>
271-
<li>help - list all known commands (including user added)</li>
272-
<li>clear - clear the "screen" i.e. viewport</li>
273-
<li>history - show the command history captured by <code>readline.js</code> in <code>history.js</code>
257+
<li><code>help</code> - list all known commands (including user added)</li>
258+
<li><code>clear</code> - clear the "screen" i.e. viewport</li>
259+
<li><code>history</code> - show the command history captured by <code>readline.js</code> in <code>history.js</code>
274260
</li>
275261
</ul>
276262
<h3>

‎javascripts/example.js

Copy file name to clipboardExpand all lines: javascripts/example.js
+5-33Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -150,44 +150,16 @@
150150
$(document).ready(function() {
151151

152152
// The default name for the div the shell uses as its container is `shell-panel`, although that can be changed via
153-
// the shell config parameter `shell-view-id`. The `Shell` display model relies on a div to contain a 'view'. The
154-
// acts as the view-port, i.e. the visible portion of the shell content, while the view is appended to and
155-
// scrolled up as new content is added.
153+
// the shell config parameter `shell-panel-id`. The `Shell` display model relies on a 'panel' to contain a 'view'.
154+
// The 'panel' acts as the view-port, i.e. the visible portion of the shell content, while the 'view' is appended
155+
// to and scrolled up as new content is added.
156156
var $consolePanel = $('#shell-panel');
157157

158158
// We use **jquery-ui**'s `resizable` to let us drag the bottom edge of the console up and down.
159159
$consolePanel.resizable({ handles: "s"});
160160

161-
// Wire up a the keypress handler. This will be used only for shell activation.
162-
$(document).keypress(function(event) {
163-
164-
// If the shell is already active drop out of the keyhandler, since all keyhandling happens in `Readline`.
165-
if(shell.isActive()) {
166-
return;
167-
}
168-
169-
// Mimicking *Quake*-style dropdown consoles, we activate and show on `~`.
170-
_console.log("activating shell");
171-
if(event.keyCode == 126) {
172-
event.preventDefault();
173-
shell.activate();
174-
$consolePanel.slideDown();
175-
$consolePanel.focus();
176-
}
177-
});
178-
179-
// Whenever we get either a `EOT` (`Ctrl-D` on empty line) or a `Cancel` (`Ctrl-C`) signal from the shell,
180-
// we deactivate the shell and hide the console.
181-
function hideAndDeactivate() {
182-
_console.log("deactivating shell");
183-
shell.deactivate();
184-
$consolePanel.slideUp();
185-
$consolePanel.blur();
186-
}
187-
188-
// Attach our hide function to the EOT and Cancel events.
189-
shell.onEOT(hideAndDeactivate);
190-
shell.onCancel(hideAndDeactivate);
161+
// activate the shell
162+
shell.activate();
191163
});
192164

193165
// We attach the various objects we've created here to `Josh.Instance` purely so they can be inspected via a

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.