Pagination plugin using pure javascript