scriptreplay in javascript