1 addOnloadHook( considerChangingExpiryFocus );
3 function considerChangingExpiryFocus() {
4 if ( !document.getElementById ) {
7 var drop = document.getElementById( 'wpBlockExpiry' );
11 var field = document.getElementById( 'wpBlockOther' );
16 if ( opt == 'other' ) {
17 field.style.display = '';
19 field.style.display = 'none';
23 function updateBlockOptions() {
24 if ( !document.getElementById ) {
28 var target = document.getElementById( 'mw-bi-target' );
33 var addy = target.value;
34 var isEmpty = addy.match(/^\s*$/);
35 var isIp = addy.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+)?$/);
36 var isIpRange = isIp && addy.match(/\/\d+$/);
38 var anonymousRow = document.getElementById( 'wpAnonOnlyRow' );
40 anonymousRow.style.display = ( !isIp && !isEmpty ) ? 'none' : '';
43 var autoblockRow = document.getElementById( 'wpEnableAutoblockRow' );
45 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
48 var hideuserRow = document.getElementById( 'wpEnableHideUser' );
50 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
53 var watchuserRow = document.getElementById( 'wpEnableWatchUser' );
55 watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : '';