Added thresholds to swipe handler.

Made both vertical and horizontal swipes use the horizontal threshold,
as the vertical threshold is very large to set up blocking of vertical swipes.
Fixed missing semicolons (not required, but recommended).
Fixed use of == operator instead of ===.
Switched manual loop for shifting and deleting the first item, with a call to array's shift method.