Fixes period generation code in work_timer.js

This pull request attempts to solve the issues in #21 by updating the period generation code to take account of the stop time of each work period.