Uit Hack42
(source: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-blockoptions.js&oldid=531178744) |
(fixes) |
||
Regel 1: | Regel 1: | ||
− | function QuickBlock (blockOther,blockReason | + | // <nowiki> |
− | blockForm = document. | + | |
− | + | function QuickBlock (blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk) { | |
− | + | blockForm = document.evaluate("//form[contains(@action,'Speciaal:Blokkeren')]", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; | |
− | + | ||
− | + | $( '#mw-input-wpExpiry' ).find( 'select' ).val(blockOther).change(); | |
− | + | $( '#mw-input-wpReason' ).find( 'select' ).val("other").change(); | |
− | + | $( 'input[name="wpReason-other"]' ).val(blockReason); | |
− | + | $( 'input[name="wpCreateAccount"]' ).prop( "checked", createAccount==1 ); | |
− | + | $( 'input[name="wpDisableEmail"]' ).prop( "checked", emailBan==1 ); | |
− | + | $( 'input[name="wpDisableUTEdit"]' ).prop( "checked", allowUsertalk==1 ); | |
− | + | $( 'input[name="wpAutoBlock"]' ).prop( "checked", enableAutoblock==1 ); | |
− | + | $( 'input[name="wpWatch"]' ).prop( "checked", watchUser==1 ); | |
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
blockForm.submit(); | blockForm.submit(); | ||
} | } | ||
Regel 105: | Regel 43: | ||
} | } | ||
− | function addblockoptions() {//blockOther,blockReason | + | function addblockoptions() {//blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk |
mw.util.addPortletLink('p-cactions', | mw.util.addPortletLink('p-cactions', | ||
− | 'javascript:('+QuickBlock+')(" | + | 'javascript:('+QuickBlock+')("infinite","spam",1,1,1,0,1)', |
− | ' | + | 'spam: indef', |
− | 'p-block- | + | 'p-block-vandalism'); |
mw.util.addPortletLink('p-cactions', | mw.util.addPortletLink('p-cactions', | ||
− | 'javascript:('+QuickBlock+')(" | + | 'javascript:('+QuickBlock+')("infinite","?",1,1,1,0,0)', |
− | + | '?: indef', | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ' | ||
'p-block-vandalism'); | 'p-block-vandalism'); | ||
− | + | //blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | //blockOther,blockReason | ||
} | } | ||
− | if ( mw.config.get('wgCanonicalSpecialPageName') == ' | + | if ( mw.config.get('wgCanonicalSpecialPageName') == 'Block' )$(addblockoptions); |
+ | |||
+ | // </nowiki> |
Versie van 8 sep 2022 12:13
// <nowiki> function QuickBlock (blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk) { blockForm = document.evaluate("//form[contains(@action,'Speciaal:Blokkeren')]", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; $( '#mw-input-wpExpiry' ).find( 'select' ).val(blockOther).change(); $( '#mw-input-wpReason' ).find( 'select' ).val("other").change(); $( 'input[name="wpReason-other"]' ).val(blockReason); $( 'input[name="wpCreateAccount"]' ).prop( "checked", createAccount==1 ); $( 'input[name="wpDisableEmail"]' ).prop( "checked", emailBan==1 ); $( 'input[name="wpDisableUTEdit"]' ).prop( "checked", allowUsertalk==1 ); $( 'input[name="wpAutoBlock"]' ).prop( "checked", enableAutoblock==1 ); $( 'input[name="wpWatch"]' ).prop( "checked", watchUser==1 ); blockForm.submit(); } function userIsInGroup (group) { //are they in a given local group? if (mw.config.get('wgUserGroups')) { if (!group || group.length == 0) group = '*'; if (mw.config.get('wgUserGroups').join (' ').indexOf (group) != -1){ return true; } else{ return false; } } return false; } function userIsInGlobalGroup (group) { //are they in a given global group? if (mw.config.get('wgGlobalGroups')) { if (!group || group.length == 0) group = '*'; if (mw.config.get('wgGlobalGroups').join (' ').indexOf (group) != -1){ return true; } else{ return false; } } return false; } function addblockoptions() {//blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk mw.util.addPortletLink('p-cactions', 'javascript:('+QuickBlock+')("infinite","spam",1,1,1,0,1)', 'spam: indef', 'p-block-vandalism'); mw.util.addPortletLink('p-cactions', 'javascript:('+QuickBlock+')("infinite","?",1,1,1,0,0)', '?: indef', 'p-block-vandalism'); //blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk } if ( mw.config.get('wgCanonicalSpecialPageName') == 'Block' )$(addblockoptions); // </nowiki>