Effects of van der Waals interaction on the adsorption of H2 on MoS2 monolayers and nanoribbons