Executes JS functions based on the last part of the current path name.