Index: trunk/extensions/Survey/Survey.settings.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | |
22 | 22 | protected static function getDefaultSettings() { |
23 | 23 | return array( |
| 24 | + 'JSDebug' => false, |
24 | 25 | 'defaultEnabled' => false, |
25 | 26 | 'defaultUserType' => Survey::$USER_ALL, |
26 | 27 | 'defaultNamespaces' => array(), |
Index: trunk/extensions/Survey/INSTALL |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | You should NOT modify the settings file, but can have a look at it to get an idea of |
44 | 44 | how to use the settings, in case the below descriptions do not suffice. |
45 | 45 | |
46 | | -{| |
| 46 | +{| class="wikitable sortable" |
47 | 47 | ! Name |
48 | 48 | ! Type |
49 | 49 | ! Default |
— | — | @@ -77,4 +77,9 @@ |
78 | 78 | | integer |
79 | 79 | | 0 |
80 | 80 | | The default minimun amount of pages users should visit before getting a survey |
| 81 | +| - |
| 82 | +| JSDebug |
| 83 | +| boolean |
| 84 | +| false |
| 85 | +| Indicates if JavaScript debugging should be on or not. Should be false on production environments. |
81 | 86 | |} |
Index: trunk/extensions/Survey/includes/SurveyTag.php |
— | — | @@ -69,6 +69,11 @@ |
70 | 70 | |
71 | 71 | if ( !$loadedJs ) { |
72 | 72 | $parser->getOutput()->addModules( 'ext.survey.tag' ); |
| 73 | + $parser->getOutput()->addHeadItem( |
| 74 | + Skin::makeVariablesScript( array( |
| 75 | + 'wgSurveyDebug' => SurveySettings::get( 'JSDebug' ) |
| 76 | + ) ) |
| 77 | + ); |
73 | 78 | } |
74 | 79 | |
75 | 80 | return Html::element( |
Index: trunk/extensions/Survey/resources/ext.survey.js |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | window.survey = new( function() { |
11 | 11 | |
12 | 12 | this.log = function( message ) { |
13 | | - if ( true /* window.wgSurveyDebug */ ) { // TODO |
| 13 | + if ( mediaWiki.config.get( 'wgSurveyDebug' ) ) { |
14 | 14 | if ( typeof mediaWiki === 'undefined' ) { |
15 | 15 | if ( typeof console !== 'undefined' ) { |
16 | 16 | console.log( 'Survey: ' + message ); |