From cfdf044df284d294e0e73efb10ebce1052264694 Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 20 Dec 2006 14:05:23 +0000 Subject: Cleaned up scripts, merged redundant functionality --- program/js/app.js | 129 +++++++++++++++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 65 deletions(-) (limited to 'program/js/app.js') diff --git a/program/js/app.js b/program/js/app.js index 55e38bfda..434f1f45b 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -28,9 +28,10 @@ function rcube_webmail() this.commands = new Object(); this.onloads = new Array(); - // create public reference to myself + // create protected reference to myself rcube_webmail_client = this; this.ref = 'rcube_webmail_client'; + var ref = this; // webmail client settings this.dblclick_time = 500; @@ -315,9 +316,9 @@ function rcube_webmail() this.start_keepalive = function() { if (this.env.keep_alive && !this.env.framed && this.task=='mail' && this.gui_objects.messagelist) - this._int = setInterval(this.ref+'.check_for_recent()', this.env.keep_alive * 1000); + this._int = setInterval(function(){ ref.check_for_recent(); }, this.env.keep_alive * 1000); else if (this.env.keep_alive && !this.env.framed && this.task!='login') - this._int = setInterval(this.ref+'.send_keep_alive()', this.env.keep_alive * 1000); + this._int = setInterval(function(){ ref.send_keep_alive(); }, this.env.keep_alive * 1000); } @@ -669,10 +670,12 @@ function rcube_webmail() // open attachment in frame if it's of a supported mimetype if (this.env.uid && props.mimetype && find_in_array(props.mimetype, this.mimetypes)>=0) { + if (props.mimetype == 'text/html') + qstring += '&safe=1'; this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'); if (this.attachment_win) { - setTimeout(this.ref+'.attachment_win.focus()', 10); + setTimeout(function(){ ref.attachment_win.focus(); }, 10); break; } } @@ -849,19 +852,19 @@ function rcube_webmail() var uid; if (uid = this.get_single_uid()) { - this.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : '')); + ref.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : '')); if (this.printwin) - setTimeout(this.ref+'.printwin.focus()', 20); + setTimeout(function(){ ref.printwin.focus(); }, 20); } break; case 'viewsource': var uid; if (uid = this.get_single_uid()) - { - this.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox)); + { + ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox)); if (this.sourcewin) - setTimeout(this.ref+'.sourcewin.focus()', 20); + setTimeout(function(){ ref.sourcewin.focus(); }, 20); } break; @@ -983,7 +986,7 @@ function rcube_webmail() // set timer for requests if (a && this.env.request_timeout) - this.request_timer = setTimeout(this.ref+'.request_timed_out()', this.env.request_timeout * 1000); + this.request_timer = setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000); }; @@ -1091,7 +1094,7 @@ function rcube_webmail() // start timer for message preview (wait for double click) if (selected && this.env.contentframe) - this.preview_timer = setTimeout(this.ref+'.msglist_get_preview()', this.dblclick_time + 10); + this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, this.dblclick_time + 10); else if (this.env.contentframe) this.show_messageframe(false); } @@ -1333,24 +1336,8 @@ function rcube_webmail() return; } - var a_uids = new Array(); - - if (this.env.uid) - a_uids[a_uids.length] = this.env.uid; - else - { - var selection = this.message_list.get_selection(); - for (var n=0, id; n