js: added js to mark the last item in each row, respecting the type of items in those rows (4x4 or 2x2).