Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js |
— | — | @@ -46,36 +46,25 @@ |
47 | 47 | 'current': mw.config.get( 'wgCategories', [] ) |
48 | 48 | }; |
49 | 49 | |
50 | | - // Categories are configured with underscores, but article's categories are returned with |
51 | | - // spaces instead. Convert to underscores here for sane comparison. |
52 | | - for ( var cat in categories['current'] ) { |
53 | | - categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_'); |
54 | | - } |
55 | | - |
56 | | - // Category exclusion |
57 | | - var disable = false; |
58 | | - for ( var i = 0; i < categories.current.length; i++ ) { |
59 | | - if ( $.inArray( categories.current[i], categories.exclude ) > -1 ) { |
60 | | - disable = true; |
61 | | - break; |
62 | | - } |
63 | | - } |
64 | | - |
65 | | - // Category inclusion |
66 | 50 | var enable = false; |
67 | | - for ( var i = 0; i < categories.current.length; i++ ) { |
68 | | - if ( $.inArray( categories.current[i], categories.include ) > -1 ) { |
| 51 | + for( cat in categories['current'] ) { |
| 52 | + // Categories are configured with underscores, but article's categories are returned with |
| 53 | + // spaces instead. Revert to underscores here for sane comparison. |
| 54 | + categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_'); |
| 55 | + // Check exclusion - exclusion overrides everything else |
| 56 | + if( $.inArray( categories['current'][cat], categories.exclude ) > -1 ) { |
| 57 | + // Blacklist overrides everything else |
| 58 | + return; |
| 59 | + } |
| 60 | + if( $.inArray( categories['current'][cat], categories.include ) > -1 ) { |
| 61 | + // One match is enough for include, however we are iterating on the 'current' |
| 62 | + // categories, and others might be blacklisted - so continue iterating |
69 | 63 | enable = true; |
70 | | - break; |
71 | 64 | } |
72 | | - } |
| 65 | + } |
73 | 66 | |
74 | | - // Lottery inclusion |
75 | | - var wonLottery = ( Number( mw.config.get( 'wgArticleId', 0 ) ) % 1000 ) |
76 | | - < Number( mw.config.get( 'wgArticleFeedbackv5LotteryOdds', 0 ) ) * 10; |
77 | | - |
78 | 67 | // Lazy loading |
79 | | - if ( !disable && ( wonLottery || enable ) ) { |
| 68 | + if ( enable ) { |
80 | 69 | mw.loader.load( 'ext.articleFeedbackv5' ); |
81 | 70 | // Load the IE-specific module |
82 | 71 | if( navigator.appVersion.indexOf( 'MSIE' ) != -1 ) { |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -63,10 +63,10 @@ |
64 | 64 | // the new odds are applied to everyone, not just people who have yet to be |
65 | 65 | // placed in a bucket. |
66 | 66 | 'buckets' => array( |
67 | | - 'zero' => 25, |
68 | | - 'one' => 25, |
69 | | - 'two' => 25, |
70 | | - 'three' => 25, |
| 67 | + 'zero' => 0, |
| 68 | + 'one' => 34, |
| 69 | + 'two' => 33, |
| 70 | + 'three' => 33, |
71 | 71 | 'four' => 0, |
72 | 72 | 'five' => 0, |
73 | 73 | ), |