PreloadFileDescription

PreloadFileDescription is a script that allows you to specify custom text (ex. template code) that will be preloaded when uploading files via Special:Upload.
It also has few other useful features:
* Support for multiple custom text templates selectable via a dropdown menu (like licenses)
* Ability to select specific license as default
== ==
Configuration is located at MediaWiki:Common.js by default on your wiki.
=== Single template ===
You can specify text to preload as a value of PFD_template variable. Use \n to add line-break in the code.
Note: PFD_template is currently broken, use PFD_templates instead.
=== Multiple templates ===
If you want to add ability to select the text that is preloaded from few different options that, use different template or have additional categories.
In this case, PFD_templates is a list that contains objects with template properties or strings that will generate group names inside the dropdown menu.
The first template on the list will be preloaded at the start.
== ==
There are few additional variables that allow to modify behavior.
; PFD_language
: By default, script will display messages in language user has set (and fallback to English if it's not present). You can force script to display text in specific language by providing a language code. Example:
PFD_language = 'en';
; PFD_messages
: Override messages with custom content. Example:
PFD_messages = {
 'en': {
 'template-change-notice': 'If you change the template, your description\'s gonna have a bad time.',
 }
}
; PFD_license
: You can specify license template to be selected by default. Put template name (first part of the entry from Mediawiki:Licenses) as a value. (case sensitive) Example:
PFD_license = 'Fairuse';
; PFD_requireLicense
: When set to true script will disable file upload until proper (non-empty) license is specified. Example:
PFD_requireLicense = true;
; PFD_discourageEditorFileUpload
: When set to true, script will display a short notice when using media uploader from inside the editor (right rail). Example:
PFD_discourageEditorFileUpload = true;
=== Template entry object ===
The object with info about the template also has two optional properties:
; altdesc
: Allows you to specify alternative version of the same template. It'll add two buttons below the description area that allow to switch between the two. Using this method rather than specifying a different template is good for keeping the list compact and having more options. Taking Polish League of Legends Wiki as an example: some templates have an alternative version which include code that automatically fills some parameters if the file has a proper name – allowing uploading multiple files without the need to fill the description separately.
; license
: Script will automatically select specified license when this template is selected (and revert to previously selected one when changed back).
Example code with all properties specified: