Last modified: 2014-04-28 17:51:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44357, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42357 - Show number of items on Whatlinkshere if less than limit value
Show number of items on Whatlinkshere if less than limit value
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: PiRSquared17
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-22 12:39 UTC by Scott Martin (http://enwp.org/user:scott)
Modified: 2014-04-28 17:51 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Scott Martin (http://enwp.org/user:scott) 2012-11-22 12:39:42 UTC
It would be to useful to show the number of items displayed on Special:WhatLinksHere if it is less than the limit value (in other words, all appearing on a single page).

E.g. when limit=50, if 35 results are returned, display "Showing 35 results."

Note: this isn't quite the same as #4394.
Comment 1 Scott Martin (http://enwp.org/user:scott) 2012-11-22 12:41:15 UTC
Bug 4394, even.
Comment 2 MrBlueSky 2012-12-07 21:38:56 UTC
The actual limit on the number of results which are shown is something of a moving target because of bug [[bug 42357]], at least when redirects are shown.
Comment 3 MrBlueSky 2012-12-07 21:39:53 UTC
Bug 6424, actually ;)
Comment 4 Technical 13 2014-02-24 00:30:02 UTC
Adding:

$('div#mw-content-text').html($('div#mw-content-text').html().replace(/previous [\d,]* \|  next [\d,]*/, 'showing all ' + $('ul#mw-whatlinkshere-list li').length + ' results'));

to my [[Special:MyPage/common.js]] works for me.  Of course, you could add some formatting in there if you were so inclined...
Comment 5 Technical 13 2014-02-24 01:15:15 UTC
/* 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 ';
    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, allPagesReplace));
}

Is the anal retentive version... 
Can be loaded locally on enwp with:
importScript( 'User:Technical 13/Scripts/Gadget-pageCount.js' );// [[User:Technical 13/Scripts/Gadget-pageCount]]

or globally on any other mw site with:
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Technical 13/Scripts/Gadget-pageCount.js&action=raw&ctype=text/javascript' );//[[User:Technical 13/enwpScripts]]

Since this can be done very easily with JavaScript, closing as WORKSFORME
Comment 6 Kunal Mehta (Legoktm) 2014-02-24 01:17:04 UTC
Userscripts aren't a valid solution.
Comment 7 Gerrit Notification Bot 2014-04-22 04:10:52 UTC
Change 127866 had a related patch set uploaded by Gerrit Patch Uploader:
Show number of displayed pages on WhatLinksHere

https://gerrit.wikimedia.org/r/127866
Comment 9 Niklas Laxström 2014-04-22 07:33:34 UTC
Why not just change ul to ol?
Comment 10 Nemo 2014-04-22 07:40:31 UTC
(In reply to Niklas Laxström from comment #9)
> Why not just change ul to ol?

No opinion, but ol would be more noisy.
Comment 11 PiRSquared17 2014-04-22 11:57:23 UTC
(In reply to Nemo from comment #10)
> (In reply to Niklas Laxström from comment #9)
> > Why not just change ul to ol?
> 
> No opinion, but ol would be more noisy.

Maybe the person who requested this could comment on that.  If not, would it be better to display the count above the list?
Comment 12 Scott Martin (http://enwp.org/user:scott) 2014-04-28 17:51:13 UTC
(In reply to PiRSquared17 from comment #8)
> Demo: http://pirsquared-dev.wmflabs.org/wiki/Special:WhatLinksHere/Cake

I may be missing something here but this demo doesn't appear to be a demo of my request. If it were, it would say "showing 5 results"....

(In reply to Nemo from comment #10)
> (In reply to Niklas Laxström from comment #9)
> > Why not just change ul to ol?
> 
> No opinion, but ol would be more noisy.

I've just tried switching WhatLinksHere's standard output to an ol on a 50-item result list and it is very noisy - plus kind of confusing if you don't know that the results are displayed in order of creation. I don't think it would be much of an inprovement.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links