cleanup viewer JS