js script optimzation