From 909a3acb83c66aafa545eb086921a422a69cfabe Mon Sep 17 00:00:00 2001 From: alecpl Date: Tue, 26 Jul 2011 10:54:18 +0000 Subject: - Move console object initialization code into one place --- program/include/rcube_html_page.php | 8 ++++---- program/include/rcube_template.php | 7 ++++++- program/js/app.js | 8 -------- 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'program') diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php index 0cceb8964..200233c5d 100644 --- a/program/include/rcube_html_page.php +++ b/program/include/rcube_html_page.php @@ -219,12 +219,12 @@ class rcube_html_page } } - if (!empty($this->scripts['foot'])) { - $page_footer .= sprintf($this->script_tag, $this->scripts['foot']); + if (!empty($this->footer)) { + $page_footer .= $this->footer . "\n"; } - if (!empty($this->footer)) { - $page_footer .= $this->footer; + if (!empty($this->scripts['foot'])) { + $page_footer .= sprintf($this->script_tag, $this->scripts['foot']); } // find page header diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index a4c1a6915..a672c5058 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -428,10 +428,15 @@ class rcube_template extends rcube_html_page if ($write) { // add debug console if ($this->config['debug_level'] & 8) { - $this->add_footer('
+ $this->add_footer('' ); + $this->add_script( + "if (!window.console || !window.console.log) {\n". + " window.console = new rcube_console();\n". + " $('#console').show();\n". + "}", 'foot'); } $this->write(trim($output)); } diff --git a/program/js/app.js b/program/js/app.js index 0ec920b3a..b424f006a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -138,14 +138,6 @@ function rcube_webmail() return; } - // Enable debug console - if (!window.console || !window.console.log) { - window.console = new rcube_console(); - } - else { - $('#console').hide(); - } - // find all registered gui containers for (var n in this.gui_containers) this.gui_containers[n] = $('#'+this.gui_containers[n]); -- cgit v1.2.3