Content deleted Content added
Technical 13 (talk | contribs) wrap it in an if statement to not try and replace text which doesn't exist. |
Technical 13 (talk | contribs) →show result count if all results are shown on one page: anal retentive version... |
||
Line 38:
$('.mw-uctop').closest('li').css({"font-size":"6px", "text-decoration":"italic"});
/* show result count if all results are shown on one page */
if($('div#mw-content-text').html().search(/previous [\d,]* \| next [\d,]*/) !== -1){
var allPagesReplace = 'showing ';
$('div#mw-content-text').html($('div#mw-content-text').html().replace(/previous [\d,]* \| next [\d,]*/g, 'showing all ' + $('ul#mw-whatlinkshere-list li').length + ' results'));▼
if($('ul#mw-whatlinkshere-list li').length === 1){
allPagesReplace += 'the only ';
} else if('ul#mw-whatlinkshere-list li').length > 1){
allPagesReplace += 'all ' + $('ul#mw-whatlinkshere-list li').length;
}
allPagesReplace += ' result';
if('ul#mw-whatlinkshere-list li').length > 1){
allPagesReplace += 's';
}
▲ $('div#mw-content-text').html($('div#mw-content-text').html().replace(/previous [\d,]* \| next [\d,]*/g,
}
|