Update javascript.js

Navigation optimization