2 * Legacy emulation for the now depricated block.js
4 * Ported by: Trevor Parscal
10 'considerChangingExpiryFocus': function() {
11 var $expiry
= $( '#wpBlockExpiry' );
12 var $other
= $( '#wpBlockOther' );
13 if ( $expiry
.length
&& $other
.length
) {
14 if ( $expiry
.val() == 'other' ) {
15 $other
.css( 'display', '' );
17 $other
.css( 'display', 'none' );
21 'updateBlockOptions': function() {
22 var $target
= $( '#mw-bi-target' );
23 if ( $target
.length
) {
24 var address
= $target
.val();
25 var isEmpty
= address
.match( /^\s*$/ );
26 var isIp
= address
.match( /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/ );
27 var isIpRange
= isIp
&& address
.match( /\/\d+$/ );
29 $( '#wpAnonOnlyRow' ).css( 'display', !isIp
&& !isEmpty
? 'none' : '' );
30 $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 'display', isIp
&& !isEmpty
? 'none' : '' );
31 $( '#wpEnableWatchUser' ).css( 'display', isIpRange
&& !isEmpty
? 'none' : '' );
38 $( document
).ready( function() {
39 mw
.legacy
.considerChangingExpiryFocus();