Add swipe support for mobile scripts (fix #3989)

Fixes regression caused by #3989.  There are also some formatting fixes that I've noted.
indent change only