User:Schnark/mostEdited

From mediawiki.org

This is the documentation for User:Schnark/mostEdited.js which is a user script that shows you a list of those pages that were edited many times in the last hour (or any other period). These pages seem to be interesting to other users just now, so they are probably interesting to you, too, at least some of them. Use the edits other users do to find pages you are interested in!

Let's find out what other users are coding!
Presidents can't resign without you noticing it.

Installation[edit]

Go to the wiki, where you want to use this script and put the following line in Special:MyPage/common.js there:

mw.loader.load( '//www.mediawiki.org/w/index.php?title=User:Schnark/mostEdited.js&action=raw&ctype=text/javascript' );

If you know how to import user scripts and prefer some other way to do so, you can of course use your favorite method to install it.

Limitations[edit]

There are a few cases, where the script doesn't behave the way you might expect it.

  • The wiki should run MediaWiki 1.18. I haven't tried what happens with 1.17 (this might work), but it won't work with 1.16 or earlier.
  • You shouldn't use an user script that adds things to the prototype of plain objects. I know that I should take care about that, but I don't, so it's up to you to take care.
  • If you use an old skin without sidebar the link to the new special page won't be in the sidebar (that's surprising, isn't it?) but somewhere else. The script tries hard to find the link to recent changes and put the new link above, but if the wiki adapted the sidebar the link might under some strange circumstances appear somewhere else.
  • If you use an user script that adds a submit button in the recent changes before the normal submit button, the new button isn't shown in the right place.
  • If you use a language different from English or German you will see English texts, but with the plural rules for your language.
  • This is an AJAX application, so going back and forth in your browser will probably clear the list away.
  • It might happen that you don't see the notice that you have new messages on your discussion page when you use the new special page. (At least in a skin different from Vector.)

Usage[edit]

Normal Usage[edit]

You should see a new link in the sidebar directly above the link to the recent changes. Additionally on Special:RecentChanges there will be a new button. Both go to Special:BlankPage?action=mostedited. On the top you can select a few options: the period of time to look at, and the namespaces. The selector for the namespaces you should know from the recent changes, it behaves exactly the same way. If you came from the recent changes it will even show the same selection at the beginning. Make your options and then click the button to submit your query.

You will get a list of the pages with the most edits. Some information is shown for each page, including the sections, which were edited most. A little arrow indicates whether the number of edits seems to be increasing or decreasing. Look at the list to find out which pages sound interesting to you and visit them!

Advanced Usage[edit]

You can use different parameters in the URL to configure what you will see:

Parameter meaning
hours the period of time to investigate, in hours, you may choose any number, even numbers that are not listed in the dropdown
namespace the number of the namespace
invert set to 1 to invert the selection of the namespace
associated set to 1 to include (or exclude) the associated namespace as well
limit number of pages to show at most (default 10)
section-limit number of sections to show at most for each page (default 3)
edits number of edits a page must have at least to be listed (default 2)
section-edits number of edits a section must have at least to be listed (default 2)
max-calls number of API calls the script will make at most for one query (default 5)

Localisation[edit]

If you want to, you can add localisation for your language. Just copy the following lines directly above the line you use to import the script:

$( document ).bind( 'mostedited-setmessages', function () {
	mw.messages.set( {
	// from core
	'minutes': '{{PLURAL:$1|$1 minute|$1 minutes}}',
	'hours': '{{PLURAL:$1|$1 hour|$1 hours}}',
	'days': '{{PLURAL:$1|$1 day|$1 days}}',
	'allpagessubmit': 'Go',
	'namespace': 'Namespace:',
	'invert': 'Invert selection',
	'tooltip-invert': 'Check this box to hide changes within the selected namespace (and the associated namespace if checked)',
	'namespace_association': 'Associated namespace',
	'tooltip-namespace_association': 'Check this box to also include the talk or subject namespace associated with the selected namespace',
	'blanknamespace': '(Main)',
	'namespacesall': 'all',
	'rc-change-size': '$1',
	'pagetitle': '$1 - {{SITENAME}}',

	// own messages
	'mostedited-legend': 'Most edited pages options', // legend for options on BlankPage with action=mostedited
	'mostedited': 'Most edited pages', // link in sidebar and title of the page
	'tooltip-n-mostedited': 'Shows the most edited pages', // tooltip for link in sidebar
	'mostedited-submit': 'Show most edited pages', // submit button in RecentChanges
	'mostedited-time': 'Time:', // label for time selection
	'mostedited-edits': '{{PLURAL:$1|$1 edit|$1 edits}} ($2 minor {{PLURAL:$2|edit|edits}})', // $1 - total number of edits to the page/section, $2 - number of minor edits
	'mostedited-users': '{{PLURAL:$1|$1 user|$1 users}} ($2 anonymous {{PLURAL:$2|user|users}})', // $1 - total number of different editors, $2 - number of anonymous editors
	'mostedited-size': 'Size change: $1', // $1 - formatted number
	'mostedited-no-pages': 'There are no pages with $1 or more edits in the selected period.', // $1 - number of edits a page must have at least to get shown
	'mostedited-increasing': 'The number of edits seems to be increasing.',
	'mostedited-unchanging': 'The number of edits seems not to change.',
	'mostedited-decreasing': 'The number of edits seems to be decreasing.',
	'mostedited-changed-period': '(changed to: $1)',
	'mostedited-changed-period-tooltip': 'The period had to be shortened because there are too many edits.'
	} );
} );

Translate all the strings. The first are messages you will find in the language files, the others are new messages. You don't need to include messages you don't translate.