js device parser multireplace refactored