add view history function