update $script.js to 2.4.0
add support for server-side logic and some minor tweaks