Merge pull request #458 from owncloud/js_console_switch

Very simple js console switcher.
This commit is contained in:
Thomas Tanghus 2012-11-15 15:05:47 -08:00
commit b99213f7a7
4 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,19 @@
/**
* 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

View File

@ -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']; ?>';

View File

@ -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']; ?>';

View File

@ -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() ?>';