Localization: Splitting the date and time in the 'userrestricted-indef' messages...
[mediawiki.git] / skins / common / block.js
blob6f7be0cd7b209ade9f9b3682369d09f53d72106b
1 addOnloadHook(considerChangingExpiryFocus);
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         }
23 function updateBlockOptions() {
24         if (!document.getElementById)
25                 return;
27         var target = document.getElementById('mw-bi-target');
28         if (!target)
29                 return;
31         var addy = target.value;
32         var isEmpty = addy.match(/^\s*$/);
33         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+)?$/);
35         var anonymousRow = document.getElementById('wpAnonOnlyRow');
36         if( anonymousRow ) {
37                 anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : '';
38         }
40         var autoblockRow = document.getElementById('wpEnableAutoblockRow');
41         if( autoblockRow ) {
42                 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
43         }
45         var emailblockRow = document.getElementById('wpEnableEmailBan');
46         if( emailblockRow ) {
47                 emailblockRow.style.display = isIp && !isEmpty ? 'none' : '';
48         }
49         
50         var hideuserRow = document.getElementById('wpEnableHideUser');
51         if( hideuserRow ) {
52                 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
53         }