Index: trunk/phase3/skins/common/protect.js |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | var check = document.createElement('input'); |
17 | 17 | check.id = "mwProtectUnchained"; |
18 | 18 | check.type = "checkbox"; |
19 | | - check.onclick = protectChainUpdate; |
| 19 | + check.addEventListener( 'click', protectChainUpdate, false ); |
20 | 20 | col2.appendChild(check); |
21 | 21 | |
22 | 22 | var space = document.createTextNode(" "); |
— | — | @@ -42,30 +42,22 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | function allowCascade() { |
46 | | - var pr_types = document.getElementsByTagName("select"); |
47 | | - for (var i = 0; i < pr_types.length; i++) { |
48 | | - if (pr_types[i].id.match(/^mwProtect-level-/)) { |
49 | | - var selected_level = pr_types[i].getElementsByTagName("option")[pr_types[i].selectedIndex].value; |
50 | | - if ( !isCascadeableLevel(selected_level) ) { |
51 | | - document.getElementById('mwProtect-cascade').checked=false; |
52 | | - document.getElementById('mwProtect-cascade').disabled=true; |
| 46 | + var lists = protectSelectors(); |
| 47 | + for( var i = 0; i < lists.length; i++ ) { |
| 48 | + if( lists[i].selectedIndex > -1 ) { |
| 49 | + var items = lists[i].getElementsByTagName( 'option' ); |
| 50 | + var selected = items[ lists[i].selectedIndex ].value; |
| 51 | + if( wgCascadeableLevels.indexOf( selected ) == -1 ) { |
| 52 | + document.getElementById( 'mwProtect-cascade' ).checked = false; |
| 53 | + document.getElementById( 'mwProtect-cascade' ).disabled = true; |
53 | 54 | return false; |
54 | 55 | } |
55 | 56 | } |
56 | 57 | } |
57 | | - document.getElementById('mwProtect-cascade').disabled=false; |
| 58 | + document.getElementById( 'mwProtect-cascade' ).disabled = false; |
58 | 59 | return true; |
59 | 60 | } |
60 | 61 | |
61 | | -function isCascadeableLevel( level ) { |
62 | | - for (var k = 0; k < wgCascadeableLevels.length; k++) { |
63 | | - if ( wgCascadeableLevels[k] == level ) { |
64 | | - return true; |
65 | | - } |
66 | | - } |
67 | | - return false; |
68 | | -} |
69 | | - |
70 | 62 | function protectLevelsUpdate(source) { |
71 | 63 | if (!protectUnchained()) { |
72 | 64 | protectUpdateAll(source.selectedIndex); |