/** * Roundcube functions for default skin interface * * Copyright (c) 2013, The Roundcube Dev Team * * The contents are subject to the Creative Commons Attribution-ShareAlike * License. It is allowed to copy, distribute, transmit and to adapt the work * by keeping credits to the original autors in the README file. * See http://creativecommons.org/licenses/by-sa/3.0/ for details. * * @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0 */ /* magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0 */ function rcube_mail_ui(){function f(a){p||(p=rcmail.local_storage_get_item("prefs.larry",{}));if(null==p[a]){var d=rcmail.get_cookie(a);null!=d&&(p[a]=d,rcmail.local_storage_set_item("prefs.larry",p)&&rcmail.set_cookie(a,d,new Date))}return p[a]}function q(a,d){p[a]=d;if(!rcmail.local_storage_set_item("prefs.larry",p)){var c=new Date;c.setYear(c.getFullYear()+1);rcmail.set_cookie(a,d,c)}}function s(a){a=a?10:0;rcmail.resize_timeout&&window.clearTimeout(rcmail.resize_timeout);rcmail.resize_timeout= window.setTimeout(function(){"mail"==rcmail.env.task&&("show"==rcmail.env.action||"preview"==rcmail.env.action?v():"compose"==rcmail.env.action&&t());$("body.iframe .footerleft").each(function(){var a=$(this),c=$(document.body),b=a.hasClass("floating"),g=c.outerHeight(!0)>$(window).height();g!=b&&(b=g?"addClass":"removeClass",a[b]("floating"),c[b]("floatingbuttons"))})},a)}function k(a){var d=$(a.object).siblings("div");d.length&&$(a.object).insertBefore(d.first());if("error"==a.type&&"login"!=rcmail.env.task){rcmail.hide_message(a.object); l.message_timer&&window.clearTimeout(l.message_timer);l.messagedialog||(l.messagedialog=$("
").addClass("popupdialog").hide());var d=a.message,c=function(){l.messagedialog.is(":visible")&&l.messagedialog.dialog("destroy").hide()};l.messagedialog.is(":visible")&&l.messagedialog.text()!=d&&(d=l.messagedialog.html()+"

"+a.message+"

");l.messagedialog.html(d).dialog({resizable:!1,closeOnEscape:!0,dialogClass:"popupmessage "+a.type,title:r.errortitle,close:c,position:["center","center"],hide:{effect:"fadeOut"}, width:420,minHeight:90}).show();l.messagedialog.closest("div[role=dialog]").attr("role","alertdialog");0 .mailvelope");if(a.length){var d= $("#messagecontent").length?$("#messagecontent").height()-16:$(window).height()-a.offset().top-10;a.height(d)}}function b(a){}function e(a){}function F(a){if("TEXTAREA"==a.nodeName){var d=$(a),c=a.scrollHeight;d.css("height",14*(80 div").width(d+8);$("#composebody_ifr").height(c+4-$("div.mce-toolbar").height());$("#googie_edit_layer").width(d).height(c);a=$("#directorylist");a.length&&$("#compose-contacts .scroller").css("top",a.position().top+a.outerHeight())}function A(a){var d=$("#quotadisplay"),c=$("#quotamenu"),b=a.total?24*Math.ceil(a.percent/100*20):0;a.total&&480==b&&100>a.percent&&(b-=24);d.css("background-position","0 -"+b+"px");d.attr("class","countdisplay p"+10*Math.round(a.percent/ 10));a.table&&(c.length||(c=$('
').appendTo($("body"))),c.html(a.table),d.css("cursor","pointer").off("click").on("click",function(a){return rcmail.command("menu-open","quotamenu",a.target,a)}))}function G(a){$(".boxtitle a.search",a).click(function(d){var c=$(".boxtitle",a),b=$(".listsearchbox",a),g=b.is(":visible")?-1:1,m=34+($("select",b).length?22:0);b.slideToggle({duration:160,progress:function(d,b){0>g&&(b=1-b);$(".scroller",a).css("top",c.outerHeight()+ m*b+"px")},complete:function(){b.toggleClass("expanded");b.is(":visible")?(b.find("input[type=text]").focus(),m=34+($("select",b).length?$("select",b).outerHeight()+4:0),$(".scroller",a).css("top",c.outerHeight()+m+"px")):$("a.reset",b).click()}});return!1})}function L(a){"reply-list"==a.command&&1==rcmail.env.reply_all_mode?(a=rcmail.gettext(a.status?"replylist":"replyall"),"preview"==rcmail.env.action?$("a.button.replyall").attr("title",a):$("a.button.reply-all").text(a).attr("title",a)):"compose-encrypted"== a.command&&$("a.button.encrypt").show()}function B(a,d){var b=w[a]=$("#"+a);b.appendTo(document.body);b.length&&(u[a]=$.extend(u[a]||{},d||{}))}function H(){$("#preview-shortheaders").toggle();var a=$("#preview-allheaders").toggle(),d=$("a#previewheaderstoggle");a.is(":visible")?d.attr("href","#hide").removeClass("add").addClass("remove").attr("aria-expanded","true"):d.attr("href","#details").removeClass("remove").addClass("add").attr("aria-expanded","false");q("previewheaders",a.is(":visible")?"1": "0")}function x(a,d){if(d||!$("#mail"+a+"mode").hasClass("disabled"))$("#maillistmode, #mailthreadmode").removeClass("selected").attr("tabindex","0").attr("aria-disabled","false"),$("#mail"+a+"mode").addClass("selected").attr("tabindex","-1").attr("aria-disabled","true")}function y(a){if(a&&"messagelistmenu"==a.name)M(a);else if(a){var d=u[a.name]||{},b=$(d.link||"#"+a.name+"link"),e=a.obj&&a.obj.is(":visible");if(a.obj&&e&&b.length){var g=b.parent();$(window);g.hasClass("dropbutton")&&(b=g);if(d.above|| b.hasClass("dropbutton"))g=b.offset(),a.obj.css({left:g.left+"px",top:g.top+(d.above?-a.obj.height():b.outerHeight())+"px"})}a.obj&&d.iconized&&a.obj.children("ul").addClass("iconized");a.obj&&d.editable&&a.obj.attr("data-editable","true");"function"==typeof d.callback&&d.callback(e,a)}}function N(a,b){var c=a.parentNode.id.replace(/^attach/,"");$("#attachmenuopen").off("click").attr("onclick","").click(function(a){return rcmail.command("open-attachment",c,this)});$("#attachmenudownload").off("click").attr("onclick", "").click(function(){rcmail.command("download-attachment",c,this)});u.attachmentmenu.link=a;rcmail.command("menu-open",{menu:"attachmentmenu",id:c},a,b)}function M(a){var b=$("#listoptions");b.is(":visible")?b.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="list_col[]"]').each(function(){$(this).prop("checked", -1!=$.inArray(this.value,rcmail.env.listcols))}),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(a){setTimeout(function(){b.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){b.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus()},minWidth:500,width:b.width()+25}).show())}function O(a){$("#listoptions").dialog("close");rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus(); a=$('input[name="sort_col"]:checked').val();var b=$('input[name="sort_ord"]:checked').val(),c=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(c,a,b,rcmail.env.threading)}function P(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden");a.clone().css({position:"absolute",top:"0",left:"0",width:a.width()+"px","z-index":10}).appendTo(b).animate({left:-(a.width()+5)+"px"},300,"swing",function(){$(this).remove();b.css("overflow","auto")})} function Q(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden"),c=a.clone().appendTo(b);a.css({position:"absolute",top:"0",left:-(a.width()+5)+"px",width:a.width()+"px",height:a.height()+"px","z-index":10}).animate({left:"0"},300,"linear",function(){c.remove();$(this).css({position:"relative",left:"0",width:"100%",height:"auto","z-index":1});b.css("overflow","auto")})}function z(a){var b=$("#upload-dialog");b.is(":visible")?b.dialog("close"):rcmail.mailvelope_editor||("compose"!=rcmail.env.action|| b.data("extended")||($("").addClass("iconlink add").attr("href","#add").html("Add").appendTo($('input[type="file"]',b).parent()).click(I),b.data("extended",!0)),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:b.attr("title"),open:function(a){document.all||$("input[type=file]",b).first().click()},close:function(){try{$("#upload-dialog form").get(0).reset()}catch(a){}b.dialog("destroy").hide();$("div.addline",b).remove()},width:480}).show())}function I(a){a=$(this).parent();a=a.clone().addClass("addline").insertAfter(a); a.children(".iconlink").click(I);a.children("input").val("");document.all||$("input[type=file]",a).click()}function C(a,b){var c=$("#compose-"+a);if(!c.is(":visible"))return D[a]&&!b&&$("#_"+a).val(D[a]),c.show(),$("#"+a+"-link").hide(),t(),$("input,textarea",c).focus(),!1}function J(a,b){var c=$(a),e=c.get(0).id,g=c.children("fieldset");if(g.length){e||(e="rcmtabcontainer",c.attr("id",e));var m=$("
    ").addClass("tabsbar").prependTo(c);g.each(function(a){var b,c=$(this),d=c.children("legend"),g= e+"-t"+a;b=$("").text(d.text()).attr("href","#"+g);a=$("
  • ").addClass("tablink");d.remove();c.attr("id",g);a.append(b).appendTo(m)});c.tabs({active:b||0,heightStyle:"content",activate:function(a,b){s()}})}}var r={},w={},u={forwardmenu:{editable:1},searchmenu:{editable:1,callback:function(a){if(a&&rcmail.env.search_mods){var b,c;a=$('input:checkbox[name="s_mods[]"]',w.searchmenu);var e=rcmail.env.mailbox,g=rcmail.env.search_mods,m=rcmail.env.search_scope||"base";"mail"==rcmail.env.task?("all"== m&&(e="*"),g=g[e]?g[e]:g["*"],c="text",$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+m).prop("checked",!0)):c="*";if(g[c])a.map(function(){this.checked=!0;this.disabled=this.value!=c});else for(b in a.prop("disabled",!1).prop("checked",!1),g)$("#s_mod_"+b).prop("checked",!0)}}},attachmentmenu:{},listoptions:{editable:1},groupmenu:{above:1},mailboxmenu:{above:1},spellmenu:{callback:function(a,b){var c,e,g,m=rcmail.spellcheck_lang(),f=$("ul",b.obj);if(!f.length){f=$('