Fandom Developers Wiki
(This script adds a feature, not fixes a bug, I believe the one that should be archived is the '''UserpageEditDropdownDelete''' component of Sofix)
(Adding {{ConfigOptions}} and other minor changes.)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
| Author = [[User:Sophiedp|Sophie]]
 
| Author = [[User:Sophiedp|Sophie]]
 
| Other attribution = [[User:Thundercraft5|Thundercraft5]] {{{suggestion|(suggestion for protection and customization reasons)}}}
 
| Other attribution = [[User:Thundercraft5|Thundercraft5]] {{{suggestion|(suggestion for protection and customization reasons)}}}
| Updated = {{Updated|MediaWiki:DeleteUserpage.js}}
+
| Code = [[MediaWiki:DeleteUserpage.js|DeleteUserpage.js]]
| Code = [[MediaWiki:DeleteUserpage.js|code.js]]
 
 
| Status = stable
 
| Status = stable
 
| Type = user
 
| Type = user
Line 49: Line 48:
   
 
{{{example-config|Here is an example configuration of the script using the variables above:}}}
 
{{{example-config|Here is an example configuration of the script using the variables above:}}}
  +
{{#tag:syntaxhighlight|
{{#tag:source|window.DeleteUserpage = {
+
window.DeleteUserpage = {
 
noConfirm: true,
 
noConfirm: true,
 
protect: true,
 
protect: true,
Line 56: Line 56:
 
expiry: '{{{example-config-expiry|1 week}}}'
 
expiry: '{{{example-config-expiry|1 week}}}'
 
}
 
}
|lang=javascript}}
+
|lang=javascript
  +
}}
  +
{{#if:{{SUBPAGENAME}}|{{ConfigOptions/{{int:lang}}}}|{{ConfigOptions}}}}
 
</includeonly>
 
</includeonly>

Latest revision as of 18:06, 9 July 2022

DeleteUserpage adds a button to delete a user's userpage on their contributions page.

Installation

Configuration

To configure the script, you can set the following keys in the window.DeleteUserpage object:

Name Type What it does
noConfirm boolean Controls if you get a confirmation for deleting/protecting the userpage
deleteReason string Custom delete reason
protectReason string Custom protection reason
reason string Custom reason, used for both protecting and deleting, if a custom reason isn't set for that individual action
protect boolean Switch to enable protection of the userpage after deletion, needs to be set to true to get the option to protect the page
expiry string Custom protection length

Here is an example configuration of the script using the variables above:

window.DeleteUserpage = {
   noConfirm: true,
   protect: true,
   deleteReason: 'spam',
   protectReason: 'spam',
   expiry: '1 week'
}

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)