Update to use window-scoped variables instead of script-scoped ones. Added filetype-based exclusion.