Simple Javascript undo and redo independent of other libraries