Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -1644,8 +1644,8 @@ |
1645 | 1645 | var msg = mw.msg ( 'articlefeedbackv5-error-response' ); |
1646 | 1646 | if ( 'error' in data && 'info' in data.error ) { |
1647 | 1647 | msg = data.error.info; |
1648 | | - } else if ( typeof console != 'undefined' ) { |
1649 | | - console.log(data); |
| 1648 | + } else { |
| 1649 | + aft5_debug(data); |
1650 | 1650 | } |
1651 | 1651 | $.articleFeedbackv5.markShowstopperError( msg ); |
1652 | 1652 | return; |
— | — | @@ -1944,8 +1944,8 @@ |
1945 | 1945 | $.articleFeedbackv5.bucketId, |
1946 | 1946 | { 'expires': cfg.expires, 'path': '/' } |
1947 | 1947 | ); |
1948 | | - if ( $.articleFeedbackv5.debug && typeof console != 'undefined' ) { |
1949 | | - console.log( 'Using bucket #' + $.articleFeedbackv5.bucketId ); |
| 1948 | + if ( $.articleFeedbackv5.debug ) { |
| 1949 | + aft5_debug( 'Using bucket #' + $.articleFeedbackv5.bucketId ); |
1950 | 1950 | } |
1951 | 1951 | }; |
1952 | 1952 | |
— | — | @@ -2342,9 +2342,7 @@ |
2343 | 2343 | * @param string message the message to display, if in dev |
2344 | 2344 | */ |
2345 | 2345 | $.articleFeedbackv5.markShowstopperError = function ( message ) { |
2346 | | - if ( typeof console != 'undefined' ) { |
2347 | | - console.log( message ); |
2348 | | - } |
| 2346 | + aft5_debug( message ); |
2349 | 2347 | var $err = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' ); |
2350 | 2348 | $err.text( $.articleFeedbackv5.debug && message ? message : mw.msg( 'articlefeedbackv5-error' ) ); |
2351 | 2349 | $err.html( $err.html().replace( "\n", '<br />' ) ); |
— | — | @@ -2395,9 +2393,7 @@ |
2396 | 2394 | } |
2397 | 2395 | } |
2398 | 2396 | if ( $.articleFeedbackv5.debug ) { |
2399 | | - if ( typeof console != 'undefined' ) { |
2400 | | - console.log( errors ); |
2401 | | - } |
| 2397 | + aft5_debug( errors ); |
2402 | 2398 | } |
2403 | 2399 | if ( 'markFormErrors' in $.articleFeedbackv5.currentBucket() ) { |
2404 | 2400 | $.articleFeedbackv5.currentBucket().markFormErrors( errors ); |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | } |
79 | 79 | }(); |
80 | 80 | if ( $aftDiv.articleFeedbackv5( 'inDebug' ) ) { |
81 | | - console.log( 'Using link option #' + linkBucket ); |
| 81 | + aft5_debug( 'Using link option #' + linkBucket ); |
82 | 82 | } |
83 | 83 | |
84 | 84 | /* Add section links */ |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js |
— | — | @@ -2,7 +2,20 @@ |
3 | 3 | * Script for Article Feedback Extension |
4 | 4 | */ |
5 | 5 | |
| 6 | +/** |
| 7 | + * Global debug function |
| 8 | + * |
| 9 | + * @param any Output message |
| 10 | + */ |
| 11 | +var aft5_debug = function( any ) { |
| 12 | + if ( typeof console != 'undefined' ) { |
| 13 | + console.log( any ); |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +/*** Main entry point ***/ |
6 | 18 | jQuery( function( $ ) { |
| 19 | + |
7 | 20 | // Load check, is this page ArticleFeedbackv5-enabled ? |
8 | 21 | // Keep in sync with ApiArticleFeedbackv5.php |
9 | 22 | if ( |
— | — | @@ -37,7 +50,6 @@ |
38 | 51 | // spaces instead. Revent to underscores here for sane comparison. |
39 | 52 | for( cat in categories['current'] ) { |
40 | 53 | categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_'); |
41 | | - console.log(categories['current'][cat]); |
42 | 54 | } |
43 | 55 | |
44 | 56 | // Category exclusion |