Fandom

Wikia Developers Wiki

Standard Edit Summary

888pages on
this wiki
Add New Page
Talk73 Share

Standard edit summary adds a drop down box below the edit summary box with a list of commonly used summaries. The summary field remains fully editable, of course. If it already contains a summary the preset is simply appended. That can be done multiple times, too.

The list with the presets is stored in a file named Template:Stdsummaries. You will need both the script and the preset list for this addon to work.

This script also sets tabindexes, so pressing the tab key changes focus from the edit area to the edit summary dropdown, then edit summary text area, then minor edit checkbox and then the publish button.

The preset list may include comments beginning with : * or <

Demo

Open this page for editing to see the script in the effect. (But please don't publish the page unless you've actually edited it, thanks!)

Installation

Add this code:

importArticles({ type: 'script', articles: [ 
    'u:dev:Standard_Edit_Summary/code.js'
]});

to your wiki's MediaWiki:Common.js (or another appropriate script file)

Options

To use any of the options below you need to create an object named window.dev.editSummaries in your JavaScript code:

// Create the "dev" namespace if it doesn't exist already:
 
window.dev = window.dev || {};
 
// Create the sub-namespace for this addon and set some options:
 
window.dev.editSummaries = {
     css: '#stdSummaries { ... }',
     select: 'MediaWiki:StandardEditSummary'
};
 
// The options need to be set before the import! Otherwise they may not work.
 
importArticles({ type: 'script', articles: [ 
    'u:dev:Standard_Edit_Summary/code.js'
]});

CSS

By default this CSS is added to the page to properly position the dropdown:

#stdSummaries {
    border-radius: 4px;
    padding: 1px 2px;
    width: 284px;
}
.EditPage.toolbar-expanded.editpage-sourcewidemode-on.mode-source #stdSummaries {
    position: relative;
    right: 290px;
    top: 3px;
    width: 278px;
}
.EditPage.toolbar-expanded.editpage-sourcewidemode-on.mode-source .module_page_controls .preview_box,.EditPage.toolbar-expanded.editpage-sourcewidemode-on.mode-source .module_page_controls .buttons {
    position: relative;
    top: -21px;
    right: -56px;
}

For most wikis this should work fine, but if you'd rather override it with your own CSS you can specify it like so:

window.dev = window.dev || {};
window.dev.editSummaries = {
     css: '#stdSummaries { ... }'
};

If you'd rather set the CSS in your standard CSS files, set the value to false:

window.dev = window.dev || {};
window.dev.editSummaries = {
    css: false
};

Summaries

By default (and for legacy reasons) the contents of the dropdown are loaded from Template:Stdsummaries, you can specify an alternate source if you wish:

window.dev = window.dev || {};
window.dev.editSummaries = {
    select: 'MediaWiki:StandardEditSummary'
};

But you don't need to use an external source. You can also specify the summaries inline:

window.dev = window.dev || {};
window.dev.editSummaries = {
    select: [
        '(click to browse)',
        '1.Refactoring', [
            'Cleanup',
            'Corrected spelling/grammar'
            /* etc. */
         ]
         /* etc. */
    ]
};

In the above example everything in the first dimension of the array is meant for grouping only and cannot be chosen as a summary. The second dimension holds the actual summaries.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.