mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
setted up jquery-terminal plagin
This commit is contained in:
parent
680dcd1584
commit
aa7befc238
8 changed files with 2841 additions and 0 deletions
82
lib/client/terminal/jquery-terminal/CHANGELOG
Normal file
82
lib/client/terminal/jquery-terminal/CHANGELOG
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
0.4.17 fix IE formatting issue by adding cross-browser split
|
||||
0.4.16 add reverse history search on CTRL+R
|
||||
|
||||
fix cancel ajax call on CTRL+D
|
||||
0.4.15 only one command from multiply commands is added to history
|
||||
CTRL+D is handled even if exit is false
|
||||
0.4.14 terminal don't add space after prompt (prompt need to add this space)
|
||||
fix historyFilter
|
||||
remove livequery
|
||||
0.4.12 history return history object
|
||||
add historyFilter
|
||||
new event onCommandChange that execute scroll_to_bottom
|
||||
add event onBeforeLogin
|
||||
0.4.11 fix blank lines when echo longer strings
|
||||
0.4.10 fix long line formatting and linebreak in the middle of formatting
|
||||
0.4.9 fix wrap first line when prompt contain formatting
|
||||
0.4.8 fix alt+d and ctrl+u
|
||||
0.4.7 fix inserting special characters in Webkit on Windows
|
||||
0.4.6 remove undocumented pipe operator
|
||||
refreash prompt on resume
|
||||
0.4.5 fix line wrapping when text contains tabulations
|
||||
0.4.4 fix line wrapping with scrollbars
|
||||
0.4.3 fix JSON-RPC when use without login
|
||||
0.4.2 fix formatting when text contain empty lines
|
||||
0.4.1 fix formatting when text contains newline characters
|
||||
0.4 fix text formating when text splited into more then one line
|
||||
you can pass nested objects as first argument
|
||||
add tab completion with object passed as first argument
|
||||
0.3.8 fix cursor manipulation when command contain new line characters
|
||||
0.3.7 fix function terminal.login_name
|
||||
0.3.6 fix switch between terminals - when terminal is not visible scroll to current terminal
|
||||
0.3.5 fix scrolling in jQuery 1.6
|
||||
0.3.3 fixing PAGE UP/DOWN
|
||||
0.3.2 fixing cursor in long lines
|
||||
0.3.1 fixing small bugs, speed up resizing
|
||||
0.3 fix resizing on start and issue with greetings
|
||||
add formating strings to set style of text.
|
||||
add to echo a function which will be called when terminal
|
||||
is resized
|
||||
0.3-RC2 fix manipulation of long line commands
|
||||
0.3-RC1 add callbacks and new functions
|
||||
you can now overwrite keyboard shortcuts
|
||||
resizing recalculates lines lenght and redraw content
|
||||
if you create plugin for elements that are not in the DOM
|
||||
and then append it to DOM it's display corectly
|
||||
put all dependencies in one file
|
||||
Default greetings show terminal signature depending on
|
||||
width of terminal
|
||||
use Local Sorage for command line history if posible
|
||||
remove access to command line (cmd plugin) and add interface
|
||||
to allow interact with it
|
||||
|
||||
0.2.3.9 fix append enter character (0x0D) to the command (thanks to marat
|
||||
for reporting the bug)
|
||||
|
||||
0.2.3.8 update mousewheel plugin which fix scrolling in Opera (Thanks for
|
||||
Alexey Dubovtsev for reporting the bug)
|
||||
|
||||
0.2.3.7 fix cursor in IE in tilda example
|
||||
|
||||
0.2.3.6 fix json serialization in IE
|
||||
|
||||
0.2.3.5 fix demos and clipboard textarea transparency in IE
|
||||
|
||||
0.2.3.4 fix long lines in command line issue
|
||||
|
||||
0.2.3.3 fix Terminal in Internet Exporer
|
||||
|
||||
0.2.3.2 fix blank line issue (thanks to Chris Janicki for finding the
|
||||
bug) and fix CTRL + Arrows scroll on CTRL+V
|
||||
|
||||
0.2.3.1 allow CTRL+W CTRL+T
|
||||
|
||||
0.2.3 fix for "(#$%.{" characters on Opera/Chrome, add cursor move
|
||||
with CTRL+P, CTRL+N, CTRL+F, CTRL+B which also work in Chrome.
|
||||
Fix Arrow Keys on Chrome (for cursor move and command line
|
||||
history). Change License to LGPL3.
|
||||
|
||||
0.2.2 fix down-arrow/open parentises issue in Opera and Chrome
|
||||
|
||||
0.2.1 add support for paste from clipboard with CTRL+V (Copy to
|
||||
clipboard is alway enabled on websites)
|
||||
69
lib/client/terminal/jquery-terminal/README
Normal file
69
lib/client/terminal/jquery-terminal/README
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
__ _____ ________ __
|
||||
/ // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
|
||||
__ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
|
||||
/ / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
|
||||
\___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
|
||||
\/ /____/ version 0.4.18
|
||||
|
||||
|
||||
http://terminal.jcubic.pl
|
||||
|
||||
Licensed under GNU LGPL Version 3 license http://www.gnu.org/licenses/lgpl.html
|
||||
Copyright (c) 2011 Jakub Jankiewicz <http://jcubic.pl>
|
||||
|
||||
JQuery Terminal Emulator is a plugin for creating command line interpreters in
|
||||
your applications. It can automatically call JSON-RPC service when user type
|
||||
commands or you can provide you own function in which you can parse user
|
||||
command. It's ideal if you want to provide additional functionality for power
|
||||
users. It can also be used to debug your aplication.
|
||||
|
||||
Features:
|
||||
|
||||
* You can create interpreter for your JSON-RPC service with one line
|
||||
of code.
|
||||
|
||||
* Support for authentication (you can provide function when user enter
|
||||
login and password or if you use JSON-RPC it can automatically call
|
||||
login function on the server and pass token to all functions)
|
||||
|
||||
* Stack of interpreters - you can create commands that trigger additional
|
||||
interpreters (eg. you can use couple of JSON-RPC service and run them
|
||||
when user type command)
|
||||
|
||||
* Command Tree - you can use nested objects. Each command will invoke a
|
||||
function, if the value is an object it will create new interpreter and
|
||||
use function from that object as commands. You can use as much nested
|
||||
object/commands as you like. If the value is a string it will create
|
||||
JSON-RPC service.
|
||||
|
||||
* Support for command line history it use Local Storage if posible
|
||||
|
||||
* Support for tab completion if you create terminal from an object
|
||||
|
||||
* Include keyboard shortcut from bash like CTRL+A, CTRL+D, CTRL+E etc.
|
||||
|
||||
* Multiply terminals on one page (every terminal can have different
|
||||
command, it's own authentication function and it's own command history)
|
||||
|
||||
* It catch all exceptions and display error messages in terminal
|
||||
(you can see errors in your javascript and php code in terminal if they
|
||||
are in interpreter function)
|
||||
|
||||
|
||||
Example of usage (javascript interpreter)
|
||||
|
||||
jQuery(function($, undefined) {
|
||||
$('#term_demo').terminal(function(command, term) {
|
||||
if (command !== '') {
|
||||
var result = window.eval(command);
|
||||
if (result != undefined) {
|
||||
term.echo(String(result));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
greetings: 'Javascript Interpreter',
|
||||
name: 'js_demo',
|
||||
height: 200,
|
||||
width: 450,
|
||||
prompt: 'js> '});
|
||||
});
|
||||
69
lib/client/terminal/jquery-terminal/README.in
Normal file
69
lib/client/terminal/jquery-terminal/README.in
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
__ _____ ________ __
|
||||
/ // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
|
||||
__ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
|
||||
/ / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
|
||||
\___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
|
||||
\/ /____/ version {{VER}}
|
||||
|
||||
|
||||
http://terminal.jcubic.pl
|
||||
|
||||
Licensed under GNU LGPL Version 3 license http://www.gnu.org/licenses/lgpl.html
|
||||
Copyright (c) 2011 Jakub Jankiewicz <http://jcubic.pl>
|
||||
|
||||
JQuery Terminal Emulator is a plugin for creating command line interpreters in
|
||||
your applications. It can automatically call JSON-RPC service when user type
|
||||
commands or you can provide you own function in which you can parse user
|
||||
command. It's ideal if you want to provide additional functionality for power
|
||||
users. It can also be used to debug your aplication.
|
||||
|
||||
Features:
|
||||
|
||||
* You can create interpreter for your JSON-RPC service with one line
|
||||
of code.
|
||||
|
||||
* Support for authentication (you can provide function when user enter
|
||||
login and password or if you use JSON-RPC it can automatically call
|
||||
login function on the server and pass token to all functions)
|
||||
|
||||
* Stack of interpreters - you can create commands that trigger additional
|
||||
interpreters (eg. you can use couple of JSON-RPC service and run them
|
||||
when user type command)
|
||||
|
||||
* Command Tree - you can use nested objects. Each command will invoke a
|
||||
function, if the value is an object it will create new interpreter and
|
||||
use function from that object as commands. You can use as much nested
|
||||
object/commands as you like. If the value is a string it will create
|
||||
JSON-RPC service.
|
||||
|
||||
* Support for command line history it use Local Storage if posible
|
||||
|
||||
* Support for tab completion if you create terminal from an object
|
||||
|
||||
* Include keyboard shortcut from bash like CTRL+A, CTRL+D, CTRL+E etc.
|
||||
|
||||
* Multiply terminals on one page (every terminal can have different
|
||||
command, it's own authentication function and it's own command history)
|
||||
|
||||
* It catch all exceptions and display error messages in terminal
|
||||
(you can see errors in your javascript and php code in terminal if they
|
||||
are in interpreter function)
|
||||
|
||||
|
||||
Example of usage (javascript interpreter)
|
||||
|
||||
jQuery(function($, undefined) {
|
||||
$('#term_demo').terminal(function(command, term) {
|
||||
if (command !== '') {
|
||||
var result = window.eval(command);
|
||||
if (result != undefined) {
|
||||
term.echo(String(result));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
greetings: 'Javascript Interpreter',
|
||||
name: 'js_demo',
|
||||
height: 200,
|
||||
width: 450,
|
||||
prompt: 'js> '});
|
||||
});
|
||||
63
lib/client/terminal/jquery-terminal/dterm.js
vendored
Normal file
63
lib/client/terminal/jquery-terminal/dterm.js
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*!
|
||||
* Example plugin using JQuery Terminal Emulator
|
||||
* Copyright (C) 2010 Jakub Jankiewicz <http://jcubic.pl>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function($) {
|
||||
$.extend_if_has = function(desc, source, array) {
|
||||
for (var i=array.length;i--;) {
|
||||
if (typeof source[array[i]] != 'undefined') {
|
||||
desc[array[i]] = source[array[i]];
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
};
|
||||
$.fn.dterm = function(eval, options) {
|
||||
var op = $.extend_if_has({}, options,
|
||||
['greetings', 'prompt', 'onInit',
|
||||
'onExit', 'clear',
|
||||
'login', 'name', 'exit']);
|
||||
op.enabled = false;
|
||||
var terminal = this.terminal(eval, op).css('overflow', 'hidden');
|
||||
if (!options.title) {
|
||||
options.title = 'JQuery Terminal Emulator';
|
||||
}
|
||||
if (options.logoutOnClose) {
|
||||
options.close = function(e, ui) {
|
||||
terminal.logout();
|
||||
terminal.clear();
|
||||
};
|
||||
} else {
|
||||
options.close = function(e, ui) {
|
||||
terminal.disable();
|
||||
};
|
||||
}
|
||||
var self = this;
|
||||
var dialog = this.dialog($.extend(options, {
|
||||
resizeStop: function(e, ui) {
|
||||
var content = self.find('.ui-dialog-content');
|
||||
terminal.resize(content.width(), content.height());
|
||||
},
|
||||
open: function(e, ui) {
|
||||
terminal.focus();
|
||||
terminal.resize();
|
||||
},
|
||||
show: 'fade',
|
||||
closeOnEscape: false
|
||||
}));
|
||||
self.terminal = terminal;
|
||||
return self;
|
||||
};
|
||||
})(jQuery);
|
||||
17
lib/client/terminal/jquery-terminal/index.html
Normal file
17
lib/client/terminal/jquery-terminal/index.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script src="jquery-1.7.1.min.js"></script>
|
||||
<script src="jquery.mousewheel-min.js"></script>
|
||||
<script src="http://terminal.jcubic.pl/js/jquery.terminal-0.4.17.js"></script>
|
||||
<link href="jquery.terminal.css" rel="stylesheet">
|
||||
|
||||
<div id='terminal'></div>
|
||||
<script>
|
||||
jQuery(function($, undefined) {
|
||||
$('#terminal').terminal(function(command, term) {
|
||||
term.echo('');
|
||||
}, {
|
||||
greetings: 'Javascript Interpreter',
|
||||
name: 'js_demo',
|
||||
height: 200,
|
||||
prompt: 'js>'});
|
||||
});
|
||||
</script>
|
||||
84
lib/client/terminal/jquery-terminal/jquery.mousewheel.js
Normal file
84
lib/client/terminal/jquery-terminal/jquery.mousewheel.js
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var types = ['DOMMouseScroll', 'mousewheel'];
|
||||
|
||||
if ($.event.fixHooks) {
|
||||
for ( var i=types.length; i; ) {
|
||||
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
|
||||
}
|
||||
}
|
||||
|
||||
$.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.addEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.removeEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind("mousewheel", fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = "mousewheel";
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
|
||||
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
|
||||
|
||||
// New school multidimensional scroll (touchpads) deltas
|
||||
deltaY = delta;
|
||||
|
||||
// Gecko
|
||||
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaY = 0;
|
||||
deltaX = -1*delta;
|
||||
}
|
||||
|
||||
// Webkit
|
||||
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
||||
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
return ($.event.dispatch || $.event.handle).apply(this, args);
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
66
lib/client/terminal/jquery-terminal/jquery.terminal.css
Normal file
66
lib/client/terminal/jquery-terminal/jquery.terminal.css
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
.terminal .clipboard {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
opacity: 0.01;
|
||||
filter: alpha(opacity = 0.01);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.01);
|
||||
width: 2px;
|
||||
}
|
||||
.cmd > .clipboard {
|
||||
position: fixed;
|
||||
}
|
||||
.terminal {
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cmd {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
height: 1.3em;
|
||||
}
|
||||
.terminal .terminal-output div {
|
||||
display: block;
|
||||
}
|
||||
.terminal {
|
||||
font-family: FreeMono, monospace;
|
||||
color: #aaa;
|
||||
background-color: #000;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
}
|
||||
.terminal .cmd span {
|
||||
float: left;
|
||||
}
|
||||
.terminal .cmd span.inverted {
|
||||
background-color: #aaa;
|
||||
color: #000;
|
||||
}
|
||||
.terminal div::-moz-selection, .terminal span::-moz-selection {
|
||||
background-color: #aaa;
|
||||
color: #000;
|
||||
}
|
||||
.terminal div::selection, .terminal span::selection {
|
||||
background-color: #aaa;
|
||||
color: #000;
|
||||
}
|
||||
.terminal .terminal-output div.error, .terminal .terminal-output div.error div {
|
||||
color: red;
|
||||
}
|
||||
.tilda {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1100;
|
||||
}
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
.terminal a {
|
||||
color: #0F60FF;
|
||||
}
|
||||
.terminal a:hover {
|
||||
color: red;
|
||||
}
|
||||
2391
lib/client/terminal/jquery-terminal/jquery.terminal.js
Normal file
2391
lib/client/terminal/jquery-terminal/jquery.terminal.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue