Skip to content

Commit 6cece2e

Browse files
committed
Merge pull request #44 from dellis23/master
Updated to latest version of jquery-console.
2 parents 65c2c7d + 7a6bf2b commit 6cece2e

File tree

3 files changed

+746
-604
lines changed

3 files changed

+746
-604
lines changed

resources/public/javascript/jquery-console/README

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
INTRODUCTION
22

3-
See demo.html. Or here: http://chrisdone.com/jquery-console/demo.html
3+
See demo.html. Or here: http://chrisdone.com/jquery-console/
44

55
Options available:
66

@@ -18,6 +18,10 @@ Options available:
1818

1919
promptLabel string Prompt string like 'JavaScript> '.
2020

21+
cols integer the number of cols, this value is only
22+
used by the command completion to format
23+
the list of results.
24+
2125
commandValidate function When user hits return, validate
2226
whether to trigger commandHandle and
2327
re-prompt.
@@ -30,6 +34,10 @@ Options available:
3034
to report a result of the command
3135
asynchronously.
3236

37+
commandComplete function Handle the command completion when the
38+
tab key is pressed. It returns a list
39+
of string completion suffixes.
40+
3341
animateScroll bool Whether to animate the scroll to
3442
top. Currently disabled.
3543

@@ -39,6 +47,9 @@ Options available:
3947

4048
cancelHandle function Handle a user-signaled interrupt.
4149

50+
fadeOnReset bool Whether to trigger a fade in/out when
51+
the console is reset. Defaults to true.
52+
4253
LICENSE
4354

4455
Copyright 2010 Chris Done, Simon David Pratt. All rights reserved.
@@ -68,5 +79,3 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
6879
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
6980
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
7081
POSSIBILITY OF SUCH DAMAGE.
71-
72-

resources/public/javascript/jquery-console/demo.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,33 @@
102102
},
103103
promptHistory:true
104104
});
105+
/* Fifth console */
106+
var console5 = $('<div class="console1">');
107+
$('body').append(console5);
108+
var controller5 = console5.console({
109+
promptLabel: 'Complete> ',
110+
commandHandle:function(line){
111+
if (line) {
112+
return [{msg:"you typed " + line,className:"jquery-console-message-value"}];
113+
} else {
114+
var m = "type a color among (" + this.colors.join(", ") + ")";
115+
return [{msg:m,className:"jquery-console-message-value"}];
116+
}
117+
},
118+
colors: ["red","blue","green","black","yellow","white","grey"],
119+
cols: 40,
120+
completeHandle:function(prefix){
121+
var colors = this.colors;
122+
var ret = [];
123+
for (var i=0;i<colors.length;i++) {
124+
var color=colors[i];
125+
if (color.lastIndexOf(prefix,0) === 0) {
126+
ret.push(color.substring(prefix.length));
127+
}
128+
}
129+
return ret;
130+
}
131+
})
105132
});
106133
</script>
107134
<style type="text/css" media="screen">

0 commit comments

Comments
 (0)