javascript extension's filter modified

basically it's copied from @pydave's java extension filter,
and seems to work pretty good.