Aptana (and Eclipse?) upload_current_file_on_save.js adapted

I'm just getting familiar with Aptana (a variation of the Eclipse IDE) for PHP development and I got really intrigued by the Scripts available to run custom macros within Aptana.
One I really wanted to use is "Upload current file on Save", which is coded within the file: upload_current_file_on_save.js

The problem with this file is that it comes disabled. If you get into it you'll see explicit comments that explains it.

Seems it's disabled because it is not "toggleable" like other scripts, so if enabled from within the script code, it would be always enabled in *ANY* Aptana projects, and this could be an undesired feature.
Aptana support staff say to use that script as project-specific script to avoid the previously explained issue.

Being everything scripted in javascript, a language known to me, I've tried to edit the code and obtained (at least in my case) a version of the feature that can be turned on and off just like other scripts.
Of course there could be better ways to fix the script, but I didn't wanted to spend a lot of time with it and got in the following working solution in few minutes, which is ok for me:

Feel free to use this script if you like. And in case you do anything better, then please comment this post with a link to your solution :)