SSブログ
JavaScript ブログトップ

Script.aculo.us [JavaScript]

nice!(0) 

scroll [JavaScript]

document.parentWindow.scroll(x,y)

nice!(0) 

rhino [JavaScript]

$ cat bin/set_rhino_env
export RHINO_HOME=/home/smnb/Tools/rhino1_7R1
export CLASSPATH=$CLASSPATH:$RHINO_HOME/js.jar

$ source ./bin/set_rhino_env

$ java org.mozilla.javascript.tools.shell.Main
Rhino 1.7 release 1 2008 03 06
js>

$ java org.mozilla.javascript.tools.shell.Main -e "print('Hello')"
Hello



js> help()

Command Description
======= ===========
help() Display usage and help messages.
defineClass(className) Define an extension using the Java class
named with the string argument.
Uses ScriptableObject.defineClass().
load(["foo.js", ...]) Load JavaScript source files named by
string arguments.
loadClass(className) Load a class named by a string argument.
The class must be a script compiled to a
class file.
print([expr ...]) Evaluate and print expressions.
quit() Quit the shell.
version([number]) Get or set the JavaScript version number.
gc() Runs the garbage collector.
spawn(arg) Evaluate function or scriptname on a new thread
sync(function) Creates a synchronized version of the function,
where the synchronization object is "this"
readFile(fileName [, encoding])
Returns the content of the file as a string.
Encoding of the string can be optionally specified.
readUrl(url [, encoding])
Similar to readFile, reads the contents of the url.
runCommand(name ...) Runs a specified shell command. Additional arguments are
passed to the command
seal(args ...) Seals the supplied objects
toint32(arg) Converts the argument into a 32-bit integer
serialize(obj, fileName)
Serializes an object and saves it to a file
deserialise(fileName) Reconstructs a serialized object
environment Returns the current environment object
history Displays the shell command history

For full description of all available commands see shell.html in
the docs directory of Rhino distribution.

===================================
all: test

RHINO_HOME=/home/smnb/Tools/rhino1_7R1
RHINO_SHELL=java org.mozilla.javascript.tools.shell.Main
ENVSET= @echo $$CLASSPATH | grep rhino 1>/dev/null 2>&1 ; if [ ! $$? ] ; then \
export RHINO_HOME=$(RHINO_HOME);\
export CLASSPATH=$$CLASSPATH:$$RHINO_HOME/js.jar;\
fi
test:
$(ENVSET); (echo 'print("Hello")'; echo "quit()") | $(RHINO_SHELL)

help:
$(ENVSET); $(RHINO_SHELL) -e "help()"

mmm:
cat makefile

clean:
rm *~


nice!(0) 
JavaScript ブログトップ