r105697 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105696‎ | r105697 | r105698 >
Date:19:20, 9 December 2011
Author:yonishostak
Status:ok
Tags:
Comment:
AFTv5: remove console references, introduce safe debug global function
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1644,8 +1644,8 @@
16451645 var msg = mw.msg ( 'articlefeedbackv5-error-response' );
16461646 if ( 'error' in data && 'info' in data.error ) {
16471647 msg = data.error.info;
1648 - } else if ( typeof console != 'undefined' ) {
1649 - console.log(data);
 1648+ } else {
 1649+ aft5_debug(data);
16501650 }
16511651 $.articleFeedbackv5.markShowstopperError( msg );
16521652 return;
@@ -1944,8 +1944,8 @@
19451945 $.articleFeedbackv5.bucketId,
19461946 { 'expires': cfg.expires, 'path': '/' }
19471947 );
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 );
19501950 }
19511951 };
19521952
@@ -2342,9 +2342,7 @@
23432343 * @param string message the message to display, if in dev
23442344 */
23452345 $.articleFeedbackv5.markShowstopperError = function ( message ) {
2346 - if ( typeof console != 'undefined' ) {
2347 - console.log( message );
2348 - }
 2346+ aft5_debug( message );
23492347 var $err = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' );
23502348 $err.text( $.articleFeedbackv5.debug && message ? message : mw.msg( 'articlefeedbackv5-error' ) );
23512349 $err.html( $err.html().replace( "\n", '<br />' ) );
@@ -2395,9 +2393,7 @@
23962394 }
23972395 }
23982396 if ( $.articleFeedbackv5.debug ) {
2399 - if ( typeof console != 'undefined' ) {
2400 - console.log( errors );
2401 - }
 2397+ aft5_debug( errors );
24022398 }
24032399 if ( 'markFormErrors' in $.articleFeedbackv5.currentBucket() ) {
24042400 $.articleFeedbackv5.currentBucket().markFormErrors( errors );
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js
@@ -77,7 +77,7 @@
7878 }
7979 }();
8080 if ( $aftDiv.articleFeedbackv5( 'inDebug' ) ) {
81 - console.log( 'Using link option #' + linkBucket );
 81+ aft5_debug( 'Using link option #' + linkBucket );
8282 }
8383
8484 /* Add section links */
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js
@@ -2,7 +2,20 @@
33 * Script for Article Feedback Extension
44 */
55
 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 ***/
618 jQuery( function( $ ) {
 19+
720 // Load check, is this page ArticleFeedbackv5-enabled ?
821 // Keep in sync with ApiArticleFeedbackv5.php
922 if (
@@ -37,7 +50,6 @@
3851 // spaces instead. Revent to underscores here for sane comparison.
3952 for( cat in categories['current'] ) {
4053 categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_');
41 - console.log(categories['current'][cat]);
4254 }
4355
4456 // Category exclusion

Status & tagging log