ElEditors, Interface administrators, Administrators
70,778
edits
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 333: | Line 333: | ||
$("#ca-ve-edit").clone().attr('id', 'ca-ve-edit-clone').prependTo($('#p-views .mw-portlet-body ul')); | $("#ca-ve-edit").clone().attr('id', 'ca-ve-edit-clone').prependTo($('#p-views .mw-portlet-body ul')); | ||
$("#ca-ve-edit").hide(); | $("#ca-ve-edit").hide(); | ||
}); | |||
function highlightRows() { | |||
var rows_to_highlight = [ | var rows_to_highlight = [ | ||
'Normal', | 'Normal', | ||
Line 339: | Line 342: | ||
'PvE', | 'PvE', | ||
'PvP' | 'PvP' | ||
] | ]; | ||
rows_to_highlight.forEach(function (rowContent) { | rows_to_highlight.forEach(function (rowContent) { | ||
Line 345: | Line 348: | ||
rows.each(function () { | rows.each(function () { | ||
if ($(this).text() == rowContent) $(this).parent().addClass('tone-4'); | if ($(this).text() == rowContent) $(this).parent().addClass('tone-4'); | ||
}) | }); | ||
}) | }); | ||
} | |||
$(document).ready(function () { | |||
// Call the function on page load | |||
highlightRows(); | |||
}); | |||
// Watch for new elements added to the page and call the function again | |||
var observer = new MutationObserver(function (mutationsList) { | |||
for (var mutation of mutationsList) { | |||
if (mutation.addedNodes.length > 0) { | |||
highlightRows(); | |||
break; | |||
} | |||
} | |||
}); | |||
observer.observe(document.body, { childList: true, subtree: true }); | |||
}); | }); | ||