Added some profiling sections for expensive functions
[mediawiki.git] / skins / common / block.js
blob90211efa7c7c07ee5a997efe966d67fbb42ab4c0
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+)?$/);
34         var isIpRange = isIp && addy.match(/\/\d+$/);
36         var anonymousRow = document.getElementById('wpAnonOnlyRow');
37         if( anonymousRow ) {
38                 anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : '';
39         }
41         var autoblockRow = document.getElementById('wpEnableAutoblockRow');
42         if( autoblockRow ) {
43                 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
44         }
46         var emailblockRow = document.getElementById('wpEnableEmailBan');
47         if( emailblockRow ) {
48                 emailblockRow.style.display = isIp && !isEmpty ? 'none' : '';
49         }
50         
51         var hideuserRow = document.getElementById('wpEnableHideUser');
52         if( hideuserRow ) {
53                 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
54         }
56         var watchuserRow = document.getElementById('wpEnableWatchUser');
57         if( watchuserRow ) {
58                 watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : '';
59         }