- Move console object initialization code into one place

release-0.6
alecpl 13 years ago
parent 71e8cc3bce
commit 909a3acb83

@ -219,12 +219,12 @@ class rcube_html_page
} }
} }
if (!empty($this->scripts['foot'])) { if (!empty($this->footer)) {
$page_footer .= sprintf($this->script_tag, $this->scripts['foot']); $page_footer .= $this->footer . "\n";
} }
if (!empty($this->footer)) { if (!empty($this->scripts['foot'])) {
$page_footer .= $this->footer; $page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
} }
// find page header // find page header

@ -428,10 +428,15 @@ class rcube_template extends rcube_html_page
if ($write) { if ($write) {
// add debug console // add debug console
if ($this->config['debug_level'] & 8) { if ($this->config['debug_level'] & 8) {
$this->add_footer('<div id="console" style="position:absolute;top:5px;left:5px;width:405px;padding:2px;background:white;z-index:9000;"> $this->add_footer('<div id="console" style="position:absolute;top:5px;left:5px;width:405px;padding:2px;background:white;z-index:9000;display:none">
<a href="#toggle" onclick="con=$(\'#dbgconsole\');con[con.is(\':visible\')?\'hide\':\'show\']();return false">console</a> <a href="#toggle" onclick="con=$(\'#dbgconsole\');con[con.is(\':visible\')?\'hide\':\'show\']();return false">console</a>
<textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:10px" spellcheck="false"></textarea></div>' <textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:10px" spellcheck="false"></textarea></div>'
); );
$this->add_script(
"if (!window.console || !window.console.log) {\n".
" window.console = new rcube_console();\n".
" $('#console').show();\n".
"}", 'foot');
} }
$this->write(trim($output)); $this->write(trim($output));
} }

@ -138,14 +138,6 @@ function rcube_webmail()
return; return;
} }
// Enable debug console
if (!window.console || !window.console.log) {
window.console = new rcube_console();
}
else {
$('#console').hide();
}
// find all registered gui containers // find all registered gui containers
for (var n in this.gui_containers) for (var n in this.gui_containers)
this.gui_containers[n] = $('#'+this.gui_containers[n]); this.gui_containers[n] = $('#'+this.gui_containers[n]);

Loading…
Cancel
Save