Simplify restripe_rows

This commit is contained in:
Michael Wiencek 2014-12-28 21:31:58 -06:00
parent d98ba93c88
commit e191ae11ab

View file

@ -734,7 +734,7 @@ function batch_recording_rels() {
if (hide_performed_recs) { if (hide_performed_recs) {
$recordings.filter(".performed").hide(); $recordings.filter(".performed").hide();
restripe_rows(); restripeRows();
} }
callback && callback(); callback && callback();
@ -1467,7 +1467,7 @@ function batch_recording_rels() {
if (hide_performed_recs) { if (hide_performed_recs) {
$row.find("input[name=add-to-merge]").attr("checked", false); $row.find("input[name=add-to-merge]").attr("checked", false);
$row.hide(); $row.hide();
restripe_rows(); restripeRows();
} }
if (callback) if (callback)
@ -1504,7 +1504,7 @@ function batch_recording_rels() {
$rec.hide().data("filtered", true); $rec.hide().data("filtered", true);
} }
} }
restripe_rows(); restripeRows();
} }
function toggle_performed_recordings() { function toggle_performed_recordings() {
@ -1517,7 +1517,7 @@ function batch_recording_rels() {
} else { } else {
$performed.filter(function() {return !$(this).data("filtered");}).show(); $performed.filter(function() {return !$(this).data("filtered");}).show();
} }
restripe_rows(); restripeRows();
$.cookie('hide_performed_recs', hide_performed_recs.toString(), { path: '/', expires: 1000 }); $.cookie('hide_performed_recs', hide_performed_recs.toString(), { path: '/', expires: 1000 });
} }
@ -1534,7 +1534,7 @@ function batch_recording_rels() {
} else { } else {
$pending.filter(function() {return !$(this).data("filtered");}).show(); $pending.filter(function() {return !$(this).data("filtered");}).show();
} }
restripe_rows(); restripeRows();
$.cookie('hide_pending_edits', hide_pending_edits.toString(), { path: '/', expires: 1000 }); $.cookie('hide_pending_edits', hide_pending_edits.toString(), { path: '/', expires: 1000 });
} }
toggle_pending_edits(null, hide_pending_edits); toggle_pending_edits(null, hide_pending_edits);
@ -1573,19 +1573,11 @@ function batch_recording_rels() {
return $input; return $input;
} }
function restripe_rows() { function restripeRows() {
var $rows = $recordings.filter(":visible"), $recordings.filter(":visible").each(function (index, row) {
row, even = false; var even = (index + 1) % 2 === 0;
row.className = row.className.replace(even ? 'odd' : 'even', even ? 'even' : 'odd');
for (var i = 0; i < $rows.length; i++) { });
row = $rows[i];
if (even) {
$(row).addClass("ev");
} else {
$(row).removeClass("ev");
}
even = !even;
}
} }
function rowTitleCell($row) { function rowTitleCell($row) {