summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-12-17 21:28:37 +0000
committerthomascube <thomas@roundcube.net>2006-12-17 21:28:37 +0000
commita7d5c6480cdef191b04e71005ffea0e35b84ac24 (patch)
tree2417f87ab39eb74765da109af8fb62bb730b9090 /program/js
parent5b0687dfcabb7258902f070057fc8a41ba27a776 (diff)
Added patch for resizeable preview pane
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js31
-rw-r--r--program/js/common.js31
-rw-r--r--program/js/list.js4
3 files changed, 56 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js
index d47f4278e..4bb261cda 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -26,6 +26,7 @@ function rcube_webmail()
this.buttons = new Object();
this.gui_objects = new Object();
this.commands = new Object();
+ this.onloads = new Array();
// create public reference to myself
rcube_webmail_client = this;
@@ -77,13 +78,17 @@ function rcube_webmail()
this.buttons[command][this.buttons[command].length] = button_prop;
};
-
// register a specific gui object
this.gui_object = function(name, id)
{
this.gui_objects[name] = id;
};
-
+
+ // execute the given script on load
+ this.add_onload = function(f)
+ {
+ this.onloads[this.onloads.length] = f;
+ };
// initialize webmail client
this.init = function()
@@ -101,7 +106,7 @@ function rcube_webmail()
// find all registered gui objects
for (var n in this.gui_objects)
this.gui_objects[n] = rcube_find_object(this.gui_objects[n]);
-
+
// tell parent window that this frame is loaded
if (this.env.framed && parent.rcmail && parent.rcmail.set_busy)
parent.rcmail.set_busy(false);
@@ -293,6 +298,16 @@ function rcube_webmail()
// start keep-alive interval
this.start_keepalive();
+
+
+ // execute all foreign onload scripts
+ for (var i=0; i<this.onloads.length; i++)
+ {
+ if (typeof(this.onloads[i]) == 'string')
+ eval(this.onloads[i]);
+ else if (typeof(this.onloads[i]) == 'function')
+ this.onloads[i]();
+ }
};
@@ -678,7 +693,7 @@ function rcube_webmail()
this.show_message(this.env.next_uid, false, this.env.action=='preview');
break;
- case 'lastmessage':
+ case 'lastmessage':
if (this.env.last_uid)
this.show_message(this.env.last_uid);
break;
@@ -1209,6 +1224,7 @@ function rcube_webmail()
add_url += '&_refresh=1';
this.env.current_page = page;
this.message_list.clear_selection();
+ this.show_messageframe(false);
}
// also send search request to get the right messages
@@ -1324,17 +1340,16 @@ function rcube_webmail()
else
{
var selection = this.message_list.get_selection();
- var id;
- for (var n=0; n<selection.length; n++)
+ for (var n=0, id; n<selection.length; n++)
{
id = selection[n];
a_uids[a_uids.length] = id;
this.message_list.remove_row(id);
}
- this.message_list.select_next();
+ this.show_messageframe(false);
}
-
+
var lock = false;
// show wait message
diff --git a/program/js/common.js b/program/js/common.js
index d5ecf8f89..2df349a91 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -530,6 +530,33 @@ function rcube_get_object_pos(obj)
return {x:iX, y:iY};
}
+
+
+/**
+ * Return the currently applied value of a css property
+ *
+ * @param {Object} html_element Node reference
+ * @param {String} css_property Property name to read in Javascript notation (eg. 'textAlign')
+ * @param {String} mozilla_equivalent Equivalent property name in CSS notation (eg. 'text-align')
+ * @return CSS property value
+ * @type String
+ */
+function get_elements_computed_style(html_element, css_property, mozilla_equivalent)
+ {
+ if (arguments.length==2)
+ mozilla_equivalent = css_property;
+
+ var el = html_element;
+ if (typeof(html_element)=='string')
+ el = nex_get_object(html_element);
+
+ if (el && el.currentStyle)
+ return el.currentStyle[css_property];
+ else if (el && document.defaultView && document.defaultView.getComputedStyle)
+ return document.defaultView.getComputedStyle(el, null).getPropertyValue(mozilla_equivalent);
+ else
+ return false;
+ }
// cookie functions by GoogieSpell
@@ -543,6 +570,8 @@ function setCookie(name, value, expires, path, domain, secure)
document.cookie = curCookie;
}
+roundcube_browser.prototype.set_cookie = setCookie;
+
function getCookie(name)
{
var dc = document.cookie;
@@ -561,5 +590,7 @@ function getCookie(name)
return unescape(dc.substring(begin + prefix.length, end));
}
+roundcube_browser.prototype.get_cookie = getCookie;
+
var bw = new roundcube_browser();
diff --git a/program/js/list.js b/program/js/list.js
index eac19bb60..0797295ee 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -272,7 +272,7 @@ get_next_row: function()
return false;
var last_selected_row = this.rows[this.last_selected];
- var new_row = last_selected_row && last_selected_row.obj.nextSibling;
+ var new_row = last_selected_row ? last_selected_row.obj.nextSibling : null;
while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none'))
new_row = new_row.nextSibling;
@@ -285,7 +285,7 @@ get_prev_row: function()
return false;
var last_selected_row = this.rows[this.last_selected];
- var new_row = last_selected_row && last_selected_row.obj.previousSibling;
+ var new_row = last_selected_row ? last_selected_row.obj.previousSibling : null;
while (new_row && (new_row.nodeType != 1 || new_row.style.display == 'none'))
new_row = new_row.previousSibling;