diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-11-15 19:43:10 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-11-15 19:43:10 +0100 |
commit | b51b9539d074222d01bd4a9836be6fe2f191a31e (patch) | |
tree | c5aff4e3f55fceb97eb6c747c61bff4307658eb6 /core | |
parent | 8a93cc14f66b6d2d725ae52ce0bf632a03fac59d (diff) | |
download | nextcloud-server-b51b9539d074222d01bd4a9836be6fe2f191a31e.tar.gz nextcloud-server-b51b9539d074222d01bd4a9836be6fe2f191a31e.zip |
Very simple js console switcher.
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 16 | ||||
-rw-r--r-- | core/templates/layout.base.php | 1 | ||||
-rw-r--r-- | core/templates/layout.guest.php | 1 | ||||
-rw-r--r-- | core/templates/layout.user.php | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js index 164fab80ed4..3b4cabe710b 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1,4 +1,20 @@ /** + * Disable console output unless DEBUG mode is enabled. + * Add + * define('DEBUG', true); + * To the end of config/config.php to enable debug mode. + */ +if (oc_debug !== true) { + if (!window.console) { + window.console = {}; + } + var methods = ['log', 'debug', 'warn', 'info', 'error', 'assert']; + for (var i = 0; i < methods.length; i++) { + console[methods[i]] = function () { }; + } +} + +/** * translate a string * @param app the id of the app for which to translate the string * @param text the string to translate diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php index d8f83058775..47f4b423b3e 100644 --- a/core/templates/layout.base.php +++ b/core/templates/layout.base.php @@ -8,6 +8,7 @@ <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> <?php endforeach; ?> <script type="text/javascript"> + var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>; var oc_webroot = '<?php echo OC::$WEBROOT; ?>'; var oc_appswebroots = <?php echo $_['apps_paths'] ?>; var oc_requesttoken = '<?php echo $_['requesttoken']; ?>'; diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 2eaa517b324..e83d9e1a682 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -8,6 +8,7 @@ <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> <?php endforeach; ?> <script type="text/javascript"> + var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>; var oc_webroot = '<?php echo OC::$WEBROOT; ?>'; var oc_appswebroots = <?php echo $_['apps_paths'] ?>; var oc_requesttoken = '<?php echo $_['requesttoken']; ?>'; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 451a4685e82..ba5053edecf 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -8,6 +8,7 @@ <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> <?php endforeach; ?> <script type="text/javascript"> + var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>; var oc_webroot = '<?php echo OC::$WEBROOT; ?>'; var oc_appswebroots = <?php echo $_['apps_paths'] ?>; var oc_current_user = '<?php echo OC_User::getUser() ?>'; |