Allow include external libraries as JSNI code

See comments in javadoc about advantages and usage of this feature.

Also fixed a bug in getScript, and moved a method.