Odd and even major indices and one-dimensional characters for classical Weyl groups