Don't load debugging javascript if debugging is off
Don't load debugging javascript if debugging is off

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -589,6 +589,10 @@
 				}
 			}
 		}
+
+		if ($this->log && $this->log->GetEnabled()) {
+			$this->tpl->assign('debug', true);
+		}
 	}
 
 	/**

--- a/js/common.js
+++ b/js/common.js
@@ -9,8 +9,8 @@
  * @subpackage Javascript
  */
 
-define(["jquery", "modules/getproject", "modules/lang", "modules/tooltip.snapshot", "modules/tooltip.commit", "modules/tooltip.tag", 'modules/loginpopup', 'modernizr', 'modules/debug'],
-	function($, project, lang, tooltipSnapshot, tooltipCommit, tooltipTag, loginpopup) {
+define(["jquery", "module", "modules/getproject", "modules/lang", "modules/tooltip.snapshot", "modules/tooltip.commit", "modules/tooltip.tag", 'modules/loginpopup', 'modernizr'],
+	function($, module, project, lang, tooltipSnapshot, tooltipCommit, tooltipTag, loginpopup) {
 		$(function() {
 			lang($('div.lang_select'));
 			tooltipSnapshot($('a.snapshotTip'));
@@ -23,6 +23,9 @@
       }
       loginpopup('a.loginLink');
 		});
+    if (module.config().debug) {
+      require(['modules/debug']);
+    }
 	}
 );
 

--- a/templates/main.tpl
+++ b/templates/main.tpl
@@ -62,6 +62,11 @@
 			project: '{$project->GetProject()}'
 		},
 		{/if}
+    {if $debug}
+    'common': {
+      debug: true
+    },
+    {/if}
 		'modules/geturl': {
 			baseurl: '{$baseurl}/'
 		},

comments