raw/ace/assets/js/uncompressed/fullcalendar.js
function buildSegmentSubrows(segments) {

		// Give preference to elements with certain criteria, so they have
		// a chance to be closer to the top.
		segments.sort(compareDaySegments);

		var subrows = [];
		for (var i=0; i<segments.length; i++) {
			var segment = segments[i];

			// loop through subrows, starting with the topmost, until the segment
			// doesn't collide with other segments.
			for (var j=0; j<subrows.length; j++) {
				if (!isDaySegmentCollision(segment, subrows[j])) {
					break;
				}
			}
			// `j` now holds the desired subrow index
			if (subrows[j]) {
				subrows[j].push(segment);
			}
			else {
				subrows[j] = [ segment ];
			}
		}

		return subrows;
	}
function buildSegmentSubrows(segments) {

		// Give preference to elements with certain criteria, so they have
		// a chance to be closer to the top.
		segments.sort(compareDaySegments);

		var subrows = [];
		for (var i=0; i<segments.length; i++) {
			var segment = segments[i];

			// loop through subrows, starting with the topmost, until the segment
			// doesn't collide with other segments.
			for (var j=0; j<subrows.length; j++) {
				if (!isDaySegmentCollision(segment, subrows[j])) {
					break;
				}
			}
			// `j` now holds the desired subrow index
			if (subrows[j]) {
				subrows[j].push(segment);
			}
			else {
				subrows[j] = [ segment ];
			}
		}

		return subrows;
	}
function buildSegmentSubrows ( segments ) { // Give preference to elements with certain criteria, so they have // a chance to be closer to the top. segments . sort ( compareDaySegments ) ; var subrows = [ ] ; for ( var i = 0 ; i < segments . length ; i ++ ) { var segment = segments [ i ] ; // loop through subrows, starting with the topmost, until the segment // doesn't collide with other segments. for ( var j = 0 ; j < subrows . length ; j ++ ) { if ( ! isDaySegmentCollision ( segment , subrows [ j ] ) ) { break ; } } // `j` now holds the desired subrow index if ( subrows [ j ] ) { subrows [ j ] . push ( segment ) ; } else { subrows [ j ] = [ segment ] ; } } return subrows ; }
Take an array of segments, which are all assumed to be in the same row, and sort into subrows.
Take an array of segments which are all assumed to be in the same row and sort into subrows .