nice please email it to me.

On Jul 3, 11:18 am, sherdim <sher...@gmail.com> wrote:
> Hello!
>
> The current shell is pretty for copy-paste operations but  the
> scrolling through recent command history is useful for interactive
> using.
>
> Here is the update for JavaScript function, which allows such
> scrolling up and down as in a standard shell. Instead of command
> completion it shows possible variants in the output.
>
> Massimo, you can use it in the release if you want.
> For others - just replace the single function in
> /web2py/applications/admin/views/shell/index.html with this.
>
> ==========code of script==============
> $('#statement').keyup(function(event){
>   var t=$('#statement');
>   var s=t.val()
>   var o=$('#output')
>   if(s=='\n') t.val('');
>   if(s.length>1 && s.substr(s.length-1,1)=='\n' && s.substr
> (s.length-2,1)!=':' &&
>       (s.indexOf(':\n ')<0 || s.substr(s.length-2,1)=='\n')) {
>       t.val('');
>       $.post("{{=URL(r=request,f='callback',args=app)}}",
>        {statement:s},function(data){o.html(o.html()+data).attr
> ('scrollTop',o.attr('scrollHeight'));});
>   } else { };
>   if(event.keyCode==38){
>     var i=s.length
>     if(i==0){
>         var s=o.find('table:last pre:first').text();
>         bShellScrolling=o.find('table').length;
>     }else if(bShellScrolling){
>         var i=bShellScrolling
>         if(i<1){
>             return
>         }else{
>             i--
>             var s=o.find('table::nth-child('+(i)+') pre:first').text
> ();
>             bShellScrolling=i
>         }
>     }else if(s.indexOf('\n')<0){
>         var oo=o.find('tr:first-child pre:contains("'+s+'")')
>         if(oo.length==0){
>             return
>         }else if(oo.length==1){
>             s=oo.text();
>         }else{
>             sVar=oo.text();
>             o.html(o.html()+'<dd>'+s+' ?</dd><dt><tt>'+sVar+'</tt></
> dt>').attr('scrollTop',o.attr('scrollHeight'))
>             return
>         }
>     }else{
>       //multistring expr
>       return;
>     }
>     //  if(s.slice(s.length-1)=='\n'){
>     s=s.slice(0,s.length-1)
>     //  }
>     t.val(s);
>   }
>   if(bShellScrolling && event.keyCode==40){
>     var i=bShellScrolling
>     i++
>     var s=o.find('table:nth-child('+i+') tr:first-child pre').text();
>     if(s){
>         s=s.slice(0,s.length-1)
>         t.val(s);
>         bShellScrolling=i
>     }else{
>         bShellScrolling=0
>         t.val('')
>     }
>   };
>   if(bShellScrolling && (event.keyCode==37 || event.keyCode==39)){
>     bShellScrolling=0;
>   };});
>
> ========end script===========
>
> Vale!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to