* (bug 13130) Moved edit token and autosummary fields above edit tools to
[mediawiki.git] / skins / common / block.js
blob78ae3bf2c6573e88ad0b0b14fcaf3abccf16d3b4
1 function considerChangingExpiryFocus() {
2         if (!document.getElementById) {
3                 return;
4         }
5         var drop = document.getElementById('wpBlockExpiry');
6         if (!drop) {
7                 return;
8         }
9         var field = document.getElementById('wpBlockOther');
10         if (!field) {
11                 return;
12         }
13         var opt = drop.value;
14         if (opt == 'other') {
15                 field.style.display = '';
16         } else {
17                 field.style.display = 'none';
18         }
21 function updateBlockOptions() {
22         if (!document.getElementById)
23                 return;
25         var target = document.getElementById('mw-bi-target');
26         if (!target)
27                 return;
29         var addy = target.value;
30         var isEmpty = addy.match(/^\s*$/);
31         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+)?$/);
33         var anonymousRow = document.getElementById('wpAnonOnlyRow');
34         if( anonymousRow ) {
35                 anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : '';
36         }
38         var autoblockRow = document.getElementById('wpEnableAutoblockRow');
39         if( autoblockRow ) {
40                 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
41         }
43         var emailblockRow = document.getElementById('wpEnableEmailBan');
44         if( emailblockRow ) {
45                 emailblockRow.style.display = isIp && !isEmpty ? 'none' : '';
46         }
47         
48         var hideuserRow = document.getElementById('wpEnableHideUser');
49         if( hideuserRow ) {
50                 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
51         }