AjaxDelete allows you to delete and undelete pages without leaving the page you're on, by showing a deletion modal when you click on any delete or undelete link. The modal can also be opened by pressing the D 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 delete and undelete pages normally.
Usage
The delete modal will show up when you click on any ?action=delete
link, using it is pretty self-explanatory. Select one of the generic delete/undelete 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>
. Check the "Watch this page" box if you wish to follow the article and then click "Delete" to delete it, or "Cancel" to close the modal.
When undeleting, a modal will pop up prompting you to input a reason. Clicking "Restore" will undelete the page, and "Cancel" will close the modal.
Customization
All custom variables are under the window.AjaxDelete
object.
To set custom delete reasons, you just need to add to the window.AjaxDelete.deleteReasons
object in the syntax: 'reason to submit': 'reason to display',
. And to set custom reasons for images, add to the window.AjaxDelete.imageDeleteReasons
object in the same syntax.
The "Watch this page" checkbox is checked by default. To stop this behavior, set the window.AjaxDelete.autoCheckWatch
boolean to false
.
The script also provides an AJAX Undelete modal. If you don't wish for this to appear, you can set window.AjaxDelete.noUndelete
boolean to true
.
If you wish the page to reload after deleting or undeleting instead of just showing the banner, set window.AjaxDelete.reload
boolean to true
.
Example configuration:
window.AjaxDelete = {
deleteReasons: {
'[[w:Help:Vandalism|Vandalism]]': 'Vandalism',
'[[w:Help:Spam|Spam]]': 'Spam',
'Marked for speedy deletion': 'Speedy',
'Empty page': 'Empty',
'Author request': 'Author request',
'Irrelevant to <insert wiki topic here>': 'Irrelevant',
'Failed to comply with the [[Project:Manual of Style|manual of style]] for over 6 months': 'MoS'
},
imageDeleteReasons: {
'Offensive': 'Offensive',
'Inappropriate': 'Inappropriate',
'Harassment': 'Harassment',
'Housekeeping/Unused': 'Unused',
'Copyright infringement': 'Copyright',
'Author request': 'Author request'
},
autoCheckWatch: false,
noUndelete: true,
reload: 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.
// 1. AjaxRC import statement
importArticles({
type: 'script',
articles: [
'u:dev:MediaWiki:AjaxRC.js'
]
});
// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;
// 2. AjaxRC import statement
importArticles({
type: 'script',
articles: [
'u:dev:MediaWiki:AjaxRC.js'
]
});
All default values from the dropdowns are taken from their respective MediaWiki pages (MediaWiki:Deletereason-dropdown and MediaWiki:Filedelete-reason-dropdown).