diff options
Diffstat (limited to 'CheckUser/modules')
-rw-r--r-- | CheckUser/modules/ext.checkuser.caMultiLock.js | 35 | ||||
-rw-r--r-- | CheckUser/modules/ext.checkuser.cidr.js | 10 |
2 files changed, 40 insertions, 5 deletions
diff --git a/CheckUser/modules/ext.checkuser.caMultiLock.js b/CheckUser/modules/ext.checkuser.caMultiLock.js new file mode 100644 index 00000000..99d62e26 --- /dev/null +++ b/CheckUser/modules/ext.checkuser.caMultiLock.js @@ -0,0 +1,35 @@ +/** + * Adds a link to Special:MultiLock on a central wiki if $wgCheckUserCAMultiLock + * is configured on the Special:CheckUser's block form + */ +( function ( mw, $ ) { + var centralURL = mw.config.get( 'wgCUCAMultiLockCentral' ), + $userCheckboxes = $( '#checkuserresults li :checkbox' ); + + // Initialize the link + $( '#checkuserblock fieldset' ).append( + $( '<a>', { + id: 'cacu-multilock-link', + text: mw.msg( 'checkuser-centralauth-multilock' ), + href: centralURL, + } ) + ); + + // Change the URL of the link when a checkbox's state is changed + $userCheckboxes.on( 'change', function() { + var names = []; + $.each( $userCheckboxes.serializeArray(), function( i, obj ) { + if ( obj.name && obj.name === 'users[]' ) { + // Only registered accounts (not IPs) can be locked + if ( !mw.util.isIPAddress( obj.value ) ) { + names.push( obj.value ); + } + } + } ); + + var mlHref = centralURL + '?wpTarget=' + encodeURIComponent( names.join( '\n' ) ); + // Update the href of the link with the latest change + $( '#cacu-multilock-link' ).prop( 'href', mlHref ); + } ); + +}( mediaWiki, jQuery ) ); diff --git a/CheckUser/modules/ext.checkuser.cidr.js b/CheckUser/modules/ext.checkuser.cidr.js index c305273b..f07bfd15 100644 --- a/CheckUser/modules/ext.checkuser.cidr.js +++ b/CheckUser/modules/ext.checkuser.cidr.js @@ -1,6 +1,4 @@ /* -- (c) Aaron Schulz 2009 */ -/*global mediaWiki*/ - ( function ( mw, $ ) { var showResults = function ( size, cidr ) { $( '#mw-checkuser-cidr-res' ).val( cidr ); @@ -30,6 +28,8 @@ var updateCIDRresult = function () { ips = text.split( '\t' ); } else if ( text.indexOf( ',' ) !== -1 ) { ips = text.split( ',' ); + } else if ( text.indexOf( ' - ' ) !== -1 ) { + ips = text.split( ' - ' ); } else if ( text.indexOf( '-' ) !== -1 ) { ips = text.split( '-' ); } else if ( text.indexOf( ' ' ) !== -1 ) { @@ -177,7 +177,7 @@ var updateCIDRresult = function () { // Build the IP in CIDR form prefixCidr = binPrefix.length; // CIDR too small? - if ( prefixCidr < 96 ) { + if ( prefixCidr < 32 ) { showResults( '!', '>' + Math.pow( 2, 128 - prefixCidr ) ); return; // too big } @@ -252,8 +252,8 @@ var hex2int = function ( hex ) { $( function () { updateCIDRresult(); - $( '#mw-checkuser-iplist' ).bind( 'keyup click', function () { + $( '#mw-checkuser-iplist' ).on( 'keyup click', function () { updateCIDRresult(); } ); } ); -} )( mediaWiki, jQuery );
\ No newline at end of file +} )( mediaWiki, jQuery ); |