Index: trunk/phase3/skins/common/protect.js |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | if( lists[i].selectedIndex > -1 ) { |
49 | 49 | var items = lists[i].getElementsByTagName( 'option' ); |
50 | 50 | var selected = items[ lists[i].selectedIndex ].value; |
51 | | - if( wgCascadeableLevels.indexOf( selected ) == -1 ) { |
| 51 | + if( !isCascadeableLevel(selected) ) { |
52 | 52 | document.getElementById( 'mwProtect-cascade' ).checked = false; |
53 | 53 | document.getElementById( 'mwProtect-cascade' ).disabled = true; |
54 | 54 | return false; |
— | — | @@ -58,6 +58,15 @@ |
59 | 59 | return true; |
60 | 60 | } |
61 | 61 | |
| 62 | +function isCascadeableLevel( level ) { |
| 63 | + for (var k = 0; k < wgCascadeableLevels.length; k++) { |
| 64 | + if ( wgCascadeableLevels[k] == level ) { |
| 65 | + return true; |
| 66 | + } |
| 67 | + } |
| 68 | + return false; |
| 69 | +} |
| 70 | + |
62 | 71 | /** |
63 | 72 | * When protection levels are locked together, update the rest |
64 | 73 | * when one action's level changes |