Fandom Developers Wiki
Advertisement

Diese Seite (oder ein Abschnitt dieser) wurde immer noch nicht übersetzt. Bitte übersetze sie in der vorgegebenen Sprache (Deutsch).

AjaxBlock allows you to block and unblock users without leaving the current page you're on, by showing a block modal when you click on any block/unblock link.

Note: The modal won't open if you're holding either the ⇧ Shift or Ctrl key. This is to allow users to access the block and unblock special pages normally.

Installation[]

Verwendung[]

The block modal will show up when you click on any Special:Block link with a target. Using it is pretty self-explanatory. Set a block length from either the dropdown or typing on the input the custom time you prefer (times like 4 months and 2 weeks are acceptable formats). Then select one of the common block 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 result in: <common reason>: <further ellaboration>. Check the options you'd like to be applied to the block and finally click the "Block this user" button, or "Cancel" to close the modal.

When unblocking, a modal will pop up prompting you to input a reason. Clicking "Unblock this user" will unblock the user, or "Cancel" to close the modal.

Customization[]

All custom variables are under the window.AjaxBlock object.

Custom default expiry times[]

To set custom expiry times, you just need to add to the window.AjaxBlock.expiryTimes object using the syntax: 'time to submit': 'time to display',. For example:

window.AjaxBlock = {
    expiryTimes: {
        '2 hours': '2 hours',
        '1 day': 'one day',
        '1 week': 'a week',
        '2 months 4 weeks 2 days 7 hours': 'overly specific block duration'
    }
};

The default is grabbed from MediaWiki:Ipboptions. On most English wikis, it's: 2 hours, 5 hours, 12 hours, 1 day, 3 days, 5 days, 1 week, 2 weeks, 1 month, 3 months, 6 months, 1 year, 2 years, 3 years, infinite.

Custom default block reasons[]

Pretty much the same as with expiry times, but you have to change window.AjaxBlock.blockReasons. For example:

window.AjaxBlock = {
    blockReasons: {
        '[[w:Help:Vandalism|Vandalism]]': 'Vandalism',
        '[[w:Help:Spam|Spam]]': 'Spam',
        'Under the legal age': 'COPPA',
        'Removing information/blanking articles': 'Blanking',
        'Failing to comply with the [[Project:File Policy|File Policy]]': 'File policy'
    }
};

There's a fancier syntax in case you want grouped reasons like the ones generated with the MediaWiki page. It does require some finnicky code so it's advised to stay away from it unless you're experienced with JavaScript object notation. An example can be found at the bottom of the page.

The defaults are grabbed from MediaWiki:Ipbreason-dropdown, so you may not need this setting!

Custom default unblock reasons[]

The object below represents the custom default unblock reasons selection. Pretty much the same as with the block reasons. But with unblock reasons. And it's window.AjaxBlock.unblockReasons. For example:

window.AjaxBlock = {
    unblockReasons: {
        'Error': 'Error',
        'Appealed': 'Appealed',
        'Covered by a Bigger Range Block': 'Range block'
    }
};

There are no defaults. If you don't provide this, you'll have to type out the unblock reason manually. Of course, Special:Unblock doesn't have a dropdown either, so it should be fine.

Auto-check options

Automatically checked checkboxes on the block modal. talk specifies whether the user will be stripped of rights to post on their talk page or message wall. autoBlock specifies whether the user will be autoblocked with their subsequent IPs. override specifies whether to override the current block. And noCreate specifies whether to prevent the user from creating new accounts. That one doesn't work.

window.AjaxBlock = {
    check: {
        talk: true,
        autoBlock: true,
        override: true,
        noCreate: true,
    }
};

talk and autoBlock are unchecked by default.

Example configuration[]

window.AjaxBlock = {
    expiryTimes: {
        '2 hours': '2 hours',
        '1 day': 'one day',
        '1 week': 'a week',
        '2 months': '2m',
        'never': 'Never'
    },
    blockReasons: {
        '[[w:Help:Vandalism|Vandalism]]': 'Vandalism',
        '[[w:Help:Spam|Spam]]': 'Spam',
        'Under the legal age': 'COPPA',
        'Removing information/blanking articles': 'Blanking',
        'Failing to comply with the [[Project:File Policy|File Policy]]': 'File policy'
    },
    unblockReasons: {
        'Error': 'Error',
        'Appealed': 'Appealed',
        'Covered by a Bigger Range Block': 'Range block'
    },
    check: {
        talk: true,
        autoBlock: true,
        override: true,
        noCreate: true
    }
};

Example configuration with all parameters[]

window.AjaxBlock = {
    blockReasons: {
        'General': {
            '[[w:c:community:Help:Vandalism|Vandalism]]': 'Vandalism',
            '[[WP:WP:CRV|Removing Content From Pages]]': 'Removing Content From Pages',
            '[[WP:WP:DISRUPT|Disruptive Editing]]': 'Disruptive Editing',
            '[[WP:WP:Disinformation|Inserting False Information]]': 'Inserting False Information',
            'Creating Nonsense/[[w:c:community:Help:Vandalism|Vandalism]] Articles': 'Creating Spam Articles',
            'Inserting nonsense/gibberish into pages': 'Inserting nonsense/gibberish into pages',
        },
        'Accounts': {
            '[[wP:Wp:PROXY|Open Proxy/VPN]]': '[[wP:Wp:PROXY|Open Proxy/VPN]]',
            '[[WP:WP:VOA|Vandalism-Only Account]]': 'Vandalisn-Only Account',
            '[[WP:WP:IU|Unacceptable Username]]': 'Unacceptable Username',
            'Abusing Multiple Accounts ([[WP:WP:SOCK|Sockpuppetry]])': 'Sockpuppety',
            'Long-Term Abuse': 'Long-Term Abuse',
        },
        'Spam': {
            '[[w:Help:Spam|Spam/Advertising]] Only account': 'Spam/Advertising Only account',
            '[[w:Help:Spam|Spam/Advertising]]': 'Spam/Advertising',
            '[[WP:WP:LINKSPAM|Spamming Links to External Sites]]': 'External Link Spam',
            '[[WP:WP:SPAM|Posting Spam on Userpage]]': 'Posting Spam on Userpage',
        },
        'Comments': {
            '[[Project:Article Comment Guidelines|Spamming Nonsense Comments/Posts]]': 'Spamming Nonsense Comments/Posts',
            'Intimidating/Harassing Comments/Posts': 'Intimidating/Harassing Comments/Posts',
            'Swearing in Comments/Discussions': 'Swearing in Comments/Discussions'
        },
    },
    unblockReasons: {
        'Error': 'Error',
        'Appealed': 'Appealed',
        'Covered by a Bigger Range Block': 'Range block'
    },
    expiryTimes: {
        '2 hours': '2 hours',
        '1 day': 'one day',
        '1 week': 'a week',
        '2 months': '2m',
        'never': 'Never'
    },
    check: {
        talk: true,
        autoBlock: true,
        override: true,
        noCreate: 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'
    ]
});
Advertisement