utility.js: simplify even/odd table row striping.
This commit is contained in:
@@ -2,10 +2,6 @@ import Cookie from './cookie'
|
|||||||
import Utility from './utility'
|
import Utility from './utility'
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
// Table striping
|
|
||||||
$(".striped tbody tr:even").addClass("even");
|
|
||||||
$(".striped tbody tr:odd").addClass("odd");
|
|
||||||
|
|
||||||
// Account notices
|
// Account notices
|
||||||
$("#hide-sign-up-notice").click(function(e) {
|
$("#hide-sign-up-notice").click(function(e) {
|
||||||
$("#sign-up-notice").hide();
|
$("#sign-up-notice").hide();
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import Utility from './utility'
|
|
||||||
|
|
||||||
let SavedSearch = {};
|
let SavedSearch = {};
|
||||||
|
|
||||||
SavedSearch.initialize_all = function() {
|
SavedSearch.initialize_all = function() {
|
||||||
if ($("#c-saved-searches").length) {
|
if ($("#c-saved-searches").length) {
|
||||||
Utility.sorttable($("#c-saved-searches table"));
|
$("#c-saved-searches table").stupidtable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,15 +103,6 @@ Utility.regexp_escape = function(string) {
|
|||||||
return string.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
return string.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
Utility.sorttable = function(table) {
|
|
||||||
table.stupidtable();
|
|
||||||
table.bind("aftertablesort", function(event, data) {
|
|
||||||
$("#c-saved-searches table tbody tr").removeClass("even odd");
|
|
||||||
$("#c-saved-searches table tbody tr:even").addClass("even");
|
|
||||||
$("#c-saved-searches table tbody tr:odd").addClass("odd");
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.selectRange = function(start, end) {
|
$.fn.selectRange = function(start, end) {
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
if (this.setSelectionRange) {
|
if (this.setSelectionRange) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ table.striped {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.even {
|
tr:nth-child(even) {
|
||||||
background-color: #FAFAFA;
|
background-color: #FAFAFA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @artist_versions.each do |artist_version| %>
|
<% @artist_versions.each do |artist_version| %>
|
||||||
<tr class="<%= cycle 'even', 'odd' %>">
|
<tr>
|
||||||
<% if artist_version.visible? %>
|
<% if artist_version.visible? %>
|
||||||
<td><%= link_to artist_version.name, artist_path(artist_version.artist_id) %></td>
|
<td><%= link_to artist_version.name, artist_path(artist_version.artist_id) %></td>
|
||||||
<td class="col-expand"><%= artist_version_other_names_diff(artist_version) %></td>
|
<td class="col-expand"><%= artist_version_other_names_diff(artist_version) %></td>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @artist_versions.each do |artist_version| %>
|
<% @artist_versions.each do |artist_version| %>
|
||||||
<tr class="<%= cycle 'even', 'odd' %>">
|
<tr>
|
||||||
<% if artist_version.visible? %>
|
<% if artist_version.visible? %>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user