using js to construct timeline