Fix for CSP error under Firefox OS, now using regular JS functions, not generated on-fly