jquery - Display Text File -
i wondering how display contents of textfile in terminal output because have no idea how go it. want work "more [filename]" files in same directory html script.
here current code*: http://pastebin.com/in4axus9
*i used pastebin formatting messing when pasted here.
thanks
try:
var c = $.terminal.splitcommand(cmd); if (c.name == "more") { $.get(c.args[0], function(file) { term.echo(file); }); }
it display whole file @ one, if want similar more command need split file pages. maybe this:
var export_data = term.export_view(); $.get(c.args[0], function(file) { var = 0; var lines = file.split('\n'); term.clear().echo(lines.slice(i, i+term.rows()).join('\n')); term.push($.noop, { keydown: function(e) { if (e.which == 32) { i++; term.clear().echo(lines.slice(i, i+term.rows()).join('\n')); } else if (e.which == 27) { term.pop().import_view(export_data); } return false; } }); });
if want have more 2 lines displayed need resize terminal:
var terminal = $('...').terminal(...); var $win = $(window); $win.resize(function() { var height = $win.height(); terminal.innerheight(height); }).resize(); terminal.resize();
Comments
Post a Comment