Javascript file filtering