comparison skins/classic/functions.min.js @ 8:bf99236cc5cd

try to recover from upgrade fail
author Charlie Root
date Sat, 29 Dec 2018 07:07:34 -0500
parents 4681f974d28b
children
comparison
equal deleted inserted replaced
7:65fd7d441cf1 8:bf99236cc5cd
1 function rcube_init_settings_tabs(){var d,b,a=$("#tabsbar"),f=$("span:last",a),c="#settingstabpreferences",e=window.rcmail&&rcmail.env.action?rcmail.env.action:null;if(f&&f.attr("id")!="settingstababout"&&(d=$("#settingstababout"))){b=d.clone(true);d.remove();f.after(b)}if(e){c="#settingstab"+(e.indexOf("identity")>0?"identities":e.replace(/\./g,""))}$(c).addClass("tablink-selected");$("a",c).removeAttr("onclick").click(function(){return false})}function rcube_init_tabs(e,d){var c=$("#"+e),a=c.children("fieldset");if(!a.length){return}d=d?d:0;a.each(function(f){if(f!=d){$(this).hide()}});var b=$("<div>").addClass("tabsbar").appendTo(c);a.each(function(f){var j,g,k=$(this),h=k.children("legend");g=$("<a>").text(h.text()).attr("href","#");j=$("<span>").attr({id:"tab"+f,"class":"tablink"}).click(function(){rcube_show_tab(e,f);return false});h.remove();k.addClass("tabbed");if(f==d){j.addClass("tablink-selected")}j.append(g).appendTo(b)})}function rcube_show_tab(c,b){var a=$("#"+c).children("fieldset");a.each(function(d){$(this)[b==d?"show":"hide"]();$("#tab"+d).toggleClass("tablink-selected",d==b)})}function rcube_mail_ui(){this.popups={markmenu:{id:"markmessagemenu"},replyallmenu:{id:"replyallmenu"},forwardmenu:{id:"forwardmenu",editable:1},searchmenu:{id:"searchmenu",editable:1},messagemenu:{id:"messagemenu"},attachmentmenu:{id:"attachmentmenu"},dragmenu:{id:"dragmenu",sticky:1},groupmenu:{id:"groupoptionsmenu",above:1},mailboxmenu:{id:"mailboxoptionsmenu",above:1},composemenu:{id:"composeoptionsmenu",editable:1,overlap:1},spellmenu:{id:"spellmenu"},responsesmenu:{id:"responsesmenu"},uploadmenu:{id:"attachment-form",editable:1,above:1,toggle:!bw.ie&&!bw.linux},uploadform:{id:"upload-form",editable:1,toggle:!bw.ie&&!bw.linux}};var b;for(var a in this.popups){b=$("#"+this.popups[a].id);if(b.length){this.popups[a].obj=b}else{delete this.popups[a]}}}rcube_mail_ui.prototype={show_popup:function(b,a,c){var d;if(!this.popups[b]&&(d=$("#"+b))&&d.length){this.popups[b]=$.extend(c,{id:b,obj:d})}if(typeof this[b]=="function"){return this[b](a)}else{return this.show_popupmenu(b,a)}},show_popupmenu:function(c,b){var g=this.popups[c].obj,a=this.popups[c].above,e=$(this.popups[c].link?this.popups[c].link:rcube_find_object(c+"link"));if(typeof b=="undefined"){b=g.is(":visible")?false:true}else{if(this.popups[c].toggle&&b&&this.popups[c].obj.is(":visible")){b=false}}if(b&&e.length){var d=e.parent(),f=$(window),h=d.hasClass("dropbutton")?d.offset():e.offset();if(!a&&h.top+e.height()+g.height()>f.height()){a=true}if(h.left+g.width()>f.width()){h.left=f.width()-g.width()-30}g.css({left:h.left,top:(h.top+(a?-g.height():e.height()))})}g[b?"show":"hide"]()},dragmenu:function(a){this.popups.dragmenu.obj[a?"show":"hide"]()},forwardmenu:function(a){$("input[name='forwardtype'][value="+(rcmail.env.forward_attachment?1:0)+"]",this.popups.forwardmenu.obj).prop("checked",true);this.show_popupmenu("forwardmenu",a)},uploadmenu:function(a){if(typeof a=="object"){a=false}if(!a){try{$("#attachment-form form")[0].reset()}catch(b){}}this.show_popupmenu("uploadmenu",a);if(!document.all&&this.popups.uploadmenu.obj.is(":visible")){$("#attachment-form input[type=file]").click()}},searchmenu:function(h){var d=this.popups.searchmenu.obj,c=rcube_find_object("searchmenulink");if(typeof h=="undefined"){h=d.is(":visible")?false:true}if(h&&c){var f=$(c).offset();d.css({left:f.left,top:(f.top+c.offsetHeight+2)});if(rcmail.env.search_mods){var b,g,e=$('input:checkbox[name="s_mods[]"]',d),a=rcmail.env.mailbox,j=rcmail.env.search_mods,k=rcmail.env.search_scope||"base";if(rcmail.env.task=="mail"){j=j[a]?j[a]:j["*"];g="text";$('input:radio[name="s_scope"]').prop("checked",false).filter("#s_scope_"+k).prop("checked",true)}else{g="*"}if(j[g]){e.map(function(){this.checked=true;this.disabled=this.value!=g})}else{e.prop("disabled",false).prop("checked",false);for(b in j){$("#s_mod_"+b).prop("checked",true)}}}}d[h?"show":"hide"]()},set_searchmod:function(f){var d,a,b=rcmail.env.task,e=rcmail.env.search_mods,g=rcmail.env.mailbox,c=$('input[name="s_scope"]:checked').val();if(c=="all"){g="*"}if(!e){e={}}if(b=="mail"){if(!e[g]){e[g]=rcube_clone_object(e["*"])}a=e[g];d="text"}else{a=e;d="*"}if(!f.checked){delete (a[f.value])}else{a[f.value]=1}if(f.value==d){$('input:checkbox[name="s_mods[]"]').map(function(){if(this==f){return}this.checked=true;if(f.checked){this.disabled=true;delete a[this.value]}else{this.disabled=false;a[this.value]=1}})}rcmail.set_searchmods(a)},show_listmenu:function(d){var a=this,b={},c=$("#listmenu");if(c.is(":visible")){c.dialog("close",d.originalEvent);return}$('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop("checked",true);$('input[name="sort_ord"][value="DESC"]').prop("checked",rcmail.env.sort_order=="DESC");$('input[name="sort_ord"][value="ASC"]').prop("checked",rcmail.env.sort_order!="DESC");$('input[name="view"][value="thread"]').prop("checked",rcmail.env.threading?true:false);$('input[name="view"][value="list"]').prop("checked",rcmail.env.threading?false:true);$('input[name="list_col[]"]').each(function(){$(this).prop("checked",$.inArray(this.value,rcmail.env.listcols)!=-1)});b[rcmail.gettext("save")]=function(f){c.dialog("close",f);a.save_listmenu()};c.dialog({modal:true,resizable:false,closeOnEscape:true,title:null,open:function(f){var g=0;$("#listmenu fieldset").each(function(){var e=$(this).height();if(e>g){g=e}}).css("min-height",g+"px").height(g);setTimeout(function(){c.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(f){c.dialog("destroy").hide();if(f.originalEvent&&rcube_event.is_keyboard(f.originalEvent)){$("#listmenulink").focus()}},buttons:b,minWidth:500,width:c.width()+20}).show()},save_listmenu:function(){var c=$('input[name="sort_col"]:checked').val(),b=$('input[name="sort_ord"]:checked').val(),a=$('input[name="view"]:checked').val(),d=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(d,c,b,a=="thread"?1:0)},spellmenu:function(b){var d,a,f=rcmail.spellcheck_lang(),e=this.popups.spellmenu.obj,c=$("ul",e);if(!c.length){c=$("<ul>");for(i in rcmail.env.spell_langs){a=$("<li>");d=$('<a href="#"></a>').text(rcmail.env.spell_langs[i]).addClass("active").data("lang",i).click(function(){rcmail.spellcheck_lang_set($(this).data("lang"))});d.appendTo(a);a.appendTo(c)}c.appendTo(e)}$("li",c).each(function(){var g=$("a",this);if(g.data("lang")==f){g.addClass("selected")}else{if(g.hasClass("selected")){g.removeClass("selected")}}});this.show_popupmenu("spellmenu",b)},show_attachmentmenu:function(b,a){var c=b.parentNode.id.replace(/^attach/,"");$("#attachmenuopen").unbind("click").attr("onclick","").click(function(d){return rcmail.command("open-attachment",c,this)});$("#attachmenudownload").unbind("click").attr("onclick","").click(function(){rcmail.command("download-attachment",c,this)});this.popups.attachmentmenu.link=b;rcmail.command("menu-open",{menu:"attachmentmenu",id:c},b,a)},menu_open:function(a){if(a&&a.name=="messagelistmenu"){this.show_listmenu()}},body_mouseup:function(b){var a=b.target;ref=this;$.each(this.popups,function(d,c){if(c.obj.is(":visible")&&a!=rcube_find_object(d+"link")&&!c.toggle&&a!=c.obj.get(0)&&(!c.editable||!ref.target_overlaps(a,c.id))&&(!c.sticky||!rcube_mouse_is_over(b,rcube_find_object(c.id)))&&!$(a).is(".folder-selector-link")&&!$(a).children(".folder-selector-link").length){window.setTimeout('rcmail_ui.show_popup("'+d+'",false);',50)}})},target_overlaps:function(c,a){var b=rcube_find_object(a);while(c.parentNode){if(c.parentNode==b){return true}c=c.parentNode}return false},body_keydown:function(b){if(b.keyCode==27){for(var a in this.popups){if(this.popups[a].obj.is(":visible")){this.show_popup(a,false)}}}},switch_preview_pane:function(d){var b,c=$("#mailpreviewframe");if(d.checked){rcmail.env.contentframe="messagecontframe";if(mailviewsplit.layer){mailviewsplit.resize();mailviewsplit.layer.elm.style.display=""}else{mailviewsplit.init()}if(bw.opera){$("#messagelistcontainer").css({height:""})}c.show();if(b=rcmail.message_list.get_single_selection()){rcmail.show_message(b,false,true)}}else{c.hide();if(bw.ie7){var a=document.getElementById("mailcontframe");a.style.bottom=0;a.style.height=parseInt(a.parentNode.offsetHeight)+"px"}else{$("#mailcontframe").css({height:"auto",bottom:0});if(bw.opera){$("#messagelistcontainer").css({height:"auto"})}}if(mailviewsplit.layer){mailviewsplit.layer.elm.style.display="none"}rcmail.env.contentframe=null;rcmail.show_contentframe(false)}rcmail.command("save-pref",{name:"preview_pane",value:(d.checked?1:0)})},init_compose_form:function(){var e,c,g,b=["cc","bcc","replyto","followupto"],h=document.getElementById("compose-div"),a=document.getElementById("compose-headers-div");for(e=0;e<b.length;e++){c=b[e];g=$("#_"+c);if(g.length){g.on("change",{v:c},function(f){if(this.value){rcmail_ui.show_header_form(f.data.v)}});if(g.val()!=""){rcmail_ui.show_header_form(c)}}}if(bw.ie){var d=rcube_find_object("form");d.onkeydown=function(f){if(rcube_event.get_keycode(f)==27){rcube_event.cancel(f)}}}$(window).resize(function(){rcmail_ui.resize_compose_body()});$("#compose-container").resize(function(){rcmail_ui.resize_compose_body()});h.style.top=(parseInt(a.offsetHeight,10)+3)+"px";$(window).resize();$("#contacts-table").css("top",$("#directorylist").height()+24+"px");$("#quicksearchbox").keydown(function(f){if(rcube_event.get_keycode(f)==13){rcmail.command("search")}})},resize_compose_body:function(){var d=$("#compose-div .boxlistcontent"),b=d.width()-6,c=d.height()-2,a=bw.ie||bw.opera?4:0;$("#compose-body_ifr").width(b+6).height(c-1-$("div.mce-toolbar").height());$("#compose-body").width(b-a).height(c);$("#googie_edit_layer").width(b).height(c)},resize_compose_body_ev:function(){window.setTimeout(function(){rcmail_ui.resize_compose_body()},100)},show_header_form:function(f){var d,b,c=document.getElementById(f+"-link");if((b=this.next_sibling(c))){b.style.display="none"}else{if((b=this.prev_sibling(c))){b.style.display="none"}}c.style.display="none";if((d=document.getElementById("compose-"+f))){var e=document.getElementById("compose-div"),a=document.getElementById("compose-headers-div");$(d).show();e.style.top=(parseInt(a.offsetHeight,10)+3)+"px";this.resize_compose_body()}return false},hide_header_form:function(b){var l,g,f=document.getElementById(b+"-link"),h=f.parentNode,k=h.getElementsByTagName("a");f.style.display="";for(var e=0;e<k.length;e++){if(k[e].style.display!="none"){for(var d=e+1;d<k.length;d++){if(k[d].style.display!="none"){if((g=this.next_sibling(k[e]))){g.style.display="";break}}}}}document.getElementById("_"+b).value="";if((l=document.getElementById("compose-"+b))){var a=document.getElementById("compose-div"),c=document.getElementById("compose-headers-div");l.style.display="none";a.style.top=(parseInt(c.offsetHeight,10)+1)+"px";this.resize_compose_body()}return false},next_sibling:function(b){var a=b.nextSibling;while(a&&a.nodeType==3){a=a.nextSibling}return a},prev_sibling:function(b){var a=b.previousSibling;while(a&&a.nodeType==3){a=a.previousSibling}return a},enable_command:function(b){if(b.command=="reply-list"&&rcmail.env.reply_all_mode==1){var a=rcmail.gettext(b.status?"replylist":"replyall");$("a.button.replyAll").attr("title",a)}},folder_search_init:function(a){$(".boxtitle a.search",a).click(function(f){var g=$(".boxtitle",a),d=$(".listsearchbox",a),c=d.is(":visible")?-1:1,b=24+($("select",d).length?24:0);d.slideToggle({duration:160,progress:function(h,e){if(c<0){e=1-e}$(".boxlistcontent",a).css("top",(g.outerHeight()+b*e)+"px")},complete:function(){d.toggleClass("expanded");if(d.is(":visible")){d.find("input[type=text]").focus()}else{$("a.reset",d).click()}}});return false})}};function rcube_layer(b,a){this.name=b;this.create=function(n){var d=(n.x)?n.x:0,m=(n.y)?n.y:0,k=n.width,f=n.height,g=n.zindex,c=n.vis,j=n.parent,e=document.createElement("DIV");e.id=this.name;e.style.position="absolute";e.style.visibility=(c)?(c==2)?"inherit":"visible":"hidden";e.style.left=d+"px";e.style.top=m+"px";if(k){e.style.width=k.toString().match(/\%$/)?k:k+"px"}if(f){e.style.height=f.toString().match(/\%$/)?f:f+"px"}if(g){e.style.zIndex=g}if(j){j.appendChild(e)}else{document.body.appendChild(e)}this.elm=e};if(a!=null){this.create(a);this.name=this.elm.id}else{this.elm=document.getElementById(b)}if(!this.elm){return false}this.css=this.elm.style;this.event=this.elm;this.width=this.elm.offsetWidth;this.height=this.elm.offsetHeight;this.x=parseInt(this.elm.offsetLeft);this.y=parseInt(this.elm.offsetTop);this.visible=(this.css.visibility=="visible"||this.css.visibility=="show"||this.css.visibility=="inherit")?true:false;this.move=function(c,d){this.x=c;this.y=d;this.css.left=Math.round(this.x)+"px";this.css.top=Math.round(this.y)+"px"};this.resize=function(c,d){this.css.width=c+"px";this.css.height=d+"px";this.width=c;this.height=d};this.show=function(c){if(c==1){this.css.visibility="visible";this.visible=true}else{if(c==2){this.css.visibility="inherit";this.visible=true}else{this.css.visibility="hidden";this.visible=false}}};this.write=function(c){this.elm.innerHTML=c}}function rcmail_scroller(c,d,a){var b=this;this.list=$(c);this.top=$(d);this.bottom=$(a);this.step_size=6;this.step_time=20;this.delay=500;this.top.mouseenter(function(){b.ts=window.setTimeout(function(){b.scroll("down")},b.delay)}).mouseout(function(){if(b.ts){window.clearTimeout(b.ts)}});this.bottom.mouseenter(function(){b.ts=window.setTimeout(function(){b.scroll("up")},b.delay)}).mouseout(function(){if(b.ts){window.clearTimeout(b.ts)}});this.scroll=function(e){var g=this,f=this.step_size;if(!rcmail.drag_active){return}if(e=="down"){f*=-1}this.list.get(0).scrollTop+=f;this.ts=window.setTimeout(function(){g.scroll(e)},this.step_time)}}function iframe_events(){try{var b=this.contentDocument?this.contentDocument:this.contentWindow?this.contentWindow.document:null;$(b).mouseup(function(c){rcmail_ui.body_mouseup(c)})}catch(a){}}function rcube_render_mailboxlist(){var a=$("#mailboxlist > li > a, #mailboxlist ul:visible > li > a");if(a.length>(bw.ie&&bw.vendver<9?40:100)){return}a.each(function(){var c=$(this),d=c.data("text");if(!d){d=c.text().replace(/\s+\([0-9]+\)$/,"");c.data("text",d)}if(d.length<6){return}var b=fit_string_to_size(d,c,c.width()-c.children("span.unreadcount").width()-16);if(b!=d){c.attr("title",d)}c.contents().filter(function(){return(this.nodeType==3)}).get(0).data=b})}function fit_string_to_size(f,b,e){var l,k,g,m=f,a="...";if(!rcmail.env.tmp_span){k=$("<b>").css({visibility:"hidden",padding:"0px","font-family":b.css("font-family"),"font-size":b.css("font-size")}).appendTo($("body",document)).get(0);rcmail.env.tmp_span=k}else{k=rcmail.env.tmp_span}g=$(k);g.text(m);l=k.offsetWidth;if(l>e){var h=Math.max(1,Math.floor(f.length*((l-e)/l)/2)),j=Math.floor(f.length/2),d=j,c=j;while(true){d=j-h;c=j+h;g.text(f.substring(0,d)+a+f.substring(c));if(d<3||k.offsetWidth){break}h++}m=f.substring(0,d)+a+f.substring(c)}return m}function update_quota(a){percent_indicator(rcmail.gui_objects.quotadisplay,a);if(a.table){var b=$("#quotamenu");if(!b.length){b=$('<div id="quotamenu" class="popupmenu">').appendTo($("body"))}b.html(a.table);$("#quotaimg").css("cursor","pointer").off("click").on("click",function(c){return rcmail.command("menu-open","quotamenu",c.target,c)})}}function percent_indicator(e,f){if(!f||!e){return false}var m=80,a=55,b=f.width?f.width:rcmail.env.indicator_width?rcmail.env.indicator_width:100,l=f.height?f.height:rcmail.env.indicator_height?rcmail.env.indicator_height:14,c=f.percent?Math.abs(parseInt(f.percent)):0,g=parseInt(c/100*b),k=$(e).position();k.top=Math.max(0,k.top);k.left=Math.max(0,k.left);rcmail.env.indicator_width=b;rcmail.env.indicator_height=l;if(g>b){g=b;c=100}if(f.title){f.title=rcmail.get_label("quota")+": "+f.title}var d=$("<div>");d.css({position:"absolute",top:k.top,left:k.left,width:b+"px",height:l+"px",zIndex:100,lineHeight:l+"px"}).attr("title",f.title).addClass("quota_text").html(c+"%");var j=$("<div>");j.css({position:"absolute",top:k.top+1,left:k.left+1,width:g+"px",height:l+"px",zIndex:99});var h=$("<div>");h.css({position:"absolute",top:k.top+1,left:k.left+1,width:b+"px",height:l+"px",zIndex:98}).addClass("quota_bg");if(c>=m){d.addClass(" quota_text_high");j.addClass("quota_high")}else{if(c>=a){d.addClass(" quota_text_mid");j.addClass("quota_mid")}else{d.addClass(" quota_text_low");j.addClass("quota_low")}}$(e).html("").append(j).append(h).append(d);$("#quotaimg").attr("title",f.title)}var rcmail_editor_settings={};var rcmail_ui;function rcube_init_mail_ui(){rcmail_ui=new rcube_mail_ui();$(document.body).mouseup(function(a){rcmail_ui.body_mouseup(a)}).mousedown(function(a){rcmail_ui.body_keydown(a)});rcmail.addEventListener("init",function(){if(rcmail.env.quota_content){update_quota(rcmail.env.quota_content)}rcmail.addEventListener("setquota",update_quota);$("iframe").load(iframe_events).contents().mouseup(function(a){rcmail_ui.body_mouseup(a)});if(rcmail.env.task=="mail"){rcmail.addEventListener("enable-command","enable_command",rcmail_ui).addEventListener("menu-open","menu_open",rcmail_ui).addEventListener("aftersend-attachment","uploadmenu",rcmail_ui).addEventListener("aftertoggle-editor","resize_compose_body_ev",rcmail_ui).gui_object("dragmenu","dragmenu");if(rcmail.gui_objects.mailboxlist){rcmail.treelist.addEventListener("expand",rcube_render_mailboxlist);rcmail.addEventListener("responseaftermark",rcube_render_mailboxlist).addEventListener("responseaftergetunread",rcube_render_mailboxlist).addEventListener("responseaftercheck-recent",rcube_render_mailboxlist).addEventListener("responseafterrefresh",rcube_render_mailboxlist).addEventListener("afterimport-messages",function(){rcmail_ui.show_popup("uploadform",false)})}if(bw.ie&&rcmail.message_list){$(window).resize(function(){setTimeout(function(){rcmail.message_list.resize()},10)})}if(rcmail.env.action=="compose"){rcmail_ui.init_compose_form()}else{if(rcmail.env.action=="show"||rcmail.env.action=="preview"){$('#attachment-list > li[id^="attach"]').each(function(){$(this).append($('<a class="drop"></a>').bind("click keypress",function(a){if(a.type!="keypress"||a.which==13){rcmail_ui.show_attachmentmenu(this,a);return false}}))})}}}else{if(rcmail.env.task=="addressbook"){rcmail.addEventListener("afterupload-photo",function(){rcmail_ui.show_popup("uploadform",false)}).gui_object("dragmenu","dragmenu")}else{if(rcmail.env.task=="settings"){if(rcmail.env.action=="folders"){rcmail_ui.folder_search_init($("#folder-manager"))}}}}})}; 1 /**
2 * Roundcube functions for default skin interface
3 *
4 * @licstart The following is the entire license notice for the
5 * JavaScript code in this file.
6 *
7 * Copyright (c) 2006-2014, The Roundcube Dev Team
8 *
9 * The JavaScript code in this page is free software: you can redistribute it
10 * and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 3 of
12 * the License, or (at your option) any later version.
13 *
14 * @licend The above is the entire license notice
15 * for the JavaScript code in this file.
16 */
17 function rcube_init_settings_tabs(){var a;var b=$("#tabsbar");var d=$("span:last",b),c="#settingstabpreferences",f=window.rcmail&&rcmail.env.action?rcmail.env.action:null;d&&"settingstababout"!=d.attr("id")&&(a=$("#settingstababout"))&&(b=a.clone(!0),a.remove(),d.after(b));f&&(c="#settingstab"+(0<f.indexOf("identity")?"identities":f.replace(/\./g,"")));$(c).addClass("tablink-selected");$("a",c).removeAttr("onclick").click(function(){return!1})}
18 function rcube_init_tabs(a,b){var d=$("#"+a),c=d.children("fieldset");if(c.length){b=b?b:0;c.each(function(a){a!=b&&$(this).hide()});var f=$("<div>").addClass("tabsbar").appendTo(d);c.each(function(d){var c=$(this),e=c.children("legend");var l=$("<a>").text(e.text()).attr("href","#");var h=$("<span>").attr({id:"tab"+d,"class":"tablink"}).click(function(){rcube_show_tab(a,d);return!1});e.remove();c.addClass("tabbed");d==b&&h.addClass("tablink-selected");h.append(l).appendTo(f)})}}
19 function rcube_show_tab(a,b){$("#"+a).children("fieldset").each(function(a){$(this)[b==a?"show":"hide"]();$("#tab"+a).toggleClass("tablink-selected",a==b)})}
20 function rcube_mail_ui(){this.popups={markmenu:{id:"markmessagemenu"},replyallmenu:{id:"replyallmenu"},forwardmenu:{id:"forwardmenu",editable:1},searchmenu:{id:"searchmenu",editable:1},messagemenu:{id:"messagemenu"},attachmentmenu:{id:"attachmentmenu"},dragmenu:{id:"dragmenu",sticky:1},groupmenu:{id:"groupoptionsmenu",above:1},mailboxmenu:{id:"mailboxoptionsmenu",above:1},composemenu:{id:"composeoptionsmenu",editable:1,overlap:1},spellmenu:{id:"spellmenu"},responsesmenu:{id:"responsesmenu"},uploadmenu:{id:"attachment-form",
21 editable:1,above:1,toggle:!bw.ie&&!bw.linux},uploadform:{id:"upload-form",editable:1,toggle:!bw.ie&&!bw.linux}};var a;for(a in this.popups){var b=$("#"+this.popups[a].id);b.length?this.popups[a].obj=b:delete this.popups[a]}}
22 rcube_mail_ui.prototype={show_popup:function(a,b,d){var c;!this.popups[a]&&(c=$("#"+a))&&c.length&&(this.popups[a]=$.extend(d,{id:a,obj:c}));return"function"==typeof this[a]?this[a](b):this.show_popupmenu(a,b)},show_popupmenu:function(a,b){var d=this.popups[a].obj,c=this.popups[a].above,f=$(this.popups[a].link?this.popups[a].link:rcube_find_object(a+"link"));"undefined"==typeof b?b=d.is(":visible")?!1:!0:this.popups[a].toggle&&b&&this.popups[a].obj.is(":visible")&&(b=!1);if(b&&f.length){var e=f.parent();
23 a=$(window);e=e.hasClass("dropbutton")?e.offset():f.offset();!c&&e.top+f.height()+d.height()>a.height()&&(c=!0);e.left+d.width()>a.width()&&(e.left=a.width()-d.width()-30);d.css({left:e.left,top:e.top+(c?-d.height():f.height())})}d[b?"show":"hide"]()},dragmenu:function(a){this.popups.dragmenu.obj[a?"show":"hide"]()},forwardmenu:function(a){$("input[name='forwardtype'][value="+(rcmail.env.forward_attachment?1:0)+"]",this.popups.forwardmenu.obj).prop("checked",!0);this.show_popupmenu("forwardmenu",
24 a)},uploadmenu:function(a){"object"==typeof a&&(a=!1);if(!a)try{$("#attachment-form form")[0].reset()}catch(b){}rcmail.mailvelope_editor||(this.show_popupmenu("uploadmenu",a),!document.all&&this.popups.uploadmenu.obj.is(":visible")&&$("#attachment-form input[type=file]").click())},searchmenu:function(a){var b=this.popups.searchmenu.obj,d=rcube_find_object("searchmenulink");"undefined"==typeof a&&(a=b.is(":visible")?!1:!0);if(a&&d){var c=$(d).offset();b.css({left:c.left,top:c.top+d.offsetHeight+2});
25 if(rcmail.env.search_mods){var f;d=$('input:checkbox[name="s_mods[]"]',b);c=rcmail.env.mailbox;var e=rcmail.env.search_mods,g=rcmail.env.search_scope||"base";if("mail"==rcmail.env.task){e=e[c]?e[c]:e["*"];var k="text";$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+g).prop("checked",!0)}else k="*";if(e[k])d.map(function(){this.checked=!0;this.disabled=this.value!=k});else for(f in d.prop("disabled",!1).prop("checked",!1),e)$("#s_mod_"+f).prop("checked",!0)}}b[a?"show":"hide"]()},
26 set_searchmod:function(a){var b=rcmail.env.task;var d=rcmail.env.search_mods,c=rcmail.env.mailbox;"all"==$('input[name="s_scope"]:checked').val()&&(c="*");d||(d={});if("mail"==b){d[c]||(d[c]=rcube_clone_object(d["*"]));var f=d[c];b="text"}else f=d,b="*";a.checked?f[a.value]=1:delete f[a.value];a.value==b&&$('input:checkbox[name="s_mods[]"]').map(function(){this!=a&&(this.checked=!0,a.checked?(this.disabled=!0,delete f[this.value]):(this.disabled=!1,f[this.value]=1))});rcmail.set_searchmods(f)},show_listmenu:function(a){var b=
27 this,d={},c=$("#listmenu");c.is(":visible")?c.dialog("close",a.originalEvent):($('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop("checked",!0),$('input[name="sort_ord"][value="DESC"]').prop("checked","DESC"==rcmail.env.sort_order),$('input[name="sort_ord"][value="ASC"]').prop("checked","DESC"!=rcmail.env.sort_order),$('input[name="view"][value="thread"]').prop("checked",rcmail.env.threading?!0:!1),$('input[name="view"][value="list"]').prop("checked",rcmail.env.threading?!1:!0),$('input[name="list_col[]"]').each(function(){$(this).prop("checked",
28 -1!=$.inArray(this.value,rcmail.env.listcols))}),$.each(["widescreen","desktop","list"],function(){$('input[name="layout"][value="'+this+'"]').prop("checked",rcmail.env.layout==this)}),$("#listoptions-columns",c)["widescreen"==rcmail.env.layout?"hide":"show"](),d[rcmail.gettext("save")]=function(a){c.dialog("close",a);b.save_listmenu()},c.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(a){var b=0;$("#listmenu fieldset").each(function(){var a=$(this).height();a>b&&(b=a)}).css("min-height",
29 b+"px").height(b);setTimeout(function(){c.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){c.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus()},buttons:d,minWidth:500,width:c.width()+20}).show())},save_listmenu:function(){var a=$('input[name="sort_col"]:checked').val(),b=$('input[name="sort_ord"]:checked').val(),d=$('input[name="view"]:checked').val(),c=$('input[name="layout"]:checked').val(),
30 f=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(f,a,b,"thread"==d?1:0,c)},spellmenu:function(a){var b=rcmail.spellcheck_lang(),d=this.popups.spellmenu.obj,c=$("ul",d);if(!c.length){c=$("<ul>");for(i in rcmail.env.spell_langs){var f=$("<li>");var e=$('<a href="#"></a>').text(rcmail.env.spell_langs[i]).addClass("active").data("lang",i).click(function(){rcmail.spellcheck_lang_set($(this).data("lang"))});e.appendTo(f);f.appendTo(c)}c.appendTo(d)}$("li",
31 c).each(function(){var a=$("a",this);a.data("lang")==b?a.addClass("selected"):a.hasClass("selected")&&a.removeClass("selected")});this.show_popupmenu("spellmenu",a)},show_attachmentmenu:function(a,b){var d=a.parentNode.id.replace(/^attach/,"");$.each(["open","download","rename"],function(){var a=this;$("#attachmenu"+a).off("click").attr("onclick","").click(function(b){return rcmail.command(a+"-attachment",d,this)})});this.popups.attachmentmenu.link=a;rcmail.command("menu-open",{menu:"attachmentmenu",
32 id:d},a,b)},menu_open:function(a){a&&"messagelistmenu"==a.name&&this.show_listmenu()},body_mouseup:function(a){var b=a.target;ref=this;$.each(this.popups,function(d,c){!c.obj.is(":visible")||b==rcube_find_object(d+"link")||c.toggle||b==c.obj.get(0)||c.editable&&ref.target_overlaps(b,c.id)||c.sticky&&rcube_mouse_is_over(a,rcube_find_object(c.id))||$(b).is(".folder-selector-link")||$(b).children(".folder-selector-link").length||window.setTimeout('rcmail_ui.show_popup("'+d+'",false);',50)})},target_overlaps:function(a,
33 b){for(b=rcube_find_object(b);a.parentNode;){if(a.parentNode==b)return!0;a=a.parentNode}return!1},body_keydown:function(a){if(27==a.keyCode)for(var b in this.popups)this.popups[b].obj.is(":visible")&&this.show_popup(b,!1)},set_layout:function(a){var b=a?a.new_layout:rcmail.env.layout,d=$("#mailcontframe"),c=$("#mailpreviewframe");a&&$("#mailrightcontainer").removeClass().addClass(b);this.mailviewsplitv||(this.mailviewsplitv=new rcube_splitter({id:"mailviewsplitterv",p1:"mailleftcontainer",p2:"mailrightcontainer",
34 orientation:"v",relative:!0,start:165,callback:rcube_render_mailboxlist}),this.mailviewsplitv.init());$("#mailviewsplitter")["desktop"==b?"show":"hide"]();$("#mailviewsplitter2")["widescreen"==b?"show":"hide"]();$("#mailpreviewframe")["list"!=b?"show":"hide"]();rcmail.env.contentframe="list"==b?null:"messagecontframe";"widescreen"==b?($("#countcontrols").detach().appendTo($("#messagelistheader")),d.css({height:"auto",width:400}),c.css({top:0,left:410,height:"auto"}).show(),this.mailviewsplit2?this.mailviewsplit2.resize():
35 (this.mailviewsplit2=new rcube_splitter({id:"mailviewsplitter2",p1:"mailcontframe",p2:"mailpreviewframe",orientation:"v",relative:!0,start:405}),this.mailviewsplit2.init())):"desktop"==b?(d.css({height:200,width:"100%"}),c.css({left:0,top:210,height:"auto"}).show(),this.mailviewsplit?this.mailviewsplit.resize():(this.mailviewsplit=new rcube_splitter({id:"mailviewsplitter",p1:"mailcontframe",p2:"mailpreviewframe",orientation:"h",relative:!0,start:205}),this.mailviewsplit.init())):(d.css({height:"auto",
36 width:"100%"}),c.hide());a&&"widescreen"==a.old_layout&&$("#countcontrols").detach().appendTo($("#messagelistfooter"))},init_compose_form:function(){var a,b=["cc","bcc","replyto","followupto"],d=document.getElementById("compose-div"),c=document.getElementById("compose-headers-div");for(a=0;a<b.length;a++){var f=b[a];var e=$("#_"+f);e.length&&(e.on("change",{v:f},function(a){this.value&&rcmail_ui.show_header_form(a.data.v)}),""!=e.val()&&rcmail_ui.show_header_form(f))}bw.ie&&(rcube_find_object("form").onkeydown=
37 function(a){27==rcube_event.get_keycode(a)&&rcube_event.cancel(a)});$(window).resize(function(){rcmail_ui.resize_compose_body()});$("#compose-container").resize(function(){rcmail_ui.resize_compose_body()});d.style.top=parseInt(c.offsetHeight,10)+3+"px";$(window).resize();$("#contacts-table").css("top",$("#directorylist").height()+24+"px");$("#quicksearchbox").keydown(function(a){13==rcube_event.get_keycode(a)&&rcmail.command("search")})},resize_compose_body:function(){var a=$("#compose-div .boxlistcontent"),
38 b=a.width()-6;a=a.height()-2;var d=bw.ie||bw.opera?4:0;$("#compose-body_ifr").width(b+6).height(a-1-$("div.mce-toolbar").height());$("#compose-body").width(b-d).height(a);$("#googie_edit_layer").width(b).height(a)},resize_compose_body_ev:function(){window.setTimeout(function(){rcmail_ui.resize_compose_body()},100)},show_header_form:function(a){var b,d=document.getElementById(a+"-link");if(b=this.next_sibling(d))b.style.display="none";else if(b=this.prev_sibling(d))b.style.display="none";d.style.display=
39 "none";if(a=document.getElementById("compose-"+a))b=document.getElementById("compose-div"),d=document.getElementById("compose-headers-div"),$(a).show(),b.style.top=parseInt(d.offsetHeight,10)+3+"px",this.resize_compose_body();return!1},hide_header_form:function(a){var b,d=document.getElementById(a+"-link"),c=d.parentNode.getElementsByTagName("a");d.style.display="";for(d=0;d<c.length;d++)if("none"!=c[d].style.display)for(var f=d+1;f<c.length;f++)if("none"!=c[f].style.display&&(b=this.next_sibling(c[d]))){b.style.display=
40 "";break}document.getElementById("_"+a).value="";if(a=document.getElementById("compose-"+a))b=document.getElementById("compose-div"),c=document.getElementById("compose-headers-div"),a.style.display="none",b.style.top=parseInt(c.offsetHeight,10)+1+"px",this.resize_compose_body();return!1},next_sibling:function(a){for(a=a.nextSibling;a&&3==a.nodeType;)a=a.nextSibling;return a},prev_sibling:function(a){for(a=a.previousSibling;a&&3==a.nodeType;)a=a.previousSibling;return a},enable_command:function(a){"reply-list"==
41 a.command&&1==rcmail.env.reply_all_mode?(a=rcmail.gettext(a.status?"replylist":"replyall"),$("a.button.replyAll").attr("title",a)):"compose-encrypted"==a.command&&$("#messagetoolbar > a.encrypt").show()},folder_search_init:function(a){$(".boxtitle a.search",a).click(function(b){var d=$(".boxtitle",a),c=$(".listsearchbox",a),f=c.is(":visible")?-1:1,e=24+($("select",c).length?24:0);c.slideToggle({duration:160,progress:function(b,c){0>f&&(c=1-c);$(".boxlistcontent",a).css("top",d.outerHeight()+e*c+"px")},
42 complete:function(){c.toggleClass("expanded");c.is(":visible")?c.find("input[type=text]").focus():$("a.reset",c).click()}});return!1})}};
43 function rcube_layer(a,b){this.name=a;this.create=function(a){var b=a.x?a.x:0,d=a.y?a.y:0,e=a.width,g=a.height,k=a.zindex,l=a.vis;a=a.parent;var h=document.createElement("DIV");h.id=this.name;h.style.position="absolute";h.style.visibility=l?2==l?"inherit":"visible":"hidden";h.style.left=b+"px";h.style.top=d+"px";e&&(h.style.width=e.toString().match(/%$/)?e:e+"px");g&&(h.style.height=g.toString().match(/%$/)?g:g+"px");k&&(h.style.zIndex=k);a?a.appendChild(h):document.body.appendChild(h);this.elm=h};
44 null!=b?(this.create(b),this.name=this.elm.id):this.elm=document.getElementById(a);if(!this.elm)return!1;this.css=this.elm.style;this.event=this.elm;this.width=this.elm.offsetWidth;this.height=this.elm.offsetHeight;this.x=parseInt(this.elm.offsetLeft);this.y=parseInt(this.elm.offsetTop);this.visible="visible"==this.css.visibility||"show"==this.css.visibility||"inherit"==this.css.visibility?!0:!1;this.move=function(a,b){this.x=a;this.y=b;this.css.left=Math.round(this.x)+"px";this.css.top=Math.round(this.y)+
45 "px"};this.resize=function(a,b){this.css.width=a+"px";this.css.height=b+"px";this.width=a;this.height=b};this.show=function(a){1==a?(this.css.visibility="visible",this.visible=!0):2==a?(this.css.visibility="inherit",this.visible=!0):(this.css.visibility="hidden",this.visible=!1)};this.write=function(a){this.elm.innerHTML=a}}
46 function rcmail_scroller(a,b,d){var c=this;this.list=$(a);this.top=$(b);this.bottom=$(d);this.step_size=6;this.step_time=20;this.delay=500;this.top.mouseenter(function(){c.ts=window.setTimeout(function(){c.scroll("down")},c.delay)}).mouseout(function(){c.ts&&window.clearTimeout(c.ts)});this.bottom.mouseenter(function(){c.ts=window.setTimeout(function(){c.scroll("up")},c.delay)}).mouseout(function(){c.ts&&window.clearTimeout(c.ts)});this.scroll=function(a){var b=this,c=this.step_size;rcmail.drag_active&&
47 ("down"==a&&(c*=-1),this.list.get(0).scrollTop+=c,this.ts=window.setTimeout(function(){b.scroll(a)},this.step_time))}}
48 function rcube_render_mailboxlist(){var a=$("#mailboxlist > li > a, #mailboxlist ul:visible > li > a");100<a.length||a.each(function(){var a=$(this),d=a.data("text");d||(d=a.text().replace(/\s+\([0-9]+\)$/,""),a.data("text",d));if(!(6>d.length)){var c=fit_string_to_size(d,a,a.width()-a.children("span.unreadcount").width()-16);c!=d&&a.attr("title",d);a.contents().filter(function(){return 3==this.nodeType}).get(0).data=c}})}
49 function fit_string_to_size(a,b,d){var c=a;rcmail.env.tmp_span?b=rcmail.env.tmp_span:(b=$("<b>").css({visibility:"hidden",padding:"0px","font-family":b.css("font-family"),"font-size":b.css("font-size")}).appendTo($("body",document)).get(0),rcmail.env.tmp_span=b);var f=$(b);f.text(c);var e=b.offsetWidth;if(e>d){d=Math.max(1,Math.floor((e-d)/e*a.length/2));c=Math.floor(a.length/2);for(var g;;){e=c-d;g=c+d;f.text(a.substring(0,e)+"..."+a.substring(g));if(3>e||b.offsetWidth)break;d++}c=a.substring(0,
50 e)+"..."+a.substring(g)}return c}function update_quota(a){percent_indicator(rcmail.gui_objects.quotadisplay,a);if(a.table){var b=$("#quotamenu");b.length||(b=$('<div id="quotamenu" class="popupmenu">').appendTo($("body")));b.html(a.table);$("#quotaimg").css("cursor","pointer").off("click").on("click",function(a){return rcmail.command("menu-open","quotamenu",a.target,a)})}}
51 function percent_indicator(a,b){if(!b||!a)return!1;var d=b.width?b.width:rcmail.env.indicator_width?rcmail.env.indicator_width:100,c=b.height?b.height:rcmail.env.indicator_height?rcmail.env.indicator_height:14,f=b.percent?Math.abs(parseInt(b.percent)):0,e=parseInt(f/100*d),g=$(a).position();g.top=Math.max(0,g.top);g.left=Math.max(0,g.left);rcmail.env.indicator_width=d;rcmail.env.indicator_height=c;e>d&&(e=d,f=100);b.title&&(b.title=rcmail.get_label("quota")+": "+b.title);var k=$("<div>");k.css({position:"absolute",
52 top:g.top,left:g.left,width:d+"px",height:c+"px",zIndex:100,lineHeight:c+"px"}).attr("title",b.title).addClass("quota_text").html(f+"%");var l=$("<div>");l.css({position:"absolute",top:g.top+1,left:g.left+1,width:e+"px",height:c+"px",zIndex:99});e=$("<div>");e.css({position:"absolute",top:g.top+1,left:g.left+1,width:d+"px",height:c+"px",zIndex:98}).addClass("quota_bg");80<=f?(k.addClass(" quota_text_high"),l.addClass("quota_high")):55<=f?(k.addClass(" quota_text_mid"),l.addClass("quota_mid")):(k.addClass(" quota_text_low"),
53 l.addClass("quota_low"));$(a).html("").append(l).append(e).append(k);$("#quotaimg").attr("title",b.title)}function attachment_menu_append(a){$(a).append($('<a class="drop"></a>').on("click keypress",function(a){if("keypress"!=a.type||13==a.which)return rcmail_ui.show_attachmentmenu(this,a),!1}))}var rcmail_editor_settings={},rcmail_ui;
54 function rcube_init_mail_ui(){rcmail_ui=new rcube_mail_ui;$(document.body).mouseup(function(a){rcmail_ui.body_mouseup(a)}).mousedown(function(a){rcmail_ui.body_keydown(a)});rcmail.addEventListener("init",function(){rcmail.env.quota_content&&update_quota(rcmail.env.quota_content);rcmail.addEventListener("setquota",update_quota);rcube_webmail.set_iframe_events({mouseup:function(a){return rcmail_ui.body_mouseup(a)}});if("mail"==rcmail.env.task)if(rcmail.addEventListener("enable-command","enable_command",
55 rcmail_ui).addEventListener("menu-open","menu_open",rcmail_ui).addEventListener("aftersend-attachment","uploadmenu",rcmail_ui).addEventListener("aftertoggle-editor","resize_compose_body_ev",rcmail_ui).gui_object("dragmenu","dragmenu"),rcmail.gui_objects.mailboxlist&&(rcmail.treelist.addEventListener("expand",rcube_render_mailboxlist),rcmail.addEventListener("responseaftermark",rcube_render_mailboxlist).addEventListener("responseaftergetunread",rcube_render_mailboxlist).addEventListener("responseaftercheck-recent",
56 rcube_render_mailboxlist).addEventListener("responseafterrefresh",rcube_render_mailboxlist).addEventListener("afterimport-messages",function(){rcmail_ui.show_popup("uploadform",!1)})),rcmail.init_pagejumper("#pagejumper"),bw.ie&&rcmail.message_list&&$(window).resize(function(){setTimeout(function(){rcmail.message_list.resize()},10)}),"list"==rcmail.env.action||!rcmail.env.action)rcmail.addEventListener("layout-change","set_layout",rcmail_ui),rcmail_ui.set_layout();else if("compose"==rcmail.env.action)rcmail_ui.init_compose_form(),
57 rcmail.addEventListener("compose-encrypted",function(a){$("a.button.encrypt")[a.active?"addClass":"removeClass"]("selected");$("select[name='editorSelector']").prop("disabled",a.active);$("a.button.attach, a.button.responses, a.button.attach, #uploadmenulink")[a.active?"addClass":"removeClass"]("buttonPas disabled");$("#responseslist a.insertresponse")[a.active?"removeClass":"addClass"]("active")}),rcmail.addEventListener("fileappended",function(a){a.attachment.complete&&attachment_menu_append(a.item)}),
58 $("#attachmentslist > li").each(function(){attachment_menu_append(this)});else{if("show"==rcmail.env.action||"preview"==rcmail.env.action)$('#attachment-list > li[id^="attach"]').each(function(){attachment_menu_append(this)}),$(window).resize(function(){$('#attachment-list > li[id^="attach"]').length||$("#attachment-list").hide();var a=$("#messagebody.mailvelope");if(a.length){var b=$("#messageframe");b=(b.length?b.height()+b.offset().top-25:$(this).height())-a.offset().top-20;a.height(b)}})}else"addressbook"==
59 rcmail.env.task?rcmail.addEventListener("afterupload-photo",function(){rcmail_ui.show_popup("uploadform",!1)}).gui_object("dragmenu","dragmenu"):"settings"==rcmail.env.task&&"folders"==rcmail.env.action&&rcmail_ui.folder_search_init($("#folder-manager"))})};