dev

AjaxContentModel is a script which allows you without leaving the page you're on, by showing a content model change modal when you click on any content model change link. The modal can also be opened by pressing the C key on a page.

Note: The modal won't open if you're holding either the ⇧ Shift or Ctrl key. This is to allow users to access the content model page normally.


Installation

Usage

The content model modal will show up when you click on any Special:ChangeContentModel link, using it is pretty self-explanatory. Select one of the generic content model change reasons or type your own on the input. You can specify the reason further if you choose a common reason and input your own at the same time, which would appear as: <common reason>: <further ellaboration>. Click "Cancel" to close the modal.


Customization

All configuration variables are under the window.AjaxContentModel object.

Configuration variables
Name Description Default
reasons Allows for setting custom preset reasons in the modal dropdown. null
doKeyBind Whether to add a keyboard shortcut to what shortcutKey is set to. true
toolbarPlacement Sets the placement of the content model change link in the bottom toolbar. Set this to "mytools" to add it to your "My Tools" menu, or set it to false to disable it entirely. "toolbar"
appendToContentMenu Whether to append a content model change link to the context menu next to the page's "Edit" button. true
shortcutKey Sets the shortcut key to use. This has no effect if doKeyBind is set to false. "c"

Example configuration:

window.AjaxContentModel = {
    reaons: {
		'Main': {
        	'Test': 'Test',
		},
		'Other': {
			'Module Redirect': 'Module Redirect',
		},
    },
	doKeyBind: true,
	shortcutKey: "c",
	toolbarPlacement: "toolbar",
	appendToContentMenu: true,
};

Using configuration options with Fandom Developers Wiki scripts

The instructions on this page describe how to use configuration options with a script. Here on the Fandom Developers Wiki, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.

Configuration options load too late, don't work
// 1. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
Proper placement of configuration options
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;

// 2. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});
Text above can be found here (edit)