JavaScript Shell

While at The Ajax Experience I noticed a tool that a few of the speakers made use of that was missing from my arsenal. The tool? JavaScript Shell.

This little beauty, once you’ve added the bookmark to your browser allows you to open a JavaScript Shell for any page you happen to be on! The shell lets you enter JavaScript from command-line to manipulate the page, trigger functions, analyze properties, etc. All libraries that the site has loaded are available within the Shell…so, if you use jQuery or some other toolkit, all defined functions and plugins are usable.

Here’s some features and pre-defined functions from the JavaScript Shell site

Features

  • You can enter statements and expressions at the same prompt.
  • The result of each non-void statement or expression is shown.
  • User-defined variables.
    • b = document.body
  • User-defined functions.
    • function f() { return 5; }
  • JavaScript error messages are shown in red.
  • Previous statements and expressions are available through Up and Down arrow keys.
  • Tab completion.
  • Multiline input (Shift+Enter to insert a line break).
  • If the shell is opened using a bookmarklet, JavaScript typed into the shell runs in the context of the original window.
  • Works well in Firefox, mostly works in Opera 8 and in IE 6 for Windows.

Built-in functions

  • ans: the result of the previous expression.
  • print(expr): prints expr on its own line.
    • for(i = 0; i < 6; ++i) print(i * i)
  • pr(expr): prints and returns its input, so you can use it to print intermediate results in the middle of an expression.
    • function fact(n) { return n>0 ? pr(n*fact(n-1)) : 1 }
  • blink(node) or Alt+B: makes a node blink for a second.
    • blink(document.links[3])
  • props(obj) or Alt+P: lists the methods and fields of an object.
    • props(document.body)
    • In Firefox, props also shows which properties belong to the object itself and which belong to objects in its prototype chain.

I’m a fan :D

Discuss This Article


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comment Preview:

 (1565) - javascript shell (59) - jquery shell (36) - shell (10) - jquery javascript shell (5) - jquery blink (4) - javascript shell firefox (4) - firefox javascript shell (3) - jquery blink effect (3) - javascript use shell firefox (2) - href="javascript:__Shell (2) - javascript shell windows (2) - open javascript shell in firefox (2) - prototype command shell javascruot (2) - document.print javascript (2) - shell firefox (2) - jquery print object (2) - document.print in javascript (2) - javascript shell jquery (2) - javascript (2) - shell print document (1) - javascript blink command line (1) - jquery shell firefox (1) - javascript Shell open pdf (1) - how to find javascript shell in firefox (1) - prototype javascript command line (1) - Javascript and shell (1) - jquery link blink (1) - blink con jquery (1) - JavaScript Windows Shell Programming (1) - javascript call shell (1) - javascript document.print firefox (1) - printable props documents (1) - how to print a line in javascript (1) - blink javascript (1) - shell run javascript firefox (1) - javascript shell print document windows (1) - prototype shell command javascript (1) - jquery firefox blink (1) - windows javascript shell (1) - document.print() javascript (1) - how to print blink javascript (1) - jquery light blink (1) - shell desde javascript (1) - firefox execute shell command javascript (1) - run shell javascript from Firefox (1) - jquery blink title of the window (1) - javascript shell bookmark props (1) - line break in shell (1) - jquery document print (1) - firefox javascript command shell (1) - javascript shell open (1) - jQuery Documentation printable (1) - prototype javascript shell (1) - javascript shell libraries (1) - javascript & shell (1) - Opera JavaScript Shell (1) - javascript shell bookmark (1) - jquery print page (1) - Javascript shell programming (1) - jquery print (1) - jquery (1) - call shell with javascript (1) - href javascript shell (1) - calling a shell program in a javascript (1) - shell printing using javascript (1) - javascript-shell jquery (1) - shell.open in javascript (1) - javascript to opening a shell (1) - document.print firefox jscript (1) - javascript command line shell (1) - print page jquery (1) - jquery .shell (1) - printing with jquery (1) - javascript shell firefox 3 (1) - command line javascript shell with completion (1) - Javascript Shell on firefox 3 (1) - shell in javascript (1) - myspace (1) -