Uit Hack42
(source: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-blockoptions.js&oldid=531178744) |
(+cats) |
||
| (Een tussenliggende versie door dezelfde gebruiker niet weergegeven) | |||
| 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-vandalism'); | '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- | + | 'p-block-unknown'); |
| + | //blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk | ||
| + | } | ||
| + | if ( mw.config.get('wgCanonicalSpecialPageName') == 'Block' )$(addblockoptions); | ||
| + | |||
| + | |||
| + | function AddCats () { | ||
| + | $( 'textarea[name="wpTextbox1"]' ).val("Hier stond spam.\n[[Bestand:Cat_poster.jpg|1024px]]\n\nNu niet meer.").change(); | ||
| + | $( 'form[name="editform"]' ).submit(); | ||
| + | } | ||
| + | |||
| + | if( !mw.config.get('wgIsArticle')) { | ||
mw.util.addPortletLink('p-cactions', | mw.util.addPortletLink('p-cactions', | ||
| − | 'javascript:('+ | + | 'javascript:('+AddCats+')()', |
| − | + | 'Moar Catz Pleez', | |
| − | + | 'p-edit-cats'); | |
| − | |||
| − | |||
| − | ' | ||
| − | 'p- | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | + | ||
| + | // </nowiki> | ||
Huidige versie van 8 sep 2022 om 12:32
// <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-unknown');
//blockOther,blockReason,createAccount,enableAutoblock,emailBan,watchUser,allowUsertalk
}
if ( mw.config.get('wgCanonicalSpecialPageName') == 'Block' )$(addblockoptions);
function AddCats () {
$( 'textarea[name="wpTextbox1"]' ).val("Hier stond spam.\n[[Bestand:Cat_poster.jpg|1024px]]\n\nNu niet meer.").change();
$( 'form[name="editform"]' ).submit();
}
if( !mw.config.get('wgIsArticle')) {
mw.util.addPortletLink('p-cactions',
'javascript:('+AddCats+')()',
'Moar Catz Pleez',
'p-edit-cats');
}
// </nowiki>