mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-13 11:52:27 +00:00
Use CSS instead of JS for highlighting table rows
This improves performance significantly and reduces the incidence of bugs and undesireable side-effects when using this userscript in conjunction with other userscripts, userstyles and/or browser extensions that modify the look and feel of MB pages.
This commit is contained in:
parent
424b2c6937
commit
7cb81736b3
1 changed files with 1 additions and 18 deletions
|
@ -20,24 +20,7 @@ $(document).ready(function () {
|
|||
LASTFM_APIKEY = '';
|
||||
|
||||
// Highlight table rows
|
||||
$('table.tbl tbody tr').hover(
|
||||
function () {
|
||||
$(this)
|
||||
.children('td')
|
||||
.each(function () {
|
||||
let backgroundColor = $(this).css('backgroundColor');
|
||||
if (backgroundColor != 'rgb(255, 255, 0)') $(this).css('backgroundColor', '#ffeea8');
|
||||
});
|
||||
},
|
||||
function () {
|
||||
$(this)
|
||||
.children('td')
|
||||
.each(function () {
|
||||
let backgroundColor = $(this).css('backgroundColor');
|
||||
if (backgroundColor != 'rgb(255, 255, 0)') $(this).css('backgroundColor', '');
|
||||
});
|
||||
}
|
||||
);
|
||||
$('head').append('<style>table.tbl > tbody > tr:hover { background-color: #ffeea8 } table.tbl > tbody > tr:hover > td { background-color: rgba(0, 0, 0, 0) }</style>');
|
||||
|
||||
let re;
|
||||
|
||||
|
|
Loading…
Reference in a new issue