User:KnightMiner/editSummaryPresets.js/doc

From Minecraft Wiki
Jump to: navigation, search
This is the documentation page, it should be transcluded into the main script page. See Template:Documentation for more information

This script creates a menu of custom edit summaries to insert into a page. It also allows creation of custom summaries, defining a group to only appear in a certain namespace, and calling the last editor's username for summaries.

Usage[edit]

if (mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit') {
   var customSummaries = [
       'An edit summary preset',
       'Another edit summary preset',
       'A preset [' + '[a wiki link]]'
   ];
   importScript( 'User:KnightMiner/editSummaryPresets.js' );
}

This script supports virtually unlimited summaries and groups.

The last editor's username can be called using {user} anywhere within a string. For example, a summary might be 'The last user who edited this page was {user}'

The extra single quotes and plus sign on the link is to prevent the wiki software from creating a link as the variables are loaded. This normally happens with templates being transcluded or substituted in scripts, so the single quotes and plus may not be needed.

Groups[edit]

Groups are created using a JavaScript object. Within that object, set label for the name of the option group and values as an array of options like before.

Namespace limitations can be set as an array called namespaces, which is simply any namespace numbers which this summary is valid in. The script also supports the keywords talk for any talk page, and main for any content page. If no namespace is set, the group appears in all namespaces.

Sources[edit]

This is based on User:Kanegasi/editsummarypresets.js, though completely rewritten.