User:Gary/show TOC limit.js
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*
SHOW TOC LIMIT
Description: Shows the table of contents' limit (with the use of {{TOC limit}}) if it is indeed limited.
*/
function showTocLimit()
{
if (!$('#toc').length) return false;
for (var i = 2; i <= 7; i++)
{
if (!$('.toclimit-' + i).length) continue;
$('#toctitle').children().eq(0).append('<span style="font-size: 85%;"> (lim. to ' + i + ')</span>');
break;
}
}
$(document).ready(function()
{
showTocLimit();
});