wrong variable index - thanks faeryty for reporting

Signed-off-by: emanuele <emanuele45@gmail.com>
And use addInlineJavascript

Signed-off-by: emanuele <emanuele45@gmail.com>
Some outdated stuff

Signed-off-by: emanuele <emanuele45@gmail.com>