summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-03-15 08:24:19 +0000
committeralecpl <alec@alec.pl>2011-03-15 08:24:19 +0000
commit129aeff1991a37c4877fd6bf03825e084fe821fc (patch)
tree9f43f2e6110559d26e5d177d67bcefd2ed184bdd /program/js
parent3e63a0b898ecfdca5600ed6c56397048fd463453 (diff)
- Move console initialization to rcube.init(), hide console area if browser's console exists, some code cleanup
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js8
-rw-r--r--program/js/common.js26
2 files changed, 22 insertions, 12 deletions
diff --git a/program/js/app.js b/program/js/app.js
index fdd9d9c97..f81f8d5ee 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -135,6 +135,14 @@ function rcube_webmail()
return;
}
+ // Enable debug console
+ if (!window.console) {
+ 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]);
diff --git a/program/js/common.js b/program/js/common.js
index 5730e4ec2..4d3cbfac1 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -81,7 +81,7 @@ function roundcube_browser()
this.vendver = (/khtml\/([0-9\.]+)/.test(this.agent_lc)) ? parseFloat(RegExp.$1) : 0;
// get real language out of safari's user agent
- if(this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/.test(this.agent_lc)))
+ if (this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/.test(this.agent_lc)))
this.lang = RegExp.$1;
this.dhtml = ((this.ie4 && this.win) || this.ie5 || this.ie6 || this.ns4 || this.mz);
@@ -582,8 +582,8 @@ function rcube_find_object(id, d)
// determine whether the mouse is over the given object or not
function rcube_mouse_is_over(ev, obj)
{
- var mouse = rcube_event.get_mouse_pos(ev);
- var pos = $(obj).offset();
+ var mouse = rcube_event.get_mouse_pos(ev),
+ pos = $(obj).offset();
return ((mouse.x >= pos.left) && (mouse.x < (pos.left + obj.offsetWidth)) &&
(mouse.y >= pos.top) && (mouse.y < (pos.top + obj.offsetHeight)));
@@ -603,18 +603,23 @@ function setCookie(name, value, expires, path, domain, secure)
function getCookie(name)
{
- var dc = document.cookie;
- var prefix = name + "=";
- var begin = dc.indexOf("; " + prefix);
+ var dc = document.cookie,
+ prefix = name + "=",
+ begin = dc.indexOf("; " + prefix);
+
if (begin == -1) {
begin = dc.indexOf(prefix);
- if (begin != 0) return null;
+ if (begin != 0)
+ return null;
}
- else
+ else {
begin += 2;
+ }
+
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
+
return unescape(dc.substring(begin + prefix.length, end));
};
@@ -634,7 +639,7 @@ function rcube_console()
else
msg += '\n--------------------------------------\n';
- // Konqueror doesn't allows to just change value of hidden element
+ // Konqueror doesn't allow to just change the value of hidden element
if (bw.konq) {
box.innerText += msg;
box.value = box.innerText;
@@ -654,9 +659,6 @@ function rcube_console()
var bw = new roundcube_browser();
bw.set_html_class();
-if (!window.console)
- console = new rcube_console();
-
// Add escape() method to RegExp object
// http://dev.rubyonrails.org/changeset/7271