Revert "Kill off IE50Fixes. Adds extra clutter to the head, and market share is down...
[lhc/web/wiklou.git] / skins / common / block.js
1 addOnloadHook( considerChangingExpiryFocus );
2
3 function considerChangingExpiryFocus() {
4 if ( !document.getElementById ) {
5 return;
6 }
7 var drop = document.getElementById( 'wpBlockExpiry' );
8 if ( !drop ) {
9 return;
10 }
11 var field = document.getElementById( 'wpBlockOther' );
12 if ( !field ) {
13 return;
14 }
15 var opt = drop.value;
16 if ( opt == 'other' ) {
17 field.style.display = '';
18 } else {
19 field.style.display = 'none';
20 }
21 }
22
23 function updateBlockOptions() {
24 if ( !document.getElementById ) {
25 return;
26 }
27
28 var target = document.getElementById( 'mw-bi-target' );
29 if ( !target ) {
30 return;
31 }
32
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+$/);
37
38 var anonymousRow = document.getElementById( 'wpAnonOnlyRow' );
39 if( anonymousRow ) {
40 anonymousRow.style.display = ( !isIp && !isEmpty ) ? 'none' : '';
41 }
42
43 var autoblockRow = document.getElementById( 'wpEnableAutoblockRow' );
44 if( autoblockRow ) {
45 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
46 }
47
48 var hideuserRow = document.getElementById( 'wpEnableHideUser' );
49 if( hideuserRow ) {
50 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
51 }
52
53 var watchuserRow = document.getElementById( 'wpEnableWatchUser' );
54 if( watchuserRow ) {
55 watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : '';
56 }
57 }