optimization jQuery detection