JS refactor is_mobile functino