[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 /*! 2 * JavaScript for Special:Block 3 */ 4 ( function ( mw, $ ) { 5 $( function () { 6 var $blockTarget = $( '#mw-bi-target' ), 7 $anonOnlyRow = $( '#mw-input-wpHardBlock' ).closest( 'tr' ), 8 $enableAutoblockRow = $( '#mw-input-wpAutoBlock' ).closest( 'tr' ), 9 $hideUser = $( '#mw-input-wpHideUser' ).closest( 'tr' ), 10 $watchUser = $( '#mw-input-wpWatch' ).closest( 'tr' ); 11 12 function updateBlockOptions( instant ) { 13 var blocktarget = $.trim( $blockTarget.val() ), 14 isEmpty = blocktarget === '', 15 isIp = mw.util.isIPv4Address( blocktarget, true ) || mw.util.isIPv6Address( blocktarget, true ), 16 isIpRange = isIp && blocktarget.match( /\/\d+$/ ); 17 18 if ( isIp && !isEmpty ) { 19 $enableAutoblockRow.goOut( instant ); 20 $hideUser.goOut( instant ); 21 } else { 22 $enableAutoblockRow.goIn( instant ); 23 $hideUser.goIn( instant ); 24 } 25 if ( !isIp && !isEmpty ) { 26 $anonOnlyRow.goOut( instant ); 27 } else { 28 $anonOnlyRow.goIn( instant ); 29 } 30 if ( isIpRange && !isEmpty ) { 31 $watchUser.goOut( instant ); 32 } else { 33 $watchUser.goIn( instant ); 34 } 35 } 36 37 if ( $blockTarget.length ) { 38 // Bind functions so they're checked whenever stuff changes 39 $blockTarget.keyup( updateBlockOptions ); 40 41 // Call them now to set initial state (ie. Special:Block/Foobar?wpBlockExpiry=2+hours) 42 updateBlockOptions( /* instant= */ true ); 43 } 44 } ); 45 }( mediaWiki, jQuery ) );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |