From ab0b51a1fef87bcc643c3aaf2e635c811b28ccd8 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Tue, 15 Feb 2011 06:10:59 -0500 Subject: [PATCH] - Use only one from IMAP authentication methods to prevent login delays (1487784) --- program/js/googiespell.js | 69 +++++++++++++++++++--------------- 1 files changed, 39 insertions(+), 30 deletions(-) diff --git a/program/js/googiespell.js b/program/js/googiespell.js index a9879f3..22716c4 100644 --- a/program/js/googiespell.js +++ b/program/js/googiespell.js @@ -52,7 +52,7 @@ this.show_spell_img = false; // roundcube mod. this.decoration = true; - this.use_close_btn = true; + this.use_close_btn = false; this.edit_layer_dbl_click = true; this.report_ta_not_found = true; @@ -82,15 +82,16 @@ // Set document's onclick to hide the language and error menu $(document).bind('click', function(e) { - if($(e.target).attr('googie_action_btn') != '1' && ref.isLangWindowShown()) + var target = $(e.target); + if(target.attr('googie_action_btn') != '1' && ref.isLangWindowShown()) ref.hideLangWindow(); - if($(e.target).attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) + if(target.attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) ref.hideErrorWindow(); }); this.decorateTextarea = function(id) { - this.text_area = typeof(id) == 'string' ? document.getElementById(id) : id; + this.text_area = typeof id === 'string' ? document.getElementById(id) : id; if (this.text_area) { if (!this.spell_container && this.decoration) { @@ -111,16 +112,15 @@ this.checkSpellingState(); } - else - if (this.report_ta_not_found) - alert('Text area not found'); + else if (this.report_ta_not_found) + alert('Text area not found'); }; ////// // API Functions (the ones that you can call) ///// this.setSpellContainer = function(id) { - this.spell_container = typeof(id) == 'string' ? document.getElementById(id) : id; + this.spell_container = typeof id === 'string' ? document.getElementById(id) : id; }; this.setLanguages = function(lang_dict) { @@ -317,7 +317,7 @@ ///// this.createErrorWindow = function() { this.error_window = document.createElement('div'); - $(this.error_window).addClass('googie_window').attr('googie_action_btn', '1'); + $(this.error_window).addClass('googie_window popupmenu').attr('googie_action_btn', '1'); }; this.isErrorWindowShown = function() { @@ -325,8 +325,8 @@ }; this.hideErrorWindow = function() { - $(this.error_window).css('visibility', 'hidden'); - $(this.error_window_iframe).css('visibility', 'hidden'); + $(this.error_window).hide(); + $(this.error_window_iframe).hide(); }; this.updateOrginalText = function(offset, old_value, new_value, id) { @@ -393,11 +393,7 @@ table = document.createElement('table'), list = document.createElement('tbody'); - pos.top -= this.edit_layer.scrollTop; - - $(this.error_window).css({'visibility': 'visible', - 'top': (pos.top+20)+'px', 'left': (pos.left)+'px'}).html(''); - + $(this.error_window).html(''); $(table).addClass('googie_list').attr('googie_action_btn', '1'); // Check if we should use custom menu builder, if not we use the default @@ -541,6 +537,16 @@ table.appendChild(list); this.error_window.appendChild(table); + // calculate and set position + var height = $(this.error_window).height(), + width = $(this.error_window).width(), + pageheight = $(document).height(), + pagewidth = $(document).width(), + top = pos.top + height + 20 < pageheight ? pos.top + 20 : pos.top - height, + left = pos.left + width < pagewidth ? pos.left : pos.left - width; + + $(this.error_window).css({'top': top+'px', 'left': left+'px'}).show(); + // Dummy for IE - dropdown bug fix if ($.browser.msie) { if (!this.error_window_iframe) { @@ -549,9 +555,10 @@ this.error_window_iframe = iframe; } - $(this.error_window_iframe).css({'visibility': 'visible', - 'top': this.error_window.offsetTop, 'left': this.error_window.offsetLeft, - 'width': this.error_window.offsetWidth, 'height': this.error_window.offsetHeight}); + $(this.error_window_iframe) + .css({'top': this.error_window.offsetTop, 'left': this.error_window.offsetLeft, + 'width': this.error_window.offsetWidth, 'height': this.error_window.offsetHeight}) + .show(); } }; @@ -561,7 +568,8 @@ ////// this.createEditLayer = function(width, height) { this.edit_layer = document.createElement('div'); - $(this.edit_layer).addClass('googie_edit_layer').width(width-10).height(height); + $(this.edit_layer).addClass('googie_edit_layer').attr('id', 'googie_edit_layer') + .width('auto').height(height); if (this.text_area.nodeName.toLowerCase() != 'input' || $(this.text_area).val() == '') { $(this.edit_layer).css('overflow', 'auto').height(height-4); @@ -570,8 +578,9 @@ } var ref = this; + if (this.edit_layer_dbl_click) { - $(this.edit_layer).bind('click', function(e) { + $(this.edit_layer).dblclick(function(e) { if (e.target.className != 'googie_link' && !ref.isErrorWindowShown()) { ref.resumeEditing(); var fn1 = function() { @@ -621,7 +630,7 @@ }; $(elm).html(text).addClass('googie_link').bind('click', d) - .attr({'googie_action_btn' : '1', 'g_id' : id, 'is_corrected' : false}); + .attr({'googie_action_btn' : '1', 'g_id' : id, 'is_corrected' : false}); return elm; }; @@ -701,8 +710,8 @@ ////// this.createLangWindow = function() { this.language_window = document.createElement('div'); - $(this.language_window).addClass('googie_window') - .width(100).attr('googie_action_btn', '1'); + $(this.language_window).addClass('googie_window popupmenu') + .width(100).attr('googie_action_btn', '1'); // Build up the result list var table = document.createElement('table'), @@ -759,11 +768,11 @@ }; this.isLangWindowShown = function() { - return $(this.language_window).is(':hidden'); + return $(this.language_window).is(':visible'); }; this.hideLangWindow = function() { - $(this.language_window).css('visibility', 'hidden'); + $(this.language_window).hide(); $(this.switch_lan_pic).removeClass().addClass('googie_lang_3d_on'); }; @@ -783,7 +792,7 @@ pos.left - 100 + width : pos.left + width, top = pos.top + h < pageheight ? pos.top + height : pos.top - h - 4; - $(this.language_window).css({'visibility': 'visible', 'top' : top+'px','left' : left+'px'}); + $(this.language_window).css({'top' : top+'px','left' : left+'px'}).show(); this.highlightCurSel(); }; @@ -922,7 +931,7 @@ // Misc. functions ///// this.isDefined = function(o) { - return (o != 'undefined' && o != null) + return (o !== undefined && o !== null) }; this.errorFixed = function() { @@ -968,13 +977,13 @@ //$(this.indicator).remove(); // roundcube mod. if (window.rcmail) - rcmail.set_busy(false); + rcmail.set_busy(false, null, this.rc_msg_id); }; this.appendIndicator = function(elm) { // modified by roundcube if (window.rcmail) - rcmail.set_busy(true, 'checking'); + this.rc_msg_id = rcmail.set_busy(true, 'checking'); /* this.indicator = document.createElement('img'); $(this.indicator).attr('src', this.img_dir + 'indicator.gif') -- Gitblit v1.9.1