MediaWiki:Common.js: Difference between revisions
From Elwiki
No edit summary Tag: Manual revert |
No edit summary Tag: Reverted |
||
Line 334: | Line 334: | ||
$("#ca-ve-edit").hide(); | $("#ca-ve-edit").hide(); | ||
// Define a variable to hold the rows to highlight | |||
var _rows_to_highlight = [ | |||
'Normal', | |||
'[Enhanced]', | |||
'PvE', | |||
'PvP' | |||
]; | |||
// Define a function to highlight the rows | |||
function highlightRows() { | |||
$('[class^="colortable-"] td b').parent().removeClass('tone-4'); | |||
_rows_to_highlight.forEach(function (rowContent) { | |||
var rows = $('[class^="colortable-"] td b:contains("' + rowContent + '")'); | var rows = $('[class^="colortable-"] td b:contains("' + rowContent + '")'); | ||
rows.each(function () { | rows.each(function () { | ||
if ($(this).text() == rowContent) $(this).parent().addClass('tone-4'); | if ($(this).text() == rowContent) $(this).parent().addClass('tone-4'); | ||
}) | }); | ||
}) | }); | ||
} | |||
// Define a getter and a setter for the rows to highlight | |||
Object.defineProperty(window, 'rows_to_highlight', { | |||
get: function() { | |||
return _rows_to_highlight; | |||
}, | |||
set: function(newValue) { | |||
_rows_to_highlight = newValue; | |||
highlightRows(); | |||
} | |||
}); | |||
highlightRows(); | |||
}); | }); |