* (bug 9430) Update Cantonese translations
[mediawiki.git] / skins / common / block.js
blobc9c024468a53d6e4f03c170ebcdb91f83dfd9341
2 function considerChangingExpiryFocus() {
3         if (!document.getElementById) {
4                 return;
5         }
6         var drop = document.getElementById('wpBlockExpiry');
7         if (!drop) {
8                 return;
9         }
10         var field = document.getElementById('wpBlockOther');
11         if (!field) {
12                 return;
13         }
14         var opt = drop.value;
15         if (opt == 'other') {
16                 field.style.display = '';
17         } else {
18                 field.style.display = 'none';
19         }
22 function updateBlockOptions() {
23         if (!document.getElementById)
24                 return;
25         
26         var target = document.getElementById('mw-bi-target');
27         if (!target)
28                 return;
29         
30         var addy = target.value;
31         var isEmpty = addy.match(/^\s*$/);
32         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         
34         /*
35         var anonymousCheck = document.getElementById('wpAnonOnly');
36         anonymousCheck.disabled = !isIp && !isEmpty;
37         
38         var autoblockCheck = document.getElementById('wpEnableAutoblock');
39         autoblockCheck.disabled = isIp && !isEmpty;
40         */
42         var anonymousRow = document.getElementById('wpAnonOnlyRow');
43         anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : '';
44         
45         var autoblockRow = document.getElementById('wpEnableAutoblockRow');
46         autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';